-
Notifications
You must be signed in to change notification settings - Fork 2k
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
sys/psa_crypto: ed25519 private key {ex,im}port #20334
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey hey 🐭
just a short review, so this PR doesn't go stale 😃
I think @Einhornhool is going to review this thoroughly?
Hi! Thank you for the work!
This can be easily determined by the key location. There is a range of location values reserved for secure elements (either |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the work! I have some questions :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I think this should still be adressed before proceeding to merging. Maybe you could try it out with a secure element and report on the current behavior. |
Damn, sorry, I forgot about this.
psa_builtin_export_key function.It would be better to check the key location before calling psa_get_key_data_from_key_slot and then returning PSA_ERROR_NOT_SUPPORTED or PSA_ERROR_NOT_PERMITTED .
|
Thanks for testing! See this diff for the changes to fix the On the way I noticed that I had actually broken the key import in previous fixup commits (I guess that's what the tests are for :P). Fixed that and also the May I squash? |
Wow that is a difficult one 🤔 I actually expect the other I also found a related issue along the way which is not a regression and therefore out of scope for this PR. Opened #20468 as a follow-up for it. |
They were not since they symlink to @Einhornhool this should now be ready for final review, then I will squash all the fixups together. |
Here's the new output for
So for me this is fine! |
ecfcf76
to
e787d42
Compare
Thanks for the renewed review! I've just squashed and rebased onto current master. Maybe @Teufelchen1 could have a look at the documentation discussion above and provide a proxy-ack? |
sys/psa_crypto: ed25519 private key {ex,im}port
e787d42
to
5f08f74
Compare
Contribution description
This PR adds support for ed25519 private keys to
psa_import_key()
and adds the correspondingpsa_export_key()
function. For public asymmetric keys,psa_export_key()
should behave likepsa_export_public_key()
. The backend implementations are used to derive the public key from the private key passed topsa_import_key()
.Note that exporting and importing private keys from and to secure elements is not yet properly handled and will likely break for now. Maybe @Einhornhool could give a hint on where and how to test whether the key is stored on a secure element, to be able to report an error to the user.
Testing procedure
Two tests have been added to
tests/sys/psa_crypto
and tested successfully with hardware support on the nRF52840dk and using the software implementation on native.