1524bc
From d2c3c0ccc6ec7f38b995545d31431d013bd7e047 Mon Sep 17 00:00:00 2001
1524bc
From: Andreas Schneider <asn@samba.org>
1524bc
Date: Mon, 4 Nov 2019 08:40:34 +0100
1524bc
Subject: [PATCH 138/187] libcli:smb: Do not use gnutls_aead_cipher_encryptv2()
1524bc
 with GnuTLS 3.6.10
1524bc
1524bc
The gnutls_aead_cipher_encryptv2() implementation was released with a
1524bc
bug. This wont be fixed before 3.6.11.
1524bc
1524bc
See https://gitlab.com/gnutls/gnutls/merge_requests/1085
1524bc
1524bc
Signed-off-by: Andreas Schneider <asn@samba.org>
1524bc
Reviewed-by: Alexander Bokovoy <ab@samba.org>
1524bc
(cherry picked from commit 176d0f0364bc1deb3c8df2f3bb928e01f89f216b)
1524bc
---
1524bc
 libcli/smb/smb2_signing.c | 8 ++++++--
1524bc
 1 file changed, 6 insertions(+), 2 deletions(-)
1524bc
1524bc
diff --git a/libcli/smb/smb2_signing.c b/libcli/smb/smb2_signing.c
1524bc
index 166ab9d83ff..7561a7a858d 100644
1524bc
--- a/libcli/smb/smb2_signing.c
1524bc
+++ b/libcli/smb/smb2_signing.c
1524bc
@@ -478,7 +478,9 @@ NTSTATUS smb2_signing_encrypt_pdu(struct smb2_signing_key *encryption_key,
1524bc
 	       0,
1524bc
 	       16 - iv_size);
1524bc
 
1524bc
-#ifdef HAVE_GNUTLS_AEAD_CIPHER_ENCRYPTV2
1524bc
+/* gnutls_aead_cipher_encryptv2() has a bug in version 3.6.10 */
1524bc
+#if defined(HAVE_GNUTLS_AEAD_CIPHER_ENCRYPTV2) && \
1524bc
+    GNUTLS_VERSION_NUMBER > 0x03060a
1524bc
 	{
1524bc
 		uint8_t tag[tag_size];
1524bc
 		giovec_t auth_iov[1];
1524bc
@@ -679,7 +681,9 @@ NTSTATUS smb2_signing_decrypt_pdu(struct smb2_signing_key *decryption_key,
1524bc
 		}
1524bc
 	}
1524bc
 
1524bc
-#ifdef HAVE_GNUTLS_AEAD_CIPHER_ENCRYPTV2
1524bc
+/* gnutls_aead_cipher_encryptv2() has a bug in version 3.6.10 */
1524bc
+#if defined(HAVE_GNUTLS_AEAD_CIPHER_ENCRYPTV2) && \
1524bc
+    GNUTLS_VERSION_NUMBER > 0x03060a
1524bc
 	{
1524bc
 		giovec_t auth_iov[1];
1524bc
 
1524bc
-- 
1524bc
2.23.0
1524bc