From nobody Tue Feb 10 07:22:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623151502; cv=none; d=zohomail.com; s=zohoarc; b=nS4/W9OhBOSXq4144O3BEMc9nAKcWc+ymjL5P/PqFrHkB6yiDgioQCwEy1aPd4HSCV38DSVfH6bj9toH+Ete1EpmVm1ZSTrauDdPl8zBdA1lfCZ0Ca3R32y2uKTPDLz0FhBo8lrArL+6P8xO/URXrBq4EWm7cueSTYE3dENv1i0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623151502; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sCOhPBhifj1LhShqnVZ8abbpPO12ArNNNi5QZfCe5ks=; b=dqOzhFPVZ2DEL3/xviW2pcj8v4dS8spASdSYvb9viIiOcIsD0OXnGWeQ7yxQ9NyyeOn6hIHfIZIQSt0de06e9y4sQYqrCOULMcNhUWOHezlEQGDmNWE7G+Nz1nGsvdjnv9m3UgaFgDb4DEyIrzu1AKZPN6IrUowe/KAPz6uuZeU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623151502018554.4631855702704; Tue, 8 Jun 2021 04:25:02 -0700 (PDT) Received: from localhost ([::1]:34792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqZqu-0000vP-HF for importer@patchew.org; Tue, 08 Jun 2021 07:25:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqZp7-0006Po-Vb for qemu-devel@nongnu.org; Tue, 08 Jun 2021 07:23:09 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:41670) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lqZp5-0007wI-O3 for qemu-devel@nongnu.org; Tue, 08 Jun 2021 07:23:09 -0400 Received: by mail-wr1-x42c.google.com with SMTP id o3so2770901wri.8 for ; Tue, 08 Jun 2021 04:23:06 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id i9sm15388621wrn.54.2021.06.08.04.23.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 04:23:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sCOhPBhifj1LhShqnVZ8abbpPO12ArNNNi5QZfCe5ks=; b=X7SUEQVhw4i46CLZu8WhFny4w1sKnHAtzPOPk7q3YsvdFXFdIOpPA8y3y5omXsR0Ch zyUt/J0SJHfMa9jl+WSw7V1mkm3n6ezzmEi3Cp9bbGiQRRHYcKYWFDoUQsiDeLdm9Pur Ks5JgEFlR5hoANv7qMdzq8Tzv8ws094CevlKy6iOE+UEIWZ1BaAoO6FJMQwbqi+Qc2EI JXnv+GpCvtnCX9F9jYuk+r9d8xaGbiZyZyHndm6HjrvlDkSR51w7/jj852/PN3RXy/cV 6eDCAJNrH4pLb8oHKF5M9nBEKZBFEhXzHZJxDFrzhNK2emazsTSrP6K/YDnhj7RdKiwU rGBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=sCOhPBhifj1LhShqnVZ8abbpPO12ArNNNi5QZfCe5ks=; b=Kg+fOJqDWaz+tnmNUyxjj3CcpQPK8VAior5+KdYzNoW0z9AbmBkFG7MNPMlE5y9XR+ 5GcmGk6I9qsDtJD7bXEJc0gSM0OLGDr0OO/hnV9K7XBty30TO/WR0dWUxK30bbGOX9nA e10WMKIqcGVdDrS1yTp2SpKksEevwZeuzKo16cbosSvvSDo1+oXROgwYVcyAfmurEwun DueL0PFQly1lBqDgR/y9zONI6VLVZCilSv2wn1IcQ6E7paZ40+JEAFueGGe0M/uOivYU guJoi1vh5uepkwpvm1OQ2JjA4j3cYPeop3vQT6TqZZVAtTRuUY4rWHKM6cUlf/Kb9Z18 ujoQ== X-Gm-Message-State: AOAM532LLOAobmsIIlDXRJvLqqzT9ZtvrVBywB5W4viHHaLwL59uNg4c 7ib1cZqbGgKXbTgdxh60Ga0sG1iFM+GNXg== X-Google-Smtp-Source: ABdhPJxpFQ/ag1vAQQDS9DLE08Hbi0P+vFkql7Sc+nIvHC7Q62kQjcr5gYXbjvtWWk1FJVDP5VrWDA== X-Received: by 2002:adf:b648:: with SMTP id i8mr15699191wre.425.1623151385498; Tue, 08 Jun 2021 04:23:05 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 03/26] configure, meson: convert crypto detection to meson Date: Tue, 8 Jun 2021 13:22:38 +0200 Message-Id: <20210608112301.402434-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210608112301.402434-1-pbonzini@redhat.com> References: <20210608112301.402434-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42c.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Richard Henderson --- configure | 188 +++-------------------------------------- crypto/meson.build | 41 +++------ meson.build | 81 +++++++++++++----- meson_options.txt | 6 ++ tests/unit/meson.build | 6 +- 5 files changed, 90 insertions(+), 232 deletions(-) diff --git a/configure b/configure index 44c413e9b8..74c8ea8cf1 100755 --- a/configure +++ b/configure @@ -404,10 +404,9 @@ seccomp=3D"auto" glusterfs=3D"auto" gtk=3D"auto" tls_priority=3D"NORMAL" -gnutls=3D"$default_feature" -nettle=3D"$default_feature" -gcrypt=3D"$default_feature" -qemu_private_xts=3D"yes" +gnutls=3D"auto" +nettle=3D"auto" +gcrypt=3D"auto" auth_pam=3D"$default_feature" vte=3D"$default_feature" virglrenderer=3D"$default_feature" @@ -1372,17 +1371,17 @@ for opt do ;; --tls-priority=3D*) tls_priority=3D"$optarg" ;; - --disable-gnutls) gnutls=3D"no" + --disable-gnutls) gnutls=3D"disabled" ;; - --enable-gnutls) gnutls=3D"yes" + --enable-gnutls) gnutls=3D"enabled" ;; - --disable-nettle) nettle=3D"no" + --disable-nettle) nettle=3D"disabled" ;; - --enable-nettle) nettle=3D"yes" + --enable-nettle) nettle=3D"enabled" ;; - --disable-gcrypt) gcrypt=3D"no" + --disable-gcrypt) gcrypt=3D"disabled" ;; - --enable-gcrypt) gcrypt=3D"yes" + --enable-gcrypt) gcrypt=3D"enabled" ;; --disable-auth-pam) auth_pam=3D"no" ;; @@ -2800,156 +2799,6 @@ EOF fi fi =20 -########################################## -# GNUTLS probe - -if test "$gnutls" !=3D "no"; then - pass=3D"no" - if $pkg_config --exists "gnutls >=3D 3.5.18"; then - gnutls_cflags=3D$($pkg_config --cflags gnutls) - gnutls_libs=3D$($pkg_config --libs gnutls) - # Packaging for the static libraries is not always correct. - # At least ubuntu 18.04 ships only shared libraries. - write_c_skeleton - if compile_prog "" "$gnutls_libs" ; then - pass=3D"yes" - fi - fi - if test "$pass" =3D "no" && test "$gnutls" =3D "yes"; then - feature_not_found "gnutls" "Install gnutls devel >=3D 3.1.18" - else - gnutls=3D"$pass" - fi -fi - - -# If user didn't give a --disable/enable-gcrypt flag, -# then mark as disabled if user requested nettle -# explicitly -if test -z "$gcrypt" -then - if test "$nettle" =3D "yes" - then - gcrypt=3D"no" - fi -fi - -# If user didn't give a --disable/enable-nettle flag, -# then mark as disabled if user requested gcrypt -# explicitly -if test -z "$nettle" -then - if test "$gcrypt" =3D "yes" - then - nettle=3D"no" - fi -fi - -has_libgcrypt() { - if ! has "libgcrypt-config" - then - return 1 - fi - - if test -n "$cross_prefix" - then - host=3D$(libgcrypt-config --host) - if test "$host-" !=3D $cross_prefix - then - return 1 - fi - fi - - maj=3D`libgcrypt-config --version | awk -F . '{print $1}'` - min=3D`libgcrypt-config --version | awk -F . '{print $2}'` - - if test $maj !=3D 1 || test $min -lt 8 - then - return 1 - fi - - return 0 -} - - -if test "$nettle" !=3D "no"; then - pass=3D"no" - if $pkg_config --exists "nettle >=3D 3.4"; then - nettle_cflags=3D$($pkg_config --cflags nettle) - nettle_libs=3D$($pkg_config --libs nettle) - # Link test to make sure the given libraries work (e.g for static). - write_c_skeleton - if compile_prog "" "$nettle_libs" ; then - if test -z "$gcrypt"; then - gcrypt=3D"no" - fi - pass=3D"yes" - fi - fi - if test "$pass" =3D "yes" - then - cat > $TMPC << EOF -#include -int main(void) { - return 0; -} -EOF - if compile_prog "$nettle_cflags" "$nettle_libs" ; then - qemu_private_xts=3Dno - fi - fi - if test "$pass" =3D "no" && test "$nettle" =3D "yes"; then - feature_not_found "nettle" "Install nettle devel >=3D 2.7.1" - else - nettle=3D"$pass" - fi -fi - -if test "$gcrypt" !=3D "no"; then - pass=3D"no" - if has_libgcrypt; then - gcrypt_cflags=3D$(libgcrypt-config --cflags) - gcrypt_libs=3D$(libgcrypt-config --libs) - # Debian has removed -lgpg-error from libgcrypt-config - # as it "spreads unnecessary dependencies" which in - # turn breaks static builds... - if test "$static" =3D "yes" - then - gcrypt_libs=3D"$gcrypt_libs -lgpg-error" - fi - - # Link test to make sure the given libraries work (e.g for static). - write_c_skeleton - if compile_prog "" "$gcrypt_libs" ; then - pass=3D"yes" - fi - fi - if test "$pass" =3D "yes"; then - gcrypt=3D"yes" - cat > $TMPC << EOF -#include -int main(void) { - gcry_cipher_hd_t handle; - gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_XTS, 0); - return 0; -} -EOF - if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then - qemu_private_xts=3Dno - fi - elif test "$gcrypt" =3D "yes"; then - feature_not_found "gcrypt" "Install gcrypt devel >=3D 1.5.0" - else - gcrypt=3D"no" - fi -fi - - -if test "$gcrypt" =3D "yes" && test "$nettle" =3D "yes" -then - error_exit "Only one of gcrypt & nettle can be enabled" -fi - ########################################## # libtasn1 - only for the TLS creds/session test suite =20 @@ -5703,24 +5552,6 @@ if test "$gdbus_codegen" !=3D "" ; then echo "GDBUS_CODEGEN=3D$gdbus_codegen" >> $config_host_mak fi echo "CONFIG_TLS_PRIORITY=3D\"$tls_priority\"" >> $config_host_mak -if test "$gnutls" =3D "yes" ; then - echo "CONFIG_GNUTLS=3Dy" >> $config_host_mak - echo "GNUTLS_CFLAGS=3D$gnutls_cflags" >> $config_host_mak - echo "GNUTLS_LIBS=3D$gnutls_libs" >> $config_host_mak -fi -if test "$gcrypt" =3D "yes" ; then - echo "CONFIG_GCRYPT=3Dy" >> $config_host_mak - echo "GCRYPT_CFLAGS=3D$gcrypt_cflags" >> $config_host_mak - echo "GCRYPT_LIBS=3D$gcrypt_libs" >> $config_host_mak -fi -if test "$nettle" =3D "yes" ; then - echo "CONFIG_NETTLE=3Dy" >> $config_host_mak - echo "NETTLE_CFLAGS=3D$nettle_cflags" >> $config_host_mak - echo "NETTLE_LIBS=3D$nettle_libs" >> $config_host_mak -fi -if test "$qemu_private_xts" =3D "yes" ; then - echo "CONFIG_QEMU_PRIVATE_XTS=3Dy" >> $config_host_mak -fi if test "$tasn1" =3D "yes" ; then echo "CONFIG_TASN1=3Dy" >> $config_host_mak fi @@ -6438,6 +6269,7 @@ if test "$skip_meson" =3D no; then -Dcurl=3D$curl -Dglusterfs=3D$glusterfs -Dbzip2=3D$bzip2 -Dlibiscs= i=3D$libiscsi \ -Dlibnfs=3D$libnfs -Diconv=3D$iconv -Dcurses=3D$curses -Dlibudev= =3D$libudev\ -Drbd=3D$rbd -Dlzo=3D$lzo -Dsnappy=3D$snappy -Dlzfse=3D$lzfse \ + -Dgnutls=3D$gnutls -Dnettle=3D$nettle -Dgcrypt=3D$gcrypt \ -Dzstd=3D$zstd -Dseccomp=3D$seccomp -Dvirtfs=3D$virtfs -Dcap_ng=3D= $cap_ng \ -Dattr=3D$attr -Ddefault_devices=3D$default_devices \ -Ddocs=3D$docs -Dsphinx_build=3D$sphinx_build -Dinstall_blobs=3D$b= lobs \ diff --git a/crypto/meson.build b/crypto/meson.build index af7e80c6f6..7cbf1a6ba7 100644 --- a/crypto/meson.build +++ b/crypto/meson.build @@ -22,48 +22,31 @@ crypto_ss.add(files( 'tlssession.c', )) =20 -if 'CONFIG_NETTLE' in config_host - crypto_ss.add(files('hash-nettle.c', 'hmac-nettle.c', 'pbkdf-nettle.c')) -elif 'CONFIG_GCRYPT' in config_host - crypto_ss.add(files('hash-gcrypt.c', 'pbkdf-gcrypt.c')) - crypto_ss.add(files('hmac-gcrypt.c')) +if nettle.found() + crypto_ss.add(nettle, files('hash-nettle.c', 'hmac-nettle.c', 'pbkdf-net= tle.c')) +elif gcrypt.found() + crypto_ss.add(gcrypt, files('hash-gcrypt.c', 'hmac-gcrypt.c', 'pbkdf-gcr= ypt.c')) else crypto_ss.add(files('hash-glib.c', 'hmac-glib.c', 'pbkdf-stub.c')) endif +if xts =3D=3D 'private' + crypto_ss.add(files('xts.c')) +endif =20 crypto_ss.add(when: 'CONFIG_SECRET_KEYRING', if_true: files('secret_keyrin= g.c')) -crypto_ss.add(when: 'CONFIG_QEMU_PRIVATE_XTS', if_true: files('xts.c')) crypto_ss.add(when: 'CONFIG_AF_ALG', if_true: files('afalg.c', 'cipher-afa= lg.c', 'hash-afalg.c')) -crypto_ss.add(when: 'CONFIG_GNUTLS', if_true: files('tls-cipher-suites.c')) - -if 'CONFIG_NETTLE' in config_host - crypto_ss.add(nettle) -elif 'CONFIG_GCRYPT' in config_host - crypto_ss.add(gcrypt) -endif - -if 'CONFIG_GNUTLS' in config_host - crypto_ss.add(gnutls) -endif - +crypto_ss.add(when: gnutls, if_true: files('tls-cipher-suites.c')) =20 util_ss.add(files('aes.c')) util_ss.add(files('init.c')) =20 -if 'CONFIG_GCRYPT' in config_host - util_ss.add(files('random-gcrypt.c')) -elif 'CONFIG_GNUTLS' in config_host - util_ss.add(files('random-gnutls.c')) +if gcrypt.found() + util_ss.add(gcrypt, files('random-gcrypt.c')) +elif gnutls.found() + util_ss.add(gnutls, files('random-gnutls.c')) elif 'CONFIG_RNG_NONE' in config_host util_ss.add(files('random-none.c')) else util_ss.add(files('random-platform.c')) endif =20 -if 'CONFIG_GCRYPT' in config_host - util_ss.add(gcrypt) -endif - -if 'CONFIG_GNUTLS' in config_host - util_ss.add(gnutls) -endif diff --git a/meson.build b/meson.build index 43e9c4590e..b374fa92cd 100644 --- a/meson.build +++ b/meson.build @@ -320,21 +320,6 @@ urcubp =3D not_found if 'CONFIG_TRACE_UST' in config_host urcubp =3D declare_dependency(link_args: config_host['URCU_BP_LIBS'].spl= it()) endif -gcrypt =3D not_found -if 'CONFIG_GCRYPT' in config_host - gcrypt =3D declare_dependency(compile_args: config_host['GCRYPT_CFLAGS']= .split(), - link_args: config_host['GCRYPT_LIBS'].split(= )) -endif -nettle =3D not_found -if 'CONFIG_NETTLE' in config_host - nettle =3D declare_dependency(compile_args: config_host['NETTLE_CFLAGS']= .split(), - link_args: config_host['NETTLE_LIBS'].split(= )) -endif -gnutls =3D not_found -if 'CONFIG_GNUTLS' in config_host - gnutls =3D declare_dependency(compile_args: config_host['GNUTLS_CFLAGS']= .split(), - link_args: config_host['GNUTLS_LIBS'].split(= )) -endif pixman =3D not_found if have_system or have_tools pixman =3D dependency('pixman-1', required: have_system, version:'>=3D0.= 21.8', @@ -829,6 +814,54 @@ if 'CONFIG_OPENGL' in config_host link_args: config_host['OPENGL_LIBS'].split(= )) endif =20 +gnutls =3D not_found +if not get_option('gnutls').auto() or have_system + gnutls =3D dependency('gnutls', version: '>=3D3.5.18', + method: 'pkg-config', + required: get_option('gnutls'), + kwargs: static_kwargs) +endif + +# Nettle has priority over gcrypt +gcrypt =3D not_found +nettle =3D not_found +xts =3D 'private' +if get_option('nettle').enabled() and get_option('gcrypt').enabled() + error('Only one of gcrypt & nettle can be enabled') +elif (not get_option('nettle').auto() or have_system) and not get_option('= gcrypt').enabled() + nettle =3D dependency('nettle', version: '>=3D3.4', + method: 'pkg-config', + required: get_option('nettle'), + kwargs: static_kwargs) + if cc.has_header('nettle/xts.h', dependencies: nettle) + xts =3D 'nettle' + endif +endif +if (not get_option('gcrypt').auto() or have_system) and not nettle.found() + gcrypt =3D dependency('libgcrypt', version: '>=3D1.5', + method: 'config-tool', + required: get_option('gcrypt'), + kwargs: static_kwargs) + if cc.compiles(''' + #include + int main(void) { + gcry_cipher_hd_t handle; + gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_XTS, 0); + return 0; + } + ''', dependencies: gcrypt) + xts =3D 'gcrypt' + endif + # Debian has removed -lgpg-error from libgcrypt-config + # as it "spreads unnecessary dependencies" which in + # turn breaks static builds... + if gcrypt.found() and enable_static + gcrypt =3D declare_dependency(dependencies: [ + gcrypt, + cc.find_library('gpg-error', required: true, kwargs: static_kwargs)]) + endif +endif + gtk =3D not_found gtkx11 =3D not_found if not get_option('gtk').auto() or (have_system and not cocoa.found()) @@ -1168,6 +1201,10 @@ config_host_data.set('CONFIG_VIRTFS', have_virtfs) config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found()) config_host_data.set('CONFIG_KEYUTILS', keyutils.found()) config_host_data.set('CONFIG_GETTID', has_gettid) +config_host_data.set('CONFIG_GNUTLS', gnutls.found()) +config_host_data.set('CONFIG_GCRYPT', gcrypt.found()) +config_host_data.set('CONFIG_NETTLE', nettle.found()) +config_host_data.set('CONFIG_QEMU_PRIVATE_XTS', xts =3D=3D 'private') config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim) config_host_data.set('CONFIG_STATX', has_statx) config_host_data.set('CONFIG_ZSTD', zstd.found()) @@ -2673,16 +2710,16 @@ summary(summary_info, bool_yn: true, section: 'Bloc= k layer support') # Crypto summary_info =3D {} summary_info +=3D {'TLS priority': config_host['CONFIG_TLS_PRIORITY']} -summary_info +=3D {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS= ')} +summary_info +=3D {'GNUTLS support': gnutls.found()} # TODO: add back version -summary_info +=3D {'libgcrypt': config_host.has_key('CONFIG_GCRYPT= ')} -if config_host.has_key('CONFIG_GCRYPT') - summary_info +=3D {' XTS': not config_host.has_key('CONFIG= _QEMU_PRIVATE_XTS')} +summary_info +=3D {'libgcrypt': gcrypt.found()} +if gcrypt.found() + summary_info +=3D {' XTS': xts !=3D 'private'} endif # TODO: add back version -summary_info +=3D {'nettle': config_host.has_key('CONFIG_NETTLE= ')} -if config_host.has_key('CONFIG_NETTLE') - summary_info +=3D {' XTS': not config_host.has_key('CONFIG= _QEMU_PRIVATE_XTS')} +summary_info +=3D {'nettle': nettle.found()} +if nettle.found() + summary_info +=3D {' XTS': xts !=3D 'private'} endif summary_info +=3D {'crypto afalg': config_host.has_key('CONFIG_AF_ALG= ')} summary_info +=3D {'rng-none': config_host.has_key('CONFIG_RNG_NO= NE')} diff --git a/meson_options.txt b/meson_options.txt index 3d304cac96..343ffffb7c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -76,6 +76,12 @@ option('iconv', type : 'feature', value : 'auto', description: 'Font glyph conversion support') option('curses', type : 'feature', value : 'auto', description: 'curses UI') +option('gnutls', type : 'feature', value : 'auto', + description: 'GNUTLS cryptography support') +option('nettle', type : 'feature', value : 'auto', + description: 'nettle cryptography support') +option('gcrypt', type : 'feature', value : 'auto', + description: 'libgcrypt cryptography support') option('libudev', type : 'feature', value : 'auto', description: 'Use libudev to enumerate host devices') option('lzfse', type : 'feature', value : 'auto', diff --git a/tests/unit/meson.build b/tests/unit/meson.build index b3bc2109da..fcf6ed2ef5 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -83,7 +83,7 @@ if have_block 'test-crypto-afsplit': [io], 'test-crypto-block': [io], } - if 'CONFIG_GNUTLS' in config_host and \ + if gnutls.found() and \ 'CONFIG_TASN1' in config_host and \ 'CONFIG_POSIX' in config_host tests +=3D { @@ -97,7 +97,7 @@ if have_block if 'CONFIG_AUTH_PAM' in config_host tests +=3D {'test-authz-pam': [authz]} endif - if 'CONFIG_QEMU_PRIVATE_XTS' in config_host + if xts =3D=3D 'private' tests +=3D {'test-crypto-xts': [crypto, io]} endif if 'CONFIG_POSIX' in config_host @@ -106,7 +106,7 @@ if have_block if 'CONFIG_REPLICATION' in config_host tests +=3D {'test-replication': [testblock]} endif - if 'CONFIG_NETTLE' in config_host or 'CONFIG_GCRYPT' in config_host + if nettle.found() or gcrypt.found() tests +=3D {'test-crypto-pbkdf': [io]} endif if 'CONFIG_EPOLL_CREATE1' in config_host --=20 2.31.1