qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 7/7] crypto: Make QCryptoTLSCreds* structures private


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v3 7/7] crypto: Make QCryptoTLSCreds* structures private
Date: Tue, 15 Jun 2021 19:29:30 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1

On 6/15/21 7:27 PM, Philippe Mathieu-Daudé wrote:
> Code consuming the "crypto/tlscreds*.h" APIs doesn't need
> to access its internals. Move the structure definitions to
> the "tlscredspriv.h" private header (only accessible by
> implementations). The public headers (in include/) still
> forward-declare the structures typedef.
> 
> This solves a bug introduced by commit 7de2e856533 which made
> migration/qemu-file-channel.c include "io/channel-tls.h",
> itself sometime depends on GNUTLS, leading to build failure
> on OSX:
> 
>   [2/35] Compiling C object libmigration.fa.p/migration_qemu-file-channel.c.o
>   FAILED: libmigration.fa.p/migration_qemu-file-channel.c.o
>   cc -Ilibmigration.fa.p -I. -I.. -Iqapi [ ... ] -o 
> libmigration.fa.p/migration_qemu-file-channel.c.o -c 
> ../migration/qemu-file-channel.c
>   In file included from ../migration/qemu-file-channel.c:29:
>   In file included from include/io/channel-tls.h:26:
>   In file included from include/crypto/tlssession.h:24:
>   include/crypto/tlscreds.h:28:10: fatal error: 'gnutls/gnutls.h' file not 
> found
>   #include <gnutls/gnutls.h>
>            ^~~~~~~~~~~~~~~~~
>   1 error generated.
> 
> Reported-by: Stefan Weil <sw@weilnetz.de>
> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/407
> Fixes: 7de2e856533 ("yank: Unregister function when using TLS migration")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  crypto/tlscredspriv.h              | 45 ++++++++++++++++++++++++++++++
>  include/crypto/tls-cipher-suites.h |  6 ----
>  include/crypto/tlscreds.h          | 16 -----------
>  include/crypto/tlscredsanon.h      | 12 --------
>  include/crypto/tlscredspsk.h       | 12 --------
>  include/crypto/tlscredsx509.h      | 10 -------
>  crypto/tls-cipher-suites.c         |  7 +++++
>  crypto/tlscredsanon.c              |  3 +-
>  crypto/tlscredspsk.c               |  3 +-
>  crypto/tlscredsx509.c              |  4 +--
>  crypto/tlssession.c                |  1 +
>  11 files changed, 58 insertions(+), 61 deletions(-)

> index bea5f76c55d..2675b1af8f8 100644
> --- a/crypto/tlscredsanon.c
> +++ b/crypto/tlscredsanon.c
> @@ -26,9 +26,10 @@
>  #include "qom/object_interfaces.h"
>  #include "trace.h"
>  
> -

Involuntary line removal :/ Can restore if v4 required.

>  #ifdef CONFIG_GNUTLS
>  
> +#include <gnutls/gnutls.h>
> +
>  
>  static int
>  qcrypto_tls_creds_anon_load(QCryptoTLSCredsAnon *creds,
> diff --git a/crypto/tlscredspsk.c b/crypto/tlscredspsk.c
> index f5a31108d15..820719c5e84 100644
> --- a/crypto/tlscredspsk.c
> +++ b/crypto/tlscredspsk.c
> @@ -26,9 +26,10 @@
>  #include "qom/object_interfaces.h"
>  #include "trace.h"
>  
> -
>  #ifdef CONFIG_GNUTLS
>  
> +#include <gnutls/gnutls.h>
> +
>  static int
>  lookup_key(const char *pskfile, const char *username, gnutls_datum_t *key,
>             Error **errp)
> diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
> index d9d6f4421e5..44dbe0dc819 100644
> --- a/crypto/tlscredsx509.c
> +++ b/crypto/tlscredsx509.c
> @@ -27,12 +27,10 @@
>  #include "qom/object_interfaces.h"
>  #include "trace.h"
>  
> -
>  #ifdef CONFIG_GNUTLS
> -
> +#include <gnutls/gnutls.h>
>  #include <gnutls/x509.h>
>  
> -
>  static int
>  qcrypto_tls_creds_check_cert_times(gnutls_x509_crt_t cert,
>                                     const char *certFile,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]