diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-07-01 15:29:58 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-07-01 15:30:05 +0200 |
commit | 568935848dd6b82b9315d8b6c529d00e2605e03d (patch) | |
tree | c76b84cc8e9504f317a7d8c6091c21c9d041c30b | |
parent | 605f24146e0976347848388e60e7bca1f849fe3f (diff) | |
download | gnutls-568935848dd6b82b9315d8b6c529d00e2605e03d.tar.gz |
gnutls_aead_cipher_decrypt: corrected the return value of ptext_len
That is, do not account the tag_size into the plaintext.
-rw-r--r-- | lib/crypto-api.c | 2 | ||||
-rw-r--r-- | lib/crypto-selftests.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/crypto-api.c b/lib/crypto-api.c index 982148ab4a..7d3d5ed8b5 100644 --- a/lib/crypto-api.c +++ b/lib/crypto-api.c @@ -713,7 +713,7 @@ gnutls_aead_cipher_decrypt(gnutls_aead_cipher_hd_t handle, return gnutls_assert_val(ret); /* That assumes that AEAD ciphers are stream */ - *ptext_len = ctext_len; + *ptext_len = ctext_len - tag_size; return 0; } diff --git a/lib/crypto-selftests.c b/lib/crypto-selftests.c index cfb439edda..d43f3558fe 100644 --- a/lib/crypto-selftests.c +++ b/lib/crypto-selftests.c @@ -550,7 +550,7 @@ static int test_cipher_aead(gnutls_cipher_algorithm_t cipher, gnutls_assert_val (GNUTLS_E_SELF_TEST_ERROR); - if (s2 != vectors[i].tag_size+vectors[i].plaintext_size && memcmp(tmp, vectors[i].plaintext, vectors[i].plaintext_size) != 0) { + if (s2 != vectors[i].plaintext_size && memcmp(tmp, vectors[i].plaintext, vectors[i].plaintext_size) != 0) { _gnutls_debug_log("%s test vector %d failed (decryption)!\n", gnutls_cipher_get_name(cipher), i); return gnutls_assert_val(GNUTLS_E_SELF_TEST_ERROR); |