From 12f45f99da22e4f04414358bea195ff22e9a7fbb Mon Sep 17 00:00:00 2001 From: David Brown Date: Tue, 26 Jan 2021 11:50:36 -0700 Subject: [PATCH] Add definitions for builtins for cipher modes Create these definitions for the various cipher modes. Signed-off-by: David Brown --- include/mbedtls/config_psa.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/include/mbedtls/config_psa.h b/include/mbedtls/config_psa.h index 67ab54d58..df457bed8 100644 --- a/include/mbedtls/config_psa.h +++ b/include/mbedtls/config_psa.h @@ -249,27 +249,31 @@ extern "C" { #endif /* PSA_WANT_KEY_TYPE_DES */ #if defined(PSA_WANT_ALG_STREAM_CIPHER) - /* Nothing to define */ +#define MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER 1 #endif /* PSA_WANT_ALG_STREAM_CIPHER */ #if defined(PSA_WANT_ALG_CTR) +#define MBEDTLS_PSA_BUILTIN_ALG_CTR 1 #define MBEDTLS_CIPHER_MODE_CTR #endif /* PSA_WANT_ALG_CTR */ #if defined(PSA_WANT_ALG_CFB) +#define MBEDTLS_PSA_BUILTIN_ALG_CFB 1 #define MBEDTLS_CIPHER_MODE_CFB #endif /* PSA_WANT_ALG_CFB */ #if defined(PSA_WANT_ALG_OFB) +#define MBEDTLS_PSA_BUILTIN_ALG_OFB 1 #define MBEDTLS_CIPHER_MODE_OFB #endif /* PSA_WANT_ALG_OFB */ #if defined(PSA_WANT_ALG_XTS) +#define MBEDTLS_PSA_BUILTIN_ALG_XTS 1 #define MBEDTLS_CIPHER_MODE_XTS #endif /* PSA_WANT_ALG_XTS */ #if defined(PSA_WANT_ALG_ECB_NO_PADDING) - /* Nothing to define. */ +#define MBEDTLS_PSA_BUILTIN_ALG_ECB 1 #endif #if defined(PSA_WANT_ALG_CBC_NO_PADDING) || defined(PSA_WANT_ALG_CBC_PKCS7) @@ -279,6 +283,14 @@ extern "C" { #endif /* PSA_WANT_ALG_CBC_PKCS7 */ #endif /* PSA_WANT_ALG_CBC_NO_PADDING || PSA_WANT_ALG_CBC_PKCS7 */ +#if defined(PSA_WANT_ALG_CBC_NO_PADDING) +#define MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING 1 +#endif /* PSA_WANT_ALG_CBC_NO_PADDING */ + +#if defined(PSA_WANT_ALG_CBC_PKCS7) +#define MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7 1 +#endif /* PSA_WANT_ALG_CBC_PKCS7 */ + #else /* MBEDTLS_PSA_CRYPTO_CONFIG */ /* @@ -396,6 +408,7 @@ extern "C" { #define PSA_WANT_KEY_TYPE_ARC4 1 #define PSA_WANT_ALG_STREAM_CIPHER 1 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ARC4 1 +#define MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER 1 #endif #if defined(MBEDTLS_CAMELLIA_C) @@ -411,28 +424,34 @@ extern "C" { #if defined(MBEDTLS_CIPHER_MODE_CBC) #define PSA_WANT_ALG_CBC_NO_PADDING 1 #if defined(MBEDTLS_CIPHER_PADDING_PKCS7) +#define MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7 1 #define PSA_WANT_ALG_CBC_PKCS7 1 #endif #endif #if defined(MBEDTLS_AES_C) || defined(MBEDTLS_DES_C) || \ defined(MBEDTLS_CAMELLIA_C) +#define MBEDTLS_PSA_BUILTIN_ALG_ECB 1 #define PSA_WANT_ALG_ECB_NO_PADDING 1 #endif #if defined(MBEDTLS_CIPHER_MODE_CFB) +#define MBEDTLS_PSA_BUILTIN_ALG_CFB 1 #define PSA_WANT_ALG_CFB 1 #endif #if defined(MBEDTLS_CIPHER_MODE_CTR) +#define MBEDTLS_PSA_BUILTIN_ALG_CTR 1 #define PSA_WANT_ALG_CTR 1 #endif #if defined(MBEDTLS_CIPHER_MODE_OFB) +#define MBEDTLS_PSA_BUILTIN_ALG_OFB 1 #define PSA_WANT_ALG_OFB 1 #endif #if defined(MBEDTLS_CIPHER_MODE_XTS) +#define MBEDTLS_PSA_BUILTIN_ALG_XTS 1 #define PSA_WANT_ALG_XTS 1 #endif