GeezerVison is showing github.com — deps: update ngtcp2 to 1.22.0 · nodejs/node@15530a7
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: deps/ngtcp2/ngtcp2/crypto/boringssl/boringssl.c +27-3Lines changed: 27 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -402,7 +402,7 @@ int ngtcp2_crypto_decrypt(uint8_t *dest, const ngtcp2_crypto_aead *aead, | 402 | 402 | int ngtcp2_crypto_hp_mask(uint8_t *dest, const ngtcp2_crypto_cipher *hp, | 403 | 403 | const ngtcp2_crypto_cipher_ctx *hp_ctx, | 404 | 404 | const uint8_t *sample) { | 405 | | - static const uint8_t PLAINTEXT[] = "\x00\x00\x00\x00\x00"; | | 405 | + static const uint8_t PLAINTEXT[16] = {0}; | 406 | 406 | ngtcp2_crypto_boringssl_cipher_ctx *ctx = hp_ctx->native_handle; | 407 | 407 | uint32_t counter; | 408 | 408 |
| @@ -420,7 +420,7 @@ int ngtcp2_crypto_hp_mask(uint8_t *dest, const ngtcp2_crypto_cipher *hp, | 420 | 420 | #else /* !defined(WORDS_BIGENDIAN) */ | 421 | 421 | memcpy(&counter, sample, sizeof(counter)); | 422 | 422 | #endif /* !defined(WORDS_BIGENDIAN) */ | 423 | | - CRYPTO_chacha_20(dest, PLAINTEXT, ngtcp2_strlen_lit(PLAINTEXT), ctx->key, | | 423 | + CRYPTO_chacha_20(dest, PLAINTEXT, sizeof(PLAINTEXT), ctx->key, | 424 | 424 | sample + sizeof(counter), counter); | 425 | 425 | return 0; | 426 | 426 | default: | @@ -436,7 +436,8 @@ int ngtcp2_crypto_read_write_crypto_data( | 436 | 436 | int rv; | 437 | 437 | int err; | 438 | 438 |
| 439 | | - if (SSL_provide_quic_data( | | 439 | + if (datalen && | | 440 | + SSL_provide_quic_data( | 440 | 441 | ssl, | 441 | 442 | ngtcp2_crypto_boringssl_from_ngtcp2_encryption_level(encryption_level), | 442 | 443 | data, datalen) != 1) { | @@ -465,6 +466,16 @@ int ngtcp2_crypto_read_write_crypto_data( | 465 | 466 | } | 466 | 467 |
| 467 | 468 | goto retry; | | 469 | + case SSL_ERROR_WANT_X509_LOOKUP: | | 470 | + case SSL_ERROR_WANT_PRIVATE_KEY_OPERATION: | | 471 | + case SSL_ERROR_WANT_CERTIFICATE_VERIFY: | | 472 | + /* It might be better to return this error, but ngtcp2 does | | 473 | + not need to know whether handshake has been interrupted or | | 474 | + not. We expect that necessary plumbing should be done by | | 475 | + application when handshake is interrupted (e.g., via | | 476 | + SSL_PRIVATE_KEY_METHOD). If it does not work, we will | | 477 | + reconsider this. */ | | 478 | + return 0; | 468 | 479 | default: | 469 | 480 | return -1; | 470 | 481 | } | @@ -568,6 +579,19 @@ int ngtcp2_crypto_get_path_challenge_data_cb(ngtcp2_conn *conn, uint8_t *data, | 568 | 579 | return 0; | 569 | 580 | } | 570 | 581 |
| | 582 | +int ngtcp2_crypto_get_path_challenge_data2_cb(ngtcp2_conn *conn, | | 583 | + ngtcp2_path_challenge_data *data, | | 584 | + void *user_data) { | | 585 | + (void)conn; | | 586 | + (void)user_data; | | 587 | + | | 588 | + if (RAND_bytes(data->data, NGTCP2_PATH_CHALLENGE_DATALEN) != 1) { | | 589 | + return NGTCP2_ERR_CALLBACK_FAILURE; | | 590 | + } | | 591 | + | | 592 | + return 0; | | 593 | +} | | 594 | + | 571 | 595 | int ngtcp2_crypto_random(uint8_t *data, size_t datalen) { | 572 | 596 | if (RAND_bytes(data, datalen) != 1) { | 573 | 597 | return -1; | |
Collapse file Copy file name to clipboardExpand all lines: deps/ngtcp2/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto.h +39-7Lines changed: 39 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -524,11 +524,14 @@ NGTCP2_EXTERN int ngtcp2_crypto_recv_client_initial_cb(ngtcp2_conn *conn, | 524 | 524 | * completes. It is allowed to call this function with |datalen| == | 525 | 525 | * 0. In this case, no additional read operation is done. | 526 | 526 | * | | 527 | + * This function is implemented per TLS backend. See | | 528 | + * :ref:`tls-integration` for more details. | | 529 | + * | 527 | 530 | * This function returns 0 if it succeeds, or a negative error code. | 528 | 531 | * The generic error code is -1 if a specific error code is not | 529 | 532 | * suitable. The error codes less than -10000 are specific to | 530 | | - * underlying TLS implementation. For quictls, the error codes are | 531 | | - * defined in *ngtcp2_crypto_quictls.h*. | | 533 | + * underlying TLS implementation. Refer to the implementation | | 534 | + * specific header files for error codes. | 532 | 535 | */ | 533 | 536 | NGTCP2_EXTERN int | 534 | 537 | ngtcp2_crypto_read_write_crypto_data(ngtcp2_conn *conn, | @@ -542,11 +545,22 @@ ngtcp2_crypto_read_write_crypto_data(ngtcp2_conn *conn, | 542 | 545 | * `ngtcp2_crypto_read_write_crypto_data`. It can be directly passed | 543 | 546 | * to :member:`ngtcp2_callbacks.recv_crypto_data` field. | 544 | 547 | * | | 548 | + * For quictls and OpenSSL, the following error codes are treated as | | 549 | + * success: | | 550 | + * | | 551 | + * - -10001 (e.g., :macro:`NGTCP2_CRYPTO_QUICTLS_ERR_TLS_WANT_X509_LOOKUP`) | | 552 | + * - -10002 (e.g., :macro:`NGTCP2_CRYPTO_QUICTLS_ERR_TLS_WANT_CLIENT_HELLO_CB`) | | 553 | + * | | 554 | + * To continue the interrupted handshake, call | | 555 | + * `ngtcp2_conn_continue_handshake`. | | 556 | + * | | 557 | + * See :ref:`tls-integration` for more details. | | 558 | + * | 545 | 559 | * If this function is used, the TLS implementation specific error | 546 | 560 | * codes described in `ngtcp2_crypto_read_write_crypto_data` are | 547 | | - * treated as if it returns -1. Do not use this function if an | 548 | | - * application wishes to use the TLS implementation specific error | 549 | | - * codes. | | 561 | + * treated as if it returns -1 except for those that are listed above. | | 562 | + * Do not use this function if an application wishes to use the TLS | | 563 | + * implementation specific error codes. | 550 | 564 | */ | 551 | 565 | NGTCP2_EXTERN int ngtcp2_crypto_recv_crypto_data_cb( | 552 | 566 | ngtcp2_conn *conn, ngtcp2_encryption_level encryption_level, uint64_t offset, | @@ -583,15 +597,15 @@ NGTCP2_EXTERN int ngtcp2_crypto_generate_stateless_reset_token( | 583 | 597 | * :macro:`NGTCP2_CRYPTO_TOKEN_MAGIC_RETRY` is the magic byte for | 584 | 598 | * Retry token generated by `ngtcp2_crypto_generate_retry_token`. | 585 | 599 | */ | 586 | | -#define NGTCP2_CRYPTO_TOKEN_MAGIC_RETRY 0xb6 | | 600 | +#define NGTCP2_CRYPTO_TOKEN_MAGIC_RETRY 0xB6 | 587 | 601 |
| 588 | 602 | /** | 589 | 603 | * @macro | 590 | 604 | * | 591 | 605 | * :macro:`NGTCP2_CRYPTO_TOKEN_MAGIC_RETRY2` is the magic byte for | 592 | 606 | * Retry token generated by `ngtcp2_crypto_generate_retry_token2`. | 593 | 607 | */ | 594 | | -#define NGTCP2_CRYPTO_TOKEN_MAGIC_RETRY2 0xb7 | | 608 | +#define NGTCP2_CRYPTO_TOKEN_MAGIC_RETRY2 0xB7 | 595 | 609 |
| 596 | 610 | /** | 597 | 611 | * @macro | @@ -978,11 +992,29 @@ NGTCP2_EXTERN void ngtcp2_crypto_delete_crypto_cipher_ctx_cb( | 978 | 992 | * | 979 | 993 | * This function can be directly passed to | 980 | 994 | * :member:`ngtcp2_callbacks.get_path_challenge_data` field. | | 995 | + * | | 996 | + * Deprecated since v1.22.0. Use | | 997 | + * `ngtcp2_crypto_get_path_challenge_data2_cb` instead. | 981 | 998 | */ | 982 | 999 | NGTCP2_EXTERN int ngtcp2_crypto_get_path_challenge_data_cb(ngtcp2_conn *conn, | 983 | 1000 | uint8_t *data, | 984 | 1001 | void *user_data); | 985 | 1002 |
| | 1003 | +/** | | 1004 | + * @function | | 1005 | + * | | 1006 | + * `ngtcp2_crypto_get_path_challenge_data2_cb` writes unpredictable | | 1007 | + * sequence of :macro:`NGTCP2_PATH_CHALLENGE_DATALEN` bytes to |data| | | 1008 | + * which is sent with PATH_CHALLENGE frame. | | 1009 | + * | | 1010 | + * This function can be directly passed to | | 1011 | + * :member:`ngtcp2_callbacks.get_path_challenge_data2` field. | | 1012 | + * | | 1013 | + * This function has been available since v1.22.0. | | 1014 | + */ | | 1015 | +NGTCP2_EXTERN int ngtcp2_crypto_get_path_challenge_data2_cb( | | 1016 | + ngtcp2_conn *conn, ngtcp2_path_challenge_data *data, void *user_data); | | 1017 | + | 986 | 1018 | /** | 987 | 1019 | * @function | 988 | 1020 | * | |
Collapse file Copy file name to clipboardExpand all lines: deps/ngtcp2/ngtcp2/crypto/ossl/ossl.c +48-21Lines changed: 48 additions & 21 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 49 | 49 | static EVP_CIPHER *crypto_aes_128_gcm; | 50 | 50 | static EVP_CIPHER *crypto_aes_256_gcm; | 51 | 51 | static EVP_CIPHER *crypto_aes_128_ccm; | 52 | | -static EVP_CIPHER *crypto_aes_128_ctr; | 53 | | -static EVP_CIPHER *crypto_aes_256_ctr; | | 52 | +static EVP_CIPHER *crypto_aes_128_ecb; | | 53 | +static EVP_CIPHER *crypto_aes_256_ecb; | 54 | 54 | #ifndef NGTCP2_NO_CHACHA_POLY1305 | 55 | 55 | static EVP_CIPHER *crypto_chacha20_poly1305; | 56 | 56 | static EVP_CIPHER *crypto_chacha20; | @@ -66,8 +66,8 @@ int ngtcp2_crypto_ossl_init(void) { | 66 | 66 | crypto_aes_128_gcm = EVP_CIPHER_fetch(NULL, "AES-128-GCM", NULL); | 67 | 67 | crypto_aes_256_gcm = EVP_CIPHER_fetch(NULL, "AES-256-GCM", NULL); | 68 | 68 | crypto_aes_128_ccm = EVP_CIPHER_fetch(NULL, "AES-128-CCM", NULL); | 69 | | - crypto_aes_128_ctr = EVP_CIPHER_fetch(NULL, "AES-128-CTR", NULL); | 70 | | - crypto_aes_256_ctr = EVP_CIPHER_fetch(NULL, "AES-256-CTR", NULL); | | 69 | + crypto_aes_128_ecb = EVP_CIPHER_fetch(NULL, "AES-128-ECB", NULL); | | 70 | + crypto_aes_256_ecb = EVP_CIPHER_fetch(NULL, "AES-256-ECB", NULL); | 71 | 71 | #ifndef NGTCP2_NO_CHACHA_POLY1305 | 72 | 72 | crypto_chacha20_poly1305 = EVP_CIPHER_fetch(NULL, "ChaCha20-Poly1305", NULL); | 73 | 73 | crypto_chacha20 = EVP_CIPHER_fetch(NULL, "ChaCha20", NULL); | @@ -113,20 +113,20 @@ static const EVP_CIPHER *crypto_aead_aes_128_ccm(void) { | 113 | 113 | return EVP_aes_128_ccm(); | 114 | 114 | } | 115 | 115 |
| 116 | | -static const EVP_CIPHER *crypto_cipher_aes_128_ctr(void) { | 117 | | - if (crypto_aes_128_ctr) { | 118 | | - return crypto_aes_128_ctr; | | 116 | +static const EVP_CIPHER *crypto_cipher_aes_128_ecb(void) { | | 117 | + if (crypto_aes_128_ecb) { | | 118 | + return crypto_aes_128_ecb; | 119 | 119 | } | 120 | 120 |
| 121 | | - return EVP_aes_128_ctr(); | | 121 | + return EVP_aes_128_ecb(); | 122 | 122 | } | 123 | 123 |
| 124 | | -static const EVP_CIPHER *crypto_cipher_aes_256_ctr(void) { | 125 | | - if (crypto_aes_256_ctr) { | 126 | | - return crypto_aes_256_ctr; | | 124 | +static const EVP_CIPHER *crypto_cipher_aes_256_ecb(void) { | | 125 | + if (crypto_aes_256_ecb) { | | 126 | + return crypto_aes_256_ecb; | 127 | 127 | } | 128 | 128 |
| 129 | | - return EVP_aes_256_ctr(); | | 129 | + return EVP_aes_256_ecb(); | 130 | 130 | } | 131 | 131 |
| 132 | 132 | #ifndef NGTCP2_NO_CHACHA_POLY1305 | @@ -198,7 +198,7 @@ ngtcp2_crypto_md *ngtcp2_crypto_md_sha256(ngtcp2_crypto_md *md) { | 198 | 198 | ngtcp2_crypto_ctx *ngtcp2_crypto_ctx_initial(ngtcp2_crypto_ctx *ctx) { | 199 | 199 | ngtcp2_crypto_aead_init(&ctx->aead, (void *)crypto_aead_aes_128_gcm()); | 200 | 200 | ctx->md.native_handle = (void *)crypto_md_sha256(); | 201 | | - ctx->hp.native_handle = (void *)crypto_cipher_aes_128_ctr(); | | 201 | + ctx->hp.native_handle = (void *)crypto_cipher_aes_128_ecb(); | 202 | 202 | ctx->max_encryption = 0; | 203 | 203 | ctx->max_decryption_failure = 0; | 204 | 204 | return ctx; | @@ -269,9 +269,9 @@ static const EVP_CIPHER *crypto_cipher_id_get_hp(uint32_t cipher_id) { | 269 | 269 | switch (cipher_id) { | 270 | 270 | case TLS1_3_CK_AES_128_GCM_SHA256: | 271 | 271 | case TLS1_3_CK_AES_128_CCM_SHA256: | 272 | | - return crypto_cipher_aes_128_ctr(); | | 272 | + return crypto_cipher_aes_128_ecb(); | 273 | 273 | case TLS1_3_CK_AES_256_GCM_SHA384: | 274 | | - return crypto_cipher_aes_256_ctr(); | | 274 | + return crypto_cipher_aes_256_ecb(); | 275 | 275 | #ifndef NGTCP2_NO_CHACHA_POLY1305 | 276 | 276 | case TLS1_3_CK_CHACHA20_POLY1305_SHA256: | 277 | 277 | return crypto_cipher_chacha20(); | @@ -838,17 +838,31 @@ int ngtcp2_crypto_decrypt(uint8_t *dest, const ngtcp2_crypto_aead *aead, | 838 | 838 | int ngtcp2_crypto_hp_mask(uint8_t *dest, const ngtcp2_crypto_cipher *hp, | 839 | 839 | const ngtcp2_crypto_cipher_ctx *hp_ctx, | 840 | 840 | const uint8_t *sample) { | 841 | | - static const uint8_t PLAINTEXT[] = "\x00\x00\x00\x00\x00"; | | 841 | + static const uint8_t PLAINTEXT[16] = {0}; | 842 | 842 | EVP_CIPHER_CTX *actx = hp_ctx->native_handle; | 843 | 843 | int len; | 844 | 844 |
| 845 | 845 | (void)hp; | 846 | 846 |
| 847 | | - if (!EVP_EncryptInit_ex(actx, NULL, NULL, NULL, sample) || | 848 | | - !EVP_EncryptUpdate(actx, dest, &len, PLAINTEXT, | 849 | | - ngtcp2_strlen_lit(PLAINTEXT)) || | 850 | | - !EVP_EncryptFinal_ex(actx, dest + ngtcp2_strlen_lit(PLAINTEXT), &len)) { | 851 | | - return -1; | | 847 | + switch (EVP_CIPHER_CTX_nid(actx)) { | | 848 | + case NID_aes_128_ecb: | | 849 | + case NID_aes_256_ecb: | | 850 | + if (!EVP_EncryptUpdate(actx, dest, &len, sample, NGTCP2_HP_SAMPLELEN)) { | | 851 | + return -1; | | 852 | + } | | 853 | + | | 854 | + break; | | 855 | + case NID_chacha20: | | 856 | + if (!EVP_EncryptInit_ex(actx, NULL, NULL, NULL, sample) || | | 857 | + !EVP_EncryptUpdate(actx, dest, &len, PLAINTEXT, sizeof(PLAINTEXT)) || | | 858 | + !EVP_EncryptFinal_ex(actx, dest + sizeof(PLAINTEXT), &len)) { | | 859 | + return -1; | | 860 | + } | | 861 | + | | 862 | + break; | | 863 | + default: | | 864 | + assert(0); | | 865 | + abort(); | 852 | 866 | } | 853 | 867 |
| 854 | 868 | return 0; | @@ -983,6 +997,19 @@ int ngtcp2_crypto_get_path_challenge_data_cb(ngtcp2_conn *conn, uint8_t *data, | 983 | 997 | return 0; | 984 | 998 | } | 985 | 999 |
| | 1000 | +int ngtcp2_crypto_get_path_challenge_data2_cb(ngtcp2_conn *conn, | | 1001 | + ngtcp2_path_challenge_data *data, | | 1002 | + void *user_data) { | | 1003 | + (void)conn; | | 1004 | + (void)user_data; | | 1005 | + | | 1006 | + if (RAND_bytes(data->data, NGTCP2_PATH_CHALLENGE_DATALEN) != 1) { | | 1007 | + return NGTCP2_ERR_CALLBACK_FAILURE; | | 1008 | + } | | 1009 | + | | 1010 | + return 0; | | 1011 | +} | | 1012 | + | 986 | 1013 | int ngtcp2_crypto_random(uint8_t *data, size_t datalen) { | 987 | 1014 | if (RAND_bytes(data, (int)datalen) != 1) { | 988 | 1015 | return -1; | |
Collapse file Copy file name to clipboardExpand all lines: deps/ngtcp2/ngtcp2/crypto/picotls/picotls.c +30-8Lines changed: 30 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,7 +50,7 @@ ngtcp2_crypto_md *ngtcp2_crypto_md_sha256(ngtcp2_crypto_md *md) { | 50 | 50 | ngtcp2_crypto_ctx *ngtcp2_crypto_ctx_initial(ngtcp2_crypto_ctx *ctx) { | 51 | 51 | ngtcp2_crypto_aead_init(&ctx->aead, (void *)&ptls_openssl_aes128gcm); | 52 | 52 | ctx->md.native_handle = (void *)&ptls_openssl_sha256; | 53 | | - ctx->hp.native_handle = (void *)&ptls_openssl_aes128ctr; | | 53 | + ctx->hp.native_handle = (void *)&ptls_openssl_aes128ecb; | 54 | 54 | ctx->max_encryption = 0; | 55 | 55 | ctx->max_decryption_failure = 0; | 56 | 56 | return ctx; | @@ -104,11 +104,11 @@ crypto_cipher_suite_get_aead_max_decryption_failure(ptls_cipher_suite_t *cs) { | 104 | 104 | static const ptls_cipher_algorithm_t * | 105 | 105 | crypto_cipher_suite_get_hp(ptls_cipher_suite_t *cs) { | 106 | 106 | if (cs->aead == &ptls_openssl_aes128gcm) { | 107 | | - return &ptls_openssl_aes128ctr; | | 107 | + return &ptls_openssl_aes128ecb; | 108 | 108 | } | 109 | 109 |
| 110 | 110 | if (cs->aead == &ptls_openssl_aes256gcm) { | 111 | | - return &ptls_openssl_aes256ctr; | | 111 | + return &ptls_openssl_aes256ecb; | 112 | 112 | } | 113 | 113 |
| 114 | 114 | #ifdef PTLS_OPENSSL_HAVE_CHACHA20_POLY1305 | @@ -238,6 +238,11 @@ int ngtcp2_crypto_cipher_ctx_encrypt_init(ngtcp2_crypto_cipher_ctx *cipher_ctx, | 238 | 238 | return -1; | 239 | 239 | } | 240 | 240 |
| | 241 | + if (cipher->native_handle == &ptls_openssl_aes128ecb || | | 242 | + cipher->native_handle == &ptls_openssl_aes256ecb) { | | 243 | + ptls_cipher_init(actx, NULL); | | 244 | + } | | 245 | + | 241 | 246 | cipher_ctx->native_handle = actx; | 242 | 247 |
| 243 | 248 | return 0; | @@ -352,13 +357,20 @@ int ngtcp2_crypto_decrypt(uint8_t *dest, const ngtcp2_crypto_aead *aead, | 352 | 357 | int ngtcp2_crypto_hp_mask(uint8_t *dest, const ngtcp2_crypto_cipher *hp, | 353 | 358 | const ngtcp2_crypto_cipher_ctx *hp_ctx, | 354 | 359 | const uint8_t *sample) { | | 360 | + static const uint8_t PLAINTEXT[16] = {0}; | 355 | 361 | ptls_cipher_context_t *actx = hp_ctx->native_handle; | 356 | | - static const uint8_t PLAINTEXT[] = "\x00\x00\x00\x00\x00"; | 357 | 362 |
| 358 | 363 | (void)hp; | 359 | 364 |
| | 365 | + if (hp->native_handle == &ptls_openssl_aes128ecb || | | 366 | + hp->native_handle == &ptls_openssl_aes256ecb) { | | 367 | + ptls_cipher_encrypt(actx, dest, sample, NGTCP2_HP_SAMPLELEN); | | 368 | + | | 369 | + return 0; | | 370 | + } | | 371 | + | 360 | 372 | ptls_cipher_init(actx, sample); | 361 | | - ptls_cipher_encrypt(actx, dest, PLAINTEXT, ngtcp2_strlen_lit(PLAINTEXT)); | | 373 | + ptls_cipher_encrypt(actx, dest, PLAINTEXT, sizeof(PLAINTEXT)); | 362 | 374 |
| 363 | 375 | return 0; | 364 | 376 | } | @@ -377,7 +389,7 @@ int ngtcp2_crypto_read_write_crypto_data( | 377 | 389 |
| 378 | 390 | ptls_buffer_init(&sendbuf, (void *)"", 0); | 379 | 391 |
| 380 | | - assert(epoch == ptls_get_read_epoch(cptls->ptls)); | | 392 | + assert(datalen == 0 || epoch == ptls_get_read_epoch(cptls->ptls)); | 381 | 393 |
| 382 | 394 | rv = ptls_handle_message(cptls->ptls, &sendbuf, epoch_offsets, epoch, data, | 383 | 395 | datalen, &cptls->handshake_properties); | @@ -493,15 +505,25 @@ int ngtcp2_crypto_get_path_challenge_data_cb(ngtcp2_conn *conn, uint8_t *data, | 493 | 505 | return 0; | 494 | 506 | } | 495 | 507 |
| | 508 | +int ngtcp2_crypto_get_path_challenge_data2_cb(ngtcp2_conn *conn, | | 509 | + ngtcp2_path_challenge_data *data, | | 510 | + void *user_data) { | | 511 | + (void)conn; | | 512 | + (void)user_data; | | 513 | + | | 514 | + ptls_openssl_random_bytes(data->data, NGTCP2_PATH_CHALLENGE_DATALEN); | | 515 | + | | 516 | + return 0; | | 517 | +} | | 518 | + | 496 | 519 | int ngtcp2_crypto_random(uint8_t *data, size_t datalen) { | 497 | 520 | ptls_openssl_random_bytes(data, datalen); | 498 | 521 |
| 499 | 522 | return 0; | 500 | 523 | } | 501 | 524 |
| 502 | 525 | void ngtcp2_crypto_picotls_ctx_init(ngtcp2_crypto_picotls_ctx *cptls) { | 503 | | - cptls->ptls = NULL; | 504 | | - memset(&cptls->handshake_properties, 0, sizeof(cptls->handshake_properties)); | | 526 | + *cptls = (ngtcp2_crypto_picotls_ctx){0}; | 505 | 527 | } | 506 | 528 |
| 507 | 529 | static int set_additional_extensions(ptls_handshake_properties_t *hsprops, | |
|