comparison src/event/quic/ngx_event_quic_openssl_compat.h @ 9080:7da4791e0264 quic

QUIC: OpenSSL compatibility layer. The change allows to compile QUIC with OpenSSL which lacks BoringSSL QUIC API. This implementation does not support 0-RTT.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 22 Feb 2023 19:16:53 +0400
parents
children bddd3f76e3e5
comparison
equal deleted inserted replaced
9079:639fa6723700 9080:7da4791e0264
1
2 /*
3 * Copyright (C) Nginx, Inc.
4 */
5
6
7 #ifndef _NGX_EVENT_QUIC_OPENSSL_COMPAT_H_INCLUDED_
8 #define _NGX_EVENT_QUIC_OPENSSL_COMPAT_H_INCLUDED_
9
10 #ifdef TLSEXT_TYPE_quic_transport_parameters
11 #undef NGX_QUIC_OPENSSL_COMPAT
12 #else
13
14
15 #include <ngx_config.h>
16 #include <ngx_core.h>
17
18
19 typedef struct ngx_quic_compat_s ngx_quic_compat_t;
20
21
22 enum ssl_encryption_level_t {
23 ssl_encryption_initial = 0,
24 ssl_encryption_early_data,
25 ssl_encryption_handshake,
26 ssl_encryption_application
27 };
28
29
30 typedef struct ssl_quic_method_st {
31 int (*set_read_secret)(SSL *ssl, enum ssl_encryption_level_t level,
32 const SSL_CIPHER *cipher,
33 const uint8_t *rsecret, size_t secret_len);
34 int (*set_write_secret)(SSL *ssl, enum ssl_encryption_level_t level,
35 const SSL_CIPHER *cipher,
36 const uint8_t *wsecret, size_t secret_len);
37 int (*add_handshake_data)(SSL *ssl, enum ssl_encryption_level_t level,
38 const uint8_t *data, size_t len);
39 int (*flush_flight)(SSL *ssl);
40 int (*send_alert)(SSL *ssl, enum ssl_encryption_level_t level,
41 uint8_t alert);
42 } SSL_QUIC_METHOD;
43
44
45 ngx_int_t ngx_quic_compat_init(ngx_conf_t *cf, SSL_CTX *ctx);
46
47 int SSL_set_quic_method(SSL *ssl, const SSL_QUIC_METHOD *quic_method);
48 int SSL_provide_quic_data(SSL *ssl, enum ssl_encryption_level_t level,
49 const uint8_t *data, size_t len);
50 enum ssl_encryption_level_t SSL_quic_read_level(const SSL *ssl);
51 enum ssl_encryption_level_t SSL_quic_write_level(const SSL *ssl);
52 int SSL_set_quic_transport_params(SSL *ssl, const uint8_t *params,
53 size_t params_len);
54 void SSL_get_peer_quic_transport_params(const SSL *ssl,
55 const uint8_t **out_params, size_t *out_params_len);
56
57
58 #endif /* TLSEXT_TYPE_quic_transport_parameters */
59
60 #endif /* _NGX_EVENT_QUIC_OPENSSL_COMPAT_H_INCLUDED_ */