mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-07 06:42:56 +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 */
|
#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 */
|
/* 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_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 */
|
#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 */
|
/* 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,7 +1669,7 @@ 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_SOME_AEAD */
|
#endif /* MBEDTLS_CIPHER_HAVE_AEAD_LEGACY */
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_CIPHER_HAVE_AEAD_LEGACY || MBEDTLS_NIST_KW_C */
|
#endif /* MBEDTLS_CIPHER_HAVE_AEAD_LEGACY || MBEDTLS_NIST_KW_C */
|
||||||
|
|
||||||
|
@@ -85,7 +85,7 @@ exit:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_CIPHER_AUTH_CRYPT)
|
#if defined(MBEDTLS_CIPHER_HAVE_AEAD_LEGACY)
|
||||||
/* 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_AUTH_CRYPT */
|
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_HAVE_AEAD_LEGACY */
|
||||||
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)
|
||||||
|
Reference in New Issue
Block a user