From f08a550e688b444f53e9d254671a113c06c50e1d Mon Sep 17 00:00:00 2001 From: mohammad1603 Date: Sun, 3 Jun 2018 15:05:47 +0300 Subject: [PATCH] set output length to zero to cover output length in error case --- library/psa_crypto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 6c431586e..1123a78c1 100755 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -1491,6 +1491,7 @@ psa_status_t psa_aead_encrypt( psa_key_slot_t key, size_t key_bits; unsigned char tag[16]; mbedtls_cipher_id_t cipher_id; + *ciphertext_length = 0; if( ciphertext_size < ( plaintext_length + sizeof( tag ) ) ) return( PSA_ERROR_INVALID_ARGUMENT );