From: Nikos Mavrogiannopoulos Date: Sun, 27 Jan 2013 19:00:32 +0000 (+0100) Subject: Fix AEAD out-of-place decryption X-Git-Tag: gnutls_3_1_7~47 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bbb36bd8d5586d15f040d8415e5490d3bf75de71;p=thirdparty%2Fgnutls.git Fix AEAD out-of-place decryption --- diff --git a/lib/crypto-api.c b/lib/crypto-api.c index 74916d2dd4..564c98c5c1 100644 --- a/lib/crypto-api.c +++ b/lib/crypto-api.c @@ -243,7 +243,11 @@ gnutls_cipher_decrypt2 (gnutls_cipher_hd_t handle, const void *ciphertext, { api_cipher_hd_st * h = handle; - return _gnutls_cipher_decrypt2 (&h->ctx_dec, ciphertext, + if (_gnutls_cipher_is_aead( &h->ctx_enc)!=0) + return _gnutls_cipher_decrypt2 (&h->ctx_enc, ciphertext, + ciphertextlen, text, textlen); + else + return _gnutls_cipher_decrypt2 (&h->ctx_dec, ciphertext, ciphertextlen, text, textlen); }