mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-01 10:06:53 +03:00
cipher: fix guards in mbedtls_cipher_auth_[encrypt/decrypt]_ext()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
@ -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 */
|
||||
|
||||
|
Reference in New Issue
Block a user