| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,6 +36,9 @@ $ cp -R lib/* ../node/deps/ngtcp2/ngtcp2/lib/ | |||
| 36 | 36 | $ cp -R crypto/* ../node/deps/ngtcp2/ngtcp2/crypto/ | |
| 37 | 37 | ``` | |
| 38 | 38 | ||
| 39 | + Be sure to also update the `ngtcp2.gyp` file to reflect any changes in | ||
| 40 | + the source files or include directories. | ||
| 41 | + | ||
| 39 | 42 | ### Updating nghttp3 | |
| 40 | 43 | ||
| 41 | 44 | To update nghttp3, replace `v0.7.0` with the desired git tag: | |
@@ -47,3 +50,6 @@ $ autoreconf -i | |||
| 47 | 50 | $ ./configure --prefix=$PWD/build --enable-lib-only | |
| 48 | 51 | $ cp -R lib/* ../node/deps/ngtcp2/nghttp3/lib/ | |
| 49 | 52 | ``` | |
| 53 | + | ||
| 54 | + Be sure to also update the `ngtcp2.gyp` file to reflect any changes in | ||
| 55 | + the source files or include directories. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,12 +9,13 @@ | |||
| 9 | 9 | 'ngtcp2/lib/ngtcp2_balloc.c', | |
| 10 | 10 | 'ngtcp2/lib/ngtcp2_bbr.c', | |
| 11 | 11 | 'ngtcp2/lib/ngtcp2_buf.c', | |
| 12 | + 'ngtcp2/lib/ngtcp2_callbacks.c', | ||
| 12 | 13 | 'ngtcp2/lib/ngtcp2_cc.c', | |
| 13 | 14 | 'ngtcp2/lib/ngtcp2_cid.c', | |
| 14 | 15 | 'ngtcp2/lib/ngtcp2_conn.c', | |
| 15 | 16 | 'ngtcp2/lib/ngtcp2_conv.c', | |
| 16 | - 'ngtcp2/lib/ngtcp2_dcidtr.c', | ||
| 17 | 17 | 'ngtcp2/lib/ngtcp2_crypto.c', | |
| 18 | + 'ngtcp2/lib/ngtcp2_dcidtr.c', | ||
| 18 | 19 | 'ngtcp2/lib/ngtcp2_err.c', | |
| 19 | 20 | 'ngtcp2/lib/ngtcp2_frame_chain.c', | |
| 20 | 21 | 'ngtcp2/lib/ngtcp2_gaptr.c', | |
@@ -47,8 +48,8 @@ | |||
| 47 | 48 | 'ngtcp2/lib/ngtcp2_window_filter.c', | |
| 48 | 49 | 'ngtcp2/crypto/shared.c' | |
| 49 | 50 | ], | |
| 50 | - 'ngtcp2_sources_quictls': [ | ||
| 51 | - #'ngtcp2/crypto/quictls/quictls.c' | ||
| 51 | + 'ngtcp2_sources_ossl': [ | ||
| 52 | + 'ngtcp2/crypto/ossl/ossl.c' | ||
| 52 | 53 | ], | |
| 53 | 54 | 'ngtcp2_sources_boringssl': [ | |
| 54 | 55 | 'ngtcp2/crypto/boringssl/boringssl.c' | |
@@ -142,7 +143,7 @@ | |||
| 142 | 143 | }, | |
| 143 | 144 | 'sources': [ | |
| 144 | 145 | '<@(ngtcp2_sources)', | |
| 145 | - '<@(ngtcp2_sources_quictls)', | ||
| 146 | + '<@(ngtcp2_sources_ossl)', | ||
| 146 | 147 | ] | |
| 147 | 148 | }, | |
| 148 | 149 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -69,6 +69,13 @@ extern "C" { | |||
| 69 | 69 | */ | |
| 70 | 70 | #define NGTCP2_CRYPTO_ERR_VERIFY_TOKEN -203 | |
| 71 | 71 | ||
| 72 | + /** | ||
| 73 | + * @macro | ||
| 74 | + * | ||
| 75 | + * :macro:`NGTCP2_CRYPTO_ERR_NOMEM` indicates out of memory. | ||
| 76 | + */ | ||
| 77 | + #define NGTCP2_CRYPTO_ERR_NOMEM -501 | ||
| 78 | + | ||
| 72 | 79 | /** | |
| 73 | 80 | * @function | |
| 74 | 81 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,198 @@ | |||
| 1 | + /* | ||
| 2 | + * ngtcp2 | ||
| 3 | + * | ||
| 4 | + * Copyright (c) 2025 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 | + #ifndef NGTCP2_CRYPTO_OSSL_H | ||
| 26 | + #define NGTCP2_CRYPTO_OSSL_H | ||
| 27 | + | ||
| 28 | + #include <ngtcp2/ngtcp2.h> | ||
| 29 | + | ||
| 30 | + #include <openssl/ssl.h> | ||
| 31 | + | ||
| 32 | + #ifdef __cplusplus | ||
| 33 | + extern "C" { | ||
| 34 | + #endif /* defined(__cplusplus) */ | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * @macrosection | ||
| 38 | + * | ||
| 39 | + * ossl specific error codes | ||
| 40 | + */ | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * @macro | ||
| 44 | + * | ||
| 45 | + * :macro:`NGTCP2_CRYPTO_OSSL_ERR_TLS_WANT_X509_LOOKUP` is the error | ||
| 46 | + * code which indicates that TLS handshake routine is interrupted by | ||
| 47 | + * X509 certificate lookup. See :macro:`SSL_ERROR_WANT_X509_LOOKUP` | ||
| 48 | + * error description from `SSL_do_handshake`. | ||
| 49 | + */ | ||
| 50 | + #define NGTCP2_CRYPTO_OSSL_ERR_TLS_WANT_X509_LOOKUP -10001 | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * @macro | ||
| 54 | + * | ||
| 55 | + * :macro:`NGTCP2_CRYPTO_OSSL_ERR_TLS_WANT_CLIENT_HELLO_CB` is the | ||
| 56 | + * error code which indicates that TLS handshake routine is | ||
| 57 | + * interrupted by client hello callback. See | ||
| 58 | + * :macro:`SSL_ERROR_WANT_CLIENT_HELLO_CB` error description from | ||
| 59 | + * `SSL_do_handshake`. | ||
| 60 | + */ | ||
| 61 | + #define NGTCP2_CRYPTO_OSSL_ERR_TLS_WANT_CLIENT_HELLO_CB -10002 | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * @function | ||
| 65 | + * | ||
| 66 | + * `ngtcp2_crypto_ossl_from_ossl_encryption_level` translates | ||
| 67 | + * |ossl_level| to :type:`ngtcp2_encryption_level`. This function is | ||
| 68 | + * only available for ossl backend. | ||
| 69 | + */ | ||
| 70 | + NGTCP2_EXTERN ngtcp2_encryption_level | ||
| 71 | + ngtcp2_crypto_ossl_from_ossl_encryption_level(uint32_t ossl_level); | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * @function | ||
| 75 | + * | ||
| 76 | + * `ngtcp2_crypto_ossl_from_ngtcp2_encryption_level` translates | ||
| 77 | + * |encryption_level| to OpenSSL encryption level. This function is | ||
| 78 | + * only available for ossl backend. | ||
| 79 | + */ | ||
| 80 | + NGTCP2_EXTERN uint32_t ngtcp2_crypto_ossl_from_ngtcp2_encryption_level( | ||
| 81 | + ngtcp2_encryption_level encryption_level); | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * @struct | ||
| 85 | + * | ||
| 86 | + * :type:`ngtcp2_crypto_ossl_ctx` contains per-connection state, and | ||
| 87 | + * must be set to `ngtcp2_conn_set_tls_native_handle`. | ||
| 88 | + */ | ||
| 89 | + typedef struct ngtcp2_crypto_ossl_ctx ngtcp2_crypto_ossl_ctx; | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * @function | ||
| 93 | + * | ||
| 94 | + * `ngtcp2_crypto_ossl_ctx_new` creates new | ||
| 95 | + * :type:`ngtcp2_crypto_ossl_ctx` object, and sets it to |*pctx| if it | ||
| 96 | + * succeeds. | ||
| 97 | + * | ||
| 98 | + * |ssl| is set to |*pctx|. It may be NULL, and in that case, call | ||
| 99 | + * `ngtcp2_crypto_ossl_ctx_set_ssl` later to set ``SSL`` object. | ||
| 100 | + * | ||
| 101 | + * This function returns 0 if it succeeds, or one of the following | ||
| 102 | + * negative error codes: | ||
| 103 | + * | ||
| 104 | + * :enum:`NGTCP2_CRYPTO_ERR_NOMEM` | ||
| 105 | + * Out of memory | ||
| 106 | + */ | ||
| 107 | + NGTCP2_EXTERN int ngtcp2_crypto_ossl_ctx_new(ngtcp2_crypto_ossl_ctx **pctx, | ||
| 108 | + SSL *ssl); | ||
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * @function | ||
| 112 | + * | ||
| 113 | + * `ngtcp2_crypto_ossl_ctx_del` frees resources allocated for |ctx|. | ||
| 114 | + * It also frees memory pointed by |ctx|. | ||
| 115 | + */ | ||
| 116 | + NGTCP2_EXTERN void ngtcp2_crypto_ossl_ctx_del(ngtcp2_crypto_ossl_ctx *ctx); | ||
| 117 | + | ||
| 118 | + /** | ||
| 119 | + * @function | ||
| 120 | + * | ||
| 121 | + * `ngtcp2_crypto_ossl_ctx_set_ssl` sets |ssl| to |ctx|. This | ||
| 122 | + * function must be called after ``SSL`` object is created. | ||
| 123 | + */ | ||
| 124 | + NGTCP2_EXTERN void ngtcp2_crypto_ossl_ctx_set_ssl(ngtcp2_crypto_ossl_ctx *ctx, | ||
| 125 | + SSL *ssl); | ||
| 126 | + | ||
| 127 | + /** | ||
| 128 | + * @function | ||
| 129 | + * | ||
| 130 | + * `ngtcp2_crypto_ossl_ctx_get_ssl` returns ``SSL`` object set to | ||
| 131 | + * |ctx|. If the object has not been set, this function returns NULL. | ||
| 132 | + */ | ||
| 133 | + NGTCP2_EXTERN SSL *ngtcp2_crypto_ossl_ctx_get_ssl(ngtcp2_crypto_ossl_ctx *ctx); | ||
| 134 | + | ||
| 135 | + /** | ||
| 136 | + * @function | ||
| 137 | + * | ||
| 138 | + * `ngtcp2_crypto_ossl_init` initializes libngtcp2_crypto_ossl | ||
| 139 | + * library. This initialization is optional. It is highly | ||
| 140 | + * recommended to call this function before any use of | ||
| 141 | + * libngtcp2_crypto library API to workaround the performance | ||
| 142 | + * regression. | ||
| 143 | + * | ||
| 144 | + * This function returns 0 if it succeeds, or -1. | ||
| 145 | + */ | ||
| 146 | + NGTCP2_EXTERN int ngtcp2_crypto_ossl_init(void); | ||
| 147 | + | ||
| 148 | + /** | ||
| 149 | + * @function | ||
| 150 | + * | ||
| 151 | + * `ngtcp2_crypto_ossl_configure_server_session` configures |ssl| for | ||
| 152 | + * server side QUIC connection. It performs the following | ||
| 153 | + * modifications: | ||
| 154 | + * | ||
| 155 | + * - Register callbacks via ``SSL_set_quic_tls_cbs`` | ||
| 156 | + * | ||
| 157 | + * Application must set a pointer to :type:`ngtcp2_crypto_conn_ref` to | ||
| 158 | + * SSL object by calling SSL_set_app_data, and | ||
| 159 | + * :type:`ngtcp2_crypto_conn_ref` object must have | ||
| 160 | + * :member:`ngtcp2_crypto_conn_ref.get_conn` field assigned to get | ||
| 161 | + * :type:`ngtcp2_conn`. | ||
| 162 | + * | ||
| 163 | + * Application must call ``SSL_set_app_data(ssl, NULL)`` before | ||
| 164 | + * calling ``SSL_free(ssl)`` if you cannot make `ngtcp2_conn` object | ||
| 165 | + * alive until ``SSL_free`` is called. | ||
| 166 | + * | ||
| 167 | + * It returns 0 if it succeeds, or -1. | ||
| 168 | + */ | ||
| 169 | + NGTCP2_EXTERN int ngtcp2_crypto_ossl_configure_server_session(SSL *ssl); | ||
| 170 | + | ||
| 171 | + /** | ||
| 172 | + * @function | ||
| 173 | + * | ||
| 174 | + * `ngtcp2_crypto_ossl_configure_client_session` configures |ssl| for | ||
| 175 | + * client side QUIC connection. It performs the following | ||
| 176 | + * modifications: | ||
| 177 | + * | ||
| 178 | + * - Register callbacks via ``SSL_set_quic_tls_cbs`` | ||
| 179 | + * | ||
| 180 | + * Application must set a pointer to :type:`ngtcp2_crypto_conn_ref` to | ||
| 181 | + * SSL object by calling SSL_set_app_data, and | ||
| 182 | + * :type:`ngtcp2_crypto_conn_ref` object must have | ||
| 183 | + * :member:`ngtcp2_crypto_conn_ref.get_conn` field assigned to get | ||
| 184 | + * :type:`ngtcp2_conn`. | ||
| 185 | + * | ||
| 186 | + * Application must call ``SSL_set_app_data(ssl, NULL)`` before | ||
| 187 | + * calling ``SSL_free(ssl)`` if you cannot make `ngtcp2_conn` object | ||
| 188 | + * alive until ``SSL_free`` is called. | ||
| 189 | + * | ||
| 190 | + * It returns 0 if it succeeds, or -1. | ||
| 191 | + */ | ||
| 192 | + NGTCP2_EXTERN int ngtcp2_crypto_ossl_configure_client_session(SSL *ssl); | ||
| 193 | + | ||
| 194 | + #ifdef __cplusplus | ||
| 195 | + } | ||
| 196 | + #endif /* defined(__cplusplus) */ | ||
| 197 | + | ||
| 198 | + #endif /* !defined(NGTCP2_CRYPTO_OSSL_H) */ | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,7 +37,7 @@ extern "C" { | |||
| 37 | 37 | * @struct | |
| 38 | 38 | * | |
| 39 | 39 | * :type:`ngtcp2_crypto_picotls_ctx` contains per-connection state of | |
| 40 | - * Picotls objects and must be an object to bet set to | ||
| 40 | + * Picotls object, and must be set to | ||
| 41 | 41 | * `ngtcp2_conn_set_tls_native_handle`. | |
| 42 | 42 | */ | |
| 43 | 43 | typedef struct ngtcp2_crypto_picotls_ctx { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments