b6b438
From 5c7eee2facbfc51078ecbdfcfe895a1215e56029 Mon Sep 17 00:00:00 2001
b6b438
From: Andreas Schneider <asn@samba.org>
b6b438
Date: Fri, 15 Mar 2019 14:54:13 +0100
b6b438
Subject: [PATCH 123/187] lib:crypto: Do not build AES-CMAC if we use GnuTLS
b6b438
 that supports it
b6b438
b6b438
This requires GnuTLS >= 3.6.5.
b6b438
b6b438
Signed-off-by: Andreas Schneider <asn@samba.org>
b6b438
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
b6b438
b6b438
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
b6b438
Autobuild-Date(master): Wed Aug 21 11:14:11 UTC 2019 on sn-devel-184
b6b438
b6b438
(cherry picked from commit c3f969817553dc9c9db88741bad51100b4d24604)
b6b438
---
b6b438
 lib/crypto/wscript_build      | 6 ++++--
b6b438
 source4/torture/local/local.c | 4 ++++
b6b438
 2 files changed, 8 insertions(+), 2 deletions(-)
b6b438
b6b438
diff --git a/lib/crypto/wscript_build b/lib/crypto/wscript_build
b6b438
index dcac8fcd30c..4f1665a7fd9 100644
b6b438
--- a/lib/crypto/wscript_build
b6b438
+++ b/lib/crypto/wscript_build
b6b438
@@ -26,7 +26,8 @@ bld.SAMBA_SUBSYSTEM('LIBCRYPTO_AES',
b6b438
 
b6b438
 bld.SAMBA_SUBSYSTEM('LIBCRYPTO_AES_CMAC',
b6b438
                     source='aes_cmac_128.c',
b6b438
-                    deps='talloc')
b6b438
+                    deps='talloc',
b6b438
+                    enabled=not bld.CONFIG_SET('HAVE_GNUTLS_AES_CMAC'))
b6b438
 
b6b438
 bld.SAMBA_SUBSYSTEM('LIBCRYPTO',
b6b438
         source='''
b6b438
@@ -53,7 +54,8 @@ bld.SAMBA_SUBSYSTEM('TORTURE_LIBCRYPTO_AES_GCM',
b6b438
 bld.SAMBA_SUBSYSTEM('TORTURE_LIBCRYPTO_AES_CMAC',
b6b438
                     source='aes_cmac_128_test.c',
b6b438
                     autoproto='aes_cmac_test_proto.h',
b6b438
-                    deps='talloc')
b6b438
+                    deps='talloc',
b6b438
+                    enabled=not bld.CONFIG_SET('HAVE_GNUTLS_AES_CMAC'))
b6b438
 
b6b438
 bld.SAMBA_SUBSYSTEM('TORTURE_LIBCRYPTO',
b6b438
         source='md4test.c',
b6b438
diff --git a/source4/torture/local/local.c b/source4/torture/local/local.c
b6b438
index fa4061c108b..5812f4dd20c 100644
b6b438
--- a/source4/torture/local/local.c
b6b438
+++ b/source4/torture/local/local.c
b6b438
@@ -25,7 +25,9 @@
b6b438
 #include "../lib/crypto/test_proto.h"
b6b438
 #include "../lib/crypto/aes_ccm_test_proto.h"
b6b438
 #include "../lib/crypto/aes_gcm_test_proto.h"
b6b438
+#ifndef HAVE_GNUTLS_AES_CMAC
b6b438
 #include "../lib/crypto/aes_cmac_test_proto.h"
b6b438
+#endif
b6b438
 #include "lib/registry/tests/proto.h"
b6b438
 #include "lib/replace/replace-testsuite.h"
b6b438
 
b6b438
@@ -94,8 +96,10 @@ NTSTATUS torture_local_init(TALLOC_CTX *ctx)
b6b438
 	
b6b438
 	torture_suite_add_simple_test(suite, 
b6b438
 				      "crypto.md4", torture_local_crypto_md4);
b6b438
+#ifndef HAVE_GNUTLS_AES_CMAC
b6b438
 	torture_suite_add_simple_test(suite, "crypto.aes_cmac_128",
b6b438
 				      torture_local_crypto_aes_cmac_128);
b6b438
+#endif
b6b438
 	torture_suite_add_simple_test(suite, "crypto.aes_ccm_128",
b6b438
 				      torture_local_crypto_aes_ccm_128);
b6b438
 	torture_suite_add_simple_test(suite, "crypto.aes_gcm_128",
b6b438
-- 
b6b438
2.23.0
b6b438