From 3ea3635d2f463594e2aeed03dbf38360a92ca8f2 Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Wed, 28 May 2025 10:02:12 +0200 Subject: [PATCH 1/2] Move the inclusion of crypto_sizes.h and crypto_struct.h in crypto.h That way when API are declared, the types they use are defined. This should resolve the issues related to psa_xyz_init functions returning a structure described in #7087. Signed-off-by: Ronald Cron --- include/psa/crypto.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/psa/crypto.h b/include/psa/crypto.h index 2bbcea3ee0..2fe9f35ec3 100644 --- a/include/psa/crypto.h +++ b/include/psa/crypto.h @@ -59,6 +59,18 @@ extern "C" { * of integral types defined in "crypto_types.h". */ #include "crypto_values.h" +/* The file "crypto_sizes.h" contains definitions for size calculation + * macros whose definitions are implementation-specific. */ +#include "crypto_sizes.h" + +/* The file "crypto_struct.h" contains definitions for + * implementation-specific structs that are declared above. */ +#if defined(MBEDTLS_PSA_CRYPTO_STRUCT_FILE) +#include MBEDTLS_PSA_CRYPTO_STRUCT_FILE +#else +#include "crypto_struct.h" +#endif + /** \defgroup initialization Library initialization * @{ */ @@ -4958,18 +4970,6 @@ psa_status_t psa_verify_hash_abort( } #endif -/* The file "crypto_sizes.h" contains definitions for size calculation - * macros whose definitions are implementation-specific. */ -#include "crypto_sizes.h" - -/* The file "crypto_struct.h" contains definitions for - * implementation-specific structs that are declared above. */ -#if defined(MBEDTLS_PSA_CRYPTO_STRUCT_FILE) -#include MBEDTLS_PSA_CRYPTO_STRUCT_FILE -#else -#include "crypto_struct.h" -#endif - /* The file "crypto_extra.h" contains vendor-specific definitions. This * can include vendor-defined algorithms, extra functions, etc. */ #include "crypto_extra.h" From 4960825a946f201955c674e0dc1aafec4621d25c Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Wed, 28 May 2025 10:05:32 +0200 Subject: [PATCH 2/2] Add change log Signed-off-by: Ronald Cron --- ChangeLog.d/move-crypto-struct-inclusion.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 ChangeLog.d/move-crypto-struct-inclusion.txt diff --git a/ChangeLog.d/move-crypto-struct-inclusion.txt b/ChangeLog.d/move-crypto-struct-inclusion.txt new file mode 100644 index 0000000000..c5f6d2b822 --- /dev/null +++ b/ChangeLog.d/move-crypto-struct-inclusion.txt @@ -0,0 +1,3 @@ +Bugfix + * Resolved build issue with C++ projects using TF-PSA-Crypto when compiling + with the MSVC toolset v142 and earlier. Fixes mbedtls issue #7087.