| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -432,7 +432,7 @@ int ngtcp2_crypto_hp_mask(uint8_t *dest, const ngtcp2_crypto_cipher *hp, | |||
| 432 | 432 | int ngtcp2_crypto_read_write_crypto_data( | |
| 433 | 433 | ngtcp2_conn *conn, ngtcp2_encryption_level encryption_level, | |
| 434 | 434 | const uint8_t *data, size_t datalen) { | |
| 435 | - SSL *ssl = ngtcp2_conn_get_tls_native_handle(conn); | ||
| 435 | + SSL *ssl = ngtcp2_conn_get_tls_native_handle2(conn); | ||
| 436 | 436 | int rv; | |
| 437 | 437 | int err; | |
| 438 | 438 | ||
@@ -444,7 +444,7 @@ int ngtcp2_crypto_read_write_crypto_data( | |||
| 444 | 444 | return -1; | |
| 445 | 445 | } | |
| 446 | 446 | ||
| 447 | - if (!ngtcp2_conn_get_handshake_completed(conn)) { | ||
| 447 | + if (!ngtcp2_conn_get_handshake_completed2(conn)) { | ||
| 448 | 448 | retry: | |
| 449 | 449 | rv = SSL_do_handshake(ssl); | |
| 450 | 450 | if (rv <= 0) { | |
@@ -456,7 +456,7 @@ int ngtcp2_crypto_read_write_crypto_data( | |||
| 456 | 456 | case SSL_ERROR_SSL: | |
| 457 | 457 | return -1; | |
| 458 | 458 | case SSL_ERROR_EARLY_DATA_REJECTED: | |
| 459 | - assert(!ngtcp2_conn_is_server(conn)); | ||
| 459 | + assert(!ngtcp2_conn_is_server2(conn)); | ||
| 460 | 460 | ||
| 461 | 461 | SSL_reset_early_data_reject(ssl); | |
| 462 | 462 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,46 @@ | |||
| 1 | + /* | ||
| 2 | + * ngtcp2 | ||
| 3 | + * | ||
| 4 | + * Copyright (c) 2026 ngtcp2 contributors | ||
| 5 | + * | ||
| 6 | + * Permission is hereby granted, free of charge, to any person obtaining | ||
| 7 | + * a copy of this software and associated documentation files (the | ||
| 8 | + * "Software"), to deal in the Software without restriction, including | ||
| 9 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
| 10 | + * distribute, sublicense, and/or sell copies of the Software, and to | ||
| 11 | + * permit persons to whom the Software is furnished to do so, subject to | ||
| 12 | + * the following conditions: | ||
| 13 | + * | ||
| 14 | + * The above copyright notice and this permission notice shall be | ||
| 15 | + * included in all copies or substantial portions of the Software. | ||
| 16 | + * | ||
| 17 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| 18 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 19 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| 20 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
| 21 | + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
| 22 | + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
| 23 | + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 24 | + */ | ||
| 25 | + #ifdef HAVE_CONFIG_H | ||
| 26 | + # include <config.h> | ||
| 27 | + #endif /* defined(HAVE_CONFIG_H) */ | ||
| 28 | + | ||
| 29 | + #include "munit.h" | ||
| 30 | + | ||
| 31 | + /* include test cases' include files here */ | ||
| 32 | + #include "shared_test.h" | ||
| 33 | + | ||
| 34 | + int main(int argc, char *argv[]) { | ||
| 35 | + const MunitSuite suites[] = { | ||
| 36 | + shared_suite, | ||
| 37 | + {0}, | ||
| 38 | + }; | ||
| 39 | + const MunitSuite suite = { | ||
| 40 | + .prefix = "", | ||
| 41 | + .suites = suites, | ||
| 42 | + .iterations = 1, | ||
| 43 | + }; | ||
| 44 | + | ||
| 45 | + return munit_suite_main(&suite, NULL, argc, argv); | ||
| 46 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -338,16 +338,16 @@ ngtcp2_crypto_hp_mask_cb(uint8_t *dest, const ngtcp2_crypto_cipher *hp, | |||
| 338 | 338 | * :enum:`ngtcp2_encryption_level.NGTCP2_ENCRYPTION_LEVEL_0RTT`) to | |
| 339 | 339 | * set negotiated AEAD and message digest algorithm. After the | |
| 340 | 340 | * successful call of this function, application can use | |
| 341 | - * `ngtcp2_conn_get_crypto_ctx` (or `ngtcp2_conn_get_0rtt_crypto_ctx` | ||
| 342 | - * if |level| == | ||
| 341 | + * `ngtcp2_conn_get_crypto_ctx2` (or | ||
| 342 | + * `ngtcp2_conn_get_0rtt_crypto_ctx2` if |level| == | ||
| 343 | 343 | * :enum:`ngtcp2_encryption_level.NGTCP2_ENCRYPTION_LEVEL_0RTT`) to | |
| 344 | 344 | * get :type:`ngtcp2_crypto_ctx`. | |
| 345 | 345 | * | |
| 346 | 346 | * If |conn| is initialized as client, and |level| is | |
| 347 | 347 | * :enum:`ngtcp2_encryption_level.NGTCP2_ENCRYPTION_LEVEL_1RTT`, this | |
| 348 | 348 | * function retrieves a remote QUIC transport parameters extension | |
| 349 | - * from an object obtained by `ngtcp2_conn_get_tls_native_handle`, and | ||
| 350 | - * sets it to |conn| by calling | ||
| 349 | + * from an object obtained by `ngtcp2_conn_get_tls_native_handle2`, | ||
| 350 | + * and sets it to |conn| by calling | ||
| 351 | 351 | * `ngtcp2_conn_decode_and_set_remote_transport_params`. | |
| 352 | 352 | * | |
| 353 | 353 | * This function returns 0 if it succeeds, or -1. | |
@@ -385,16 +385,16 @@ NGTCP2_EXTERN int ngtcp2_crypto_derive_and_install_rx_key( | |||
| 385 | 385 | * :enum:`ngtcp2_encryption_level.NGTCP2_ENCRYPTION_LEVEL_0RTT`) to | |
| 386 | 386 | * set negotiated AEAD and message digest algorithm. After the | |
| 387 | 387 | * successful call of this function, application can use | |
| 388 | - * `ngtcp2_conn_get_crypto_ctx` (or `ngtcp2_conn_get_0rtt_crypto_ctx` | ||
| 389 | - * if |level| == | ||
| 388 | + * `ngtcp2_conn_get_crypto_ctx2` (or | ||
| 389 | + * `ngtcp2_conn_get_0rtt_crypto_ctx2` if |level| == | ||
| 390 | 390 | * :enum:`ngtcp2_encryption_level.NGTCP2_ENCRYPTION_LEVEL_0RTT`) to | |
| 391 | 391 | * get :type:`ngtcp2_crypto_ctx`. | |
| 392 | 392 | * | |
| 393 | 393 | * If |conn| is initialized as server, and |level| is | |
| 394 | 394 | * :enum:`ngtcp2_encryption_level.NGTCP2_ENCRYPTION_LEVEL_1RTT`, this | |
| 395 | 395 | * function retrieves a remote QUIC transport parameters extension | |
| 396 | - * from an object obtained by `ngtcp2_conn_get_tls_native_handle`, and | ||
| 397 | - * sets it to |conn| by calling | ||
| 396 | + * from an object obtained by `ngtcp2_conn_get_tls_native_handle2`, | ||
| 397 | + * and sets it to |conn| by calling | ||
| 398 | 398 | * `ngtcp2_conn_decode_and_set_remote_transport_params`. | |
| 399 | 399 | * | |
| 400 | 400 | * This function returns 0 if it succeeds, or -1. | |
@@ -986,15 +986,17 @@ NGTCP2_EXTERN void ngtcp2_crypto_delete_crypto_cipher_ctx_cb( | |||
| 986 | 986 | /** | |
| 987 | 987 | * @function | |
| 988 | 988 | * | |
| 989 | + * .. warning:: | ||
| 990 | + * | ||
| 991 | + * .. version-deprecated:: 1.22.0 | ||
| 992 | + * Use `ngtcp2_crypto_get_path_challenge_data2_cb` instead. | ||
| 993 | + * | ||
| 989 | 994 | * `ngtcp2_crypto_get_path_challenge_data_cb` writes unpredictable | |
| 990 | 995 | * sequence of :macro:`NGTCP2_PATH_CHALLENGE_DATALEN` bytes to |data| | |
| 991 | 996 | * which is sent with PATH_CHALLENGE frame. | |
| 992 | 997 | * | |
| 993 | 998 | * This function can be directly passed to | |
| 994 | 999 | * :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. | ||
| 998 | 1000 | */ | |
| 999 | 1001 | NGTCP2_EXTERN int ngtcp2_crypto_get_path_challenge_data_cb(ngtcp2_conn *conn, | |
| 1000 | 1002 | uint8_t *data, | |
@@ -1010,7 +1012,7 @@ NGTCP2_EXTERN int ngtcp2_crypto_get_path_challenge_data_cb(ngtcp2_conn *conn, | |||
| 1010 | 1012 | * This function can be directly passed to | |
| 1011 | 1013 | * :member:`ngtcp2_callbacks.get_path_challenge_data2` field. | |
| 1012 | 1014 | * | |
| 1013 | - * This function has been available since v1.22.0. | ||
| 1015 | + * .. version-added:: 1.22.0 | ||
| 1014 | 1016 | */ | |
| 1015 | 1017 | NGTCP2_EXTERN int ngtcp2_crypto_get_path_challenge_data2_cb( | |
| 1016 | 1018 | ngtcp2_conn *conn, ngtcp2_path_challenge_data *data, void *user_data); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -440,7 +440,7 @@ static int crypto_ossl_ctx_write_crypto_data(ngtcp2_crypto_ossl_ctx *ossl_ctx, | |||
| 440 | 440 | left = crypto_buf_left(ossl_ctx->crypto_write); | |
| 441 | 441 | } | |
| 442 | 442 | ||
| 443 | - n = ngtcp2_min_size((size_t)(end - data), left); | ||
| 443 | + n = ngtcp2_min((size_t)(end - data), left); | ||
| 444 | 444 | crypto_buf_write(ossl_ctx->crypto_write, data, n); | |
| 445 | 445 | data += n; | |
| 446 | 446 | } | |
@@ -871,7 +871,7 @@ int ngtcp2_crypto_hp_mask(uint8_t *dest, const ngtcp2_crypto_cipher *hp, | |||
| 871 | 871 | int ngtcp2_crypto_read_write_crypto_data( | |
| 872 | 872 | ngtcp2_conn *conn, ngtcp2_encryption_level encryption_level, | |
| 873 | 873 | const uint8_t *data, size_t datalen) { | |
| 874 | - ngtcp2_crypto_ossl_ctx *ossl_ctx = ngtcp2_conn_get_tls_native_handle(conn); | ||
| 874 | + ngtcp2_crypto_ossl_ctx *ossl_ctx = ngtcp2_conn_get_tls_native_handle2(conn); | ||
| 875 | 875 | SSL *ssl = ossl_ctx->ssl; | |
| 876 | 876 | int rv; | |
| 877 | 877 | int err; | |
@@ -881,7 +881,7 @@ int ngtcp2_crypto_read_write_crypto_data( | |||
| 881 | 881 | return -1; | |
| 882 | 882 | } | |
| 883 | 883 | ||
| 884 | - if (!ngtcp2_conn_get_handshake_completed(conn)) { | ||
| 884 | + if (!ngtcp2_conn_get_handshake_completed2(conn)) { | ||
| 885 | 885 | rv = SSL_do_handshake(ssl); | |
| 886 | 886 | if (rv <= 0) { | |
| 887 | 887 | err = SSL_get_error(ssl, rv); | |
@@ -1033,7 +1033,7 @@ static int ossl_yield_secret(SSL *ssl, uint32_t ossl_level, int direction, | |||
| 1033 | 1033 | } | |
| 1034 | 1034 | ||
| 1035 | 1035 | conn = conn_ref->get_conn(conn_ref); | |
| 1036 | - ossl_ctx = ngtcp2_conn_get_tls_native_handle(conn); | ||
| 1036 | + ossl_ctx = ngtcp2_conn_get_tls_native_handle2(conn); | ||
| 1037 | 1037 | ||
| 1038 | 1038 | if (direction) { | |
| 1039 | 1039 | if (ngtcp2_crypto_derive_and_install_tx_key(conn, NULL, NULL, NULL, level, | |
@@ -1067,7 +1067,7 @@ static int ossl_crypto_send(SSL *ssl, const unsigned char *buf, size_t buflen, | |||
| 1067 | 1067 | } | |
| 1068 | 1068 | ||
| 1069 | 1069 | conn = conn_ref->get_conn(conn_ref); | |
| 1070 | - ossl_ctx = ngtcp2_conn_get_tls_native_handle(conn); | ||
| 1070 | + ossl_ctx = ngtcp2_conn_get_tls_native_handle2(conn); | ||
| 1071 | 1071 | ||
| 1072 | 1072 | rv = ngtcp2_conn_submit_crypto_data(conn, ossl_ctx->tx_level, buf, buflen); | |
| 1073 | 1073 | if (rv != 0) { | |
@@ -1094,7 +1094,7 @@ static int ossl_crypto_recv_rcd(SSL *ssl, const unsigned char **buf, | |||
| 1094 | 1094 | } | |
| 1095 | 1095 | ||
| 1096 | 1096 | conn = conn_ref->get_conn(conn_ref); | |
| 1097 | - ossl_ctx = ngtcp2_conn_get_tls_native_handle(conn); | ||
| 1097 | + ossl_ctx = ngtcp2_conn_get_tls_native_handle2(conn); | ||
| 1098 | 1098 | ||
| 1099 | 1099 | crypto_ossl_ctx_read_crypto_data(ossl_ctx, buf, bytes_read); | |
| 1100 | 1100 | ||
@@ -1116,7 +1116,7 @@ static int ossl_crypto_release_rcd(SSL *ssl, size_t released, void *arg) { | |||
| 1116 | 1116 | } | |
| 1117 | 1117 | ||
| 1118 | 1118 | conn = conn_ref->get_conn(conn_ref); | |
| 1119 | - ossl_ctx = ngtcp2_conn_get_tls_native_handle(conn); | ||
| 1119 | + ossl_ctx = ngtcp2_conn_get_tls_native_handle2(conn); | ||
| 1120 | 1120 | ||
| 1121 | 1121 | crypto_ossl_ctx_release_crypto_data(ossl_ctx, released); | |
| 1122 | 1122 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -378,7 +378,7 @@ int ngtcp2_crypto_hp_mask(uint8_t *dest, const ngtcp2_crypto_cipher *hp, | |||
| 378 | 378 | int ngtcp2_crypto_read_write_crypto_data( | |
| 379 | 379 | ngtcp2_conn *conn, ngtcp2_encryption_level encryption_level, | |
| 380 | 380 | const uint8_t *data, size_t datalen) { | |
| 381 | - ngtcp2_crypto_picotls_ctx *cptls = ngtcp2_conn_get_tls_native_handle(conn); | ||
| 381 | + ngtcp2_crypto_picotls_ctx *cptls = ngtcp2_conn_get_tls_native_handle2(conn); | ||
| 382 | 382 | ptls_buffer_t sendbuf; | |
| 383 | 383 | size_t epoch_offsets[5] = {0}; | |
| 384 | 384 | size_t epoch = | |
@@ -402,7 +402,7 @@ int ngtcp2_crypto_read_write_crypto_data( | |||
| 402 | 402 | goto fin; | |
| 403 | 403 | } | |
| 404 | 404 | ||
| 405 | - if (!ngtcp2_conn_is_server(conn) && | ||
| 405 | + if (!ngtcp2_conn_is_server2(conn) && | ||
| 406 | 406 | cptls->handshake_properties.client.early_data_acceptance == | |
| 407 | 407 | PTLS_EARLY_DATA_REJECTED) { | |
| 408 | 408 | rv = ngtcp2_conn_tls_early_data_rejected(conn); | |
@@ -540,7 +540,7 @@ static int set_additional_extensions(ptls_handshake_properties_t *hsprops, | |||
| 540 | 540 | return -1; | |
| 541 | 541 | } | |
| 542 | 542 | ||
| 543 | - nwrite = ngtcp2_conn_encode_local_transport_params(conn, buf, buflen); | ||
| 543 | + nwrite = ngtcp2_conn_encode_local_transport_params2(conn, buf, buflen); | ||
| 544 | 544 | if (nwrite < 0) { | |
| 545 | 545 | goto fail; | |
| 546 | 546 | } | |
@@ -620,7 +620,7 @@ static int update_traffic_key_server_cb(ptls_update_traffic_key_t *self, | |||
| 620 | 620 | * wait for the key to get the correct local transport | |
| 621 | 621 | * parameters from ngtcp2_conn. | |
| 622 | 622 | */ | |
| 623 | - cptls = ngtcp2_conn_get_tls_native_handle(conn); | ||
| 623 | + cptls = ngtcp2_conn_get_tls_native_handle2(conn); | ||
| 624 | 624 | ||
| 625 | 625 | if (set_additional_extensions(&cptls->handshake_properties, conn) != 0) { | |
| 626 | 626 | return -1; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -812,7 +812,7 @@ int ngtcp2_crypto_hp_mask(uint8_t *dest, const ngtcp2_crypto_cipher *hp, | |||
| 812 | 812 | int ngtcp2_crypto_read_write_crypto_data( | |
| 813 | 813 | ngtcp2_conn *conn, ngtcp2_encryption_level encryption_level, | |
| 814 | 814 | const uint8_t *data, size_t datalen) { | |
| 815 | - SSL *ssl = ngtcp2_conn_get_tls_native_handle(conn); | ||
| 815 | + SSL *ssl = ngtcp2_conn_get_tls_native_handle2(conn); | ||
| 816 | 816 | int rv; | |
| 817 | 817 | int err; | |
| 818 | 818 | ||
@@ -824,7 +824,7 @@ int ngtcp2_crypto_read_write_crypto_data( | |||
| 824 | 824 | return -1; | |
| 825 | 825 | } | |
| 826 | 826 | ||
| 827 | - if (!ngtcp2_conn_get_handshake_completed(conn)) { | ||
| 827 | + if (!ngtcp2_conn_get_handshake_completed2(conn)) { | ||
| 828 | 828 | rv = SSL_do_handshake(ssl); | |
| 829 | 829 | if (rv <= 0) { | |
| 830 | 830 | err = SSL_get_error(ssl, rv); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments