diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-09-14 14:10:14 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-02-19 15:29:33 +0100 |
commit | 55c7818fba5d84780d18b3a3aa5a6a42cfde03a3 (patch) | |
tree | efe3c74dc5e23e59bf9c85bafc0a11f0f51471dd /lib/session_pack.c | |
parent | 2de4fecc1f32f1f45dc8f7e33411a123d9060ed6 (diff) | |
download | gnutls-55c7818fba5d84780d18b3a3aa5a6a42cfde03a3.tar.gz |
security params: store PRF when packing session
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'lib/session_pack.c')
-rw-r--r-- | lib/session_pack.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/session_pack.c b/lib/session_pack.c index d20601a831..6cc5d15c7b 100644 --- a/lib/session_pack.c +++ b/lib/session_pack.c @@ -700,6 +700,7 @@ unpack_psk_auth_info(gnutls_session_t session, gnutls_buffer_st * ps) * 1 byte the protocol version * * 2 bytes the cipher suite + * 4 bytes the PRF ID * * 48 bytes the master secret * @@ -744,6 +745,8 @@ pack_security_parameters(gnutls_session_t session, gnutls_buffer_st * ps) BUFFER_APPEND_NUM(ps, session->security_parameters.entity); BUFFER_APPEND(ps, session->security_parameters.cs->id, 2); + BUFFER_APPEND_NUM(ps, session->security_parameters.prf->id); + BUFFER_APPEND_NUM(ps, session->security_parameters.cert_type); BUFFER_APPEND_NUM(ps, session->security_parameters.pversion->id); @@ -820,6 +823,11 @@ unpack_security_parameters(gnutls_session_t session, gnutls_buffer_st * ps) if (session->internals.resumed_security_parameters.cs == NULL) return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); + BUFFER_POP_NUM(ps, version); + session->internals.resumed_security_parameters.prf = mac_to_entry(version); + if (session->internals.resumed_security_parameters.prf == NULL) + return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); + BUFFER_POP_NUM(ps, session->internals.resumed_security_parameters. cert_type); @@ -950,6 +958,13 @@ gnutls_session_set_premaster(gnutls_session_t session, unsigned int entity, session->internals.resumed_security_parameters.pversion = version_to_entry(version); + if (session->internals.resumed_security_parameters.pversion->selectable_prf) + session->internals.resumed_security_parameters.prf = mac_to_entry(session->internals.resumed_security_parameters.cs->prf); + else + session->internals.resumed_security_parameters.prf = mac_to_entry(GNUTLS_MAC_MD5_SHA1); + if (session->internals.resumed_security_parameters.prf == NULL) + return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); + if (session->internals.resumed_security_parameters.pversion == NULL) return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); |