-
Notifications
You must be signed in to change notification settings - Fork 1.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
nrf_security: drivers: cracen: adding support for ed25519 without sicrypto #19812
base: main
Are you sure you want to change the base?
Conversation
…rypto Adding support directly using silexpk/sxsymcrypt files for ed25519 This bypasses sicrypto, which saves on flash usage Primarily intended for bootloader usecase Signed-off-by: Dag Erik Gjørvad <[email protected]>
CI InformationTo view the history of this post, clich the 'edited' button above Inputs:Sources:sdk-nrf: PR head: 26c4896cb0337a6bffdd0274d36c192cc24840c4 more detailssdk-nrf:
Github labels
List of changed files detected by CI (6)
Outputs:ToolchainVersion: 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
@@ -400,3 +400,10 @@ config PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY | |||
bool "SRP public key support" if !MBEDTLS_PROMPTLESS | |||
help | |||
SRP public key support. | |||
|
|||
comment "Nordic added alternative cracen driver" |
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.
why does this need a comment and why is it using comment
?
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 does not, which is why it has been removed? That is an old commit that will be squashed before pull, but lives there since it the old commit might have a bootloader usecase
const uint8_t *message); | ||
|
||
int ed25519_verify(const uint8_t *pubkey, const char *message, | ||
size_t message_length, const char *signature); | ||
|
||
int create_ed25519_pubkey(const uint8_t *ed25519, | ||
uint8_t *pubkey); |
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.
the secondary lines of these seem indented to odd lengths, plus the line length is 100 so why are these being chopped into 2 lines even when combined they don't reach 100 characters?
char workmem[160]; | ||
struct sxhash hashopctx; | ||
char pointr_buffer[64]; |
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.
use defines for lengths
r = sx_hash_feed(&hashopctx, workmem+32, 32); | ||
if (r != 0) { | ||
return r; | ||
} | ||
r = sx_hash_feed(&hashopctx, message, 100); | ||
if (r != 0) { | ||
return r; | ||
} | ||
r = sx_hash_digest(&hashopctx, workmem+96); | ||
if (r != 0) { | ||
return r; | ||
} | ||
|
||
/* Perform point multiplication R = [r]B. This is the encoded point R, | ||
* which is the first part of the signature. | ||
*/ | ||
r = sx_ed25519_ptmult((const struct sx_ed25519_dgst *)(workmem + 96), |
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.
magic numbers everywhere, get rid of them
if (r != 0) { | ||
return r; | ||
} | ||
r = sx_hash_feed(&hashopctx, workmem+32, 32); |
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.
x + x
with spaces like below
#if CONFIG_PSA_NEED_NO_SI_CRYPTO_ED25519 | ||
#else |
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.
first this is a define, secondly, if !defined(x)
?
@@ -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
|
||
#if CONFIG_PSA_NEED_NO_SI_CRYPTO_ED25519 | ||
si_status = create_ed25519_pubkey(key_buffer, data); | ||
*data_length = 32; |
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
const struct sx_pk_ecurve *sx_curve; | ||
#if CONFIG_PSA_NEED_NO_SI_CRYPTO_ED25519 | ||
#else | ||
|
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.
you just added these in the previous commit... squash changes
1b7981b
to
719961c
Compare
Update the removes the sicrypto drivers when using ed25519 with cracen. Adds the functionality to cracenpsa Also does the same for ed25519ph, as their dependencies were interwoven Signed-off-by: Dag Erik Gjørvad <[email protected]>
719961c
to
26c4896
Compare
Removing the sicrypto implementation of ed25519 and ed25519ph.
Added implementation in cracenpsa of ed25519 and ed25519ph
Updated cracenpsa to support new implementation and
remove references to old