Mercurial > hg > nginx-quic
annotate src/event/ngx_event_quic.h @ 7643:76e29ff31cd3 quic
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 28 Feb 2020 13:09:52 +0300 |
parents | 72f632f90a17 |
children | a9ff4392ecde |
rev | line source |
---|---|
7633
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 |
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 /* |
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 * |
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 */ |
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 |
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 #ifndef _NGX_EVENT_QUIC_H_INCLUDED_ |
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 #define _NGX_EVENT_QUIC_H_INCLUDED_ |
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 |
7636
53a5cdbe500c
QUIC add_handshake_data callback, varint routines.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7635
diff
changeset
|
11 #include <ngx_event_openssl.h> |
53a5cdbe500c
QUIC add_handshake_data callback, varint routines.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7635
diff
changeset
|
12 |
53a5cdbe500c
QUIC add_handshake_data callback, varint routines.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7635
diff
changeset
|
13 |
7643
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
14 #ifdef OPENSSL_IS_BORINGSSL |
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
15 #define ngx_aead_cipher_t EVP_AEAD |
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
16 #define NGX_QUIC_INITIAL_CIPHER EVP_aead_aes_128_gcm() |
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
17 #else |
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
18 #define ngx_aead_cipher_t EVP_CIPHER |
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
19 #define NGX_QUIC_INITIAL_CIPHER EVP_aes_128_gcm() |
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
20 #endif |
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
21 |
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
22 |
7641
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
23 typedef struct { |
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
24 ngx_str_t secret; |
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
25 ngx_str_t key; |
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
26 ngx_str_t iv; |
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
27 ngx_str_t hp; |
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
28 } ngx_quic_secret_t; |
7633
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 |
7634 | 30 |
7641
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
31 struct ngx_quic_connection_s { |
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
32 ngx_str_t scid; |
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
33 ngx_str_t dcid; |
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
34 ngx_str_t token; |
7633
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 |
7641
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
36 ngx_quic_secret_t client_in; |
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
37 ngx_quic_secret_t client_hs; |
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
38 ngx_quic_secret_t client_ad; |
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
39 ngx_quic_secret_t server_in; |
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
40 ngx_quic_secret_t server_hs; |
72f632f90a17
Introduced ngx_quic_secret_t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7637
diff
changeset
|
41 ngx_quic_secret_t server_ad; |
7633
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 }; |
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 |
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 |
7636
53a5cdbe500c
QUIC add_handshake_data callback, varint routines.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7635
diff
changeset
|
45 uint64_t ngx_quic_parse_pn(u_char **pos, ngx_int_t len, u_char *mask); |
53a5cdbe500c
QUIC add_handshake_data callback, varint routines.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7635
diff
changeset
|
46 uint64_t ngx_quic_parse_int(u_char **pos); |
53a5cdbe500c
QUIC add_handshake_data callback, varint routines.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7635
diff
changeset
|
47 void ngx_quic_build_int(u_char **pos, uint64_t value); |
53a5cdbe500c
QUIC add_handshake_data callback, varint routines.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7635
diff
changeset
|
48 |
7637
4daf03d2bd0a
OpenSSL compatibility.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7636
diff
changeset
|
49 ngx_int_t ngx_hkdf_extract(u_char *out_key, size_t *out_len, |
4daf03d2bd0a
OpenSSL compatibility.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7636
diff
changeset
|
50 const EVP_MD *digest, const u_char *secret, size_t secret_len, |
4daf03d2bd0a
OpenSSL compatibility.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7636
diff
changeset
|
51 const u_char *salt, size_t salt_len); |
4daf03d2bd0a
OpenSSL compatibility.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7636
diff
changeset
|
52 ngx_int_t ngx_hkdf_expand(u_char *out_key, size_t out_len, |
4daf03d2bd0a
OpenSSL compatibility.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7636
diff
changeset
|
53 const EVP_MD *digest, const u_char *prk, size_t prk_len, |
4daf03d2bd0a
OpenSSL compatibility.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7636
diff
changeset
|
54 const u_char *info, size_t info_len); |
4daf03d2bd0a
OpenSSL compatibility.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7636
diff
changeset
|
55 |
7643
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
56 ngx_int_t ngx_quic_tls_open(ngx_connection_t *c, |
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
57 const ngx_aead_cipher_t *cipher, ngx_quic_secret_t *s, ngx_str_t *out, |
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
58 u_char *nonce, ngx_str_t *in, ngx_str_t *ad); |
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
59 ngx_int_t ngx_quic_tls_seal(ngx_connection_t *c, |
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
60 const ngx_aead_cipher_t *cipher, ngx_quic_secret_t *s, ngx_str_t *out, |
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
61 u_char *nonce, ngx_str_t *in, ngx_str_t *ad); |
76e29ff31cd3
AEAD routines, introduced ngx_quic_tls_open()/ngx_quic_tls_seal().
Sergey Kandaurov <pluknet@nginx.com>
parents:
7641
diff
changeset
|
62 |
7636
53a5cdbe500c
QUIC add_handshake_data callback, varint routines.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7635
diff
changeset
|
63 |
7633
5d91389e0fd3
Initial QUIC support in http.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 #endif /* _NGX_EVENT_QUIC_H_INCLUDED_ */ |