cipher: fix guards in mbedtls_cipher_auth_[encrypt/decrypt]_ext()

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti 2023-10-16 11:22:21 +02:00
parent 5f5573fa90
commit 0521633559
2 changed files with 6 additions and 6 deletions

View file

@ -1607,7 +1607,7 @@ int mbedtls_cipher_auth_encrypt_ext(mbedtls_cipher_context_t *ctx,
}
#endif /* MBEDTLS_NIST_KW_C */
#if defined(MBEDTLS_CIPHER_HAVE_SOME_AEAD)
#if defined(MBEDTLS_CIPHER_HAVE_AEAD_LEGACY)
/* AEAD case: check length before passing on to shared function */
if (output_len < ilen + tag_len) {
return MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA;
@ -1620,7 +1620,7 @@ int mbedtls_cipher_auth_encrypt_ext(mbedtls_cipher_context_t *ctx,
return ret;
#else
return MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE;
#endif /* MBEDTLS_CIPHER_HAVE_SOME_AEAD */
#endif /* MBEDTLS_CIPHER_HAVE_AEAD_LEGACY */
}
/*
@ -1658,7 +1658,7 @@ int mbedtls_cipher_auth_decrypt_ext(mbedtls_cipher_context_t *ctx,
}
#endif /* MBEDTLS_NIST_KW_C */
#if defined(MBEDTLS_CIPHER_HAVE_SOME_AEAD)
#if defined(MBEDTLS_CIPHER_HAVE_AEAD_LEGACY)
/* AEAD case: check length before passing on to shared function */
if (ilen < tag_len || output_len < ilen - tag_len) {
return MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA;
@ -1669,7 +1669,7 @@ int mbedtls_cipher_auth_decrypt_ext(mbedtls_cipher_context_t *ctx,
input + ilen - tag_len, tag_len);
#else
return MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE;
#endif /* MBEDTLS_CIPHER_HAVE_SOME_AEAD */
#endif /* MBEDTLS_CIPHER_HAVE_AEAD_LEGACY */
}
#endif /* MBEDTLS_CIPHER_HAVE_AEAD_LEGACY || MBEDTLS_NIST_KW_C */

View file

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