From: Nikos Mavrogiannopoulos Date: Wed, 30 Nov 2016 13:18:51 +0000 (+0100) Subject: gnutls_kx_get: allow calling the function during handshake X-Git-Tag: gnutls_3_5_7~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4554411c98d53231ef264e5ce634225fc06ba30;p=thirdparty%2Fgnutls.git gnutls_kx_get: allow calling the function during handshake Previous this function would return garbage during handshake, because parameters were not considered established, however there are valid uses of this function during it. For that reason this function is modified to return a correct value even during handshake (after a hello is being exchanged). --- diff --git a/lib/state.c b/lib/state.c index 496afe4af5..b765142afa 100644 --- a/lib/state.c +++ b/lib/state.c @@ -126,7 +126,12 @@ gnutls_certificate_type_get(gnutls_session_t session) **/ gnutls_kx_algorithm_t gnutls_kx_get(gnutls_session_t session) { - return session->security_parameters.kx_algorithm; + if (session->internals.handshake_in_progress) { + /* This allows early call during handshake */ + return _gnutls_cipher_suite_get_kx_algo(session->security_parameters.cipher_suite); + } else { + return session->security_parameters.kx_algorithm; + } } /**