-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
SHA-3 support (+ minor fixes & perf) #7708
Conversation
Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Pol Henarejos <[email protected]>
Next releases will not use alt files. Signed-off-by: Pol Henarejos <[email protected]>
Sanity checks are moved to mbedtls_sha3_xxx() functions. Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Pol Henarejos <[email protected]>
Next releases will not rely on alt files. Signed-off-by: Pol Henarejos <[email protected]>
For SHA-3 families, it must be at least 28, 32, 48 or 64, depending on the family. Signed-off-by: Pol Henarejos <[email protected]>
This enables HMAC with SHA3. Signed-off-by: Pol Henarejos <[email protected]>
Taken from Mbed-TLS#1549, as it is closed. Signed-off-by: Pol Henarejos <[email protected]>
Occurs in hmac, where multiple hashes are performed with the same context) and thus, it requires to reinitialize the internal states to 0. Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Pol Henarejos <[email protected]>
Enum values should not be conditioned. Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Pol Henarejos <[email protected]>
Co-authored-by: Gilles Peskine <[email protected]> Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Pol Henarejos <[email protected]>
Signed-off-by: Dave Rodgman <[email protected]>
Signed-off-by: Dave Rodgman <[email protected]>
Signed-off-by: Dave Rodgman <[email protected]>
Signed-off-by: Dave Rodgman <[email protected]>
Signed-off-by: Dave Rodgman <[email protected]>
Signed-off-by: Dave Rodgman <[email protected]>
Signed-off-by: Dave Rodgman <[email protected]>
Signed-off-by: Dave Rodgman <[email protected]>
Signed-off-by: Dave Rodgman <[email protected]>
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 additional changes look good. Thanks, @daverodgman.
} mbedtls_md_type_t; | ||
|
||
/* Note: this should always be >= PSA_HASH_MAX_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.
Why did you remove this entire note? I think it is still valid (except for the last sentence) and useful.
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.
Sorry, I made a mistake in the merge.
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.
No worries, happens!
I don't think that's in agreement with our process. Some of your updates are IMO not trivial enough to qualify for being single-reviewer. I think there should have been a 2nd reviewer for the commits you added - obviously no need for that person to re-review the commits from 5820 that already had two approvals. (Not a big deal, but still wanted to point it out.) |
@@ -112,6 +112,9 @@ | |||
#define MBEDTLS_MD_CAN_SHA512 | |||
#define MBEDTLS_MD_SOME_LEGACY | |||
#endif | |||
#if defined(MBEDTLS_SHA3_C) | |||
#define MBEDTLS_MD_CAN_SHA3 |
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.
I'm not sure that's quite right. PSA has distinct algorithm identifiers for the various SHA-3 variants, hence distinct PSA_WANT
macros. Since the MD_CAN
macros are here to provide an abstraction above MBEDTLS_xxx_C
and PSA_WANT
macros, they need to be as fine-grained as the most fine-grained of the two, so PSA here.
Note: since this is a public macro, this needs fixing before the next release.
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.
Created #7713 and added it to the next release EPIC.
Description
Minor fixes on top of #5820, and perf improvement (around 1.8x for SHA3-256 on M1 Pro).
Agreed with @d3zd3z that since we've both reviewed #5820, we are OK for David to single-review these updates.
PR checklist
Please tick as appropriate and edit the reasons (e.g.: "backport: not needed because this is a new feature")