psa: Fix Mbed TLS hash operation definition

Use PSA_BUILTIN macros instead of the Mbed TLS ones
as in the hash operation contexts the context for a
given hash is needed only if the support for it
through PSA is enabled.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2021-10-18 10:12:20 +02:00
parent cfc3c7b593
commit 0d5a27b195

View File

@ -65,25 +65,27 @@ typedef struct
union union
{ {
unsigned dummy; /* Make the union non-empty even with no supported algorithms. */ unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
#if defined(MBEDTLS_MD2_C) #if defined(MBEDTLS_PSA_BUILTIN_ALG_MD2)
mbedtls_md2_context md2; mbedtls_md2_context md2;
#endif #endif
#if defined(MBEDTLS_MD4_C) #if defined(MBEDTLS_PSA_BUILTIN_ALG_MD4)
mbedtls_md4_context md4; mbedtls_md4_context md4;
#endif #endif
#if defined(MBEDTLS_MD5_C) #if defined(MBEDTLS_PSA_BUILTIN_ALG_MD5)
mbedtls_md5_context md5; mbedtls_md5_context md5;
#endif #endif
#if defined(MBEDTLS_RIPEMD160_C) #if defined(MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160)
mbedtls_ripemd160_context ripemd160; mbedtls_ripemd160_context ripemd160;
#endif #endif
#if defined(MBEDTLS_SHA1_C) #if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_1)
mbedtls_sha1_context sha1; mbedtls_sha1_context sha1;
#endif #endif
#if defined(MBEDTLS_SHA256_C) #if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
mbedtls_sha256_context sha256; mbedtls_sha256_context sha256;
#endif #endif
#if defined(MBEDTLS_SHA512_C) #if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
mbedtls_sha512_context sha512; mbedtls_sha512_context sha512;
#endif #endif
} ctx; } ctx;