aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Kandaurov <pluknet@nginx.com>2021-07-22 15:00:37 +0300
committerSergey Kandaurov <pluknet@nginx.com>2021-07-22 15:00:37 +0300
commit2b5659f350974dc1659c512d5681971c857c2deb (patch)
tree2e849c67585adffb914877556c1cdbec4acbcdbc
parent6157d0b5c1b3a6be7928748df2cda19838889f4f (diff)
downloadnginx-2b5659f350974dc1659c512d5681971c857c2deb.tar.gz
nginx-2b5659f350974dc1659c512d5681971c857c2deb.zip
QUIC: avoid processing 1-RTT with incomplete handshake in OpenSSL.
OpenSSL is known to provide read keys for an encryption level before the level is active in TLS, following the old BoringSSL API. In BoringSSL, it was then fixed to defer releasing read keys until QUIC may use them.
-rw-r--r--src/event/quic/ngx_event_quic.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/event/quic/ngx_event_quic.c b/src/event/quic/ngx_event_quic.c
index 0d61be837..8f57b9f5d 100644
--- a/src/event/quic/ngx_event_quic.c
+++ b/src/event/quic/ngx_event_quic.c
@@ -918,6 +918,20 @@ ngx_quic_process_payload(ngx_connection_t *c, ngx_quic_header_t *pkt)
return NGX_DECLINED;
}
+#if !defined (OPENSSL_IS_BORINGSSL)
+ /* OpenSSL provides read keys for an application level before it's ready */
+
+ if (pkt->level == ssl_encryption_application
+ && SSL_quic_read_level(c->ssl->connection)
+ < ssl_encryption_application)
+ {
+ ngx_log_error(NGX_LOG_INFO, c->log, 0,
+ "quic no %s keys ready, ignoring packet",
+ ngx_quic_level_name(pkt->level));
+ return NGX_DECLINED;
+ }
+#endif
+
pkt->keys = qc->keys;
pkt->key_phase = qc->key_phase;
pkt->plaintext = buf;