diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:20:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:20:00 +0000 |
commit | 8daa83a594a2e98f39d764422bfbdbc62c9efd44 (patch) | |
tree | 4099e8021376c7d8c05bdf8503093d80e9c7bad0 /wscript_configure_system_gnutls | |
parent | Initial commit. (diff) | |
download | samba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.tar.xz samba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.zip |
Adding upstream version 2:4.20.0+dfsg.upstream/2%4.20.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wscript_configure_system_gnutls')
-rw-r--r-- | wscript_configure_system_gnutls | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/wscript_configure_system_gnutls b/wscript_configure_system_gnutls new file mode 100644 index 0000000..1983a0c --- /dev/null +++ b/wscript_configure_system_gnutls @@ -0,0 +1,62 @@ +import os + +def parse_version(v): + return tuple(map(int, (v.split(".")))) + +gnutls_min_required_version = "3.6.13" + +conf.CHECK_FUNCS('getrandom', headers='sys/random.h') +if not conf.CONFIG_SET('HAVE_GETRANDOM'): + gnutls_min_required_version = "3.7.2" + +gnutls_required_version = gnutls_min_required_version + +conf.CHECK_CFG(package='gnutls', + args=('"gnutls >= %s" --cflags --libs' % gnutls_required_version), + msg='Checking for GnuTLS >= %s' % gnutls_required_version, + mandatory=True) + +gnutls_version_str = conf.cmd_and_log(conf.env.PKGCONFIG + ['--modversion', 'gnutls']).strip() +gnutls_version = parse_version(gnutls_version_str) + +# Define gnutls as a system library +conf.SET_TARGET_TYPE('gnutls', 'SYSLIB') + +# Check for gnutls_aead_cipher_encryptv2 +# +# This is available since version 3.6.10, but 3.6.10 has a bug which got fixed +# in 3.6.11, see: +# +# https://gitlab.com/gnutls/gnutls/-/merge_requests/1085 +# +# 3.6.10 - 3.6.14 have a severe memory leak with AES-CCM +# https://gitlab.com/gnutls/gnutls/-/merge_requests/1278 +if (gnutls_version > parse_version('3.6.14')): + conf.DEFINE('ALLOW_GNUTLS_AEAD_CIPHER_ENCRYPTV2_AES_CCM', 1) + +# Check if gnutls has fips mode support +# gnutls_fips140_mode_enabled() is available since 3.3.0 +fragment = ''' +#include <gnutls/gnutls.h> +#include <stdlib.h> + +int main(void) +{ + unsigned int ok; + + ok = gnutls_fips140_mode_enabled(); + + return !ok; +} +''' + +os.environ['GNUTLS_FORCE_FIPS_MODE'] = '1' +conf.CHECK_CODE(fragment, + 'HAVE_GNUTLS_FIPS_MODE_SUPPORTED', + execute=True, + addmain=False, + add_headers=False, + lib='gnutls', + msg='Checking for gnutls fips mode support') +del os.environ['GNUTLS_FORCE_FIPS_MODE'] + |