deps: update ngtcp2 to 1.11.0 · nodejs/node@0a72b16 · GitHub
Skip to content

Commit 0a72b16

Browse files
nodejs-github-botRafaelGSS
authored andcommitted
deps: update ngtcp2 to 1.11.0
PR-URL: #57179 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
1 parent 600fb41 commit 0a72b16

40 files changed

Lines changed: 1724 additions & 1215 deletions

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

Lines changed: 2 additions & 2 deletions

deps/ngtcp2/ngtcp2/crypto/picotls/picotls.c

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static int supported_cipher_suite(ptls_cipher_suite_t *cs) {
125125
#ifdef PTLS_OPENSSL_HAVE_CHACHA20_POLY1305
126126
|| cs->aead == &ptls_openssl_chacha20poly1305
127127
#endif /* defined(PTLS_OPENSSL_HAVE_CHACHA20_POLY1305) */
128-
;
128+
;
129129
}
130130

131131
ngtcp2_crypto_ctx *ngtcp2_crypto_ctx_tls(ngtcp2_crypto_ctx *ctx,
@@ -146,7 +146,7 @@ ngtcp2_crypto_ctx *ngtcp2_crypto_ctx_tls(ngtcp2_crypto_ctx *ctx,
146146
ctx->hp.native_handle = (void *)crypto_cipher_suite_get_hp(cs);
147147
ctx->max_encryption = crypto_cipher_suite_get_aead_max_encryption(cs);
148148
ctx->max_decryption_failure =
149-
crypto_cipher_suite_get_aead_max_decryption_failure(cs);
149+
crypto_cipher_suite_get_aead_max_decryption_failure(cs);
150150
return ctx;
151151
}
152152

@@ -329,19 +329,22 @@ int ngtcp2_crypto_decrypt(uint8_t *dest, const ngtcp2_crypto_aead *aead,
329329
const uint8_t *nonce, size_t noncelen,
330330
const uint8_t *aad, size_t aadlen) {
331331
ptls_aead_context_t *actx = aead_ctx->native_handle;
332+
size_t nwrite;
332333

333334
(void)aead;
334335

335336
ptls_aead_xor_iv(actx, nonce, noncelen);
336337

337-
if (ptls_aead_decrypt(actx, dest, ciphertext, ciphertextlen, 0, aad,
338-
aadlen) == SIZE_MAX) {
339-
return -1;
340-
}
338+
nwrite =
339+
ptls_aead_decrypt(actx, dest, ciphertext, ciphertextlen, 0, aad, aadlen);
341340

342341
/* zero-out static iv once again */
343342
ptls_aead_xor_iv(actx, nonce, noncelen);
344343

344+
if (nwrite == SIZE_MAX) {
345+
return -1;
346+
}
347+
345348
return 0;
346349
}
347350

@@ -360,13 +363,13 @@ int ngtcp2_crypto_hp_mask(uint8_t *dest, const ngtcp2_crypto_cipher *hp,
360363
}
361364

362365
int ngtcp2_crypto_read_write_crypto_data(
363-
ngtcp2_conn *conn, ngtcp2_encryption_level encryption_level,
364-
const uint8_t *data, size_t datalen) {
366+
ngtcp2_conn *conn, ngtcp2_encryption_level encryption_level,
367+
const uint8_t *data, size_t datalen) {
365368
ngtcp2_crypto_picotls_ctx *cptls = ngtcp2_conn_get_tls_native_handle(conn);
366369
ptls_buffer_t sendbuf;
367370
size_t epoch_offsets[5] = {0};
368371
size_t epoch =
369-
ngtcp2_crypto_picotls_from_ngtcp2_encryption_level(encryption_level);
372+
ngtcp2_crypto_picotls_from_ngtcp2_encryption_level(encryption_level);
370373
size_t epoch_datalen;
371374
size_t i;
372375
int rv;
@@ -388,7 +391,7 @@ int ngtcp2_crypto_read_write_crypto_data(
388391

389392
if (!ngtcp2_conn_is_server(conn) &&
390393
cptls->handshake_properties.client.early_data_acceptance ==
391-
PTLS_EARLY_DATA_REJECTED) {
394+
PTLS_EARLY_DATA_REJECTED) {
392395
rv = ngtcp2_conn_tls_early_data_rejected(conn);
393396
if (rv != 0) {
394397
rv = -1;
@@ -405,8 +408,8 @@ int ngtcp2_crypto_read_write_crypto_data(
405408
assert(i != 1);
406409

407410
if (ngtcp2_conn_submit_crypto_data(
408-
conn, ngtcp2_crypto_picotls_from_epoch(i),
409-
sendbuf.base + epoch_offsets[i], epoch_datalen) != 0) {
411+
conn, ngtcp2_crypto_picotls_from_epoch(i),
412+
sendbuf.base + epoch_offsets[i], epoch_datalen) != 0) {
410413
rv = -1;
411414
goto fin;
412415
}
@@ -463,7 +466,7 @@ ngtcp2_encryption_level ngtcp2_crypto_picotls_from_epoch(size_t epoch) {
463466
}
464467

465468
size_t ngtcp2_crypto_picotls_from_ngtcp2_encryption_level(
466-
ngtcp2_encryption_level encryption_level) {
469+
ngtcp2_encryption_level encryption_level) {
467470
switch (encryption_level) {
468471
case NGTCP2_ENCRYPTION_LEVEL_INITIAL:
469472
return 0;
@@ -532,17 +535,17 @@ static int set_additional_extensions(ptls_handshake_properties_t *hsprops,
532535
}
533536

534537
int ngtcp2_crypto_picotls_collect_extension(
535-
ptls_t *ptls, struct st_ptls_handshake_properties_t *properties,
536-
uint16_t type) {
538+
ptls_t *ptls, struct st_ptls_handshake_properties_t *properties,
539+
uint16_t type) {
537540
(void)ptls;
538541
(void)properties;
539542

540543
return type == NGTCP2_TLSEXT_QUIC_TRANSPORT_PARAMETERS_V1;
541544
}
542545

543546
int ngtcp2_crypto_picotls_collected_extensions(
544-
ptls_t *ptls, struct st_ptls_handshake_properties_t *properties,
545-
ptls_raw_extension_t *extensions) {
547+
ptls_t *ptls, struct st_ptls_handshake_properties_t *properties,
548+
ptls_raw_extension_t *extensions) {
546549
ngtcp2_crypto_conn_ref *conn_ref;
547550
ngtcp2_conn *conn;
548551
int rv;
@@ -558,7 +561,7 @@ int ngtcp2_crypto_picotls_collected_extensions(
558561
conn = conn_ref->get_conn(conn_ref);
559562

560563
rv = ngtcp2_conn_decode_and_set_remote_transport_params(
561-
conn, extensions->data.base, extensions->data.len);
564+
conn, extensions->data.base, extensions->data.len);
562565
if (rv != 0) {
563566
ngtcp2_conn_set_tls_error(conn, rv);
564567
return -1;
@@ -613,7 +616,7 @@ static int update_traffic_key_server_cb(ptls_update_traffic_key_t *self,
613616
}
614617

615618
static ptls_update_traffic_key_t update_traffic_key_server = {
616-
update_traffic_key_server_cb,
619+
update_traffic_key_server_cb,
617620
};
618621

619622
static int update_traffic_key_cb(ptls_update_traffic_key_t *self, ptls_t *ptls,
@@ -661,7 +664,7 @@ int ngtcp2_crypto_picotls_configure_client_context(ptls_context_t *ctx) {
661664
}
662665

663666
int ngtcp2_crypto_picotls_configure_server_session(
664-
ngtcp2_crypto_picotls_ctx *cptls) {
667+
ngtcp2_crypto_picotls_ctx *cptls) {
665668
ptls_handshake_properties_t *hsprops = &cptls->handshake_properties;
666669

667670
hsprops->collect_extension = ngtcp2_crypto_picotls_collect_extension;
@@ -671,7 +674,7 @@ int ngtcp2_crypto_picotls_configure_server_session(
671674
}
672675

673676
int ngtcp2_crypto_picotls_configure_client_session(
674-
ngtcp2_crypto_picotls_ctx *cptls, ngtcp2_conn *conn) {
677+
ngtcp2_crypto_picotls_ctx *cptls, ngtcp2_conn *conn) {
675678
ptls_handshake_properties_t *hsprops = &cptls->handshake_properties;
676679

677680
hsprops->client.max_early_data_size = calloc(1, sizeof(size_t));
@@ -692,7 +695,7 @@ int ngtcp2_crypto_picotls_configure_client_session(
692695
}
693696

694697
void ngtcp2_crypto_picotls_deconfigure_session(
695-
ngtcp2_crypto_picotls_ctx *cptls) {
698+
ngtcp2_crypto_picotls_ctx *cptls) {
696699
ptls_handshake_properties_t *hsprops;
697700
ptls_raw_extension_t *exts;
698701

deps/ngtcp2/ngtcp2/lib/includes/ngtcp2/ngtcp2.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,12 @@ typedef void *(*ngtcp2_realloc)(void *ptr, size_t size, void *user_data);
167167
* }
168168
*
169169
* void conn_new() {
170-
* ngtcp2_mem mem = {NULL, my_malloc_cb, my_free_cb, my_calloc_cb,
171-
* my_realloc_cb};
170+
* ngtcp2_mem mem = {
171+
* .malloc = my_malloc_cb,
172+
* .free = my_free_cb,
173+
* .calloc = my_calloc_cb,
174+
* .realloc = my_realloc_cb,
175+
* };
172176
*
173177
* ...
174178
* }

deps/ngtcp2/ngtcp2/lib/includes/ngtcp2/version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
*
3737
* Version number of the ngtcp2 library release.
3838
*/
39-
#define NGTCP2_VERSION "1.10.0"
39+
#define NGTCP2_VERSION "1.11.0"
4040

4141
/**
4242
* @macro
@@ -46,6 +46,6 @@
4646
* number, 8 bits for minor and 8 bits for patch. Version 1.2.3
4747
* becomes 0x010203.
4848
*/
49-
#define NGTCP2_VERSION_NUM 0x010a00
49+
#define NGTCP2_VERSION_NUM 0x010b00
5050

5151
#endif /* !defined(NGTCP2_VERSION_H) */

deps/ngtcp2/ngtcp2/lib/ngtcp2_acktr.c

Lines changed: 114 additions & 0 deletions

0 commit comments

Comments
 (0)