cipher: reset MBEDTLS_CIPHER_HAVE_AEAD to MBEDTLS_CIPHER_MODE_AEAD

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti 2023-10-17 11:43:34 +02:00
parent 9a4273099c
commit 2f00b7a5da
3 changed files with 13 additions and 13 deletions

View file

@ -34,7 +34,7 @@
#include "mbedtls/platform_util.h" #include "mbedtls/platform_util.h"
#if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CCM_C) || defined(MBEDTLS_CHACHAPOLY_C) #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
#define MBEDTLS_CIPHER_HAVE_AEAD #define MBEDTLS_CIPHER_MODE_AEAD
#endif #endif
#if defined(MBEDTLS_CIPHER_MODE_CBC) #if defined(MBEDTLS_CIPHER_MODE_CBC)
@ -1080,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_AEAD) || defined(MBEDTLS_NIST_KW_C) #if defined(MBEDTLS_CIPHER_MODE_AEAD) || defined(MBEDTLS_NIST_KW_C)
/** /**
* \brief The authenticated encryption (AEAD/NIST_KW) function. * \brief The authenticated encryption (AEAD/NIST_KW) function.
* *
@ -1187,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_AEAD || MBEDTLS_NIST_KW_C */ #endif /* MBEDTLS_CIPHER_MODE_AEAD || 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_AEAD) #if defined(MBEDTLS_CIPHER_MODE_AEAD)
/* /*
* 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_AEAD */ #endif /* MBEDTLS_CIPHER_MODE_AEAD */
#if defined(MBEDTLS_CIPHER_HAVE_AEAD) || defined(MBEDTLS_NIST_KW_C) #if defined(MBEDTLS_CIPHER_MODE_AEAD) || defined(MBEDTLS_NIST_KW_C)
/* /*
* Packet-oriented encryption for AEAD/NIST_KW: public function. * Packet-oriented encryption for AEAD/NIST_KW: public function.
*/ */
@ -1607,7 +1607,7 @@ int mbedtls_cipher_auth_encrypt_ext(mbedtls_cipher_context_t *ctx,
} }
#endif /* MBEDTLS_NIST_KW_C */ #endif /* MBEDTLS_NIST_KW_C */
#if defined(MBEDTLS_CIPHER_HAVE_AEAD) #if defined(MBEDTLS_CIPHER_MODE_AEAD)
/* AEAD case: check length before passing on to shared function */ /* AEAD case: check length before passing on to shared function */
if (output_len < ilen + tag_len) { if (output_len < ilen + tag_len) {
return MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA; return MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA;
@ -1620,7 +1620,7 @@ int mbedtls_cipher_auth_encrypt_ext(mbedtls_cipher_context_t *ctx,
return ret; return ret;
#else #else
return MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE; return MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE;
#endif /* MBEDTLS_CIPHER_HAVE_AEAD */ #endif /* MBEDTLS_CIPHER_MODE_AEAD */
} }
/* /*
@ -1658,7 +1658,7 @@ int mbedtls_cipher_auth_decrypt_ext(mbedtls_cipher_context_t *ctx,
} }
#endif /* MBEDTLS_NIST_KW_C */ #endif /* MBEDTLS_NIST_KW_C */
#if defined(MBEDTLS_CIPHER_HAVE_AEAD) #if defined(MBEDTLS_CIPHER_MODE_AEAD)
/* AEAD case: check length before passing on to shared function */ /* AEAD case: check length before passing on to shared function */
if (ilen < tag_len || output_len < ilen - tag_len) { if (ilen < tag_len || output_len < ilen - tag_len) {
return MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA; return MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA;
@ -1669,8 +1669,8 @@ int mbedtls_cipher_auth_decrypt_ext(mbedtls_cipher_context_t *ctx,
input + ilen - tag_len, tag_len); input + ilen - tag_len, tag_len);
#else #else
return MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE; return MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE;
#endif /* MBEDTLS_CIPHER_HAVE_AEAD */ #endif /* MBEDTLS_CIPHER_MODE_AEAD */
} }
#endif /* MBEDTLS_CIPHER_HAVE_AEAD || MBEDTLS_NIST_KW_C */ #endif /* MBEDTLS_CIPHER_MODE_AEAD || MBEDTLS_NIST_KW_C */
#endif /* MBEDTLS_CIPHER_C */ #endif /* MBEDTLS_CIPHER_C */

View file

@ -85,7 +85,7 @@ exit:
return 0; return 0;
} }
#if defined(MBEDTLS_CIPHER_HAVE_AEAD) #if defined(MBEDTLS_CIPHER_MODE_AEAD)
/* Helper for resetting key/direction /* Helper for resetting key/direction
* *
* The documentation doesn't explicitly say whether calling * The documentation doesn't explicitly say whether calling
@ -842,7 +842,7 @@ exit:
} }
/* END_CASE */ /* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_HAVE_AEAD */ /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_AEAD */
void auth_crypt_tv(int cipher_id, data_t *key, data_t *iv, void auth_crypt_tv(int cipher_id, data_t *key, data_t *iv,
data_t *ad, data_t *cipher, data_t *tag, data_t *ad, data_t *cipher, data_t *tag,
char *result, data_t *clear, int use_psa) char *result, data_t *clear, int use_psa)