Skip to content

register_se_driver issue and tests failure #74

@pennam

Description

@pennam

Description of defect

I'm trying to run this example on PORTENTA_H7 board. The board has an integrated ATECC608A (no external connection) and communication works fine. However all psa test are failing. This is the output from this example:

Serial Number:
01 23 DA 33 10 2C 40 D3 EE 

Config zone: 01 23 DA 33 00 00 60 02 10 2C 40 D3 EE 01 59 00 
C0 00 55 00 83 20 87 20 87 20 87 2F 87 2F 8F 8F 
9F 8F AF 8F 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 AF 8F FF FF FF FF 00 00 00 00 FF FF FF FF 
00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF 
FF FF FF FF 00 00 00 00 FF FF 00 00 00 00 00 00 
33 00 33 00 33 00 33 00 33 00 1C 00 1C 00 1C 00 
3C 00 3C 00 3C 00 3C 00 3C 00 3C 00 3C 00 1C 00 

--- Device locks information ---
  - Config locked: 1
  - Data locked: 1
  - Slot 0 locked: 0
  - Slot 1 locked: 0
  - Slot 2 locked: 0
  - Slot 3 locked: 0
  - Slot 4 locked: 0
  - Slot 5 locked: 0
  - Slot 6 locked: 0
  - Slot 7 locked: 0
  - Slot 8 locked: 0
  - Slot 9 locked: 0
  - Slot 10 locked: 0
  - Slot 11 locked: 0
  - Slot 12 locked: 0
  - Slot 13 locked: 0
  - Slot 14 locked: 0
  - Slot 15 locked: 0
--------------------------------

Private key slot in use: 1, public: 9
Running tests...
test_hash_sha256 succesful!
assertion failed at ./main.c:303 (actual=121 expected=0)
assertion failed at ./main.c:397 (actual=121 expected=0)


Available commands:
 - info - print configuration information;
 - test - run all tests on the device;
 - exit - exit the interactive loop;
 - generate_private[=%d] - generate a private key in a given slot (0-15),
                           default slot - 0.
 - generate_public=%d_%d - generate a public key in a given slot
                           (0-15, second argument) using a private key
                           from a given slot (0-15, first argument);
 - private_slot=%d - designate a slot to be used as a private key in tests;
 - public_slot=%d - designate a slot to be used as a public key in tests;
 - write_lock_config - write a hardcoded configuration to the device,
                       lock it;
 - lock_data - lock the data zone;

test_hash_sha256 is working correctly because is calling directly atecc608a_hash_sha256 function not going through psa API. I thought the problem could be a wrong registration parameter here:

ASSERT_SUCCESS_PSA(psa_register_se_driver(PSA_ATECC608A_LIFETIME, &atecc608a_drv_info));
because function is expecting a location value and not PSA_ATECC608A_LIFETIME, in fact with this configuration psa_get_se_driver_entry will fail because the location value is 0.

https://github.com/ARMmbed/mbed-os/blob/d1f02f3078b405624f7be0cd824cdf85d472fa34/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/mbedtls/psa_crypto_se.c#L75-L85

I'm trying to find the correct way to fix it but i need some help.

Target(s) affected by this defect ?

I've tested ti on PORTENTA_H7, but i think this issue is affecting other targets

Toolchain(s) (name and version) displaying this defect ?

gcc-arm-none-eabi-9-2019-q4-major

What version of Mbed-os are you using (tag or sha) ?

https://github.com/ARMmbed/mbed-os/#3377f083b3a6bd7a1b45ed2cea5cf083b9007527

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

mbed --version 
1.10.4

How is this defect reproduced ?

Flash and run the example

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions