s3:utils: let net_update_dns_internal() set status before goto done in all cases
[Samba.git] / wscript_configure_system_gnutls
blobf62de5560d6393b4864d768432078287a963e314
1 import os
3 def parse_version(v):
4     return tuple(map(int, (v.split("."))))
6 gnutls_min_required_version = "3.6.13"
8 conf.CHECK_FUNCS('getrandom', headers='sys/random.h')
9 if not conf.CONFIG_SET('HAVE_GETRANDOM'):
10    gnutls_min_required_version = "3.7.2"
12 gnutls_required_version = gnutls_min_required_version
14 conf.CHECK_CFG(package='gnutls',
15                args=('"gnutls >= %s" --cflags --libs' % gnutls_required_version),
16                      msg='Checking for GnuTLS >= %s' % gnutls_required_version,
17                      mandatory=True)
19 gnutls_version_str = conf.cmd_and_log(conf.env.PKGCONFIG + ['--modversion', 'gnutls']).strip()
20 gnutls_version = parse_version(gnutls_version_str)
22 # Define gnutls as a system library
23 conf.SET_TARGET_TYPE('gnutls', 'SYSLIB')
25 # Check for gnutls_aead_cipher_encryptv2
27 # This is available since version 3.6.10, but 3.6.10 has a bug which got fixed
28 # in 3.6.11, see:
30 #     https://gitlab.com/gnutls/gnutls/-/merge_requests/1085
32 # 3.6.10 - 3.6.14 have a severe memory leak with AES-CCM
33 #     https://gitlab.com/gnutls/gnutls/-/merge_requests/1278
34 if (gnutls_version > parse_version('3.6.14')):
35       conf.DEFINE('ALLOW_GNUTLS_AEAD_CIPHER_ENCRYPTV2_AES_CCM', 1)
37 # GNUTLS_CB_TLS_SERVER_END_POINT is available with
38 # 3.7.2
39 if (gnutls_version >= parse_version('3.7.2')):
40       conf.DEFINE('HAVE_GNUTLS_CB_TLS_SERVER_END_POINT', 1)
42 # Check if gnutls has fips mode support
43 # gnutls_fips140_mode_enabled() is available since 3.3.0
44 fragment = '''
45 #include <gnutls/gnutls.h>
46 #include <stdlib.h>
48 int main(void)
50     unsigned int ok;
52     ok = gnutls_fips140_mode_enabled();
54     return !ok;
56 '''
58 os.environ['GNUTLS_FORCE_FIPS_MODE'] = '1'
59 conf.CHECK_CODE(fragment,
60                 'HAVE_GNUTLS_FIPS_MODE_SUPPORTED',
61                 execute=True,
62                 addmain=False,
63                 add_headers=False,
64                 lib='gnutls',
65                 msg='Checking for gnutls fips mode support')
66 del os.environ['GNUTLS_FORCE_FIPS_MODE']