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