deps: update ngtcp2 to 1.19.0 · nodejs/node@9b136db · GitHub
Skip to content

Commit 9b136db

Browse files
nodejs-github-botRafaelGSS
authored andcommitted
deps: update ngtcp2 to 1.19.0
PR-URL: #61156 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
1 parent 67fbf4d commit 9b136db

138 files changed

Lines changed: 5616 additions & 18518 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

deps/ngtcp2/ngtcp2.gyp

Lines changed: 1 addition & 0 deletions

deps/ngtcp2/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto.h

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,10 @@ NGTCP2_EXTERN int ngtcp2_crypto_generate_stateless_reset_token(
627627
* @macro
628628
*
629629
* :macro:`NGTCP2_CRYPTO_MAX_REGULAR_TOKENLEN` is the maximum length
630-
* of a token generated by `ngtcp2_crypto_generate_regular_token`.
630+
* of a token generated by `ngtcp2_crypto_generate_regular_token`.
631+
* `ngtcp2_crypto_generate_regular_token2` generates a token of length
632+
* at most :macro:`NGTCP2_CRYPTO_MAX_REGULAR_TOKENLEN` bytes + the
633+
* length of the provided opaque data.
631634
*/
632635
#define NGTCP2_CRYPTO_MAX_REGULAR_TOKENLEN \
633636
(/* magic = */ 1 + sizeof(ngtcp2_tstamp) + /* aead tag = */ 16 + \
@@ -787,6 +790,77 @@ NGTCP2_EXTERN int ngtcp2_crypto_verify_regular_token(
787790
size_t secretlen, const ngtcp2_sockaddr *remote_addr,
788791
ngtcp2_socklen remote_addrlen, ngtcp2_duration timeout, ngtcp2_tstamp ts);
789792

793+
/**
794+
* @function
795+
*
796+
* `ngtcp2_crypto_generate_regular_token2` generates a token in the
797+
* buffer pointed by |token| that is sent with NEW_TOKEN frame. The
798+
* buffer pointed by |token| must have at least
799+
* :macro:`NGTCP2_CRYPTO_MAX_REGULAR_TOKENLEN` + |datalen| bytes long.
800+
* The successfully generated token starts with
801+
* :macro:`NGTCP2_CRYPTO_TOKEN_MAGIC_REGULAR`. |secret| of length
802+
* |secretlen| is a keying material to generate keys to encrypt the
803+
* token. |remote_addr| of length |remote_addrlen| is an address of
804+
* client. |ts| is the timestamp when the token is generated. |data|
805+
* of length |datalen| is an opaque data embedded in the token.
806+
* |datalen| must be less than or equal to 256.
807+
*
808+
* Calling this function with |datalen| = 0 is equivalent to calling
809+
* `ngtcp2_crypto_generate_regular_token`.
810+
*
811+
* To get the opaque data after successful verification, use
812+
* `ngtcp2_crypto_verify_regular_token2`.
813+
* `ngtcp2_crypto_verify_regular_token` can verify the token with
814+
* |datalen| > 0, but it discards the opaque data.
815+
*
816+
* This function returns the length of generated token if it succeeds,
817+
* or -1.
818+
*/
819+
NGTCP2_EXTERN ngtcp2_ssize ngtcp2_crypto_generate_regular_token2(
820+
uint8_t *token, const uint8_t *secret, size_t secretlen,
821+
const ngtcp2_sockaddr *remote_addr, ngtcp2_socklen remote_addrlen,
822+
const void *data, size_t datalen, ngtcp2_tstamp ts);
823+
824+
/**
825+
* @function
826+
*
827+
* `ngtcp2_crypto_verify_regular_token2` verifies a regular token
828+
* stored in the buffer pointed by |token| of length |tokenlen|.
829+
* |secret| of length |secretlen| is a keying material to generate
830+
* keys to decrypt the token. |remote_addr| of length
831+
* |remote_addrlen| is an address of client. |timeout| is the period
832+
* during which the token is valid. |ts| is the current timestamp.
833+
* |data| is the pointer to the buffer of length at least
834+
* |max_datalen| bytes. If the token is verified successfully, the
835+
* opaque data embedded in the token is copied to the buffer pointed
836+
* by |data|.
837+
*
838+
* If |tokenlen| is less than
839+
* :macro:`NGTCP2_CRYPTO_MAX_REGULAR_TOKENLEN`, this function returns
840+
* :macro:`NGTCP2_CRYPTO_ERR_UNREADABLE_TOKEN`.
841+
*
842+
* If the length of opaque data is larger than |max_datalen|, the
843+
* verification still succeeds, but nothing is written to the buffer
844+
* pointed by |data|, and this function returns 0. In other words,
845+
* the opaque data is discarded.
846+
*
847+
* This function returns the number of the opaque data written to the
848+
* buffer pointed by |data| if it succeeds, or one of the following
849+
* negative error codes:
850+
*
851+
* :macro:`NGTCP2_CRYPTO_ERR_UNREADABLE_TOKEN`
852+
* A token is badly formatted; or verifying the integrity
853+
* protection failed.
854+
* :macro:`NGTCP2_CRYPTO_ERR_VERIFY_TOKEN`
855+
* A token validity has expired.
856+
* :macro:`NGTCP2_CRYPTO_ERR_INTERNAL`
857+
* Internal error occurred.
858+
*/
859+
NGTCP2_EXTERN ngtcp2_ssize ngtcp2_crypto_verify_regular_token2(
860+
void *data, size_t max_datalen, const uint8_t *token, size_t tokenlen,
861+
const uint8_t *secret, size_t secretlen, const ngtcp2_sockaddr *remote_addr,
862+
ngtcp2_socklen remote_addrlen, ngtcp2_duration timeout, ngtcp2_tstamp ts);
863+
790864
/**
791865
* @function
792866
*

deps/ngtcp2/ngtcp2/crypto/ossl/ossl.c

Lines changed: 41 additions & 53 deletions

0 commit comments

Comments
 (0)