diff options
author | Aniketh01 <anikethgireesh@gmail.com> | 2019-10-03 12:12:10 +0530 |
---|---|---|
committer | Daiki Ueno <dueno@redhat.com> | 2019-12-01 18:32:33 +0100 |
commit | 51eed2631d3e216b0fe4a56a713f4665dbfe1c5c (patch) | |
tree | 4c0293c452bddb5b7dcc46c81b24ad5879841ace /lib/ext/pre_shared_key.c | |
parent | 25ae05fdc0e5627b6e53c17c2c55a987117d9cfb (diff) | |
download | gnutls-tmp-secret-hook.tar.gz |
gnutls_session_set_secret_hook_function: new functiontmp-secret-hook
This adds a callback to get notified when a new traffic secret is
set. This is particularly useful with QUIC, where the QUIC
implementations calculate actual traffic keys from the TLS secrets.
Signed-off-by: Aniketh01 <anikethgireesh@gmail.com>
Signed-off-by: Daiki Ueno <dueno@redhat.com>
Diffstat (limited to 'lib/ext/pre_shared_key.c')
-rw-r--r-- | lib/ext/pre_shared_key.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/ext/pre_shared_key.c b/lib/ext/pre_shared_key.c index d344922910..57d36dee95 100644 --- a/lib/ext/pre_shared_key.c +++ b/lib/ext/pre_shared_key.c @@ -30,6 +30,7 @@ #include "tls13/psk_ext_parser.h" #include "tls13/finished.h" #include "tls13/session_ticket.h" +#include "quic.h" #include "auth/psk_passwd.h" #include <ext/session_ticket.h> #include <ext/pre_shared_key.h> @@ -194,6 +195,7 @@ generate_early_secrets(gnutls_session_t session, const mac_entry_st *prf) { int ret; + record_parameters_st *record_params; ret = _tls13_derive_secret2(prf, EARLY_TRAFFIC_LABEL, sizeof(EARLY_TRAFFIC_LABEL)-1, session->internals.handshake_hash_buffer.data, @@ -207,6 +209,16 @@ generate_early_secrets(gnutls_session_t session, session->key.proto.tls13.e_ckey, prf->output_size); + ret = + _gnutls_epoch_get(session, EPOCH_READ_CURRENT, &record_params); + if (ret < 0) + return gnutls_assert_val(ret); + + _gnutls_call_secret_hook_func(session, GNUTLS_ENCRYPTION_LEVEL_EARLY, + GNUTLS_CLIENT, + session->key.proto.tls13.e_ckey, + prf->output_size); + ret = _tls13_derive_secret2(prf, EARLY_EXPORTER_MASTER_LABEL, sizeof(EARLY_EXPORTER_MASTER_LABEL)-1, session->internals.handshake_hash_buffer.data, session->internals.handshake_hash_buffer_client_hello_len, |