diff options
| author | Sergey Kandaurov <pluknet@nginx.com> | 2023-10-20 18:05:07 +0400 |
|---|---|---|
| committer | Sergey Kandaurov <pluknet@nginx.com> | 2023-10-20 18:05:07 +0400 |
| commit | 31620d1a89edaf110feda05ac91d68ccb532afba (patch) | |
| tree | b18fedd6f611d35195bc46651beca4950e7f5a35 /src/event/quic/ngx_event_quic_openssl_compat.c | |
| parent | b94f1fbee375eaceebf0cf0645ff83ae1966e55a (diff) | |
| download | nginx-31620d1a89edaf110feda05ac91d68ccb532afba.tar.gz nginx-31620d1a89edaf110feda05ac91d68ccb532afba.tar.bz2 | |
QUIC: explicitly zero out unused keying material.
Diffstat (limited to 'src/event/quic/ngx_event_quic_openssl_compat.c')
| -rw-r--r-- | src/event/quic/ngx_event_quic_openssl_compat.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/event/quic/ngx_event_quic_openssl_compat.c b/src/event/quic/ngx_event_quic_openssl_compat.c index cf4a2c895..c7412e82b 100644 --- a/src/event/quic/ngx_event_quic_openssl_compat.c +++ b/src/event/quic/ngx_event_quic_openssl_compat.c @@ -218,6 +218,8 @@ ngx_quic_compat_keylog_callback(const SSL *ssl, const char *line) (void) ngx_quic_compat_set_encryption_secret(c, &com->keys, level, cipher, secret, n); } + + ngx_explicit_memzero(secret, n); } @@ -246,15 +248,6 @@ ngx_quic_compat_set_encryption_secret(ngx_connection_t *c, return NGX_ERROR; } - if (sizeof(peer_secret->secret.data) < secret_len) { - ngx_log_error(NGX_LOG_ALERT, c->log, 0, - "unexpected secret len: %uz", secret_len); - return NGX_ERROR; - } - - peer_secret->secret.len = secret_len; - ngx_memcpy(peer_secret->secret.data, secret, secret_len); - key.len = key_len; peer_secret->iv.len = NGX_QUIC_IV_LEN; @@ -292,6 +285,8 @@ ngx_quic_compat_set_encryption_secret(ngx_connection_t *c, return NGX_ERROR; } + ngx_explicit_memzero(key.data, key.len); + return NGX_OK; } |
