]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Fix AEAD out-of-place decryption
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 27 Jan 2013 19:00:32 +0000 (20:00 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 27 Jan 2013 19:00:32 +0000 (20:00 +0100)
lib/crypto-api.c

index 74916d2dd4daee95751e2368eb7ccc5444ba4cb5..564c98c5c1bcd99a39fd0debd17242222e0832be 100644 (file)
@@ -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);
 }