| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,7 +49,7 @@ | |||
| 49 | 49 | 'ngtcp2/lib/ngtcp2_unreachable.c', | |
| 50 | 50 | 'ngtcp2/lib/ngtcp2_vec.c', | |
| 51 | 51 | 'ngtcp2/lib/ngtcp2_version.c', | |
| 52 | - 'ngtcp2/lib/ngtcp2_window_filter.c', | ||
| 52 | + 'ngtcp2/lib/ngtcp2_wf.c', | ||
| 53 | 53 | 'ngtcp2/crypto/shared.c' | |
| 54 | 54 | ], | |
| 55 | 55 | 'ngtcp2_sources_ossl': [ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -145,6 +145,18 @@ NGTCP2_EXTERN SSL *ngtcp2_crypto_ossl_ctx_get_ssl(ngtcp2_crypto_ossl_ctx *ctx); | |||
| 145 | 145 | */ | |
| 146 | 146 | NGTCP2_EXTERN int ngtcp2_crypto_ossl_init(void); | |
| 147 | 147 | ||
| 148 | + /** | ||
| 149 | + * @function | ||
| 150 | + * | ||
| 151 | + * `ngtcp2_crypto_ossl_free` frees the resources allocated by | ||
| 152 | + * `ngtcp2_crypto_ossl_init`. It is safe to call this function even | ||
| 153 | + * if `ngtcp2_crypto_ossl_init` fails or is not called at all. This | ||
| 154 | + * function might be useful to make some leak detection tools happy. | ||
| 155 | + * | ||
| 156 | + * .. version-added:: 1.24.0 | ||
| 157 | + */ | ||
| 158 | + NGTCP2_EXTERN void ngtcp2_crypto_ossl_free(void); | ||
| 159 | + | ||
| 148 | 160 | /** | |
| 149 | 161 | * @function | |
| 150 | 162 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -79,6 +79,60 @@ int ngtcp2_crypto_ossl_init(void) { | |||
| 79 | 79 | return 0; | |
| 80 | 80 | } | |
| 81 | 81 | ||
| 82 | + void ngtcp2_crypto_ossl_free(void) { | ||
| 83 | + if (crypto_hkdf) { | ||
| 84 | + EVP_KDF_free(crypto_hkdf); | ||
| 85 | + crypto_hkdf = NULL; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + if (crypto_sha384) { | ||
| 89 | + EVP_MD_free(crypto_sha384); | ||
| 90 | + crypto_sha384 = NULL; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + if (crypto_sha256) { | ||
| 94 | + EVP_MD_free(crypto_sha256); | ||
| 95 | + crypto_sha256 = NULL; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + #ifndef NGTCP2_NO_CHACHA_POLY1305 | ||
| 99 | + if (crypto_chacha20) { | ||
| 100 | + EVP_CIPHER_free(crypto_chacha20); | ||
| 101 | + crypto_chacha20 = NULL; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + if (crypto_chacha20_poly1305) { | ||
| 105 | + EVP_CIPHER_free(crypto_chacha20_poly1305); | ||
| 106 | + crypto_chacha20_poly1305 = NULL; | ||
| 107 | + } | ||
| 108 | + #endif /* !defined(NGTCP2_NO_CHACHA_POLY1305) */ | ||
| 109 | + | ||
| 110 | + if (crypto_aes_256_ecb) { | ||
| 111 | + EVP_CIPHER_free(crypto_aes_256_ecb); | ||
| 112 | + crypto_aes_256_ecb = NULL; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + if (crypto_aes_128_ecb) { | ||
| 116 | + EVP_CIPHER_free(crypto_aes_128_ecb); | ||
| 117 | + crypto_aes_128_ecb = NULL; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + if (crypto_aes_128_ccm) { | ||
| 121 | + EVP_CIPHER_free(crypto_aes_128_ccm); | ||
| 122 | + crypto_aes_128_ccm = NULL; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + if (crypto_aes_256_gcm) { | ||
| 126 | + EVP_CIPHER_free(crypto_aes_256_gcm); | ||
| 127 | + crypto_aes_256_gcm = NULL; | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + if (crypto_aes_128_gcm) { | ||
| 131 | + EVP_CIPHER_free(crypto_aes_128_gcm); | ||
| 132 | + crypto_aes_128_gcm = NULL; | ||
| 133 | + } | ||
| 134 | + } | ||
| 135 | + | ||
| 82 | 136 | static const EVP_CIPHER *crypto_aead_aes_128_gcm(void) { | |
| 83 | 137 | if (crypto_aes_128_gcm) { | |
| 84 | 138 | return crypto_aes_128_gcm; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -603,9 +603,9 @@ std::expected<void, Error> ProtoCodec::start_response(Stream *stream) { | |||
| 603 | 603 | nghttp3_pri pri; | |
| 604 | 604 | ||
| 605 | 605 | if (auto rv = | |
| 606 | - nghttp3_conn_get_stream_priority(httpconn_, &pri, stream->stream_id); | ||
| 606 | + nghttp3_conn_get_stream_priority2(httpconn_, &pri, stream->stream_id); | ||
| 607 | 607 | rv != 0) { | |
| 608 | - std::println(stderr, "nghttp3_conn_get_stream_priority: {}", | ||
| 608 | + std::println(stderr, "nghttp3_conn_get_stream_priority2: {}", | ||
| 609 | 609 | nghttp3_strerror(rv)); | |
| 610 | 610 | return std::unexpected{Error::HTTP3}; | |
| 611 | 611 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,23 +36,16 @@ | |||
| 36 | 36 | #include "client_base.h" | |
| 37 | 37 | #include "template.h" | |
| 38 | 38 | ||
| 39 | - namespace { | ||
| 40 | - auto _ = [] { | ||
| 41 | - if (ngtcp2_crypto_ossl_init() != 0) { | ||
| 42 | - assert(0); | ||
| 43 | - abort(); | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | - return 0; | ||
| 47 | - }(); | ||
| 48 | - } // namespace | ||
| 49 | - | ||
| 50 | 39 | extern Config config; | |
| 51 | 40 | ||
| 41 | + TLSClientContext::TLSClientContext() { ngtcp2_crypto_ossl_init(); } | ||
| 42 | + | ||
| 52 | 43 | TLSClientContext::~TLSClientContext() { | |
| 53 | 44 | if (ssl_ctx_) { | |
| 54 | 45 | SSL_CTX_free(ssl_ctx_); | |
| 55 | 46 | } | |
| 47 | + | ||
| 48 | + ngtcp2_crypto_ossl_free(); | ||
| 56 | 49 | } | |
| 57 | 50 | ||
| 58 | 51 | SSL_CTX *TLSClientContext::get_native_handle() const { return ssl_ctx_; } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,7 +37,7 @@ using namespace ngtcp2; | |||
| 37 | 37 | ||
| 38 | 38 | class TLSClientContext { | |
| 39 | 39 | public: | |
| 40 | - TLSClientContext() = default; | ||
| 40 | + TLSClientContext(); | ||
| 41 | 41 | ~TLSClientContext(); | |
| 42 | 42 | ||
| 43 | 43 | std::expected<void, Error> init(const char *private_key_file, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,23 +37,16 @@ | |||
| 37 | 37 | #include "server_base.h" | |
| 38 | 38 | #include "template.h" | |
| 39 | 39 | ||
| 40 | - namespace { | ||
| 41 | - auto _ = [] { | ||
| 42 | - if (ngtcp2_crypto_ossl_init() != 0) { | ||
| 43 | - assert(0); | ||
| 44 | - abort(); | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - return 0; | ||
| 48 | - }(); | ||
| 49 | - } // namespace | ||
| 50 | - | ||
| 51 | 40 | extern Config config; | |
| 52 | 41 | ||
| 42 | + TLSServerContext::TLSServerContext() { ngtcp2_crypto_ossl_init(); } | ||
| 43 | + | ||
| 53 | 44 | TLSServerContext::~TLSServerContext() { | |
| 54 | 45 | if (ssl_ctx_) { | |
| 55 | 46 | SSL_CTX_free(ssl_ctx_); | |
| 56 | 47 | } | |
| 48 | + | ||
| 49 | + ngtcp2_crypto_ossl_free(); | ||
| 57 | 50 | } | |
| 58 | 51 | ||
| 59 | 52 | SSL_CTX *TLSServerContext::get_native_handle() const { return ssl_ctx_; } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,7 +37,7 @@ using namespace ngtcp2; | |||
| 37 | 37 | ||
| 38 | 38 | class TLSServerContext { | |
| 39 | 39 | public: | |
| 40 | - TLSServerContext() = default; | ||
| 40 | + TLSServerContext(); | ||
| 41 | 41 | ~TLSServerContext(); | |
| 42 | 42 | ||
| 43 | 43 | std::expected<void, Error> init(const char *private_key_file, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3485,6 +3485,24 @@ typedef int (*ngtcp2_stream_stop_sending)(ngtcp2_conn *conn, int64_t stream_id, | |||
| 3485 | 3485 | void *user_data, | |
| 3486 | 3486 | void *stream_user_data); | |
| 3487 | 3487 | ||
| 3488 | + /** | ||
| 3489 | + * @functypedef | ||
| 3490 | + * | ||
| 3491 | + * :type:`ngtcp2_recv_stop_sending` is invoked when a STOP_SENDING frame | ||
| 3492 | + * is received from a remote endpoint for a stream identified by | ||
| 3493 | + * |stream_id|. |app_error_code| is the application error code carried | ||
| 3494 | + * by the STOP_SENDING frame. This callback is called at most | ||
| 3495 | + * once per stream. | ||
| 3496 | + * | ||
| 3497 | + * The callback function must return 0 if it succeeds. Returning | ||
| 3498 | + * :macro:`NGTCP2_ERR_CALLBACK_FAILURE` makes the library call return | ||
| 3499 | + * immediately. | ||
| 3500 | + */ | ||
| 3501 | + typedef int (*ngtcp2_recv_stop_sending)(ngtcp2_conn *conn, int64_t stream_id, | ||
| 3502 | + uint64_t app_error_code, | ||
| 3503 | + void *user_data, | ||
| 3504 | + void *stream_user_data); | ||
| 3505 | + | ||
| 3488 | 3506 | /** | |
| 3489 | 3507 | * @functypedef | |
| 3490 | 3508 | * | |
@@ -3626,7 +3644,8 @@ typedef int (*ngtcp2_get_path_challenge_data2)(ngtcp2_conn *conn, | |||
| 3626 | 3644 | #define NGTCP2_CALLBACKS_V1 1 | |
| 3627 | 3645 | #define NGTCP2_CALLBACKS_V2 2 | |
| 3628 | 3646 | #define NGTCP2_CALLBACKS_V3 3 | |
| 3629 | - #define NGTCP2_CALLBACKS_VERSION NGTCP2_CALLBACKS_V3 | ||
| 3647 | + #define NGTCP2_CALLBACKS_V4 4 | ||
| 3648 | + #define NGTCP2_CALLBACKS_VERSION NGTCP2_CALLBACKS_V4 | ||
| 3630 | 3649 | ||
| 3631 | 3650 | /** | |
| 3632 | 3651 | * @struct | |
@@ -3964,6 +3983,16 @@ typedef struct ngtcp2_callbacks { | |||
| 3964 | 3983 | * .. version-added:: 1.22.0 | |
| 3965 | 3984 | */ | |
| 3966 | 3985 | ngtcp2_get_path_challenge_data2 get_path_challenge_data2; | |
| 3986 | + /* The following fields have been added since | ||
| 3987 | + NGTCP2_CALLBACKS_V3. */ | ||
| 3988 | + /** | ||
| 3989 | + * :member:`recv_stop_sending` is a callback function which is invoked | ||
| 3990 | + * when a STOP_SENDING frame is received from a remote endpoint. This | ||
| 3991 | + * callback function is optional. | ||
| 3992 | + * | ||
| 3993 | + * .. version-added:: 1.24.0 | ||
| 3994 | + */ | ||
| 3995 | + ngtcp2_recv_stop_sending recv_stop_sending; | ||
| 3967 | 3996 | } ngtcp2_callbacks; | |
| 3968 | 3997 | ||
| 3969 | 3998 | /** | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,7 @@ | |||
| 36 | 36 | * | |
| 37 | 37 | * Version number of the ngtcp2 library release. | |
| 38 | 38 | */ | |
| 39 | - #define NGTCP2_VERSION "1.23.0" | ||
| 39 | + #define NGTCP2_VERSION "1.24.0" | ||
| 40 | 40 | ||
| 41 | 41 | /** | |
| 42 | 42 | * @macro | |
@@ -46,6 +46,6 @@ | |||
| 46 | 46 | * number, 8 bits for minor and 8 bits for patch. Version 1.2.3 | |
| 47 | 47 | * becomes 0x010203. | |
| 48 | 48 | */ | |
| 49 | - #define NGTCP2_VERSION_NUM 0x011700 | ||
| 49 | + #define NGTCP2_VERSION_NUM 0x011800 | ||
| 50 | 50 | ||
| 51 | 51 | #endif /* !defined(NGTCP2_VERSION_H) */ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments