summaryrefslogtreecommitdiffhomepage
path: root/src/event/quic/ngx_event_quic_protection.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2025-05-23QUIC: ssl_encryption_level_t abstraction layer.Sergey Kandaurov1-10/+9
Encryption level values are decoupled from ssl_encryption_level_t, which is now limited to BoringSSL QUIC callbacks, with mappings provided. Although the values match, this provides a technically safe approach, in particular, to access protection level sized arrays. In preparation for using OpenSSL 3.5 TLS callbacks.
2025-04-17Fixed -Wunterminated-string-initialization with gcc15.Roman Arutyunyan1-5/+7
2024-11-26QUIC: got rid of memory copy when initializing constant values.Sergey Kandaurov1-8/+9
2024-11-26QUIC: constified nonce parameter of crypto functions.Sergey Kandaurov1-6/+6
This follows OpenSSL and BoringSSL API, and gives a hint to compiler that this parameter may not be modified.
2024-08-09QUIC: zero out existing keying material only.Sergey Kandaurov1-6/+23
Previously, this used to have extra ngx_explicit_memzero() calls from within ngx_quic_keys_cleanup(), which might be suboptimal.
2024-02-14QUIC: trial packet decryption in response to invalid key update.Sergey Kandaurov1-2/+13
Inspired by RFC 9001, Section 6.3, trial packet decryption with the current keys is now used to avoid a timing side-channel signal. Further, this fixes segfault while accessing missing next keys (ticket #2585).
2023-10-20QUIC: explicitly zero out unused keying material.Sergey Kandaurov1-0/+18
2023-10-20QUIC: removed key field from ngx_quic_secret_t.Sergey Kandaurov1-24/+39
It is made local as it is only needed now when creating crypto context. BoringSSL lacks EVP interface for ChaCha20, providing instead a function for one-shot encryption, thus hp is still preserved. Based on a patch by Roman Arutyunyan.
2023-10-20QUIC: simplified ngx_quic_ciphers() API.Sergey Kandaurov1-12/+7
After conversion to reusable crypto ctx, now there's enough caller context to remove the "level" argument from ngx_quic_ciphers().
2023-10-20QUIC: cleaned up now unused ngx_quic_ciphers() calls.Sergey Kandaurov1-25/+13
2023-10-20QUIC: reusing crypto contexts for header protection.Sergey Kandaurov1-28/+74
2023-10-20QUIC: common code for crypto open and seal operations.Sergey Kandaurov1-76/+63
2023-10-20QUIC: reusing crypto contexts for packet protection.Sergey Kandaurov1-110/+160
2023-10-20QUIC: renamed protection functions.Sergey Kandaurov1-12/+13
Now these functions have names ngx_quic_crypto_XXX(): - ngx_quic_tls_open() -> ngx_quic_crypto_open() - ngx_quic_tls_seal() -> ngx_quic_crypto_seal() - ngx_quic_tls_hp() -> ngx_quic_crypto_hp()
2023-08-31QUIC: split keys availability checks to read and write sides.Sergey Kandaurov1-2/+7
Keys may be released by TLS stack in different times, so it makes sense to check this independently as well. This allows to fine-tune what key direction is used when checking keys availability. When discarding, server keys are now marked in addition to client keys.
2023-08-25QUIC: posted generating TLS Key Update next keys.Sergey Kandaurov1-9/+22
Since at least f9fbeb4ee0de and certainly after 924882f42dea, which TLS Key Update support predates, queued data output is deferred to a posted push handler. To address timing signals after these changes, generating next keys is now posted to run after the push handler.
2023-06-16QUIC: removed TLS1_3_CK_* macros wrap up.Sergey Kandaurov1-7/+0
They were preserved in 172705615d04 to ease transition from older BoringSSL.
2023-06-20QUIC: style.Sergey Kandaurov1-4/+4
2023-06-20QUIC: unified ngx_quic_tls_open() and ngx_quic_tls_seal().Sergey Kandaurov1-11/+7
2023-06-20QUIC: TLS_AES_128_CCM_SHA256 cipher suite support.Roman Arutyunyan1-10/+48
2023-06-09QUIC: common cipher control constants instead of GCM-related.Roman Arutyunyan1-8/+8
The constants are used for both GCM and CHACHAPOLY.
2023-06-09QUIC: a new constant for AEAD tag length.Roman Arutyunyan1-9/+9
Previously used constant EVP_GCM_TLS_TAG_LEN had misleading name since it was used not only with GCM, but also with CHACHAPOLY. Now a new constant NGX_QUIC_TAG_LEN introduced. Luckily all AEAD algorithms used by QUIC have the same tag length of 16.
2023-02-22QUIC: OpenSSL compatibility layer.Roman Arutyunyan1-43/+4
The change allows to compile QUIC with OpenSSL which lacks BoringSSL QUIC API. This implementation does not support 0-RTT.
2022-11-25QUIC: fixed computation of nonce with packet numbers beyond 2^32.Sergey Kandaurov1-4/+8
Prodded by Yu Zhu.
2022-11-22QUIC: fixed C4389 MSVC warning about signed/unsigned mismatch.Sergey Kandaurov1-1/+2
2022-11-22QUIC: avoid using C99 designated initializers.Sergey Kandaurov1-4/+3
They are not supported by MSVC till 2012. SSL_QUIC_METHOD initialization is moved to run-time to preserve portability among SSL library implementations, which allows to reduce its visibility. Note using of a static storage to keep SSL_set_quic_method() reference valid.
2022-11-22QUIC: moved variable declaration to fix build with MSVC 2010.Sergey Kandaurov1-36/+32
Previously, ngx_quic_hkdf_t variables used declaration with assignment in the middle of a function, which is not supported by MSVC 2010. Fixing this also required to rewrite the ngx_quic_hkdf_set macro and to switch to an explicit array size.
2022-10-20QUIC: using native TLSv1.3 cipher suite constants.Sergey Kandaurov1-8/+11
After BoringSSL aligned[1] with OpenSSL on TLS1_3_CK_* macros, and LibreSSL uses OpenSSL naming, our own variants can be dropped now. Compatibility is preserved with libraries that lack these macros. Additionally, transition to SSL_CIPHER_get_id() fixes build error with LibreSSL that doesn't implement SSL_CIPHER_get_protocol_id(). [1] https://boringssl.googlesource.com/boringssl/+/dfddbc4ded
2022-07-27QUIC: removed ngx_quic_keys_new().Vladimir Homutov1-45/+0
The ngx_quic_keys_t structure is now exposed.
2022-07-27QUIC: avoided pool usage in ngx_quic_protection.c.Vladimir Homutov1-15/+15
2022-07-27QUIC: fixed-length buffers for secrets.Vladimir Homutov1-98/+89
2022-01-26QUIC: removed draft versions support.Sergey Kandaurov1-13/+4
2021-12-07QUIC: converted ngx_quic_keys_set_encryption_secret() to NGX codes.Sergey Kandaurov1-8/+5
While here, removed check for encryption level zero, redundant by its nature.
2021-10-07QUIC: refactored packet creation.Vladimir Homutov1-3/+2
The "min" and "max" arguments refer to UDP datagram size. Generating payload requires to account properly for header size, which is variable and depends on payload size and packet number.
2021-10-26QUIC: style.Sergey Kandaurov1-1/+0
2021-06-17QUIC: compact initial secrets table.Sergey Kandaurov1-32/+6
2021-06-16QUIC: optimized initial secrets key length computation.Sergey Kandaurov1-6/+6
AES-128 key length is known in compile time.
2021-06-16QUIC: consistent use of 12-byte buffers in nonce computation.Sergey Kandaurov1-9/+9
All supported cipher suites produce 96-bit IV (RFC 5116, 5.1, RFC 8439, 2.3). This eliminates a few magic numbers and run-time overhead.
2021-06-16QUIC: consistent use of 5-byte buffers for header protection.Sergey Kandaurov1-8/+11
The output buffer is now also of 5 bytes. Header protection uses stream ciphers, which don't produce extra output nor PKCS padding.
2021-06-16QUIC: updated specification references.Sergey Kandaurov1-10/+18
This includes updating citations and further clarification.
2021-04-13QUIC: normalize header inclusion.Sergey Kandaurov1-2/+1
Stop including QUIC headers with no user-serviceable parts inside. This allows to provide a much cleaner QUIC interface. To cope with that, ngx_quic_derive_key() is now explicitly exported for v3 and quic modules. Additionally, this completely hides the ngx_quic_keys_t internal type.
2021-04-07QUIC: fixed memory leak in ngx_hkdf_extract()/ngx_hkdf_expand().Sergey Kandaurov1-0/+4
This fixes leak on successful path when built with OpenSSL.
2021-03-31QUIC: HKDF API compatibility with OpenSSL master branch.Sergey Kandaurov1-0/+2
OpenSSL 3.0 started to require HKDF-Extract output PRK length pointer used to represent the amount of data written to contain the length of the key buffer before the call. EVP_PKEY_derive() documents this. See HKDF_Extract() internal implementation update in this change: https://github.com/openssl/openssl/commit/5a285ad
2021-03-11QUIC: added error handling to ngx_hkdf_extract()/ngx_hkdf_expand().Vladimir Homutov1-16/+42
The OpenSSL variant of functions lacked proper error processing.
2021-02-19QUIC: multiple versions support.Sergey Kandaurov1-13/+9
Draft-29 and beyond are now supported simultaneously, no need to recompile.
2021-02-18QUIC: removed support prior to draft-29.Sergey Kandaurov1-10/+3
2021-02-15QUIC: fixed indentation.Sergey Kandaurov1-4/+4
2021-02-08QUIC: the "quic_host_key" directive.Vladimir Homutov1-30/+21
The token generation in QUIC is reworked. Single host key is used to generate all required keys of needed sizes using HKDF. The "quic_stateless_reset_token_key" directive is removed. Instead, the "quic_host_key" directive is used, which reads key from file, or sets it to random bytes if not specified.
2021-01-11QUIC: draft-33 salt and retry keys.Sergey Kandaurov1-3/+10
Notably, the version negotiation table is updated to reject draft-33/QUICv1 (which requires a new TLS codepoint) unless explicitly asked to built with.
2020-12-25QUIC: moved all quic sources into src/event/quic.Vladimir Homutov1-0/+1188