-
Notifications
You must be signed in to change notification settings - Fork 8.4k
TLS credentials: generate key #100760
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
base: main
Are you sure you want to change the base?
TLS credentials: generate key #100760
Conversation
| size_t key_bits; | ||
|
|
||
| /* Initialize PSA Crypto */ | ||
| status = psa_crypto_init(); |
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.
It would be better to add a mutex lock.
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.
psa_crypto_init can be called any number of times and will just return if already initialized. No mutex necessary.
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.
Yes, but it's more safe in multi-thread environment
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.
what do you mean? only one thread can access this function.
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.
Other threads may call psa_crypto_init(), not only generate_ecdsa_keypair.
Anyway, as the doc said it can be called in multiple times, it's just a suggestion.
Print usage hint instead of unhelpful "wrong parameter count" message. Signed-off-by: Maximilian Deubel <[email protected]>
bc10d51 to
e603035
Compare
e603035 to
aeaa27d
Compare
Add command to generate a key on-device. Currently, only p256 keys are supported. Signed-off-by: Maximilian Deubel <[email protected]>
f3c2a40 to
22923c5
Compare
|



Add support to generate a key on-device.
Also: print usage instructions to make commands less painful to use.
We have a usecase to generate p256 keys for use with credentials shell on-device.
Possibly, the option to read the private key should be behind a Kconfig too.