summaryrefslogtreecommitdiffhomepage
path: root/src/event/quic/ngx_event_quic_protection.h
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2022-07-27 17:31:16 +0400
committerVladimir Homutov <vl@nginx.com>2022-07-27 17:31:16 +0400
commit664cb29f5240768988cfa02834bebfddeb32cfc9 (patch)
tree17d3857a459cce9af01c1ea80884920a050986fc /src/event/quic/ngx_event_quic_protection.h
parent93c21be4d6184842b20541be190c630ec042b66a (diff)
downloadnginx-664cb29f5240768988cfa02834bebfddeb32cfc9.tar.gz
nginx-664cb29f5240768988cfa02834bebfddeb32cfc9.tar.bz2
QUIC: removed ngx_quic_keys_new().
The ngx_quic_keys_t structure is now exposed.
Diffstat (limited to 'src/event/quic/ngx_event_quic_protection.h')
-rw-r--r--src/event/quic/ngx_event_quic_protection.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/event/quic/ngx_event_quic_protection.h b/src/event/quic/ngx_event_quic_protection.h
index a9d721274..c8dc26bd1 100644
--- a/src/event/quic/ngx_event_quic_protection.h
+++ b/src/event/quic/ngx_event_quic_protection.h
@@ -16,8 +16,46 @@
#define NGX_QUIC_ENCRYPTION_LAST ((ssl_encryption_application) + 1)
+/* RFC 5116, 5.1 and RFC 8439, 2.3 for all supported ciphers */
+#define NGX_QUIC_IV_LEN 12
+
+/* largest hash used in TLS is SHA-384 */
+#define NGX_QUIC_MAX_MD_SIZE 48
+
+
+typedef struct {
+ size_t len;
+ u_char data[NGX_QUIC_MAX_MD_SIZE];
+} ngx_quic_md_t;
+
+
+typedef struct {
+ size_t len;
+ u_char data[NGX_QUIC_IV_LEN];
+} ngx_quic_iv_t;
+
+
+typedef struct {
+ ngx_quic_md_t secret;
+ ngx_quic_md_t key;
+ ngx_quic_iv_t iv;
+ ngx_quic_md_t hp;
+} ngx_quic_secret_t;
+
+
+typedef struct {
+ ngx_quic_secret_t client;
+ ngx_quic_secret_t server;
+} ngx_quic_secrets_t;
+
+
+struct ngx_quic_keys_s {
+ ngx_quic_secrets_t secrets[NGX_QUIC_ENCRYPTION_LAST];
+ ngx_quic_secrets_t next_key;
+ ngx_uint_t cipher;
+};
+
-ngx_quic_keys_t *ngx_quic_keys_new(ngx_pool_t *pool);
ngx_int_t ngx_quic_keys_set_initial_secret(ngx_quic_keys_t *keys,
ngx_str_t *secret, ngx_log_t *log);
ngx_int_t ngx_quic_keys_set_encryption_secret(ngx_log_t *log,