-
Notifications
You must be signed in to change notification settings - Fork 27
Fix union initialization in PSA operations for GCC 15: new test helpers #136
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
Changes from all commits
bdccf41
7c7387f
b295a13
468acda
92f2203
767b6f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* Common definitions used by test drivers. */ | ||
/* Copyright The Mbed TLS Contributors | ||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later | ||
*/ | ||
|
||
#ifndef PSA_CRYPTO_TEST_DRIVERS_TEST_DRIVER_COMMON_H | ||
#define PSA_CRYPTO_TEST_DRIVERS_TEST_DRIVER_COMMON_H | ||
|
||
#include "mbedtls/build_info.h" | ||
|
||
#endif /* test_driver_common.h */ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,6 +145,35 @@ const char *mbedtls_test_helper_is_psa_leaking(void); | |
while (0) | ||
|
||
|
||
/** Initializer that doesn't set the embedded union to zero. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: I grepped |
||
* | ||
* Use this to validate that our code correctly handles platforms where | ||
* `{0}` does not initialize a union to all-bits-zero, only the first member. | ||
* Such behavior is uncommon, but compliant (see discussion in | ||
* https://github.com/Mbed-TLS/mbedtls/issues/9814). | ||
* You can portably simulate that behavior by using the `xxx_init_short()` | ||
* initializer function instead of `{0}` or an official initializer | ||
* `xxx_init()` or `XXX_INIT`. | ||
*/ | ||
psa_hash_operation_t psa_hash_operation_init_short(void); | ||
psa_mac_operation_t psa_mac_operation_init_short(void); | ||
psa_cipher_operation_t psa_cipher_operation_init_short(void); | ||
psa_aead_operation_t psa_aead_operation_init_short(void); | ||
psa_key_derivation_operation_t psa_key_derivation_operation_init_short(void); | ||
psa_pake_operation_t psa_pake_operation_init_short(void); | ||
psa_sign_hash_interruptible_operation_t psa_sign_hash_interruptible_operation_init_short(void); | ||
psa_verify_hash_interruptible_operation_t psa_verify_hash_interruptible_operation_init_short(void); | ||
#if defined(PSA_KEY_AGREEMENT_IOP_INIT) | ||
psa_key_agreement_iop_t psa_key_agreement_iop_init_short(void); | ||
#endif | ||
#if defined(PSA_GENERATE_KEY_IOP_INIT) | ||
psa_generate_key_iop_t psa_generate_key_iop_init_short(void); | ||
#endif | ||
#if defined(PSA_EXPORT_PUBLIC_KEY_IOP_INIT) | ||
psa_export_public_key_iop_t psa_export_public_key_iop_init_short(void); | ||
#endif | ||
|
||
|
||
|
||
#if defined(RECORD_PSA_STATUS_COVERAGE_LOG) | ||
psa_status_t mbedtls_test_record_status(psa_status_t status, | ||
|
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.
Note: currently this is already included by all users before deciding whether to include this file. But it doesn't hurt now and might be helpful later, so no objection.