cipher: reintroduce symbol for legacy AEAD support

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti 2023-10-13 14:32:09 +02:00
parent 193e383686
commit 5f5573fa90
2 changed files with 10 additions and 6 deletions

View file

@ -33,6 +33,10 @@
#include <stddef.h> #include <stddef.h>
#include "mbedtls/platform_util.h" #include "mbedtls/platform_util.h"
#if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
#define MBEDTLS_CIPHER_HAVE_AEAD_LEGACY
#endif
#if defined(MBEDTLS_CIPHER_MODE_CBC) #if defined(MBEDTLS_CIPHER_MODE_CBC)
#define MBEDTLS_CIPHER_MODE_WITH_PADDING #define MBEDTLS_CIPHER_MODE_WITH_PADDING
#endif #endif
@ -1076,7 +1080,7 @@ int mbedtls_cipher_crypt(mbedtls_cipher_context_t *ctx,
const unsigned char *input, size_t ilen, const unsigned char *input, size_t ilen,
unsigned char *output, size_t *olen); unsigned char *output, size_t *olen);
#if defined(MBEDTLS_CIPHER_HAVE_SOME_AEAD) || defined(MBEDTLS_NIST_KW_C) #if defined(MBEDTLS_CIPHER_HAVE_AEAD_LEGACY) || defined(MBEDTLS_NIST_KW_C)
/** /**
* \brief The authenticated encryption (AEAD/NIST_KW) function. * \brief The authenticated encryption (AEAD/NIST_KW) function.
* *
@ -1183,7 +1187,7 @@ int mbedtls_cipher_auth_decrypt_ext(mbedtls_cipher_context_t *ctx,
const unsigned char *input, size_t ilen, const unsigned char *input, size_t ilen,
unsigned char *output, size_t output_len, unsigned char *output, size_t output_len,
size_t *olen, size_t tag_len); size_t *olen, size_t tag_len);
#endif /* MBEDTLS_CIPHER_HAVE_SOME_AEAD || MBEDTLS_NIST_KW_C */ #endif /* MBEDTLS_CIPHER_HAVE_AEAD_LEGACY || MBEDTLS_NIST_KW_C */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -1390,7 +1390,7 @@ int mbedtls_cipher_crypt(mbedtls_cipher_context_t *ctx,
return 0; return 0;
} }
#if defined(MBEDTLS_CIPHER_HAVE_SOME_AEAD) #if defined(MBEDTLS_CIPHER_HAVE_AEAD_LEGACY)
/* /*
* Packet-oriented encryption for AEAD modes: internal function used by * Packet-oriented encryption for AEAD modes: internal function used by
* mbedtls_cipher_auth_encrypt_ext(). * mbedtls_cipher_auth_encrypt_ext().
@ -1569,9 +1569,9 @@ static int mbedtls_cipher_aead_decrypt(mbedtls_cipher_context_t *ctx,
return MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE; return MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE;
} }
#endif /* MBEDTLS_CIPHER_HAVE_SOME_AEAD */ #endif /* MBEDTLS_CIPHER_HAVE_AEAD_LEGACY */
#if defined(MBEDTLS_CIPHER_HAVE_SOME_AEAD) || defined(MBEDTLS_NIST_KW_C) #if defined(MBEDTLS_CIPHER_HAVE_AEAD_LEGACY) || defined(MBEDTLS_NIST_KW_C)
/* /*
* Packet-oriented encryption for AEAD/NIST_KW: public function. * Packet-oriented encryption for AEAD/NIST_KW: public function.
*/ */
@ -1671,6 +1671,6 @@ int mbedtls_cipher_auth_decrypt_ext(mbedtls_cipher_context_t *ctx,
return MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE; return MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE;
#endif /* MBEDTLS_CIPHER_HAVE_SOME_AEAD */ #endif /* MBEDTLS_CIPHER_HAVE_SOME_AEAD */
} }
#endif /* MBEDTLS_CIPHER_HAVE_SOME_AEAD || MBEDTLS_NIST_KW_C */ #endif /* MBEDTLS_CIPHER_HAVE_AEAD_LEGACY || MBEDTLS_NIST_KW_C */
#endif /* MBEDTLS_CIPHER_C */ #endif /* MBEDTLS_CIPHER_C */