-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Backport 3.6: Check union initialization portably #10179
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
Backport 3.6: Check union initialization portably #10179
Conversation
When initializing a multipart or interruptible operation structure, use an
auxiliary function that doesn't initialize union members to all-bits-zero.
Context: on most compilers, initializing a union to `{0}` initializes it to
all bits zero; but on some compilers, the trailing part of members other
than the first is left uninitialized. This way, we can run the tests on any
platform and validate that the code would work correctly on platforms where
union initialization is short.
This commit makes a systematic replacement in `test_suite_psa_crypto.function`
and `test_suite_psa_crypto_driver_wrappers.function`, which gives good
enough coverage.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Partially undo "Use short initializers for multipart operation structures", only in test functions that specifically aim to test initializers. In these functions, do try with the short initializers, but alongside the standard ones. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
e359e63 to
821a5db
Compare
mpg
left a 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.
LGTM, but I guess the framework pointer should be updated to the merge commit of Mbed-TLS/mbedtls-framework#168 (currently pointing at the tip of the associated branch).
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
821a5db to
0050f5f
Compare
|
I've amended the last commit to update the framework submodule to the head of main instead of the now-merged pull request branch. |
mpg
left a 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.
LGTM, thanks!
gabor-mezei-arm
left a 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.
LGTM
Improved testing for #9814 and #9975:
HMAC-SHA-256test failures on upcominggcc-15(after partial union initialization changes) #9814.HMAC-SHA-256test failures on upcominggcc-15(after partial union initialization changes) #9814.Needs preceding PR:
PR checklist