Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

register_se_driver issue and tests failure #74

Open
pennam opened this issue Sep 8, 2021 · 2 comments · May be fixed by #75
Open

register_se_driver issue and tests failure #74

pennam opened this issue Sep 8, 2021 · 2 comments · May be fixed by #75

Comments

@pennam
Copy link

pennam commented Sep 8, 2021

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

@ciarmcom
Copy link
Member

ciarmcom commented Sep 8, 2021

Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers.
Internal Jira reference: https://jira.arm.com/browse/IOTOSM-4281

@pennam
Copy link
Author

pennam commented Sep 8, 2021

I've made some progress and fixed the registration issue. See ARMmbed/mbed-os-atecc608a#18 and #75

Now only test_sign_verify is failing the others are all ok.

@pennam pennam changed the title register_se_driver issue and failing tests register_se_driver issue and tests failure Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants