-
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: correct use of (ECDSA) key_bits #20607
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mguetschow
added
the
CI: ready for build
If set, CI server will compile all applications for all available boards for the labeled PR
label
Apr 22, 2024
github-actions
bot
added
Area: sys
Area: System
Area: examples
Area: Example Applications
labels
Apr 22, 2024
mguetschow
force-pushed
the
psa-key-bits-cleanup
branch
from
May 14, 2024 15:02
8bc3725
to
15e48f0
Compare
mguetschow
requested review from
leandrolanzieri,
aabadie and
MichelRottleuthner
as code owners
May 14, 2024 15:04
benpicco
approved these changes
May 15, 2024
benpicco
added
the
Type: bug
The issue reports a bug / The PR fixes a bug (including spelling errors)
label
May 15, 2024
Einhornhool
approved these changes
May 16, 2024
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.
Oh well, looks like I didn't read the specification correctly. Thank you for fixing this!
Thank you all! 🎉 |
1 similar comment
Thank you all! 🎉 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area: examples
Area: Example Applications
Area: sys
Area: System
Area: tests
Area: tests and testing framework
CI: ready for build
If set, CI server will compile all applications for all available boards for the labeled PR
Type: bug
The issue reports a bug / The PR fixes a bug (including spelling errors)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
The
key_bits
that are part of thepsa_key_attributes_t
are restricted to certain values in the PSA specification. An example is PSA_ECC_FAMILY_SECP_R1, which allows forkey_bits = 256
, among others.However, in https://github.com/RIOT-OS/RIOT/blob/master/examples/psa_crypto/example_ecdsa_p256.c#L91,
key_bits
was set to the size of the exported key, which at least for PSA_ECC_FAMILY_SECP_R1 doesn't match the expectedkey_bits
(as it is defined here to be1+2*key_bits
).Fixing this revealed a unnecessary computation of the
curve_bits
, which actually match thekey_bits
according to the specification. Removed the respective macros and adapted all their usage.Testing procedure
CI should suffice to see that compilation and the tests succeed.
Issues/PRs references
Fixes #20468.
Draft since blocked by #20545: the change inDone ✔️examples/psa_crypto/example_ecdsa_p256.c
needs to be copied totests/sys/psa_crypto_ecdsa*/example_ecdsa_p256.c