Make sure we don't underflow in the size macros
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
This commit is contained in:
parent
b639d43538
commit
1dda21c4a4
2 changed files with 8 additions and 6 deletions
|
@ -339,7 +339,8 @@ MBEDTLS_PSA_DEPRECATED static inline psa_status_t psa_asymmetric_verify( psa_key
|
|||
*/
|
||||
#define PSA_AEAD_DECRYPT_OUTPUT_SIZE_2_ARG( alg, ciphertext_length ) \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( size_t, \
|
||||
PSA_ALG_IS_AEAD( alg ) ? \
|
||||
PSA_ALG_IS_AEAD( alg ) && \
|
||||
(ciphertext_length) > PSA_ALG_AEAD_GET_TAG_LENGTH( alg ) ? \
|
||||
(ciphertext_length) - PSA_ALG_AEAD_GET_TAG_LENGTH( alg ) : \
|
||||
0 )
|
||||
|
||||
|
|
|
@ -323,7 +323,8 @@
|
|||
* return 0.
|
||||
*/
|
||||
#define PSA_AEAD_DECRYPT_OUTPUT_SIZE(key_type, alg, ciphertext_length) \
|
||||
(PSA_AEAD_NONCE_LENGTH(key_type, alg) != 0 ? \
|
||||
(PSA_AEAD_NONCE_LENGTH(key_type, alg) != 0 && \
|
||||
(ciphertext_length) > PSA_ALG_AEAD_GET_TAG_LENGTH(alg) ? \
|
||||
(ciphertext_length) - PSA_ALG_AEAD_GET_TAG_LENGTH(alg) : \
|
||||
0)
|
||||
|
||||
|
|
Loading…
Reference in a new issue