All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Fam Zheng" <fam@euphon.net>, "Thomas Huth" <thuth@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [PATCH v2 1/2] crypto: fix build with gcrypt enabled
Date: Tue, 01 Sep 2020 15:18:48 +0100	[thread overview]
Message-ID: <875z8x60mv.fsf@linaro.org> (raw)
In-Reply-To: <20200901133050.381844-2-berrange@redhat.com>


Daniel P. Berrangé <berrange@redhat.com> writes:

> If nettle is disabled and gcrypt enabled, the compiler and linker flags
> needed for gcrypt are not passed.
>
> Gnutls was also not added as a dependancy when gcrypt is enabled.
>
> Attempting to add the library dependencies at the same time as the
> source dependencies is error prone, as there are alot of different
> rules for picking which sources to use, and some of the source files
> use code level conditionals intead. It is thus clearer to add the
> library dependencies separately.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

That seems to fix some of the container based builds.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  configure          |  2 ++
>  crypto/meson.build | 42 +++++++++++++++++++++++++++++++-----------
>  meson.build        |  5 +++++
>  3 files changed, 38 insertions(+), 11 deletions(-)
>
> diff --git a/configure b/configure
> index 8dc981684b..3dc2431722 100755
> --- a/configure
> +++ b/configure
> @@ -6979,6 +6979,8 @@ if test "$gcrypt" = "yes" ; then
>    if test "$gcrypt_hmac" = "yes" ; then
>      echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak
>    fi
> +  echo "GCRYPT_CFLAGS=$gcrypt_cflags" >> $config_host_mak
> +  echo "GCRYPT_LIBS=$gcrypt_libs" >> $config_host_mak
>  fi
>  if test "$nettle" = "yes" ; then
>    echo "CONFIG_NETTLE=y" >> $config_host_mak
> diff --git a/crypto/meson.build b/crypto/meson.build
> index 18da7c8541..f6f5ce1ecd 100644
> --- a/crypto/meson.build
> +++ b/crypto/meson.build
> @@ -23,24 +23,35 @@ crypto_ss.add(files(
>    'tlssession.c',
>  ))
>  
> -if 'CONFIG_GCRYPT' in config_host
> -  wo_nettle = files('hash-gcrypt.c', 'pbkdf-gcrypt.c')
> +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'))
> +  if 'CONFIG_GCRYPT_HMAC' in config_host
> +    crypto_ss.add(files('hmac-gcrypt.c'))
> +  else
> +    crypto_ss.add(files('hmac-glib.c'))
> +  endif
>  else
> -  wo_nettle = files('hash-glib.c', 'pbkdf-stub.c')
> -endif
> -if 'CONFIG_GCRYPT_HMAC' not in config_host
> -  wo_nettle += files('hmac-glib.c')
> +  crypto_ss.add(files('hash-glib.c', 'hmac-glib.c', 'pbkdf-stub.c'))
>  endif
> -crypto_ss.add(when: [nettle, 'CONFIG_NETTLE'],
> -             if_true: files('hash-nettle.c', 'hmac-nettle.c', 'pbkdf-nettle.c'),
> -             if_false: wo_nettle)
>  
>  crypto_ss.add(when: 'CONFIG_SECRET_KEYRING', if_true: files('secret_keyring.c'))
>  crypto_ss.add(when: 'CONFIG_QEMU_PRIVATE_XTS', if_true: files('xts.c'))
> -crypto_ss.add(when: 'CONFIG_GCRYPT_HMAC', if_true: files('hmac-gcrypt.c'))
>  crypto_ss.add(when: 'CONFIG_AF_ALG', if_true: files('afalg.c', 'cipher-afalg.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 = crypto_ss.apply(config_host, strict: false)
>  libcrypto = static_library('crypto', crypto_ss.sources() + genh,
>                             dependencies: [crypto_ss.dependencies()],
> @@ -52,12 +63,21 @@ crypto = declare_dependency(link_whole: libcrypto,
>  
>  util_ss.add(files('aes.c'))
>  util_ss.add(files('init.c'))
> +
>  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'), gnutls)
> +  util_ss.add(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
> +
> +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 1e7aee85e3..bc6aac4ce7 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -114,6 +114,11 @@ urcubp = not_found
>  if 'CONFIG_TRACE_UST' in config_host
>    urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split())
>  endif
> +gcrypt = not_found
> +if 'CONFIG_GCRYPT' in config_host
> +  gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(),
> +                              link_args: config_host['GCRYPT_LIBS'].split())
> +endif
>  nettle = not_found
>  if 'CONFIG_NETTLE' in config_host
>    nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(),


-- 
Alex Bennée


  reply	other threads:[~2020-09-01 14:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01 13:30 [PATCH v2 0/2] crypto: fix build with gcrypt Daniel P. Berrangé
2020-09-01 13:30 ` [PATCH v2 1/2] crypto: fix build with gcrypt enabled Daniel P. Berrangé
2020-09-01 14:18   ` Alex Bennée [this message]
2020-09-01 13:30 ` [PATCH v2 2/2] gitlab: expand test coverage for crypto builds Daniel P. Berrangé
2020-09-01 15:10   ` Philippe Mathieu-Daudé
2020-09-01 15:27     ` Daniel P. Berrangé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875z8x60mv.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=fam@euphon.net \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.