mirror of
https://github.com/openssl/openssl.git
synced 2025-01-12 13:36:28 +08:00
ssl_log_secret call in tls13_key_update
Newly computed traffic secrets are now logged upon key update Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19241)
This commit is contained in:
parent
d12b824dda
commit
2f7e61b8b2
@ -2848,7 +2848,9 @@ __owur int ssl_log_secret(SSL_CONNECTION *s, const char *label,
|
||||
#define CLIENT_HANDSHAKE_LABEL "CLIENT_HANDSHAKE_TRAFFIC_SECRET"
|
||||
#define SERVER_HANDSHAKE_LABEL "SERVER_HANDSHAKE_TRAFFIC_SECRET"
|
||||
#define CLIENT_APPLICATION_LABEL "CLIENT_TRAFFIC_SECRET_0"
|
||||
#define CLIENT_APPLICATION_N_LABEL "CLIENT_TRAFFIC_SECRET_N"
|
||||
#define SERVER_APPLICATION_LABEL "SERVER_TRAFFIC_SECRET_0"
|
||||
#define SERVER_APPLICATION_N_LABEL "SERVER_TRAFFIC_SECRET_N"
|
||||
#define EARLY_EXPORTER_SECRET_LABEL "EARLY_EXPORTER_SECRET"
|
||||
#define EXPORTER_SECRET_LABEL "EXPORTER_SECRET"
|
||||
|
||||
|
@ -792,6 +792,7 @@ int tls13_update_key(SSL_CONNECTION *s, int sending)
|
||||
unsigned char key[EVP_MAX_KEY_LENGTH];
|
||||
unsigned char *insecret, *iv;
|
||||
unsigned char secret[EVP_MAX_MD_SIZE];
|
||||
char *log_label;
|
||||
EVP_CIPHER_CTX *ciph_ctx;
|
||||
size_t keylen, ivlen, taglen;
|
||||
int ret = 0, l;
|
||||
@ -840,6 +841,13 @@ int tls13_update_key(SSL_CONNECTION *s, int sending)
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Call Key log on successful traffic secret update */
|
||||
log_label = s->server == sending ? SERVER_APPLICATION_N_LABEL : CLIENT_APPLICATION_N_LABEL;
|
||||
if (!ssl_log_secret(s, log_label, secret, hashlen)) {
|
||||
/* SSLfatal() already called */
|
||||
goto err;
|
||||
}
|
||||
|
||||
s->statem.enc_write_state = ENC_WRITE_STATE_VALID;
|
||||
ret = 1;
|
||||
err:
|
||||
|
Loading…
Reference in New Issue
Block a user