diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-06-27 11:19:37 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2017-07-07 07:37:04 +0000 |
commit | 498d0831e78d2fc5e8e39580136fb4e6593f1e77 (patch) | |
tree | d867443523c6b8b7986e0e4207d33009dd8b2506 | |
parent | c514ff1cde9958f3377b8f4635fcc90221f560e3 (diff) | |
download | gnutls-tmp-handshake-simplifications.tar.gz |
set_client_ciphersuite: use the new internal APIstmp-handshake-simplifications
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | lib/handshake.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/handshake.c b/lib/handshake.c index 716921f9ea..4c48fd155f 100644 --- a/lib/handshake.c +++ b/lib/handshake.c @@ -1337,19 +1337,19 @@ _gnutls_recv_handshake(gnutls_session_t session, static int set_client_ciphersuite(gnutls_session_t session, uint8_t suite[2]) { - unsigned found = 0; unsigned j; int ret; + const gnutls_cipher_suite_entry_st *selected = NULL; for (j = 0; j < session->internals.priorities.cs.size; j++) { if (suite[0] == session->internals.priorities.cs.entry[j]->id[0] && suite[1] == session->internals.priorities.cs.entry[j]->id[1]) { - found = 1; + selected = session->internals.priorities.cs.entry[j]; break; } } - if (!found) { + if (!selected) { gnutls_assert(); _gnutls_handshake_log ("HSK[%p]: unsupported cipher suite %.2X.%.2X was negotiated\n", @@ -1358,15 +1358,13 @@ set_client_ciphersuite(gnutls_session_t session, uint8_t suite[2]) return GNUTLS_E_UNKNOWN_CIPHER_SUITE; } - ret = _gnutls_set_cipher_suite(session, suite); + ret = _gnutls_set_cipher_suite2(session, selected); if (ret < 0) return gnutls_assert_val(ret); _gnutls_handshake_log("HSK[%p]: Selected cipher suite: %s\n", session, - _gnutls_cipher_suite_get_name - (session->security_parameters.cipher_suite)); - + selected->name); /* check if the credentials (username, public key etc.) are ok. * Actually checks if they exist. @@ -1386,9 +1384,7 @@ set_client_ciphersuite(gnutls_session_t session, uint8_t suite[2]) * handshake functions are read from there; */ session->internals.auth_struct = - _gnutls_kx_auth_struct(_gnutls_cipher_suite_get_kx_algo - (session->security_parameters. - cipher_suite)); + _gnutls_kx_auth_struct(selected->kx_algorithm); if (session->internals.auth_struct == NULL) { |