-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
nrf_security: drivers: cracen: adding support for ed25519 without sicrypto #19812
Conversation
CI InformationTo view the history of this post, clich the 'edited' button above Inputs:Sources:sdk-nrf: PR head: db636a58569784f6ed4d7c7e21bad1f5be2fff0c more detailssdk-nrf:
Github labels
List of changed files detected by CI (5)
Outputs:ToolchainVersion: 342151af73 Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
You can find the documentation preview for this PR at this link. It will be updated about 10 minutes after the documentation build succeeds. Note: This comment is automatically posted by the Documentation Publish GitHub Action. |
0c0a5d5
to
933f5a8
Compare
21feb07
to
e54e7e5
Compare
subsys/nrf_security/src/drivers/cracen/cracenpsa/include/cracen_psa.h
Outdated
Show resolved
Hide resolved
subsys/nrf_security/src/drivers/cracen/cracenpsa/src/key_management.c
Outdated
Show resolved
Hide resolved
@@ -605,8 +608,10 @@ static psa_status_t export_ecc_public_key_from_keypair(const psa_key_attributes_ | |||
int si_status = 0; | |||
psa_algorithm_t key_alg = psa_get_key_algorithm(attributes); | |||
const struct sx_pk_ecurve *sx_curve; | |||
#if CONFIG_PSA_NEED_NO_SI_CRYPTO_ED25519 |
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.
as above
subsys/nrf_security/src/drivers/cracen/cracenpsa/src/key_management.c
Outdated
Show resolved
Hide resolved
718033c
to
66dcd8a
Compare
758768d
to
0ace2dc
Compare
4aee94c
to
c8b7ced
Compare
subsys/nrf_security/src/drivers/cracen/cracenpsa/include/cracen_psa.h
Outdated
Show resolved
Hide resolved
subsys/nrf_security/src/drivers/cracen/cracenpsa/include/cracen_psa.h
Outdated
Show resolved
Hide resolved
subsys/nrf_security/src/drivers/cracen/cracenpsa/src/key_management.c
Outdated
Show resolved
Hide resolved
size_t message_length); | ||
|
||
int cracen_ed25519_verify(const uint8_t *pubkey, const char *message, size_t message_length, | ||
const char *signature); | ||
|
||
int cracen_ed25519ph_sign(const uint8_t *ed25519, char *signature, const uint8_t *message, | ||
size_t message_length, int ismessage); | ||
|
||
int cracen_ed25519ph_verify(const uint8_t *pubkey, const char *message, size_t message_length, | ||
const char *signature, int ismessage); |
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.
alignment on second lines is wrong
subsys/nrf_security/src/drivers/cracen/cracenpsa/src/key_management.c
Outdated
Show resolved
Hide resolved
subsys/nrf_security/src/drivers/cracen/cracenpsa/include/cracen_psa.h
Outdated
Show resolved
Hide resolved
c8b7ced
to
e3cfb62
Compare
&privkey->hashalg, alg, digestsz); | ||
} | ||
} | ||
if (alg == PSA_ALG_PURE_EDDSA || alg == PSA_ALG_ED25519PH) { |
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.
Was that intentional to remove the IS_ENABLED statement which requires the relevant PSA_NEED to be enabled here?
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 actually this statement is not needed either anymore. cracen_signature_prepare_ec_prvkey
is never called while using eddsa, as cracen_signature_prepare_ec_prvkey
is a support function for sicrypto
if (status != SX_OK) | ||
return status; | ||
|
||
memcpy(pub_key, pub_key_A, SX_ED25519_SZ); |
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.
Does it make sense to clear the scalar stored in the first part of the digest buffer here?
Maybe the workbuf in the other functions is also worth considering to clear before exiting the 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.
That does make sense
9c701f7
to
f9ea2ff
Compare
a55a562
to
833596b
Compare
subsys/nrf_security/src/drivers/cracen/cracenpsa/src/key_management.c
Outdated
Show resolved
Hide resolved
subsys/nrf_security/src/drivers/cracen/cracenpsa/src/key_management.c
Outdated
Show resolved
Hide resolved
subsys/nrf_security/src/drivers/cracen/cracenpsa/include/cracen_psa.h
Outdated
Show resolved
Hide resolved
fb96622
to
6ca35d7
Compare
6ca35d7
to
c3ab354
Compare
Add support for Ed25519 and Ed25519ph in cracenpsa directly using silexpk/sxsymcrypt. This bypasses sicrypto, which saves on flash usage Remove sicrypto implementation of Ed25519 from being accessible from cracenpsa. Signed-off-by: Dag Erik Gjørvad <[email protected]>
c3ab354
to
db636a5
Compare
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.
Nice! Just #19812 (comment) remains which you could address if you push to this PR at some point but it can go in without that.
@nordicjm Please review when you have the chance |
Added implementation in cracenpsa of ed25519 and ed25519ph without using sicrypto
Removed the possibility of using the sicrypto implementation of ed25519 and ed25519ph through cracenpsa
Updated cracenpsa to support new implementation and
remove references to old