On Fri, Feb 07, 2025 at 11:27:55AM -0300, Fabiano Rosas wrote:
> The correct way of calling qcrypto_tls_session_handshake() requires
> calling qcrypto_tls_session_get_handshake_status() right after it so
> there's no reason to have a separate method.
> 
> Refactor qcrypto_tls_session_handshake() to inform the status in its
> own return value and alter the callers accordingly.
> 
> No functional change.
> 
> Suggested-by: Daniel P. Berrangé <berra...@redhat.com>
> Signed-off-by: Fabiano Rosas <faro...@suse.de>
> ---
>  crypto/tlssession.c                 | 64 +++++++++++------------------
>  include/crypto/tlssession.h         | 32 ++++-----------
>  io/channel-tls.c                    |  7 ++--
>  tests/unit/test-crypto-tlssession.c | 12 ++----
>  4 files changed, 39 insertions(+), 76 deletions(-)
> 
> diff --git a/crypto/tlssession.c b/crypto/tlssession.c
> @@ -720,14 +710,6 @@ qcrypto_tls_session_check_pending(QCryptoTLSSession 
> *session)
>  int
>  qcrypto_tls_session_handshake(QCryptoTLSSession *sess,
>                                Error **errp)
> -{
> -    error_setg(errp, "TLS requires GNUTLS support");
> -    return -1;
> -}
> -

This codepath is the !GNUTLS branch, so we need to continue
reporting an error here, not return QCRYPTO_TLS_HANDSHAKE_COMPLETE.

> -
> -QCryptoTLSSessionHandshakeStatus
> -qcrypto_tls_session_get_handshake_status(QCryptoTLSSession *sess)
>  {
>      return QCRYPTO_TLS_HANDSHAKE_COMPLETE;
>  }


With that small change made

Reviewed-by: Daniel P. Berrangé <berra...@redhat.com>
Acked-by: Daniel P. Berrangé <berra...@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to