samba/SOURCES/0103-lib-crypto-Prepare-not...

112 lines
3.6 KiB
Diff

From e2d47f1a730131017b7d4d71713a174da6cb270c Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@samba.org>
Date: Fri, 15 Mar 2019 14:54:13 +0100
Subject: [PATCH 103/187] lib:crypto: Prepare not to build AES or AES-CMAC if
we use GnuTLS support it
Samba will soon require GnuTLS >= 3.4.7.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Adjusted by Andrew Bartlett from an earlier more comprehensive patch by Andreas
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 1f6104f09a30cf3816fd5a580ce1b4be5b94848c)
---
lib/crypto/wscript_build | 52 ++++++++++++++++++++++++++++-------
source4/torture/local/local.c | 3 ++
2 files changed, 45 insertions(+), 10 deletions(-)
diff --git a/lib/crypto/wscript_build b/lib/crypto/wscript_build
index a26c10b627b..9a7c715754d 100644
--- a/lib/crypto/wscript_build
+++ b/lib/crypto/wscript_build
@@ -20,27 +20,59 @@ bld.SAMBA_SUBSYSTEM('LIBCRYPTO_RC4',
deps='talloc',
enabled=not bld.CONFIG_SET('HAVE_GNUTLS_3_4_7'))
+bld.SAMBA_SUBSYSTEM('LIBCRYPTO_AES_CCM',
+ source='aes_ccm_128.c',
+ deps='talloc')
+
+bld.SAMBA_SUBSYSTEM('LIBCRYPTO_AES_GCM',
+ source='aes_gcm_128.c',
+ deps='talloc')
+
+bld.SAMBA_SUBSYSTEM('LIBCRYPTO_AES',
+ source='aes.c rijndael-alg-fst.c',
+ deps='talloc')
+
+bld.SAMBA_SUBSYSTEM('LIBCRYPTO_AES_CMAC',
+ source='aes_cmac_128.c',
+ deps='talloc')
+
bld.SAMBA_SUBSYSTEM('LIBCRYPTO',
source='''
md4.c
- aes.c
- rijndael-alg-fst.c
- aes_cmac_128.c
- aes_ccm_128.c
- aes_gcm_128.c
''',
deps='''
talloc
LIBCRYPTO_RC4
+ LIBCRYPTO_AES
+ LIBCRYPTO_AES_CCM
+ LIBCRYPTO_AES_GCM
+ LIBCRYPTO_AES_CMAC
''' + extra_deps)
+bld.SAMBA_SUBSYSTEM('TORTURE_LIBCRYPTO_AES_CCM',
+ source='aes_ccm_128_test.c',
+ autoproto='aes_ccm_test_proto.h',
+ deps='talloc')
+
+bld.SAMBA_SUBSYSTEM('TORTURE_LIBCRYPTO_AES_GCM',
+ source='aes_gcm_128_test.c',
+ autoproto='aes_gcm_test_proto.h',
+ deps='talloc')
+
+bld.SAMBA_SUBSYSTEM('TORTURE_LIBCRYPTO_AES_CMAC',
+ source='aes_cmac_128_test.c',
+ autoproto='aes_cmac_test_proto.h',
+ deps='talloc')
+
bld.SAMBA_SUBSYSTEM('TORTURE_LIBCRYPTO',
- source='''md4test.c
- aes_cmac_128_test.c aes_ccm_128_test.c aes_gcm_128_test.c
- ''',
+ source='md4test.c',
autoproto='test_proto.h',
- deps='LIBCRYPTO'
- )
+ deps='''
+ LIBCRYPTO
+ TORTURE_LIBCRYPTO_AES_CCM
+ TORTURE_LIBCRYPTO_AES_GCM
+ TORTURE_LIBCRYPTO_AES_CMAC
+ ''')
bld.SAMBA_PYTHON('python_crypto',
source='py_crypto.c',
diff --git a/source4/torture/local/local.c b/source4/torture/local/local.c
index acd88772ab7..fa4061c108b 100644
--- a/source4/torture/local/local.c
+++ b/source4/torture/local/local.c
@@ -23,6 +23,9 @@
#include "torture/ndr/proto.h"
#include "torture/auth/proto.h"
#include "../lib/crypto/test_proto.h"
+#include "../lib/crypto/aes_ccm_test_proto.h"
+#include "../lib/crypto/aes_gcm_test_proto.h"
+#include "../lib/crypto/aes_cmac_test_proto.h"
#include "lib/registry/tests/proto.h"
#include "lib/replace/replace-testsuite.h"
--
2.23.0