ssl_misc: add internal MBEDTLS_SSL_HAVE_[AES/ARIA/CAMELLIA]_CBC symbols

These are used in tests to determine whether there is support for
one of those keys for CBC mode.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti 2023-10-27 16:44:27 +02:00
parent dc55470341
commit 1ebb6cd68d

View File

@ -261,6 +261,33 @@ uint32_t mbedtls_ssl_get_extension_mask(unsigned int extension_type);
* counter (8) + header (5) + IV(16) + MAC (16-48) + padding (0-256).
*/
/* Some internal helpers to determine which keys are availble for CBC mode. */
#if defined(MBEDTLS_USE_PSA_CRYPTO)
#if defined(PSA_WANT_ALG_CBC_NO_PADDING) || defined(PSA_WANT_ALG_CBC_PKCS7)
#if defined(PSA_WANT_KEY_TYPE_AES)
#define MBEDTLS_SSL_HAVE_AES_CBC
#endif
#if defined(PSA_WANT_KEY_TYPE_ARIA)
#define MBEDTLS_SSL_HAVE_ARIA_CBC
#endif
#if defined(PSA_WANT_KEY_TYPE_CAMELLIA)
#define MBEDTLS_SSL_HAVE_CAMELLIA_CBC
#endif
#endif /* PSA_WANT_ALG_CBC_NO_PADDING || PSA_WANT_ALG_CBC_PKCS7 */
#else /* MBEDTLS_USE_PSA_CRYPTO */
#if defined(MBEDTLS_CIPHER_MODE_CBC)
#if defined(MEDTLS_AES_C)
#define MBEDTLS_SSL_HAVE_AES_CBC
#endif
#if defined(MEDTLS_ARIA_C)
#define MBEDTLS_SSL_HAVE_ARIA_CBC
#endif
#if defined(MEDTLS_CAMELLIA_C)
#define MBEDTLS_SSL_HAVE_CAMELLIA_CBC
#endif
#endif /* MBEDTLS_CIPHER_MODE_CBC */
#endif /* MBEDTLS_USE_PSA_CRYPTO*/
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
/* This macro determines whether CBC is supported. */