CVE-2021-23192: python/tests/dcerpc: add tests to check how security contexts relate...
[Samba.git] / wscript_configure_system_gnutls
blob2ec217fb9dc57806f1ef12988482473e9e171461
1 from waflib import Options
3 def parse_version(v):
4     return tuple(map(int, (v.split("."))))
6 gnutls_min_required_version = "3.4.7"
8 gnutls_required_version = gnutls_min_required_version
10 conf.CHECK_CFG(package='gnutls',
11                args=('"gnutls >= %s" --cflags --libs' % gnutls_required_version),
12                      msg='Checking for GnuTLS >= %s' % gnutls_required_version,
13                      mandatory=True)
15 gnutls_version = conf.cmd_and_log(conf.env.PKGCONFIG + ['--modversion', 'gnutls']).strip()
17 # Define gnutls as a system library
18 conf.SET_TARGET_TYPE('gnutls', 'SYSLIB')
20 # Check for gnutls_pkcs7_get_embedded_data_oid (>= 3.5.5) required by libmscat
21 conf.CHECK_FUNCS_IN('gnutls_pkcs7_get_embedded_data_oid', 'gnutls')
23 # Check for gnutls_set_default_priority_append (>= 3.6.3)
24 conf.CHECK_FUNCS_IN('gnutls_set_default_priority_append', 'gnutls')
26 # Check for gnutls_aead_cipher_encryptv2
28 # This is available since version 3.6.10, but 3.6.10 has a bug which got fixed
29 # in 3.6.11, see:
31 #     https://gitlab.com/gnutls/gnutls/-/merge_requests/1085
33 # 3.6.10 - 3.6.14 have a severe memory leak with AES-CCM
34 #     https://gitlab.com/gnutls/gnutls/-/merge_requests/1278
35 if (parse_version(gnutls_version) > parse_version('3.6.14')):
36     conf.CHECK_FUNCS_IN('gnutls_aead_cipher_encryptv2', 'gnutls')
38 # Check if we have support for crypto policies
39 if conf.CHECK_FUNCS_IN('gnutls_get_system_config_file', 'gnutls'):
40     conf.DEFINE('HAVE_GNUTLS_CRYPTO_POLICIES', 1)
42 if conf.CHECK_VALUEOF('GNUTLS_CIPHER_AES_128_CFB8', headers='gnutls/gnutls.h'):
43     conf.DEFINE('HAVE_GNUTLS_AES_CFB8', 1)
44 else:
45     Logs.warn('No gnutls support for AES CFB8')
47 if conf.CHECK_VALUEOF('GNUTLS_MAC_AES_CMAC_128', headers='gnutls/gnutls.h'):
48     conf.DEFINE('HAVE_GNUTLS_AES_CMAC', 1)
49 else:
50     Logs.warn('No gnutls support for AES CMAC')