]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
gnutls_auth*_get_type: use gnutls_kx_get to retrieve key exchange
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Tue, 3 Oct 2017 13:59:14 +0000 (15:59 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 19 Feb 2018 14:29:35 +0000 (15:29 +0100)
That allows the functions to operate under TLS 1.3 which have
no key exchange as part of the ciphersuite.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
lib/auth.c

index a11768026061b586c48e7b7f82ce5cff47350fd9..1c5af27efb10946b5365901e8e7d1730c0ea427b 100644 (file)
@@ -201,6 +201,7 @@ gnutls_credentials_type_t gnutls_auth_get_type(gnutls_session_t session)
 /* This is not the credentials we must set, but the authentication data
  * we get by the peer, so it should be reversed.
  */
+       gnutls_kx_algorithm_t kx;
        int server =
            session->security_parameters.entity == GNUTLS_SERVER ? 0 : 1;
 
@@ -209,9 +210,10 @@ gnutls_credentials_type_t gnutls_auth_get_type(gnutls_session_t session)
                return 0;
        }
 
+       kx = gnutls_kx_get(session);
+
        return
-           _gnutls_map_kx_get_cred(session->security_parameters.
-                                    cs->kx_algorithm, server);
+           _gnutls_map_kx_get_cred(kx, server);
 }
 
 /**
@@ -228,14 +230,17 @@ gnutls_credentials_type_t gnutls_auth_get_type(gnutls_session_t session)
 gnutls_credentials_type_t
 gnutls_auth_server_get_type(gnutls_session_t session)
 {
+       gnutls_kx_algorithm_t kx;
+
        if (!session->security_parameters.cs) {
                gnutls_assert();
                return 0;
        }
 
+       kx = gnutls_kx_get(session);
+
        return
-           _gnutls_map_kx_get_cred(session->security_parameters.
-                                    cs->kx_algorithm, 1);
+           _gnutls_map_kx_get_cred(kx, 1);
 }
 
 /**
@@ -252,14 +257,17 @@ gnutls_auth_server_get_type(gnutls_session_t session)
 gnutls_credentials_type_t
 gnutls_auth_client_get_type(gnutls_session_t session)
 {
+       gnutls_kx_algorithm_t kx;
+
        if (!session->security_parameters.cs) {
                gnutls_assert();
                return 0;
        }
 
+       kx = gnutls_kx_get(session);
+
        return
-           _gnutls_map_kx_get_cred(session->security_parameters.
-                                    cs->kx_algorithm, 0);
+           _gnutls_map_kx_get_cred(kx, 0);
 }