diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-09-14 14:03:43 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-09-18 09:15:09 +0200 |
commit | 8944fb994b3a779544b016bd03a9c20d96cf9eac (patch) | |
tree | 36f7686f8db6e8da28195f70012b2a14c2d5a1cd /lib/handshake.c | |
parent | 8ba832da903adc2ab922fe1d767e1a3cf21e4ae1 (diff) | |
download | gnutls-8944fb994b3a779544b016bd03a9c20d96cf9eac.tar.gz |
handshake: simplify by storing a pointer to PRF mac entry
That way, we avoid multiple function calls to obtain information
such as hash size, and other MAC properties.
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'lib/handshake.c')
-rw-r--r-- | lib/handshake.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/handshake.c b/lib/handshake.c index f75980585f..46540e1ebe 100644 --- a/lib/handshake.c +++ b/lib/handshake.c @@ -334,7 +334,7 @@ _gnutls_finished(gnutls_session_t session, int type, void *ret, else len = session->internals.handshake_hash_buffer_prev_len; - algorithm = session->security_parameters.prf_mac; + algorithm = session->security_parameters.prf->id; rc = _gnutls_hash_fast(algorithm, session->internals. handshake_hash_buffer.data, len, @@ -342,7 +342,7 @@ _gnutls_finished(gnutls_session_t session, int type, void *ret, if (rc < 0) return gnutls_assert_val(rc); - hash_len = _gnutls_hash_get_algo_len(mac_to_entry(algorithm)); + hash_len = session->security_parameters.prf->output_size; if (type == GNUTLS_SERVER) { mesg = SERVER_MSG; @@ -3135,7 +3135,6 @@ int _gnutls_handshake_get_session_hash(gnutls_session_t session, gnutls_datum_t { const version_entry_st *ver = get_version(session); int ret; - const mac_entry_st *me; uint8_t concat[2*MAX_HASH_SIZE]; if (unlikely(ver == NULL)) @@ -3147,12 +3146,8 @@ int _gnutls_handshake_get_session_hash(gnutls_session_t session, gnutls_datum_t return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR); } - me = mac_to_entry(session->security_parameters.prf_mac); - if (me == NULL) - return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR); - ret = - _gnutls_hash_fast((gnutls_digest_algorithm_t)me->id, + _gnutls_hash_fast((gnutls_digest_algorithm_t)session->security_parameters.prf->id, session->internals.handshake_hash_buffer. data, session->internals.handshake_hash_buffer_client_kx_len, @@ -3160,5 +3155,5 @@ int _gnutls_handshake_get_session_hash(gnutls_session_t session, gnutls_datum_t if (ret < 0) return gnutls_assert_val(ret); - return _gnutls_set_datum(shash, concat, me->output_size); + return _gnutls_set_datum(shash, concat, session->security_parameters.prf->output_size); } |