-
Notifications
You must be signed in to change notification settings - Fork 96
Define MBEDTLS_PK_SIGNATURE_MAX_SIZE #315
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
Merged
gilles-peskine-arm
merged 11 commits into
ARMmbed:development
from
gilles-peskine-arm:pk_signature_max_size
Nov 13, 2019
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
da252be
Define a constant for the maximum signature size from pk_sign()
gilles-peskine-arm f85e4e6
test_suite_pk: fix use of sig_len without initialization
gilles-peskine-arm eba088a
test_suite_pk: check the signature size after pk_sign
gilles-peskine-arm e48fe55
test_suite_pk: pk_genkey: support a variable key size or curve
gilles-peskine-arm a719db8
Add pk_utils and pk_sign tests with different curves
gilles-peskine-arm b22a24b
Fix MBEDTLS_PK_SIGNATURE_MAX_SIZE to account for ECDSA
gilles-peskine-arm f48d6f2
Add sanity checks for the mbedtls_pk_sign output size
gilles-peskine-arm 2975571
Fix ECDSA case in PSA_ASYMMETRIC_SIGNATURE_MAX_SIZE
gilles-peskine-arm 5460565
Fix errors in the definition of MBEDTLS_PK_SIGNATURE_MAX_SIZE
gilles-peskine-arm 5bcb24b
Fix output buffer length check in pk_opaque_sign_wrap
gilles-peskine-arm 9db14fa
Update the documentation of mbedtls_pk_sign_restartable()
gilles-peskine-arm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
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.
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.
These lines appear to unset
MBEDTLS_PK_SIGNATURE_MAX_SIZEand then reset it back toMBEDTLS_MPI_MAX_SIZE. Am I missing something 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.
It's a coincidence. The undef/define gymnastic is necessary to redefine the value. While you can express max(…) using C operators, it doesn't scale. It's still ok for max(x1,x2) (
x1 > x2 ? x1 : x2) but it quickly grows unmanageable formax(x1, x2, x3, …).I'll add a comment to explain what's going on.
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.
Ah, but no, the code isn't working as intended! It's always setting
MBEDTLS_PK_SIGNATURE_MAX_SIZEto be at leastMBEDTLS_MPI_MAX_SIZE, which I wanted to avoid in the fairly common case whereMBEDTLS_MPI_MAX_SIZEis kept to a large value but RSA signature is disabled andMBEDTLS_PK_SIGNATURE_MAX_SIZEencompasses ECDSA only with a much smaller maximum size.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.
Uh, actually, this fallback was working as intended, sort of. It's not a fallback in the sense of “if nothing else is defined”, but something that can arise even if nothing is defined.
Except that the RSA_ALT case can't happen if RSA_ALT is not enabled, so that part was wrong.
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.
Fixed.