/src/h2o/deps/picotls/include/picotls.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2016 DeNA Co., Ltd., Kazuho Oku |
3 | | * |
4 | | * Permission is hereby granted, free of charge, to any person obtaining a copy |
5 | | * of this software and associated documentation files (the "Software"), to |
6 | | * deal in the Software without restriction, including without limitation the |
7 | | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
8 | | * sell copies of the Software, and to permit persons to whom the Software is |
9 | | * furnished to do so, subject to the following conditions: |
10 | | * |
11 | | * The above copyright notice and this permission notice shall be included in |
12 | | * all copies or substantial portions of the Software. |
13 | | * |
14 | | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
15 | | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
16 | | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
17 | | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
18 | | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
19 | | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
20 | | * IN THE SOFTWARE. |
21 | | */ |
22 | | #ifndef picotls_h |
23 | | #define picotls_h |
24 | | |
25 | | #ifdef __cplusplus |
26 | | extern "C" { |
27 | | #endif |
28 | | |
29 | | #ifdef _WINDOWS |
30 | | #include "wincompat.h" |
31 | | #endif |
32 | | |
33 | | #include <assert.h> |
34 | | #include <inttypes.h> |
35 | | #include <string.h> |
36 | | #include <sys/types.h> |
37 | | #ifndef _WINDOWS |
38 | | #include <netinet/in.h> |
39 | | #include <arpa/inet.h> |
40 | | #endif |
41 | | |
42 | | #if __GNUC__ >= 3 |
43 | 20.1k | #define PTLS_LIKELY(x) __builtin_expect(!!(x), 1) |
44 | 41.2k | #define PTLS_UNLIKELY(x) __builtin_expect(!!(x), 0) |
45 | 7.52k | #define PTLS_BUILD_ASSERT_EXPR(cond) (sizeof(char[2 * !!(!__builtin_constant_p(cond) || (cond)) - 1]) != 0) |
46 | 0 | #define PTLS_BUILD_ASSERT(cond) ((void)PTLS_BUILD_ASSERT_EXPR(cond)) |
47 | | #else |
48 | | #define PTLS_LIKELY(x) (x) |
49 | | #define PTLS_UNLIKELY(x) (x) |
50 | | #define PTLS_BUILD_ASSERT(cond) 1 |
51 | | #endif |
52 | | |
53 | | /* __builtin_types_compatible_p yields incorrect results when older versions of GCC is used; see #303. |
54 | | * Clang with Xcode 9.4 or prior is known to not work correctly when a pointer is const-qualified; see |
55 | | * https://github.com/h2o/quicly/pull/306#issuecomment-626037269. Older versions of clang upstream works fine, but we do not need |
56 | | * best coverage. This macro is for preventing misuse going into the master branch, having it work one of the compilers supported in |
57 | | * our CI is enough. |
58 | | */ |
59 | | #if ((defined(__clang__) && __clang_major__ >= 10) || __GNUC__ >= 6) && !defined(__cplusplus) |
60 | 7.52k | #define PTLS_ASSERT_IS_ARRAY_EXPR(a) PTLS_BUILD_ASSERT_EXPR(__builtin_types_compatible_p(__typeof__(a[0])[], __typeof__(a))) |
61 | | #else |
62 | | #define PTLS_ASSERT_IS_ARRAY_EXPR(a) 1 |
63 | | #endif |
64 | | |
65 | 7.52k | #define PTLS_ELEMENTSOF(x) (PTLS_ASSERT_IS_ARRAY_EXPR(x) * sizeof(x) / sizeof((x)[0])) |
66 | | |
67 | | #ifdef _WINDOWS |
68 | | #define PTLS_THREADLOCAL __declspec(thread) |
69 | | #else |
70 | | #define PTLS_THREADLOCAL __thread |
71 | | #endif |
72 | | |
73 | | #ifndef PTLS_HAVE_LOG |
74 | | #ifdef _WINDOWS |
75 | | #define PTLS_HAVE_LOG 0 |
76 | | #else |
77 | | #define PTLS_HAVE_LOG 1 |
78 | | #endif |
79 | | #endif |
80 | | |
81 | | #ifndef PTLS_FUZZ_HANDSHAKE |
82 | | #define PTLS_FUZZ_HANDSHAKE 0 |
83 | | #endif |
84 | | |
85 | 0 | #define PTLS_HELLO_RANDOM_SIZE 32 |
86 | | |
87 | 0 | #define PTLS_AES128_KEY_SIZE 16 |
88 | | #define PTLS_AES256_KEY_SIZE 32 |
89 | 0 | #define PTLS_AES_BLOCK_SIZE 16 |
90 | | #define PTLS_AES_IV_SIZE 16 |
91 | | #define PTLS_AESGCM_IV_SIZE 12 |
92 | 0 | #define PTLS_AESGCM_TAG_SIZE 16 |
93 | | #define PTLS_AESGCM_CONFIDENTIALITY_LIMIT 0x2000000 /* 2^25 */ |
94 | | #define PTLS_AESGCM_INTEGRITY_LIMIT UINT64_C(0x40000000000000) /* 2^54 */ |
95 | | #define PTLS_AESCCM_CONFIDENTIALITY_LIMIT 0xB504F3 /* 2^23.5 */ |
96 | | #define PTLS_AESCCM_INTEGRITY_LIMIT 0xB504F3 /* 2^23.5 */ |
97 | | |
98 | | #define PTLS_CHACHA20_KEY_SIZE 32 |
99 | | #define PTLS_CHACHA20_IV_SIZE 16 /* contrary to RFC 7539, follow OpenSSL way of using first 32 bits as ctr and latter 96 as IV */ |
100 | | #define PTLS_CHACHA20POLY1305_IV_SIZE 12 |
101 | | #define PTLS_CHACHA20POLY1305_TAG_SIZE 16 |
102 | | #define PTLS_CHACHA20POLY1305_CONFIDENTIALITY_LIMIT UINT64_MAX /* at least 2^64 */ |
103 | | #define PTLS_CHACHA20POLY1305_INTEGRITY_LIMIT UINT64_C(0x1000000000) /* 2^36 */ |
104 | | |
105 | | #define PTLS_AEGIS128L_KEY_SIZE 16 |
106 | | #define PTLS_AEGIS128L_IV_SIZE 16 |
107 | | #define PTLS_AEGIS128L_TAG_SIZE 16 |
108 | | #define PTLS_AEGIS128L_CONFIDENTIALITY_LIMIT UINT64_MAX /* at least 2^64 */ |
109 | | #define PTLS_AEGIS128L_INTEGRITY_LIMIT UINT64_C(0x1000000000000) /* 2^48 */ |
110 | | |
111 | | #define PTLS_AEGIS256_KEY_SIZE 32 |
112 | | #define PTLS_AEGIS256_IV_SIZE 32 |
113 | | #define PTLS_AEGIS256_TAG_SIZE 16 |
114 | | #define PTLS_AEGIS256_CONFIDENTIALITY_LIMIT UINT64_MAX /* at least 2^64 */ |
115 | | #define PTLS_AEGIS256_INTEGRITY_LIMIT UINT64_C(0x1000000000000) /* 2^48 */ |
116 | | |
117 | | #define PTLS_BLOWFISH_KEY_SIZE 16 |
118 | | #define PTLS_BLOWFISH_BLOCK_SIZE 8 |
119 | | |
120 | | #define PTLS_SHA256_BLOCK_SIZE 64 |
121 | | #define PTLS_SHA256_DIGEST_SIZE 32 |
122 | | |
123 | | #define PTLS_SHA384_BLOCK_SIZE 128 |
124 | | #define PTLS_SHA384_DIGEST_SIZE 48 |
125 | | |
126 | | #define PTLS_SHA512_BLOCK_SIZE 128 |
127 | | #define PTLS_SHA512_DIGEST_SIZE 64 |
128 | | |
129 | 0 | #define PTLS_MAX_SECRET_SIZE 32 |
130 | | #define PTLS_MAX_IV_SIZE 32 |
131 | 0 | #define PTLS_MAX_DIGEST_SIZE 64 |
132 | | |
133 | | /* versions */ |
134 | 0 | #define PTLS_PROTOCOL_VERSION_TLS12 0x0303 |
135 | 0 | #define PTLS_PROTOCOL_VERSION_TLS13 0x0304 |
136 | | |
137 | | /* cipher-suites */ |
138 | 0 | #define PTLS_CIPHER_SUITE_AES_128_GCM_SHA256 0x1301 |
139 | | #define PTLS_CIPHER_SUITE_NAME_AES_128_GCM_SHA256 "TLS_AES_128_GCM_SHA256" |
140 | | #define PTLS_CIPHER_SUITE_AES_256_GCM_SHA384 0x1302 |
141 | | #define PTLS_CIPHER_SUITE_NAME_AES_256_GCM_SHA384 "TLS_AES_256_GCM_SHA384" |
142 | 0 | #define PTLS_CIPHER_SUITE_CHACHA20_POLY1305_SHA256 0x1303 |
143 | | #define PTLS_CIPHER_SUITE_NAME_CHACHA20_POLY1305_SHA256 "TLS_CHACHA20_POLY1305_SHA256" |
144 | | #define PTLS_CIPHER_SUITE_AEGIS256_SHA512 0x1306 |
145 | | #define PTLS_CIPHER_SUITE_NAME_AEGIS256_SHA512 "TLS_AEGIS_256_SHA512" |
146 | | #define PTLS_CIPHER_SUITE_AEGIS128L_SHA256 0x1307 |
147 | | #define PTLS_CIPHER_SUITE_NAME_AEGIS128L_SHA256 "TLS_AEGIS_128L_SHA256" |
148 | | |
149 | | /* TLS/1.2 cipher-suites that we support (for compatibility, OpenSSL names are used) */ |
150 | | #define PTLS_CIPHER_SUITE_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0xc02b |
151 | | #define PTLS_CIPHER_SUITE_NAME_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "ECDHE-ECDSA-AES128-GCM-SHA256" |
152 | | #define PTLS_CIPHER_SUITE_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0xc02c |
153 | | #define PTLS_CIPHER_SUITE_NAME_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "ECDHE-ECDSA-AES256-GCM-SHA384" |
154 | | #define PTLS_CIPHER_SUITE_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0xc02f |
155 | | #define PTLS_CIPHER_SUITE_NAME_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "ECDHE-RSA-AES128-GCM-SHA256" |
156 | | #define PTLS_CIPHER_SUITE_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0xc030 |
157 | | #define PTLS_CIPHER_SUITE_NAME_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "ECDHE-RSA-AES256-GCM-SHA384" |
158 | | #define PTLS_CIPHER_SUITE_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 0xcca8 |
159 | | #define PTLS_CIPHER_SUITE_NAME_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 "ECDHE-RSA-CHACHA20-POLY1305" |
160 | | #define PTLS_CIPHER_SUITE_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 0xcca9 |
161 | | #define PTLS_CIPHER_SUITE_NAME_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 "ECDHE-ECDSA-CHACHA20-POLY1305" |
162 | | |
163 | | /* negotiated_groups */ |
164 | | #define PTLS_GROUP_SECP256R1 23 |
165 | | #define PTLS_GROUP_NAME_SECP256R1 "secp256r1" |
166 | | #define PTLS_GROUP_SECP384R1 24 |
167 | | #define PTLS_GROUP_NAME_SECP384R1 "secp384r1" |
168 | | #define PTLS_GROUP_SECP521R1 25 |
169 | | #define PTLS_GROUP_NAME_SECP521R1 "secp521r1" |
170 | | #define PTLS_GROUP_X25519 29 |
171 | | #define PTLS_GROUP_NAME_X25519 "x25519" |
172 | | #define PTLS_GROUP_X448 30 |
173 | | #define PTLS_GROUP_NAME_X448 "x448" |
174 | | #define PTLS_GROUP_X25519MLKEM768 4588 |
175 | | #define PTLS_GROUP_NAME_X25519MLKEM768 "X25519MLKEM768" |
176 | | |
177 | | /* signature algorithms */ |
178 | 0 | #define PTLS_SIGNATURE_RSA_PKCS1_SHA1 0x0201 |
179 | 0 | #define PTLS_SIGNATURE_RSA_PKCS1_SHA256 0x0401 |
180 | 0 | #define PTLS_SIGNATURE_ECDSA_SECP256R1_SHA256 0x0403 |
181 | | #define PTLS_SIGNATURE_ECDSA_SECP384R1_SHA384 0x0503 |
182 | | #define PTLS_SIGNATURE_ECDSA_SECP521R1_SHA512 0x0603 |
183 | 0 | #define PTLS_SIGNATURE_RSA_PSS_RSAE_SHA256 0x0804 |
184 | | #define PTLS_SIGNATURE_RSA_PSS_RSAE_SHA384 0x0805 |
185 | | #define PTLS_SIGNATURE_RSA_PSS_RSAE_SHA512 0x0806 |
186 | | #define PTLS_SIGNATURE_ED25519 0x0807 |
187 | | |
188 | | /* HPKE */ |
189 | | #define PTLS_HPKE_MODE_BASE 0 |
190 | | #define PTLS_HPKE_MODE_PSK 1 |
191 | | #define PTLS_HPKE_MODE_AUTH 2 |
192 | | #define PTLS_HPKE_MODE_AUTH_PSK 3 |
193 | | #define PTLS_HPKE_KEM_P256_SHA256 16 |
194 | | #define PTLS_HPKE_KEM_P384_SHA384 17 |
195 | 0 | #define PTLS_HPKE_KEM_X25519_SHA256 32 |
196 | 0 | #define PTLS_HPKE_HKDF_SHA256 1 |
197 | | #define PTLS_HPKE_HKDF_SHA384 2 |
198 | | #define PTLS_HPKE_HKDF_SHA512 3 |
199 | 0 | #define PTLS_HPKE_AEAD_AES_128_GCM 1 |
200 | | #define PTLS_HPKE_AEAD_AES_256_GCM 2 |
201 | | #define PTLS_HPKE_AEAD_CHACHA20POLY1305 3 |
202 | | |
203 | | /* error classes and macros */ |
204 | 0 | #define PTLS_ERROR_CLASS_SELF_ALERT 0 |
205 | 0 | #define PTLS_ERROR_CLASS_PEER_ALERT 0x100 |
206 | 0 | #define PTLS_ERROR_CLASS_INTERNAL 0x200 |
207 | | |
208 | 0 | #define PTLS_ERROR_GET_CLASS(e) ((e) & ~0xff) |
209 | | #define PTLS_ALERT_TO_SELF_ERROR(e) ((e) + PTLS_ERROR_CLASS_SELF_ALERT) |
210 | 0 | #define PTLS_ALERT_TO_PEER_ERROR(e) ((e) + PTLS_ERROR_CLASS_PEER_ALERT) |
211 | | #define PTLS_ERROR_TO_ALERT(e) ((e) & 0xff) |
212 | | |
213 | | /* the HKDF prefix */ |
214 | | #define PTLS_HKDF_EXPAND_LABEL_PREFIX "tls13 " |
215 | | |
216 | | /* alerts */ |
217 | 0 | #define PTLS_ALERT_LEVEL_WARNING 1 |
218 | 0 | #define PTLS_ALERT_LEVEL_FATAL 2 |
219 | | |
220 | 0 | #define PTLS_ALERT_CLOSE_NOTIFY 0 |
221 | 0 | #define PTLS_ALERT_UNEXPECTED_MESSAGE 10 |
222 | 0 | #define PTLS_ALERT_BAD_RECORD_MAC 20 |
223 | 0 | #define PTLS_ALERT_HANDSHAKE_FAILURE 40 |
224 | 0 | #define PTLS_ALERT_BAD_CERTIFICATE 42 |
225 | 0 | #define PTLS_ALERT_UNSUPPORTED_CERTIFICATE 43 |
226 | 0 | #define PTLS_ALERT_CERTIFICATE_REVOKED 44 |
227 | 0 | #define PTLS_ALERT_CERTIFICATE_EXPIRED 45 |
228 | 0 | #define PTLS_ALERT_CERTIFICATE_UNKNOWN 46 |
229 | 0 | #define PTLS_ALERT_ILLEGAL_PARAMETER 47 |
230 | 0 | #define PTLS_ALERT_UNKNOWN_CA 48 |
231 | | #define PTLS_ALERT_ACCESS_DENIED 49 |
232 | 0 | #define PTLS_ALERT_DECODE_ERROR 50 |
233 | 0 | #define PTLS_ALERT_DECRYPT_ERROR 51 |
234 | 0 | #define PTLS_ALERT_PROTOCOL_VERSION 70 |
235 | 0 | #define PTLS_ALERT_INTERNAL_ERROR 80 |
236 | | #define PTLS_ALERT_USER_CANCELED 90 |
237 | 0 | #define PTLS_ALERT_MISSING_EXTENSION 109 |
238 | | #define PTLS_ALERT_UNSUPPORTED_EXTENSION 110 |
239 | | #define PTLS_ALERT_UNRECOGNIZED_NAME 112 |
240 | 0 | #define PTLS_ALERT_UNKNOWN_PSK_IDENTITY 115 |
241 | 0 | #define PTLS_ALERT_CERTIFICATE_REQUIRED 116 |
242 | | #define PTLS_ALERT_NO_APPLICATION_PROTOCOL 120 |
243 | 0 | #define PTLS_ALERT_ECH_REQUIRED 121 |
244 | | |
245 | | /* TLS 1.2 */ |
246 | 0 | #define PTLS_TLS12_MASTER_SECRET_SIZE 48 |
247 | | #define PTLS_TLS12_AAD_SIZE 13 |
248 | | #define PTLS_TLS12_AESGCM_FIXED_IV_SIZE 4 |
249 | | #define PTLS_TLS12_AESGCM_RECORD_IV_SIZE 8 |
250 | | #define PTLS_TLS12_CHACHAPOLY_FIXED_IV_SIZE 12 |
251 | | #define PTLS_TLS12_CHACHAPOLY_RECORD_IV_SIZE 0 |
252 | | |
253 | | /* internal errors */ |
254 | 0 | #define PTLS_ERROR_NO_MEMORY (PTLS_ERROR_CLASS_INTERNAL + 1) |
255 | 0 | #define PTLS_ERROR_IN_PROGRESS (PTLS_ERROR_CLASS_INTERNAL + 2) |
256 | 0 | #define PTLS_ERROR_LIBRARY (PTLS_ERROR_CLASS_INTERNAL + 3) |
257 | 0 | #define PTLS_ERROR_INCOMPATIBLE_KEY (PTLS_ERROR_CLASS_INTERNAL + 4) |
258 | | #define PTLS_ERROR_SESSION_NOT_FOUND (PTLS_ERROR_CLASS_INTERNAL + 5) |
259 | 0 | #define PTLS_ERROR_STATELESS_RETRY (PTLS_ERROR_CLASS_INTERNAL + 6) |
260 | 0 | #define PTLS_ERROR_NOT_AVAILABLE (PTLS_ERROR_CLASS_INTERNAL + 7) |
261 | | #define PTLS_ERROR_COMPRESSION_FAILURE (PTLS_ERROR_CLASS_INTERNAL + 8) |
262 | 0 | #define PTLS_ERROR_REJECT_EARLY_DATA (PTLS_ERROR_CLASS_INTERNAL + 9) |
263 | 0 | #define PTLS_ERROR_DELEGATE (PTLS_ERROR_CLASS_INTERNAL + 10) |
264 | 0 | #define PTLS_ERROR_ASYNC_OPERATION (PTLS_ERROR_CLASS_INTERNAL + 11) |
265 | 0 | #define PTLS_ERROR_BLOCK_OVERFLOW (PTLS_ERROR_CLASS_INTERNAL + 12) |
266 | | |
267 | | #define PTLS_ERROR_INCORRECT_BASE64 (PTLS_ERROR_CLASS_INTERNAL + 50) |
268 | | #define PTLS_ERROR_PEM_LABEL_NOT_FOUND (PTLS_ERROR_CLASS_INTERNAL + 51) |
269 | | #define PTLS_ERROR_BER_INCORRECT_ENCODING (PTLS_ERROR_CLASS_INTERNAL + 52) |
270 | | #define PTLS_ERROR_BER_MALFORMED_TYPE (PTLS_ERROR_CLASS_INTERNAL + 53) |
271 | | #define PTLS_ERROR_BER_MALFORMED_LENGTH (PTLS_ERROR_CLASS_INTERNAL + 54) |
272 | | #define PTLS_ERROR_BER_EXCESSIVE_LENGTH (PTLS_ERROR_CLASS_INTERNAL + 55) |
273 | | #define PTLS_ERROR_BER_ELEMENT_TOO_SHORT (PTLS_ERROR_CLASS_INTERNAL + 56) |
274 | | #define PTLS_ERROR_BER_UNEXPECTED_EOC (PTLS_ERROR_CLASS_INTERNAL + 57) |
275 | | #define PTLS_ERROR_DER_INDEFINITE_LENGTH (PTLS_ERROR_CLASS_INTERNAL + 58) |
276 | | #define PTLS_ERROR_INCORRECT_ASN1_SYNTAX (PTLS_ERROR_CLASS_INTERNAL + 59) |
277 | | #define PTLS_ERROR_INCORRECT_PEM_KEY_VERSION (PTLS_ERROR_CLASS_INTERNAL + 60) |
278 | | #define PTLS_ERROR_INCORRECT_PEM_ECDSA_KEY_VERSION (PTLS_ERROR_CLASS_INTERNAL + 61) |
279 | | #define PTLS_ERROR_INCORRECT_PEM_ECDSA_CURVE (PTLS_ERROR_CLASS_INTERNAL + 62) |
280 | | #define PTLS_ERROR_INCORRECT_PEM_ECDSA_KEYSIZE (PTLS_ERROR_CLASS_INTERNAL + 63) |
281 | | #define PTLS_ERROR_INCORRECT_ASN1_ECDSA_KEY_SYNTAX (PTLS_ERROR_CLASS_INTERNAL + 64) |
282 | | |
283 | 0 | #define PTLS_HANDSHAKE_TYPE_CLIENT_HELLO 1 |
284 | 0 | #define PTLS_HANDSHAKE_TYPE_SERVER_HELLO 2 |
285 | 0 | #define PTLS_HANDSHAKE_TYPE_NEW_SESSION_TICKET 4 |
286 | 0 | #define PTLS_HANDSHAKE_TYPE_END_OF_EARLY_DATA 5 |
287 | 0 | #define PTLS_HANDSHAKE_TYPE_ENCRYPTED_EXTENSIONS 8 |
288 | 0 | #define PTLS_HANDSHAKE_TYPE_CERTIFICATE 11 |
289 | 0 | #define PTLS_HANDSHAKE_TYPE_CERTIFICATE_REQUEST 13 |
290 | 0 | #define PTLS_HANDSHAKE_TYPE_CERTIFICATE_VERIFY 15 |
291 | 0 | #define PTLS_HANDSHAKE_TYPE_FINISHED 20 |
292 | 0 | #define PTLS_HANDSHAKE_TYPE_KEY_UPDATE 24 |
293 | 0 | #define PTLS_HANDSHAKE_TYPE_COMPRESSED_CERTIFICATE 25 |
294 | 0 | #define PTLS_HANDSHAKE_TYPE_MESSAGE_HASH 254 |
295 | | #define PTLS_HANDSHAKE_TYPE_PSEUDO_HRR -1 |
296 | | |
297 | 0 | #define PTLS_CERTIFICATE_TYPE_X509 0 |
298 | 0 | #define PTLS_CERTIFICATE_TYPE_RAW_PUBLIC_KEY 2 |
299 | | |
300 | | #define PTLS_ZERO_DIGEST_SHA256 \ |
301 | | {0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, \ |
302 | | 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55} |
303 | | |
304 | | #define PTLS_ZERO_DIGEST_SHA384 \ |
305 | | {0x38, 0xb0, 0x60, 0xa7, 0x51, 0xac, 0x96, 0x38, 0x4c, 0xd9, 0x32, 0x7e, 0xb1, 0xb1, 0xe3, 0x6a, \ |
306 | | 0x21, 0xfd, 0xb7, 0x11, 0x14, 0xbe, 0x07, 0x43, 0x4c, 0x0c, 0xc7, 0xbf, 0x63, 0xf6, 0xe1, 0xda, \ |
307 | | 0x27, 0x4e, 0xde, 0xbf, 0xe7, 0x6f, 0x65, 0xfb, 0xd5, 0x1a, 0xd2, 0xf1, 0x48, 0x98, 0xb9, 0x5b} |
308 | | |
309 | | #define PTLS_ZERO_DIGEST_SHA512 \ |
310 | | {0xcf, 0x83, 0xe1, 0x35, 0x7e, 0xef, 0xb8, 0xbd, 0xf1, 0x54, 0x28, 0x50, 0xd6, 0x6d, 0x80, 0x07, \ |
311 | | 0xd6, 0x20, 0xe4, 0x05, 0x0b, 0x57, 0x15, 0xdc, 0x83, 0xf4, 0xa9, 0x21, 0xd3, 0x6c, 0xe9, 0xce, \ |
312 | | 0x47, 0xd0, 0xd1, 0x3c, 0x5d, 0x85, 0xf2, 0xb0, 0xff, 0x83, 0x18, 0xd2, 0x87, 0x7e, 0xec, 0x2f, \ |
313 | | 0x63, 0xb9, 0x31, 0xbd, 0x47, 0x41, 0x7a, 0x81, 0xa5, 0x38, 0x32, 0x7a, 0xf9, 0x27, 0xda, 0x3e} |
314 | | |
315 | 82.5k | #define PTLS_TO__STR(n) #n |
316 | 82.5k | #define PTLS_TO_STR(n) PTLS_TO__STR(n) |
317 | | |
318 | | /** |
319 | | * default maximum of tickets to send (see ptls_context_t::ticket_requests.server.max_count) |
320 | | */ |
321 | 0 | #define PTLS_DEFAULT_MAX_TICKETS_TO_SERVE 4 |
322 | | |
323 | | typedef struct st_ptls_t ptls_t; |
324 | | typedef struct st_ptls_context_t ptls_context_t; |
325 | | typedef struct st_ptls_key_schedule_t ptls_key_schedule_t; |
326 | | |
327 | | /** |
328 | | * represents a sequence of octets |
329 | | */ |
330 | | typedef struct st_ptls_iovec_t { |
331 | | uint8_t *base; |
332 | | size_t len; |
333 | | } ptls_iovec_t; |
334 | | |
335 | | /** |
336 | | * used for storing output |
337 | | */ |
338 | | typedef struct st_ptls_buffer_t { |
339 | | uint8_t *base; |
340 | | size_t capacity; |
341 | | size_t off; |
342 | | uint8_t is_allocated; /* boolean */ |
343 | | uint8_t align_bits; /* if particular alignment is required, set to log2(alignment); otherwize zero */ |
344 | | } ptls_buffer_t; |
345 | | |
346 | | /** |
347 | | * key exchange context built by ptls_key_exchange_algorithm::create. |
348 | | */ |
349 | | typedef struct st_ptls_key_exchange_context_t { |
350 | | /** |
351 | | * the underlying algorithm |
352 | | */ |
353 | | const struct st_ptls_key_exchange_algorithm_t *algo; |
354 | | /** |
355 | | * public key of this context |
356 | | */ |
357 | | ptls_iovec_t pubkey; |
358 | | /** |
359 | | * This function can be used for deriving a shared secret or for destroying the context. |
360 | | * When `secret` is non-NULL, this callback derives the shared secret using the private key of the context and the peer key |
361 | | * being given, and sets the value in `secret`. The memory pointed to by `secret->base` must be freed by the caller by calling |
362 | | * `free`. When `release` is set, the callee frees resources allocated to the context and set *keyex to NULL. Upon failure |
363 | | * (i.e., when an PTLS error code is returned), `*pubkey` and `*secret` either remain unchanged or are zero-cleared. |
364 | | */ |
365 | | int (*on_exchange)(struct st_ptls_key_exchange_context_t **keyex, int release, ptls_iovec_t *secret, ptls_iovec_t peerkey); |
366 | | } ptls_key_exchange_context_t; |
367 | | |
368 | | /** |
369 | | * A key exchange algorithm. |
370 | | */ |
371 | | typedef const struct st_ptls_key_exchange_algorithm_t { |
372 | | /** |
373 | | * ID defined by the TLS specification |
374 | | */ |
375 | | uint16_t id; |
376 | | /** |
377 | | * Creates a context for asynchronous key exchange. The function is called when ClientHello is generated. The on_exchange |
378 | | * callback of the created context is called when the client receives ServerHello. |
379 | | */ |
380 | | int (*create)(const struct st_ptls_key_exchange_algorithm_t *algo, ptls_key_exchange_context_t **ctx); |
381 | | /** |
382 | | * Implements synchronous key exchange. Called when ServerHello is generated. |
383 | | * Given a public key provided by the peer (`peerkey`), this callback generates an ephemeral private and public key, and returns |
384 | | * the public key (`pubkey`) and a secret (`secret`) derived from the peerkey and private key. |
385 | | * Upon failure (i.e., when an PTLS error code is returned), `*pubkey` and `*secret` either remain unchanged or are |
386 | | * zero-cleared. |
387 | | */ |
388 | | int (*exchange)(const struct st_ptls_key_exchange_algorithm_t *algo, ptls_iovec_t *pubkey, ptls_iovec_t *secret, |
389 | | ptls_iovec_t peerkey); |
390 | | /** |
391 | | * crypto-specific data |
392 | | */ |
393 | | intptr_t data; |
394 | | /** |
395 | | * Description as defined in the IANA TLS registry |
396 | | */ |
397 | | const char *name; |
398 | | } ptls_key_exchange_algorithm_t; |
399 | | |
400 | | /** |
401 | | * context of a symmetric cipher |
402 | | */ |
403 | | typedef struct st_ptls_cipher_context_t { |
404 | | const struct st_ptls_cipher_algorithm_t *algo; |
405 | | /* field above this line must not be altered by the crypto binding */ |
406 | | void (*do_dispose)(struct st_ptls_cipher_context_t *ctx); |
407 | | void (*do_init)(struct st_ptls_cipher_context_t *ctx, const void *iv); |
408 | | void (*do_transform)(struct st_ptls_cipher_context_t *ctx, void *output, const void *input, size_t len); |
409 | | } ptls_cipher_context_t; |
410 | | |
411 | | /** |
412 | | * a symmetric cipher |
413 | | */ |
414 | | typedef const struct st_ptls_cipher_algorithm_t { |
415 | | const char *name; |
416 | | size_t key_size; |
417 | | size_t block_size; |
418 | | size_t iv_size; |
419 | | size_t context_size; |
420 | | int (*setup_crypto)(ptls_cipher_context_t *ctx, int is_enc, const void *key); |
421 | | } ptls_cipher_algorithm_t; |
422 | | |
423 | | /** |
424 | | * This object specifies symmetric cipher to be calculated alongside the AEAD encryption. |
425 | | * QUIC stacks can use this object to apply QUIC header protection and AEAD encryption in one shot. |
426 | | */ |
427 | | typedef struct st_ptls_aead_supplementary_encryption_t { |
428 | | /** |
429 | | * Cipher context to be used. |
430 | | */ |
431 | | ptls_cipher_context_t *ctx; |
432 | | /** |
433 | | * Input to the cipher. |
434 | | * This field may point to the output of AEAD encryption, in which case the input will be read after AEAD encryption is |
435 | | * complete. |
436 | | */ |
437 | | const void *input; |
438 | | /** |
439 | | * Output. |
440 | | */ |
441 | | uint8_t output[16]; |
442 | | } ptls_aead_supplementary_encryption_t; |
443 | | |
444 | | /** |
445 | | * AEAD context. |
446 | | * AEAD implementations are allowed to stuff data at the end of the struct; see `ptls_aead_algorithm_t::setup_crypto`. |
447 | | * Ciphers for TLS over TCP MUST implement `do_encrypt`, `do_encrypt_v`, `do_decrypt`. |
448 | | * `do_encrypt_init`, `~update`, `~final` are obsolete, and therefore may not be available. |
449 | | */ |
450 | | typedef struct st_ptls_aead_context_t { |
451 | | /** |
452 | | * Points to the algorithm. This field is governed by picotls core; backends must not alter. |
453 | | */ |
454 | | const struct st_ptls_aead_algorithm_t *algo; |
455 | | /** |
456 | | * Mandatory callback that disposes of all the backend-specific data. |
457 | | */ |
458 | | void (*dispose_crypto)(struct st_ptls_aead_context_t *ctx); |
459 | | /** |
460 | | * Mandatory callback that returns the static IV. The size of IV is available as `ptls_aead_algorithm_t::iv_size`. |
461 | | */ |
462 | | void (*do_get_iv)(struct st_ptls_aead_context_t *ctx, void *iv); |
463 | | /** |
464 | | * Mandatory callback that sets the static IV. The size of IV is available as `ptls_aead_algorithm_t::iv_size`. |
465 | | */ |
466 | | void (*do_set_iv)(struct st_ptls_aead_context_t *ctx, const void *iv); |
467 | | /** |
468 | | * Deprecated. |
469 | | */ |
470 | | void (*do_encrypt_init)(struct st_ptls_aead_context_t *ctx, uint64_t seq, const void *aad, size_t aadlen); |
471 | | /** |
472 | | * Deprecated. |
473 | | */ |
474 | | size_t (*do_encrypt_update)(struct st_ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen); |
475 | | /** |
476 | | * Deprecated. |
477 | | */ |
478 | | size_t (*do_encrypt_final)(struct st_ptls_aead_context_t *ctx, void *output); |
479 | | /** |
480 | | * Mandatory callback that does "one-shot" encryption of an AEAD block. |
481 | | * When `supp` is set to non-NULL, the callback must also encrypt the supplementary block. |
482 | | * Backends may set this field to `ptls_aead__do_encrypt` that calls `do_encrypt_v` and `ptls_cipher_*` functions for handling |
483 | | * the supplimentary block. |
484 | | */ |
485 | | void (*do_encrypt)(struct st_ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen, uint64_t seq, |
486 | | const void *aad, size_t aadlen, ptls_aead_supplementary_encryption_t *supp); |
487 | | /** |
488 | | * Variant of `do_encrypt` that gathers input from multiple blocks. Support for this callback is also mandatory. |
489 | | * Legacy backends may set this field to `ptls_aead__do_encrypt_v` that calls `do_encrypt_init`, `do_encrypt_update`, |
490 | | * `do_encrypt_final`. |
491 | | */ |
492 | | void (*do_encrypt_v)(struct st_ptls_aead_context_t *ctx, void *output, ptls_iovec_t *input, size_t incnt, uint64_t seq, |
493 | | const void *aad, size_t aadlen); |
494 | | /** |
495 | | * Mandatory callback for decrypting an AEAD block. |
496 | | * If successful, returns the amount of cleartext bytes being written to output. Otherwise, returns SIZE_MAX. |
497 | | */ |
498 | | size_t (*do_decrypt)(struct st_ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen, uint64_t seq, |
499 | | const void *aad, size_t aadlen); |
500 | | } ptls_aead_context_t; |
501 | | |
502 | | /** |
503 | | * An AEAD cipher. |
504 | | */ |
505 | | typedef const struct st_ptls_aead_algorithm_t { |
506 | | /** |
507 | | * name (following the convention of `openssl ciphers -v ALL`) |
508 | | */ |
509 | | const char *name; |
510 | | /** |
511 | | * confidentiality_limit (max records / packets sent before re-key) |
512 | | */ |
513 | | const uint64_t confidentiality_limit; |
514 | | /** |
515 | | * integrity_limit (max decryption failure records / packets before re-key) |
516 | | */ |
517 | | const uint64_t integrity_limit; |
518 | | /** |
519 | | * the underlying key stream |
520 | | */ |
521 | | ptls_cipher_algorithm_t *ctr_cipher; |
522 | | /** |
523 | | * the underlying ecb cipher (might not be available) |
524 | | */ |
525 | | ptls_cipher_algorithm_t *ecb_cipher; |
526 | | /** |
527 | | * key size |
528 | | */ |
529 | | size_t key_size; |
530 | | /** |
531 | | * size of the IV |
532 | | */ |
533 | | size_t iv_size; |
534 | | /** |
535 | | * size of the tag |
536 | | */ |
537 | | size_t tag_size; |
538 | | /** |
539 | | * TLS/1.2 Security Parameters (AEAD without support for TLS 1.2 must set both values to 0) |
540 | | */ |
541 | | struct { |
542 | | size_t fixed_iv_size; |
543 | | size_t record_iv_size; |
544 | | } tls12; |
545 | | /** |
546 | | * if encrypted bytes are going to be written using non-temporal store instructions (i.e., skip cache) |
547 | | */ |
548 | | unsigned non_temporal : 1; |
549 | | /** |
550 | | * log2(alignment) being required |
551 | | */ |
552 | | uint8_t align_bits; |
553 | | /** |
554 | | * size of memory allocated for `ptls_aead_context_t` |
555 | | */ |
556 | | size_t context_size; |
557 | | /** |
558 | | * Backend callback called to setup `ptls_aead_context_t`. |
559 | | * Backends are allowed to stuff arbitrary data at the end of `ptls_aead_context_t`; actual size of the memory chunk being |
560 | | * allocated is that specified by `ptls_aead_algorithm_t::context_size`. When the `setup_crypto` callback is called, all the |
561 | | * fields outside of `ptls_aead_context_t` will be in undefined state; it is the responsibility of the callback to initialize |
562 | | * them, as well as the callbacks of `ptls_aead_context_t` that the backend supports. |
563 | | * A non-zero return value indicates failure, in which case the error will propagate as `ptls_aead_new` returning NULL. |
564 | | */ |
565 | | int (*setup_crypto)(ptls_aead_context_t *ctx, int is_enc, const void *key, const void *iv); |
566 | | } ptls_aead_algorithm_t; |
567 | | |
568 | | /** |
569 | | * |
570 | | */ |
571 | | typedef enum en_ptls_hash_final_mode_t { |
572 | | /** |
573 | | * obtains the digest and frees the context |
574 | | */ |
575 | | PTLS_HASH_FINAL_MODE_FREE = 0, |
576 | | /** |
577 | | * obtains the digest and reset the context to initial state |
578 | | */ |
579 | | PTLS_HASH_FINAL_MODE_RESET = 1, |
580 | | /** |
581 | | * obtains the digest while leaving the context as-is |
582 | | */ |
583 | | PTLS_HASH_FINAL_MODE_SNAPSHOT = 2 |
584 | | } ptls_hash_final_mode_t; |
585 | | |
586 | | /** |
587 | | * A hash context. |
588 | | */ |
589 | | typedef struct st_ptls_hash_context_t { |
590 | | /** |
591 | | * feeds additional data into the hash context |
592 | | */ |
593 | | void (*update)(struct st_ptls_hash_context_t *ctx, const void *src, size_t len); |
594 | | /** |
595 | | * returns the digest and performs necessary operation specified by mode |
596 | | */ |
597 | | void (*final)(struct st_ptls_hash_context_t *ctx, void *md, ptls_hash_final_mode_t mode); |
598 | | /** |
599 | | * creates a copy of the hash context |
600 | | */ |
601 | | struct st_ptls_hash_context_t *(*clone_)(struct st_ptls_hash_context_t *src); |
602 | | } ptls_hash_context_t; |
603 | | |
604 | | /** |
605 | | * A hash algorithm and its properties. |
606 | | */ |
607 | | typedef const struct st_ptls_hash_algorithm_t { |
608 | | /** |
609 | | * name of the hash algorithm |
610 | | */ |
611 | | const char *name; |
612 | | /** |
613 | | * block size |
614 | | */ |
615 | | size_t block_size; |
616 | | /** |
617 | | * digest size |
618 | | */ |
619 | | size_t digest_size; |
620 | | /** |
621 | | * constructor that creates the hash context |
622 | | */ |
623 | | ptls_hash_context_t *(*create)(void); |
624 | | /** |
625 | | * digest of zero-length octets |
626 | | */ |
627 | | uint8_t empty_digest[PTLS_MAX_DIGEST_SIZE]; |
628 | | } ptls_hash_algorithm_t; |
629 | | |
630 | | typedef const struct st_ptls_cipher_suite_t { |
631 | | /** |
632 | | * ID as defined by the TLS Cipher Suites registry |
633 | | */ |
634 | | uint16_t id; |
635 | | /** |
636 | | * underlying AEAD algorithm |
637 | | */ |
638 | | ptls_aead_algorithm_t *aead; |
639 | | /** |
640 | | * underlying hash algorithm |
641 | | */ |
642 | | ptls_hash_algorithm_t *hash; |
643 | | /** |
644 | | * value of the "Description" field of the TLS Cipher Suites registry |
645 | | */ |
646 | | const char *name; |
647 | | } ptls_cipher_suite_t; |
648 | | |
649 | | struct st_ptls_traffic_protection_t; |
650 | | |
651 | | typedef struct st_ptls_message_emitter_t { |
652 | | ptls_buffer_t *buf; |
653 | | struct st_ptls_traffic_protection_t *enc; |
654 | | size_t record_header_length; |
655 | | int (*begin_message)(struct st_ptls_message_emitter_t *self); |
656 | | int (*commit_message)(struct st_ptls_message_emitter_t *self); |
657 | | } ptls_message_emitter_t; |
658 | | |
659 | | /** |
660 | | * HPKE KEM |
661 | | */ |
662 | | typedef const struct st_ptls_hpke_kem_t { |
663 | | uint16_t id; |
664 | | ptls_key_exchange_algorithm_t *keyex; |
665 | | ptls_hash_algorithm_t *hash; |
666 | | } ptls_hpke_kem_t; |
667 | | |
668 | | typedef struct st_ptls_hpke_cipher_suite_id_t { |
669 | | uint16_t kdf; |
670 | | uint16_t aead; |
671 | | } ptls_hpke_cipher_suite_id_t; |
672 | | |
673 | | typedef const struct st_ptls_hpke_cipher_suite_t { |
674 | | ptls_hpke_cipher_suite_id_t id; |
675 | | const char *name; /* in form of "<kdf>/<aead>" using the sames specified in IANA HPKE registry */ |
676 | | ptls_hash_algorithm_t *hash; |
677 | | ptls_aead_algorithm_t *aead; |
678 | | } ptls_hpke_cipher_suite_t; |
679 | | |
680 | | #define PTLS_CALLBACK_TYPE0(ret, name) \ |
681 | | typedef struct st_ptls_##name##_t { \ |
682 | | ret (*cb)(struct st_ptls_##name##_t * self); \ |
683 | | } ptls_##name##_t |
684 | | |
685 | | #define PTLS_CALLBACK_TYPE(ret, name, ...) \ |
686 | | typedef struct st_ptls_##name##_t { \ |
687 | | ret (*cb)(struct st_ptls_##name##_t * self, __VA_ARGS__); \ |
688 | | } ptls_##name##_t |
689 | | |
690 | | typedef struct st_ptls_client_hello_psk_identity_t { |
691 | | ptls_iovec_t identity; |
692 | | uint32_t obfuscated_ticket_age; |
693 | | ptls_iovec_t binder; |
694 | | } ptls_client_hello_psk_identity_t; |
695 | | |
696 | | /** |
697 | | * arguments passsed to the on_client_hello callback |
698 | | */ |
699 | | typedef struct st_ptls_on_client_hello_parameters_t { |
700 | | /** |
701 | | * SNI value received from the client. The value is {NULL, 0} if the extension was absent. |
702 | | */ |
703 | | ptls_iovec_t server_name; |
704 | | /** |
705 | | * Raw value of the client_hello message. |
706 | | */ |
707 | | ptls_iovec_t raw_message; |
708 | | /** |
709 | | * points to the cipher-suites section of the raw_message (see above) |
710 | | */ |
711 | | ptls_iovec_t cipher_suites; |
712 | | /** |
713 | | * |
714 | | */ |
715 | | struct { |
716 | | ptls_iovec_t *list; |
717 | | size_t count; |
718 | | } negotiated_protocols; |
719 | | struct { |
720 | | const uint16_t *list; |
721 | | size_t count; |
722 | | } signature_algorithms; |
723 | | struct { |
724 | | const uint16_t *list; |
725 | | size_t count; |
726 | | } certificate_compression_algorithms; |
727 | | struct { |
728 | | const uint8_t *list; |
729 | | size_t count; |
730 | | } server_certificate_types; |
731 | | struct { |
732 | | const ptls_client_hello_psk_identity_t *list; |
733 | | size_t count; |
734 | | } psk_identities; |
735 | | /** |
736 | | * set to 1 if ClientHello is too old (or too new) to be handled by picotls |
737 | | */ |
738 | | unsigned incompatible_version : 1; |
739 | | } ptls_on_client_hello_parameters_t; |
740 | | |
741 | | /** |
742 | | * returns current time in milliseconds (ptls_get_time can be used to return the physical time) |
743 | | */ |
744 | | PTLS_CALLBACK_TYPE0(uint64_t, get_time); |
745 | | /** |
746 | | * after receiving ClientHello, the core calls the optional callback to give a chance to the swap the context depending on the input |
747 | | * values. The callback is required to call `ptls_set_server_name` if an SNI extension needs to be sent to the client. |
748 | | */ |
749 | | PTLS_CALLBACK_TYPE(int, on_client_hello, ptls_t *tls, ptls_on_client_hello_parameters_t *params); |
750 | | /** |
751 | | * callback to generate the certificate message. `ptls_context::certificates` are set when the callback is set to NULL. |
752 | | */ |
753 | | PTLS_CALLBACK_TYPE(int, emit_certificate, ptls_t *tls, ptls_message_emitter_t *emitter, ptls_key_schedule_t *key_sched, |
754 | | ptls_iovec_t context, int push_status_request, const uint16_t *compress_algos, size_t num_compress_algos); |
755 | | /** |
756 | | * An object that represents an asynchronous task (e.g., RSA signature generation). |
757 | | * When `ptls_handshake` returns `PTLS_ERROR_ASYNC_OPERATION`, it has an associated task in flight. The user should obtain the |
758 | | * reference to the associated task by calling `ptls_get_async_job`, then either wait for the file descriptor obtained from |
759 | | * the `get_fd` callback to become readable, or set a completion callback via `set_completion_callback` and wait for its |
760 | | * invocation. Once notified, the user should invoke `ptls_handshake` again. |
761 | | * Async jobs typically provide support for only one of the two methods. |
762 | | */ |
763 | | typedef struct st_ptls_async_job_t { |
764 | | void (*destroy_)(struct st_ptls_async_job_t *self); |
765 | | /** |
766 | | * optional callback returning a file descriptor that becomes readable when the job is complete |
767 | | */ |
768 | | int (*get_fd)(struct st_ptls_async_job_t *self); |
769 | | /** |
770 | | * optional callback for setting a completion callback |
771 | | */ |
772 | | void (*set_completion_callback)(struct st_ptls_async_job_t *self, void (*cb)(void *), void *cbdata); |
773 | | } ptls_async_job_t; |
774 | | /** |
775 | | * When gerenating CertificateVerify, the core calls the callback to sign the handshake context using the certificate. This callback |
776 | | * supports asynchronous mode; see `ptls_openssl_sign_certificate_t` for more information. |
777 | | */ |
778 | | PTLS_CALLBACK_TYPE(int, sign_certificate, ptls_t *tls, ptls_async_job_t **async, uint16_t *selected_algorithm, |
779 | | ptls_buffer_t *output, ptls_iovec_t input, const uint16_t *algorithms, size_t num_algorithms); |
780 | | /** |
781 | | * after receiving Certificate, the core calls the callback to verify the certificate chain and to obtain a pointer to a |
782 | | * callback that should be used for verifying CertificateVerify. If an error occurs between a successful return from this |
783 | | * callback to the invocation of the verify_sign callback, verify_sign is called with both data and sign set to an empty buffer. |
784 | | * The implementor of the callback should use that as the opportunity to free any temporary data allocated for the verify_sign |
785 | | * callback. |
786 | | * The name of the server to be verified, if any, is provided explicitly as `server_name`. When ECH is offered by the client but |
787 | | * the was rejected by the server, this value can be different from that being sent via `ptls_get_server_name`. |
788 | | */ |
789 | | typedef struct st_ptls_verify_certificate_t { |
790 | | int (*cb)(struct st_ptls_verify_certificate_t *self, ptls_t *tls, const char *server_name, |
791 | | int (**verify_sign)(void *verify_ctx, uint16_t algo, ptls_iovec_t data, ptls_iovec_t sign), void **verify_data, |
792 | | ptls_iovec_t *certs, size_t num_certs); |
793 | | /** |
794 | | * list of signature algorithms being supported, terminated by UINT16_MAX |
795 | | */ |
796 | | const uint16_t *algos; |
797 | | } ptls_verify_certificate_t; |
798 | | /** |
799 | | * Encrypt-and-signs (or verify-and-decrypts) a ticket (server-only). |
800 | | * When used for encryption (i.e., is_encrypt being set), the function should return 0 if successful, or else a non-zero value. |
801 | | * When used for decryption, the function should return 0 (successful), PTLS_ERROR_REJECT_EARLY_DATA (successful, but 0-RTT is |
802 | | * forbidden), or any other value to indicate failure. |
803 | | */ |
804 | | PTLS_CALLBACK_TYPE(int, encrypt_ticket, ptls_t *tls, int is_encrypt, ptls_buffer_t *dst, ptls_iovec_t src); |
805 | | /** |
806 | | * saves a ticket (client-only) |
807 | | */ |
808 | | PTLS_CALLBACK_TYPE(int, save_ticket, ptls_t *tls, ptls_iovec_t input); |
809 | | /** |
810 | | * event logging (incl. secret logging) |
811 | | */ |
812 | | typedef struct st_ptls_log_event_t { |
813 | | void (*cb)(struct st_ptls_log_event_t *self, ptls_t *tls, const char *type, const char *fmt, ...) |
814 | | __attribute__((format(printf, 4, 5))); |
815 | | } ptls_log_event_t; |
816 | | /** |
817 | | * reference counting |
818 | | */ |
819 | | PTLS_CALLBACK_TYPE(void, update_open_count, ssize_t delta); |
820 | | /** |
821 | | * applications that have their own record layer can set this function to derive their own traffic keys from the traffic secret. |
822 | | * The cipher-suite that is being associated to the connection can be obtained by calling the ptls_get_cipher function. |
823 | | */ |
824 | | PTLS_CALLBACK_TYPE(int, update_traffic_key, ptls_t *tls, int is_enc, size_t epoch, const void *secret); |
825 | | /** |
826 | | * callback for every extension detected during decoding |
827 | | */ |
828 | | PTLS_CALLBACK_TYPE(int, on_extension, ptls_t *tls, uint8_t hstype, uint16_t exttype, ptls_iovec_t extdata); |
829 | | /** |
830 | | * |
831 | | */ |
832 | | typedef struct st_ptls_decompress_certificate_t { |
833 | | /** |
834 | | * list of supported algorithms terminated by UINT16_MAX |
835 | | */ |
836 | | const uint16_t *supported_algorithms; |
837 | | /** |
838 | | * callback that decompresses the message |
839 | | */ |
840 | | int (*cb)(struct st_ptls_decompress_certificate_t *self, ptls_t *tls, uint16_t algorithm, ptls_iovec_t output, |
841 | | ptls_iovec_t input); |
842 | | } ptls_decompress_certificate_t; |
843 | | /** |
844 | | * ECH: creates the AEAD context to be used for "Open"-ing inner CH. Given `config_id`, the callback looks up the ECH config and the |
845 | | * corresponding private key, invokes `ptls_hpke_setup_base_r` with provided `cipher`, `enc`, and `info_prefix` (which will be |
846 | | * "tls ech" || 00). |
847 | | */ |
848 | | PTLS_CALLBACK_TYPE(ptls_aead_context_t *, ech_create_opener, ptls_hpke_kem_t **kem, ptls_hpke_cipher_suite_t **cipher, ptls_t *tls, |
849 | | uint8_t config_id, ptls_hpke_cipher_suite_id_t cipher_id, ptls_iovec_t enc, ptls_iovec_t info_prefix); |
850 | | |
851 | | /** |
852 | | * the configuration |
853 | | */ |
854 | | struct st_ptls_context_t { |
855 | | /** |
856 | | * PRNG to be used |
857 | | */ |
858 | | void (*random_bytes)(void *buf, size_t len); |
859 | | /** |
860 | | * |
861 | | */ |
862 | | ptls_get_time_t *get_time; |
863 | | /** |
864 | | * list of supported key-exchange algorithms terminated by NULL |
865 | | */ |
866 | | ptls_key_exchange_algorithm_t **key_exchanges; |
867 | | /** |
868 | | * list of supported cipher-suites terminated by NULL |
869 | | */ |
870 | | ptls_cipher_suite_t **cipher_suites; |
871 | | /** |
872 | | * list of certificates |
873 | | */ |
874 | | struct { |
875 | | ptls_iovec_t *list; |
876 | | size_t count; |
877 | | } certificates; |
878 | | /** |
879 | | * External pre-shared key used for mutual authentication. Unless when using PSK, all the fields must be set to NULL / 0. |
880 | | */ |
881 | | struct { |
882 | | ptls_iovec_t identity; |
883 | | ptls_iovec_t secret; |
884 | | /** |
885 | | * (mandatory) hash algorithm associated to the PSK; cipher-suites not sharing the same `ptls_hash_algorithm_t` will be |
886 | | * ignored |
887 | | */ |
888 | | ptls_hash_algorithm_t *hash; |
889 | | } pre_shared_key; |
890 | | /** |
891 | | * ECH |
892 | | */ |
893 | | struct { |
894 | | struct { |
895 | | /** |
896 | | * list of HPKE symmetric cipher-suites (set to NULL to disable ECH altogether) |
897 | | */ |
898 | | ptls_hpke_cipher_suite_t **ciphers; |
899 | | /** |
900 | | * KEMs being supported |
901 | | */ |
902 | | ptls_hpke_kem_t **kems; |
903 | | } client; |
904 | | struct { |
905 | | /** |
906 | | * callback that does ECDH key exchange and returns the AEAD context |
907 | | */ |
908 | | ptls_ech_create_opener_t *create_opener; |
909 | | /** |
910 | | * ECHConfigList to be sent to the client when there is mismatch (or when the client sends a grease) |
911 | | */ |
912 | | ptls_iovec_t retry_configs; |
913 | | } server; |
914 | | } ech; |
915 | | /** |
916 | | * |
917 | | */ |
918 | | ptls_on_client_hello_t *on_client_hello; |
919 | | /** |
920 | | * |
921 | | */ |
922 | | ptls_emit_certificate_t *emit_certificate; |
923 | | /** |
924 | | * |
925 | | */ |
926 | | ptls_sign_certificate_t *sign_certificate; |
927 | | /** |
928 | | * |
929 | | */ |
930 | | ptls_verify_certificate_t *verify_certificate; |
931 | | /** |
932 | | * lifetime of a session ticket (server-only) |
933 | | */ |
934 | | uint32_t ticket_lifetime; |
935 | | /** |
936 | | * maximum permitted size of early data (server-only) |
937 | | */ |
938 | | uint32_t max_early_data_size; |
939 | | /** |
940 | | * maximum size of the message buffer (default: 0 = unlimited = 3 + 2^24 bytes) |
941 | | */ |
942 | | size_t max_buffer_size; |
943 | | /** |
944 | | * this field is obsolete and ignored |
945 | | */ |
946 | | const char *hkdf_label_prefix__obsolete; |
947 | | /** |
948 | | * if set, psk handshakes use (ec)dhe |
949 | | */ |
950 | | unsigned require_dhe_on_psk : 1; |
951 | | /** |
952 | | * if exporter master secrets should be recorded |
953 | | */ |
954 | | unsigned use_exporter : 1; |
955 | | /** |
956 | | * if ChangeCipherSpec record should be sent during handshake. If the client sends CCS, the server sends one in response |
957 | | * regardless of the value of this flag. See RFC 8446 Appendix D.3. |
958 | | */ |
959 | | unsigned send_change_cipher_spec : 1; |
960 | | /** |
961 | | * if set, the server requests client certificates to authenticate the client |
962 | | */ |
963 | | unsigned require_client_authentication : 1; |
964 | | /** |
965 | | * if set, EOED will not be emitted or accepted |
966 | | */ |
967 | | unsigned omit_end_of_early_data : 1; |
968 | | /** |
969 | | * This option turns on support for Raw Public Keys (RFC 7250). |
970 | | * |
971 | | * When running as a client, this option instructs the client to request the server to send raw public keys in place of X.509 |
972 | | * certificate chain. The client should set its `certificate_verify` callback to one that is capable of validating the raw |
973 | | * public key that will be sent by the server. |
974 | | * |
975 | | * When running as a server, this option instructs the server to only handle clients requesting the use of raw public keys. If |
976 | | * the client does not, the handshake is rejected. Note however that the rejection happens only after the `on_client_hello` |
977 | | * callback is being called. Therefore, applications can support both X.509 and raw public keys by swapping `ptls_context_t` to |
978 | | * the correct one when that callback is being called (like handling swapping the contexts based on the value of SNI). |
979 | | */ |
980 | | unsigned use_raw_public_keys : 1; |
981 | | /** |
982 | | * boolean indicating if the cipher-suite should be chosen based on server's preference |
983 | | */ |
984 | | unsigned server_cipher_preference : 1; |
985 | | /** |
986 | | * boolean indicating if ChaCha20-Poly1305 should be reprioritized to the top of the server cipher list if a ChaCha20-Poly1305 |
987 | | * cipher is at the top of the client cipher list |
988 | | */ |
989 | | unsigned server_cipher_chacha_priority : 1; |
990 | | /** |
991 | | * |
992 | | */ |
993 | | ptls_encrypt_ticket_t *encrypt_ticket; |
994 | | /** |
995 | | * |
996 | | */ |
997 | | ptls_save_ticket_t *save_ticket; |
998 | | /** |
999 | | * |
1000 | | */ |
1001 | | ptls_log_event_t *log_event; |
1002 | | /** |
1003 | | * |
1004 | | */ |
1005 | | ptls_update_open_count_t *update_open_count; |
1006 | | /** |
1007 | | * |
1008 | | */ |
1009 | | ptls_update_traffic_key_t *update_traffic_key; |
1010 | | /** |
1011 | | * |
1012 | | */ |
1013 | | ptls_decompress_certificate_t *decompress_certificate; |
1014 | | /** |
1015 | | * |
1016 | | */ |
1017 | | ptls_on_extension_t *on_extension; |
1018 | | /** |
1019 | | * (optional) list of supported tls12 cipher-suites terminated by NULL |
1020 | | */ |
1021 | | ptls_cipher_suite_t **tls12_cipher_suites; |
1022 | | /** |
1023 | | * (optional) session ID Context to segment resumption |
1024 | | */ |
1025 | | struct { |
1026 | | uint8_t bytes[PTLS_SHA256_DIGEST_SIZE]; |
1027 | | unsigned is_set : 1; |
1028 | | } ticket_context; |
1029 | | /** |
1030 | | * (optional) list of CAs advertised to clients as supported in the CertificateRequest message; each item must be DNs in DER |
1031 | | * format. The values are sent to the client only when `ptls_context_t::require_client_authentication` is set to true. |
1032 | | */ |
1033 | | struct { |
1034 | | const ptls_iovec_t *list; |
1035 | | size_t count; |
1036 | | } client_ca_names; |
1037 | | /** |
1038 | | * (optional) |
1039 | | */ |
1040 | | struct { |
1041 | | /** |
1042 | | * if set to non-zero and if the save_ticket callback is provided, a ticket_request extension containing the specified |
1043 | | * values is sent |
1044 | | */ |
1045 | | struct { |
1046 | | uint8_t new_session_count; |
1047 | | uint8_t resumption_count; |
1048 | | } client; |
1049 | | /** |
1050 | | * if set to non-zero, the maximum number of tickets being sent is capped to the specifed value; if set to zero, the maximum |
1051 | | * adopted is PTLS_DEFAULT_MAX_TICKETS_TO_SERVE. |
1052 | | */ |
1053 | | struct { |
1054 | | uint8_t max_count; |
1055 | | } server; |
1056 | | } ticket_requests; |
1057 | | }; |
1058 | | |
1059 | | typedef struct st_ptls_raw_extension_t { |
1060 | | uint16_t type; |
1061 | | ptls_iovec_t data; |
1062 | | } ptls_raw_extension_t; |
1063 | | |
1064 | | typedef enum en_ptls_early_data_acceptance_t { |
1065 | | PTLS_EARLY_DATA_ACCEPTANCE_UNKNOWN = 0, |
1066 | | PTLS_EARLY_DATA_REJECTED, |
1067 | | PTLS_EARLY_DATA_ACCEPTED |
1068 | | } ptls_early_data_acceptance_t; |
1069 | | |
1070 | | /** |
1071 | | * optional arguments to client-driven handshake |
1072 | | */ |
1073 | | #ifdef _WINDOWS |
1074 | | /* suppress warning C4201: nonstandard extension used: nameless struct/union */ |
1075 | | #pragma warning(push) |
1076 | | #pragma warning(disable : 4201) |
1077 | | #endif |
1078 | | typedef struct st_ptls_handshake_properties_t { |
1079 | | union { |
1080 | | struct { |
1081 | | /** |
1082 | | * list of protocols offered through ALPN |
1083 | | */ |
1084 | | struct { |
1085 | | const ptls_iovec_t *list; |
1086 | | size_t count; |
1087 | | } negotiated_protocols; |
1088 | | /** |
1089 | | * session ticket sent to the application via save_ticket callback |
1090 | | */ |
1091 | | ptls_iovec_t session_ticket; |
1092 | | /** |
1093 | | * pointer to store the maximum size of early-data that can be sent immediately. If set to non-NULL, the first call to |
1094 | | * ptls_handshake (or ptls_handle_message) will set `*max_early_data` to the value obtained from the session ticket, or |
1095 | | * to zero if early-data cannot be sent. If NULL, early data will not be used. |
1096 | | */ |
1097 | | size_t *max_early_data_size; |
1098 | | /** |
1099 | | * If early-data has been accepted by peer, or if the state is still unknown. The state changes anytime after handshake |
1100 | | * keys become available. Applications can peek the tri-state variable every time it calls `ptls_hanshake` or |
1101 | | * `ptls_handle_message` to determine the result at the earliest moment. This is an output parameter. |
1102 | | */ |
1103 | | ptls_early_data_acceptance_t early_data_acceptance; |
1104 | | /** |
1105 | | * negotiate the key exchange method before sending key_share |
1106 | | */ |
1107 | | unsigned negotiate_before_key_exchange : 1; |
1108 | | /** |
1109 | | * ECH |
1110 | | */ |
1111 | | struct { |
1112 | | /** |
1113 | | * Config offered by server e.g., by HTTPS RR. If config.base is non-NULL but config.len is zero, a grease ECH will |
1114 | | * be sent, assuming that X25519-SHA256 KEM and SHA256-AES-128-GCM HPKE cipher is available. |
1115 | | */ |
1116 | | ptls_iovec_t configs; |
1117 | | /** |
1118 | | * slot to save the config obtained from server on mismatch; user must free the returned blob by calling `free` |
1119 | | */ |
1120 | | ptls_iovec_t *retry_configs; |
1121 | | } ech; |
1122 | | } client; |
1123 | | struct { |
1124 | | /** |
1125 | | * psk binder being selected (len is set to zero if none) |
1126 | | */ |
1127 | | struct { |
1128 | | uint8_t base[PTLS_MAX_DIGEST_SIZE]; |
1129 | | size_t len; |
1130 | | } selected_psk_binder; |
1131 | | /** |
1132 | | * parameters related to use of the Cookie extension |
1133 | | */ |
1134 | | struct { |
1135 | | /** |
1136 | | * HMAC key to protect the integrity of the cookie. The key should be as long as the digest size of the first |
1137 | | * ciphersuite specified in ptls_context_t (i.e. the hash algorithm of the best ciphersuite that can be chosen). |
1138 | | */ |
1139 | | const void *key; |
1140 | | /** |
1141 | | * additional data to be used for verifying the cookie |
1142 | | */ |
1143 | | ptls_iovec_t additional_data; |
1144 | | } cookie; |
1145 | | /** |
1146 | | * if HRR should always be sent |
1147 | | */ |
1148 | | unsigned enforce_retry : 1; |
1149 | | /** |
1150 | | * if retry should be stateless (cookie.key MUST be set when this option is used) |
1151 | | */ |
1152 | | unsigned retry_uses_cookie : 1; |
1153 | | } server; |
1154 | | }; |
1155 | | /** |
1156 | | * an optional list of additional extensions to send either in CH or EE, terminated by type == UINT16_MAX |
1157 | | */ |
1158 | | ptls_raw_extension_t *additional_extensions; |
1159 | | /** |
1160 | | * an optional callback that returns a boolean value indicating if a particular extension should be collected |
1161 | | */ |
1162 | | int (*collect_extension)(ptls_t *tls, struct st_ptls_handshake_properties_t *properties, uint16_t type); |
1163 | | /** |
1164 | | * an optional callback that reports the extensions being collected |
1165 | | */ |
1166 | | int (*collected_extensions)(ptls_t *tls, struct st_ptls_handshake_properties_t *properties, ptls_raw_extension_t *extensions); |
1167 | | } ptls_handshake_properties_t; |
1168 | | #ifdef _WINDOWS |
1169 | | #pragma warning(pop) |
1170 | | #endif |
1171 | | #ifdef _WINDOWS |
1172 | | /* suppress warning C4293: >> shift count negative or too big */ |
1173 | | #pragma warning(disable : 4293) |
1174 | | #endif |
1175 | | /** |
1176 | | * builds a new ptls_iovec_t instance using the supplied parameters |
1177 | | */ |
1178 | | static ptls_iovec_t ptls_iovec_init(const void *p, size_t len); |
1179 | | /** |
1180 | | * initializes a buffer, setting the default destination to the small buffer provided as the argument. |
1181 | | */ |
1182 | | static void ptls_buffer_init(ptls_buffer_t *buf, void *smallbuf, size_t smallbuf_size); |
1183 | | /** |
1184 | | * disposes a buffer, freeing resources allocated by the buffer itself (if any) |
1185 | | */ |
1186 | | static void ptls_buffer_dispose(ptls_buffer_t *buf); |
1187 | | /** |
1188 | | * internal |
1189 | | */ |
1190 | | void ptls_buffer__release_memory(ptls_buffer_t *buf); |
1191 | | /** |
1192 | | * reserves space for additional amount of memory |
1193 | | */ |
1194 | | int ptls_buffer_reserve(ptls_buffer_t *buf, size_t delta); |
1195 | | /** |
1196 | | * reserves space for additional amount of memory, requiring `buf->base` to follow specified alignment |
1197 | | */ |
1198 | | int ptls_buffer_reserve_aligned(ptls_buffer_t *buf, size_t delta, uint8_t align_bits); |
1199 | | /** |
1200 | | * internal |
1201 | | */ |
1202 | | int ptls_buffer__do_pushv(ptls_buffer_t *buf, const void *src, size_t len); |
1203 | | /** |
1204 | | * internal |
1205 | | */ |
1206 | | int ptls_buffer__adjust_quic_blocksize(ptls_buffer_t *buf, size_t body_size); |
1207 | | /** |
1208 | | * internal |
1209 | | */ |
1210 | | int ptls_buffer__adjust_asn1_blocksize(ptls_buffer_t *buf, size_t body_size); |
1211 | | /** |
1212 | | * pushes an unsigned bigint |
1213 | | */ |
1214 | | int ptls_buffer_push_asn1_ubigint(ptls_buffer_t *buf, const void *bignum, size_t size); |
1215 | | /** |
1216 | | * encodes a quic varint (maximum length is PTLS_ENCODE_QUICINT_CAPACITY) |
1217 | | */ |
1218 | | static uint8_t *ptls_encode_quicint(uint8_t *p, uint64_t v); |
1219 | 0 | #define PTLS_ENCODE_QUICINT_CAPACITY 8 |
1220 | | |
1221 | 0 | #define PTLS_QUICINT_MAX 4611686018427387903 // (1 << 62) - 1 |
1222 | | #define PTLS_QUICINT_LONGEST_STR "4611686018427387903" |
1223 | | |
1224 | | #define ptls_buffer_pushv(buf, src, len) \ |
1225 | 0 | do { \ |
1226 | 0 | if ((ret = ptls_buffer__do_pushv((buf), (src), (len))) != 0) \ |
1227 | 0 | goto Exit; \ |
1228 | 0 | } while (0) |
1229 | | |
1230 | | #define ptls_buffer_push(buf, ...) \ |
1231 | 0 | do { \ |
1232 | 0 | if ((ret = ptls_buffer__do_pushv((buf), (uint8_t[]){__VA_ARGS__}, sizeof((uint8_t[]){__VA_ARGS__}))) != 0) \ |
1233 | 0 | goto Exit; \ |
1234 | 0 | } while (0) |
1235 | | |
1236 | | #define ptls_buffer_push16(buf, v) \ |
1237 | 0 | do { \ |
1238 | 0 | uint16_t _v = (v); \ |
1239 | 0 | ptls_buffer_push(buf, (uint8_t)(_v >> 8), (uint8_t)_v); \ |
1240 | 0 | } while (0) |
1241 | | |
1242 | | #define ptls_buffer_push24(buf, v) \ |
1243 | | do { \ |
1244 | | uint32_t _v = (v); \ |
1245 | | ptls_buffer_push(buf, (uint8_t)(_v >> 16), (uint8_t)(_v >> 8), (uint8_t)_v); \ |
1246 | | } while (0) |
1247 | | |
1248 | | #define ptls_buffer_push32(buf, v) \ |
1249 | 0 | do { \ |
1250 | 0 | uint32_t _v = (v); \ |
1251 | 0 | ptls_buffer_push(buf, (uint8_t)(_v >> 24), (uint8_t)(_v >> 16), (uint8_t)(_v >> 8), (uint8_t)_v); \ |
1252 | 0 | } while (0) |
1253 | | |
1254 | | #define ptls_buffer_push64(buf, v) \ |
1255 | 0 | do { \ |
1256 | 0 | uint64_t _v = (v); \ |
1257 | 0 | ptls_buffer_push(buf, (uint8_t)(_v >> 56), (uint8_t)(_v >> 48), (uint8_t)(_v >> 40), (uint8_t)(_v >> 32), \ |
1258 | 0 | (uint8_t)(_v >> 24), (uint8_t)(_v >> 16), (uint8_t)(_v >> 8), (uint8_t)_v); \ |
1259 | 0 | } while (0) |
1260 | | |
1261 | | #define ptls_buffer_push_quicint(buf, v) \ |
1262 | 0 | do { \ |
1263 | 0 | if ((ret = ptls_buffer_reserve((buf), PTLS_ENCODE_QUICINT_CAPACITY)) != 0) \ |
1264 | 0 | goto Exit; \ |
1265 | 0 | uint8_t *d = ptls_encode_quicint((buf)->base + (buf)->off, (v)); \ |
1266 | 0 | (buf)->off = d - (buf)->base; \ |
1267 | 0 | } while (0) |
1268 | | |
1269 | | #define ptls_buffer_push_block(buf, _capacity, block) \ |
1270 | 0 | do { \ |
1271 | 0 | size_t capacity = (_capacity); \ |
1272 | 0 | ptls_buffer_pushv((buf), (uint8_t *)"\0\0\0\0\0\0\0", capacity != -1 ? capacity : 1); \ |
1273 | 0 | size_t body_start = (buf)->off; \ |
1274 | 0 | do { \ |
1275 | 0 | block \ |
1276 | 0 | } while (0); \ |
1277 | 0 | size_t body_size = (buf)->off - body_start; \ |
1278 | 0 | if (capacity != -1) { \ |
1279 | 0 | if (capacity < sizeof(size_t) && body_size >= (size_t)1 << (capacity * 8)) { \ |
1280 | 0 | ret = PTLS_ERROR_BLOCK_OVERFLOW; \ |
1281 | 0 | goto Exit; \ |
1282 | 0 | } \ |
1283 | 0 | for (; capacity != 0; --capacity) \ |
1284 | 0 | (buf)->base[body_start - capacity] = (uint8_t)(body_size >> (8 * (capacity - 1))); \ |
1285 | 0 | } else { \ |
1286 | 0 | if ((ret = ptls_buffer__adjust_quic_blocksize((buf), body_size)) != 0) \ |
1287 | 0 | goto Exit; \ |
1288 | 0 | } \ |
1289 | 0 | } while (0) |
1290 | | |
1291 | | #define ptls_buffer_push_asn1_block(buf, block) \ |
1292 | 0 | do { \ |
1293 | 0 | ptls_buffer_push((buf), 0xff); /* dummy */ \ |
1294 | 0 | size_t body_start = (buf)->off; \ |
1295 | 0 | do { \ |
1296 | 0 | block \ |
1297 | 0 | } while (0); \ |
1298 | 0 | size_t body_size = (buf)->off - body_start; \ |
1299 | 0 | if (body_size < 128) { \ |
1300 | 0 | (buf)->base[body_start - 1] = (uint8_t)body_size; \ |
1301 | 0 | } else { \ |
1302 | 0 | if ((ret = ptls_buffer__adjust_asn1_blocksize((buf), body_size)) != 0) \ |
1303 | 0 | goto Exit; \ |
1304 | 0 | } \ |
1305 | 0 | } while (0) |
1306 | | |
1307 | | #define ptls_buffer_push_asn1_sequence(buf, block) \ |
1308 | | do { \ |
1309 | | ptls_buffer_push((buf), 0x30); \ |
1310 | | ptls_buffer_push_asn1_block((buf), block); \ |
1311 | | } while (0) |
1312 | | |
1313 | | #define ptls_buffer_push_message_body(buf, key_sched, type, block) \ |
1314 | 0 | do { \ |
1315 | 0 | ptls_buffer_t *_buf = (buf); \ |
1316 | 0 | ptls_key_schedule_t *_key_sched = (key_sched); \ |
1317 | 0 | size_t mess_start = _buf->off; \ |
1318 | 0 | ptls_buffer_push(_buf, (type)); \ |
1319 | 0 | ptls_buffer_push_block(_buf, 3, block); \ |
1320 | 0 | if (_key_sched != NULL) \ |
1321 | 0 | ptls__key_schedule_update_hash(_key_sched, _buf->base + mess_start, _buf->off - mess_start, 0); \ |
1322 | 0 | } while (0) |
1323 | | |
1324 | | #define ptls_push_message(emitter, key_sched, type, block) \ |
1325 | 0 | do { \ |
1326 | 0 | ptls_message_emitter_t *_emitter = (emitter); \ |
1327 | 0 | if ((ret = _emitter->begin_message(_emitter)) != 0) \ |
1328 | 0 | goto Exit; \ |
1329 | 0 | ptls_buffer_push_message_body(_emitter->buf, (key_sched), (type), block); \ |
1330 | 0 | if ((ret = _emitter->commit_message(_emitter)) != 0) \ |
1331 | 0 | goto Exit; \ |
1332 | 0 | } while (0) |
1333 | | |
1334 | | int ptls_decode8(uint8_t *value, const uint8_t **src, const uint8_t *end); |
1335 | | int ptls_decode16(uint16_t *value, const uint8_t **src, const uint8_t *end); |
1336 | | int ptls_decode24(uint32_t *value, const uint8_t **src, const uint8_t *end); |
1337 | | int ptls_decode32(uint32_t *value, const uint8_t **src, const uint8_t *end); |
1338 | | int ptls_decode64(uint64_t *value, const uint8_t **src, const uint8_t *end); |
1339 | | uint64_t ptls_decode_quicint(const uint8_t **src, const uint8_t *end); |
1340 | | |
1341 | | #define ptls_decode_open_block(src, end, capacity, block) \ |
1342 | 0 | do { \ |
1343 | 0 | size_t _capacity = (capacity); \ |
1344 | 0 | size_t _block_size; \ |
1345 | 0 | if (_capacity == -1) { \ |
1346 | 0 | uint64_t _block_size64; \ |
1347 | 0 | const uint8_t *_src = (src); \ |
1348 | 0 | if ((_block_size64 = ptls_decode_quicint(&_src, end)) == UINT64_MAX || \ |
1349 | 0 | (sizeof(size_t) < 8 && (_block_size64 >> (8 * sizeof(size_t))) != 0)) { \ |
1350 | 0 | ret = PTLS_ALERT_DECODE_ERROR; \ |
1351 | 0 | goto Exit; \ |
1352 | 0 | } \ |
1353 | 0 | (src) = _src; \ |
1354 | 0 | _block_size = (size_t)_block_size64; \ |
1355 | 0 | } else { \ |
1356 | 0 | if (_capacity > (size_t)(end - (src))) { \ |
1357 | 0 | ret = PTLS_ALERT_DECODE_ERROR; \ |
1358 | 0 | goto Exit; \ |
1359 | 0 | } \ |
1360 | 0 | _block_size = 0; \ |
1361 | 0 | do { \ |
1362 | 0 | _block_size = _block_size << 8 | *(src)++; \ |
1363 | 0 | } while (--_capacity != 0); \ |
1364 | 0 | } \ |
1365 | 0 | if (_block_size > (size_t)(end - (src))) { \ |
1366 | 0 | ret = PTLS_ALERT_DECODE_ERROR; \ |
1367 | 0 | goto Exit; \ |
1368 | 0 | } \ |
1369 | 0 | do { \ |
1370 | 0 | const uint8_t *const end = (src) + _block_size; \ |
1371 | 0 | do { \ |
1372 | 0 | block \ |
1373 | 0 | } while (0); \ |
1374 | 0 | if ((src) != end) { \ |
1375 | 0 | ret = PTLS_ALERT_DECODE_ERROR; \ |
1376 | 0 | goto Exit; \ |
1377 | 0 | } \ |
1378 | 0 | } while (0); \ |
1379 | 0 | } while (0) |
1380 | | |
1381 | | #define ptls_decode_assert_block_close(src, end) \ |
1382 | 0 | do { \ |
1383 | 0 | if ((src) != end) { \ |
1384 | 0 | ret = PTLS_ALERT_DECODE_ERROR; \ |
1385 | 0 | goto Exit; \ |
1386 | 0 | } \ |
1387 | 0 | } while (0); |
1388 | | |
1389 | | #define ptls_decode_block(src, end, capacity, block) \ |
1390 | 0 | do { \ |
1391 | 0 | ptls_decode_open_block((src), end, capacity, block); \ |
1392 | 0 | ptls_decode_assert_block_close((src), end); \ |
1393 | 0 | } while (0) |
1394 | | |
1395 | | #if PTLS_HAVE_LOG |
1396 | | #define PTLS_LOG__DO_LOG(module, name, conn_state, get_sni, get_sni_arg, add_time, block) \ |
1397 | 0 | do { \ |
1398 | 0 | int ptlslog_include_appdata = 0; \ |
1399 | 0 | do { \ |
1400 | 0 | ptls_log__do_write_start(&logpoint, (add_time)); \ |
1401 | 0 | do { \ |
1402 | 0 | block \ |
1403 | 0 | } while (0); \ |
1404 | 0 | ptlslog_include_appdata = \ |
1405 | 0 | ptls_log__do_write_end(&logpoint, (conn_state), (get_sni), (get_sni_arg), ptlslog_include_appdata); \ |
1406 | 0 | } while (PTLS_UNLIKELY(ptlslog_include_appdata)); \ |
1407 | 0 | } while (0) |
1408 | | #else |
1409 | | #define PTLS_LOG__DO_LOG(module, name, conn_state, get_sni, get_sni_arg, add_time, block) /* don't generate code */ |
1410 | | #endif |
1411 | | |
1412 | | #define PTLS_LOG_DEFINE_POINT(_module, _name, _var) \ |
1413 | 41.2k | static struct st_ptls_log_point_t _var = {.name = PTLS_TO_STR(_module) ":" PTLS_TO_STR(_name)} |
1414 | | |
1415 | | #define PTLS_LOG(module, name, block) \ |
1416 | 0 | do { \ |
1417 | 0 | PTLS_LOG_DEFINE_POINT(module, name, logpoint); \ |
1418 | 0 | if (PTLS_LIKELY(ptls_log_point_maybe_active(&logpoint) == 0)) \ |
1419 | 0 | break; \ |
1420 | 0 | PTLS_LOG__DO_LOG(module, name, NULL, NULL, NULL, 1, {block}); \ |
1421 | 0 | } while (0) |
1422 | | |
1423 | | #define PTLS_LOG_CONN(name, tls, block) \ |
1424 | 0 | do { \ |
1425 | 0 | PTLS_LOG_DEFINE_POINT(picotls, name, logpoint); \ |
1426 | 0 | uint32_t active = ptls_log_point_maybe_active(&logpoint); \ |
1427 | 0 | if (PTLS_LIKELY(active == 0)) \ |
1428 | 0 | break; \ |
1429 | 0 | ptls_t *_tls = (tls); \ |
1430 | 0 | ptls_log_conn_state_t *conn_state = ptls_get_log_state(_tls); \ |
1431 | 0 | active &= ptls_log_conn_maybe_active(conn_state, (const char *(*)(void *))ptls_get_server_name, _tls); \ |
1432 | 0 | if (PTLS_LIKELY(active == 0)) \ |
1433 | 0 | break; \ |
1434 | 0 | PTLS_LOG__DO_LOG(picotls, name, conn_state, (const char *(*)(void *))ptls_get_server_name, _tls, 1, { \ |
1435 | 0 | PTLS_LOG_ELEMENT_PTR(tls, _tls); \ |
1436 | 0 | do { \ |
1437 | 0 | block \ |
1438 | 0 | } while (0); \ |
1439 | 0 | }); \ |
1440 | 0 | } while (0) |
1441 | | |
1442 | | #define PTLS_LOG__ELEMENT_PREFIX_CORE(lit) ",\"" lit "\":" |
1443 | | #define PTLS_LOG__ELEMENT_PREFIX(lit) PTLS_LOG__ELEMENT_PREFIX_CORE(lit), sizeof(PTLS_LOG__ELEMENT_PREFIX_CORE(lit)) - 1 |
1444 | | #define PTLS_LOG_ELEMENT_SAFESTR(name, value) \ |
1445 | | do { \ |
1446 | | const char *value_ = (value); \ |
1447 | | ptls_log__do_push_element_safestr(PTLS_LOG__ELEMENT_PREFIX(PTLS_TO_STR(name)), (value_), strlen(value_)); \ |
1448 | | } while (0) |
1449 | | #define PTLS_LOG_ELEMENT_UNSAFESTR(name, value, value_len) \ |
1450 | | ptls_log__do_push_element_unsafestr(PTLS_LOG__ELEMENT_PREFIX(PTLS_TO_STR(name)), (value), (value_len)) |
1451 | | #define PTLS_LOG_ELEMENT_HEXDUMP(name, value, value_len) \ |
1452 | | ptls_log__do_push_element_hexdump(PTLS_LOG__ELEMENT_PREFIX(PTLS_TO_STR(name)), (value), (value_len)) |
1453 | | #define PTLS_LOG_ELEMENT_PTR(name, value) PTLS_LOG_ELEMENT_UNSIGNED(name, (uint64_t)(value)) |
1454 | | #define PTLS_LOG_ELEMENT_SIGNED(name, value) \ |
1455 | | do { \ |
1456 | | if (sizeof(value) <= sizeof(int32_t)) { \ |
1457 | | ptls_log__do_push_element_signed32(PTLS_LOG__ELEMENT_PREFIX(PTLS_TO_STR(name)), (value)); \ |
1458 | | } else { \ |
1459 | | ptls_log__do_push_element_signed64(PTLS_LOG__ELEMENT_PREFIX(PTLS_TO_STR(name)), (value)); \ |
1460 | | } \ |
1461 | | } while (0) |
1462 | | #define PTLS_LOG__DO_ELEMENT_UNSIGNED(lit, value) \ |
1463 | | do { \ |
1464 | | if (sizeof(value) <= sizeof(uint32_t)) { \ |
1465 | | ptls_log__do_push_element_unsigned32(PTLS_LOG__ELEMENT_PREFIX(lit), (value)); \ |
1466 | | } else { \ |
1467 | | ptls_log__do_push_element_unsigned64(PTLS_LOG__ELEMENT_PREFIX(lit), (value)); \ |
1468 | | } \ |
1469 | | } while (0) |
1470 | | #define PTLS_LOG_ELEMENT_UNSIGNED(name, value) PTLS_LOG__DO_ELEMENT_UNSIGNED(PTLS_TO_STR(name), (value)) |
1471 | | #define PTLS_LOG_ELEMENT_BOOL(name, value) ptls_log__do_push_element_bool(PTLS_LOG__ELEMENT_PREFIX(PTLS_TO_STR(name)), (value)) |
1472 | | #define PTLS_LOG_APPDATA_ELEMENT_UNSAFESTR(name, value, value_len) \ |
1473 | | do { \ |
1474 | | if (ptlslog_include_appdata) { \ |
1475 | | PTLS_LOG_ELEMENT_UNSAFESTR(name, value, value_len); \ |
1476 | | } else { \ |
1477 | | PTLS_LOG__DO_ELEMENT_UNSIGNED(PTLS_TO_STR(name) "_len", value_len); \ |
1478 | | } \ |
1479 | | } while (0) |
1480 | | #define PTLS_LOG_APPDATA_ELEMENT_HEXDUMP(name, value, value_len) \ |
1481 | | do { \ |
1482 | | if (ptlslog_include_appdata) { \ |
1483 | | PTLS_LOG_ELEMENT_HEXDUMP(name, value, value_len); \ |
1484 | | } else { \ |
1485 | | PTLS_LOG__DO_ELEMENT_UNSIGNED(PTLS_TO_STR(name) "_len", value_len); \ |
1486 | | } \ |
1487 | | } while (0) |
1488 | | |
1489 | | /** |
1490 | | * retains a list of connections that are bound to the object |
1491 | | */ |
1492 | | struct st_ptls_log_state_t { |
1493 | | /** |
1494 | | * bit array of connections (1 is active) |
1495 | | */ |
1496 | | uint32_t active_conns; |
1497 | | /** |
1498 | | * generation counter used for staleness check; see `ptls_log._generation` |
1499 | | */ |
1500 | | uint64_t generation; |
1501 | | }; |
1502 | | |
1503 | | /** |
1504 | | * represents a log point identified by name (`module:type`) |
1505 | | */ |
1506 | | struct st_ptls_log_point_t { |
1507 | | const char *name; |
1508 | | struct st_ptls_log_state_t state; |
1509 | | }; |
1510 | | |
1511 | | /** |
1512 | | * represents a logging state of each connection |
1513 | | */ |
1514 | | typedef struct st_ptls_log_conn_state_t { |
1515 | | /** |
1516 | | * random value between 0 (inclusive) and 1 (non-inclusive) used to determine the ratio of sampling-based logging; see |
1517 | | * `ptls_add_fd'`. To disable logging entirely, use `ptls_log.dummy_conn_state`, or set the value exactly to 1. |
1518 | | */ |
1519 | | float random_; |
1520 | | /** |
1521 | | * represents peer address; ipv4 addresses are stored using the mapped form (::ffff:192.0.2.1) |
1522 | | */ |
1523 | | struct in6_addr address; |
1524 | | struct st_ptls_log_state_t state; |
1525 | | } ptls_log_conn_state_t; |
1526 | | |
1527 | | /** |
1528 | | * see `ptls_get_log_state` |
1529 | | */ |
1530 | | extern PTLS_THREADLOCAL ptls_log_conn_state_t *ptls_log_conn_state_override; |
1531 | | |
1532 | | /** |
1533 | | * global variables exposed |
1534 | | */ |
1535 | | extern struct st_ptls_log_t { |
1536 | | /** |
1537 | | * if application-data (e.g., payload) should be emitted as well |
1538 | | */ |
1539 | | volatile unsigned may_include_appdata : 1; |
1540 | | /** |
1541 | | * endpoints that want to disable logging entirely can provide this value to the loggers |
1542 | | */ |
1543 | | ptls_log_conn_state_t dummy_conn_state; |
1544 | | /** |
1545 | | * generation counter that is incremented whenever the state of loggers change; see `st_ptls_log_state_t::generation` |
1546 | | */ |
1547 | | volatile uint64_t _generation; |
1548 | | } ptls_log; |
1549 | | |
1550 | | /** |
1551 | | * initializes a ptls_log_conn_state_t |
1552 | | */ |
1553 | | void ptls_log_init_conn_state(ptls_log_conn_state_t *state, void (*random_bytes)(void *, size_t)); |
1554 | | /** |
1555 | | * forces recalculation of the log state (should be called when SNI is determined) |
1556 | | */ |
1557 | | static void ptls_log_recalc_conn_state(ptls_log_conn_state_t *state); |
1558 | | /** |
1559 | | * returns a bitmap indicating the loggers active for given log point |
1560 | | */ |
1561 | | static uint32_t ptls_log_point_maybe_active(struct st_ptls_log_point_t *point); |
1562 | | /** |
1563 | | * returns a bitmap indicating the loggers active for given connection |
1564 | | */ |
1565 | | static uint32_t ptls_log_conn_maybe_active(ptls_log_conn_state_t *conn, const char *(*get_sni)(void *), void *get_sni_arg); |
1566 | | |
1567 | | /** |
1568 | | * Returns the number of log events that were unable to be emitted. |
1569 | | */ |
1570 | | size_t ptls_log_num_lost(void); |
1571 | | /** |
1572 | | * Registers an fd to the logger. A registered fd is automatically closed and removed when it is closed by the peer. |
1573 | | * @param sample_ratio sampling ratio between 0 and 1 |
1574 | | * @param points list of points to log, in the form of p1\0p2\0\0 (i.e., concatenated list of C strings with an empty string |
1575 | | * marking the end). An empty list means attach to all. |
1576 | | * @param snis list of SNIs to log, using the same form as points |
1577 | | * @param addresses list of IPv4/v6 addresses to log, using the same form as points |
1578 | | */ |
1579 | | int ptls_log_add_fd(int fd, float sample_ratio, const char *points, const char *snis, const char *addresses, int appdata); |
1580 | | |
1581 | | void ptls_log__recalc_point(int caller_locked, struct st_ptls_log_point_t *point); |
1582 | | void ptls_log__recalc_conn(int caller_locked, struct st_ptls_log_conn_state_t *conn, const char *(*get_sni)(void *), |
1583 | | void *get_sni_arg); |
1584 | | void ptls_log__do_push_element_safestr(const char *prefix, size_t prefix_len, const char *s, size_t l); |
1585 | | void ptls_log__do_push_element_unsafestr(const char *prefix, size_t prefix_len, const char *s, size_t l); |
1586 | | void ptls_log__do_push_element_hexdump(const char *prefix, size_t prefix_len, const void *s, size_t l); |
1587 | | void ptls_log__do_push_element_signed32(const char *prefix, size_t prefix_len, int32_t v); |
1588 | | void ptls_log__do_push_element_signed64(const char *prefix, size_t prefix_len, int64_t v); |
1589 | | void ptls_log__do_push_element_unsigned32(const char *prefix, size_t prefix_len, uint32_t v); |
1590 | | void ptls_log__do_push_element_unsigned64(const char *prefix, size_t prefix_len, uint64_t v); |
1591 | | void ptls_log__do_push_element_bool(const char *prefix, size_t prefix_len, int v); |
1592 | | void ptls_log__do_push_appdata_element_unsafestr(int includes_appdata, const char *prefix, size_t prefix_len, const char *s, |
1593 | | size_t l); |
1594 | | void ptls_log__do_push_appdata_element_hexdump(int includes_appdata, const char *prefix, size_t prefix_len, const void *s, |
1595 | | size_t l); |
1596 | | void ptls_log__do_write_start(struct st_ptls_log_point_t *point, int add_time); |
1597 | | int ptls_log__do_write_end(struct st_ptls_log_point_t *point, struct st_ptls_log_conn_state_t *conn, const char *(*get_sni)(void *), |
1598 | | void *get_sni_arg, int includes_appdata); |
1599 | | |
1600 | | /** |
1601 | | * create a client object to handle new TLS connection |
1602 | | */ |
1603 | | ptls_t *ptls_client_new(ptls_context_t *ctx); |
1604 | | /** |
1605 | | * create a server object to handle new TLS connection |
1606 | | */ |
1607 | | ptls_t *ptls_server_new(ptls_context_t *ctx); |
1608 | | /** |
1609 | | * creates an object handle new TLS connection |
1610 | | */ |
1611 | | static ptls_t *ptls_new(ptls_context_t *ctx, int is_server); |
1612 | | /** |
1613 | | * creates TLS 1.2 record layer for post-handshake communication |
1614 | | */ |
1615 | | int ptls_build_tls12_export_params(ptls_context_t *ctx, ptls_buffer_t *output, int is_server, int session_reused, |
1616 | | ptls_cipher_suite_t *cipher, const void *master_secret, const void *hello_randoms, |
1617 | | uint64_t next_send_record_iv, const char *server_name, ptls_iovec_t negotiated_protocol); |
1618 | | /** |
1619 | | * store the parameters of a post-handshake TLS connection so that it can be reconstructed later |
1620 | | */ |
1621 | | int ptls_export(ptls_t *tls, ptls_buffer_t *output); |
1622 | | /** |
1623 | | * create a post-handshake TLS connection object using given parameters |
1624 | | */ |
1625 | | int ptls_import(ptls_context_t *ctx, ptls_t **tls, ptls_iovec_t params); |
1626 | | /** |
1627 | | * releases all resources associated to the object |
1628 | | */ |
1629 | | void ptls_free(ptls_t *tls); |
1630 | | /** |
1631 | | * returns address of the crypto callbacks that the connection is using |
1632 | | */ |
1633 | | ptls_context_t *ptls_get_context(ptls_t *tls); |
1634 | | /** |
1635 | | * updates the context of a connection. Can be called from `on_client_hello` callback. |
1636 | | */ |
1637 | | void ptls_set_context(ptls_t *tls, ptls_context_t *ctx); |
1638 | | /** |
1639 | | * get the signature context |
1640 | | */ |
1641 | | ptls_async_job_t *ptls_get_async_job(ptls_t *tls); |
1642 | | /** |
1643 | | * returns the client-random |
1644 | | */ |
1645 | | ptls_iovec_t ptls_get_client_random(ptls_t *tls); |
1646 | | /** |
1647 | | * returns the cipher-suite being used |
1648 | | */ |
1649 | | ptls_cipher_suite_t *ptls_get_cipher(ptls_t *tls); |
1650 | | /** |
1651 | | * returns a supported cipher-suite given an id |
1652 | | */ |
1653 | | ptls_cipher_suite_t *ptls_find_cipher_suite(ptls_cipher_suite_t **cipher_suites, uint16_t id); |
1654 | | /** |
1655 | | * Returns protocol version (e.g., 0x0303 for TLS 1.2, 0x0304 for TLS 1.3). The result may be unstable prior to handshake |
1656 | | * completion. |
1657 | | */ |
1658 | | uint16_t ptls_get_protocol_version(ptls_t *tls); |
1659 | | /** |
1660 | | * Returns current state of traffic keys. The cipher-suite being used, as well as the length of the traffic keys, can be obtained |
1661 | | * via `ptls_get_cipher`. |
1662 | | * TODO: Even in case of offloading just the TX side, there should be API for handling key updates, sending Close aleart. |
1663 | | */ |
1664 | | int ptls_get_traffic_keys(ptls_t *tls, int is_enc, uint8_t *key, uint8_t *iv, uint64_t *seq); |
1665 | | /** |
1666 | | * returns the server-name (NULL if SNI is not used or failed to negotiate) |
1667 | | */ |
1668 | | const char *ptls_get_server_name(ptls_t *tls); |
1669 | | /** |
1670 | | * sets the server-name associated to the TLS connection. If server_name_len is zero, then strlen(server_name) is called to |
1671 | | * determine the length of the name. |
1672 | | * On the client-side, the value is used for certificate validation. The value will be also sent as an SNI extension, if it looks |
1673 | | * like a DNS name. |
1674 | | * On the server-side, it can be called from on_client_hello to indicate the acceptance of the SNI extension to the client. |
1675 | | */ |
1676 | | int ptls_set_server_name(ptls_t *tls, const char *server_name, size_t server_name_len); |
1677 | | /** |
1678 | | * returns the negotiated protocol (or NULL) |
1679 | | */ |
1680 | | const char *ptls_get_negotiated_protocol(ptls_t *tls); |
1681 | | /** |
1682 | | * sets the negotiated protocol. If protocol_len is zero, strlen(protocol) is called to determine the length of the protocol name. |
1683 | | */ |
1684 | | int ptls_set_negotiated_protocol(ptls_t *tls, const char *protocol, size_t protocol_len); |
1685 | | /** |
1686 | | * returns if the handshake has been completed |
1687 | | */ |
1688 | | int ptls_handshake_is_complete(ptls_t *tls); |
1689 | | /** |
1690 | | * returns if a PSK (or PSK-DHE) handshake was performed |
1691 | | */ |
1692 | | int ptls_is_psk_handshake(ptls_t *tls); |
1693 | | /** |
1694 | | * return if a ECH handshake was performed, as well as optionally the kem and cipher-suite being used |
1695 | | * FIXME: this function always return false when the TLS session is exported and imported |
1696 | | */ |
1697 | | int ptls_is_ech_handshake(ptls_t *tls, uint8_t *config_id, ptls_hpke_kem_t **kem, ptls_hpke_cipher_suite_t **cipher); |
1698 | | /** |
1699 | | * returns a pointer to user data pointer (client is reponsible for freeing the associated data prior to calling ptls_free) |
1700 | | */ |
1701 | | void **ptls_get_data_ptr(ptls_t *tls); |
1702 | | /** |
1703 | | * Returns `ptls_log_conn_state_t` of `ptls_t`. By default, the state is initialized by calling `ptls_log_init_conn_state`, but the |
1704 | | * behavior can be overidden by setting `ptls_log_conn_state_override`. |
1705 | | * This value can be changed by setting `ptls_log_random_override` or by calling `ptls_set_log_random`. |
1706 | | */ |
1707 | | ptls_log_conn_state_t *ptls_get_log_state(ptls_t *tls); |
1708 | | /** |
1709 | | * proceeds with the handshake, optionally taking some input from peer. The function returns zero in case the handshake completed |
1710 | | * successfully. PTLS_ERROR_IN_PROGRESS is returned in case the handshake is incomplete. Otherwise, an error value is returned. The |
1711 | | * contents of sendbuf should be sent to the client, regardless of whether if an error is returned. inlen is an argument used for |
1712 | | * both input and output. As an input, the arguments takes the size of the data available as input. Upon return the value is updated |
1713 | | * to the number of bytes consumed by the handshake. In case the returned value is PTLS_ERROR_IN_PROGRESS there is a guarantee that |
1714 | | * all the input are consumed (i.e. the value of inlen does not change). |
1715 | | */ |
1716 | | int ptls_handshake(ptls_t *tls, ptls_buffer_t *sendbuf, const void *input, size_t *inlen, ptls_handshake_properties_t *args); |
1717 | | /** |
1718 | | * decrypts the first record within given buffer |
1719 | | */ |
1720 | | int ptls_receive(ptls_t *tls, ptls_buffer_t *plaintextbuf, const void *input, size_t *len); |
1721 | | /** |
1722 | | * encrypts given buffer into multiple TLS records |
1723 | | */ |
1724 | | int ptls_send(ptls_t *tls, ptls_buffer_t *sendbuf, const void *input, size_t inlen); |
1725 | | /** |
1726 | | * updates the send traffic key (as well as asks the peer to update) |
1727 | | */ |
1728 | | int ptls_update_key(ptls_t *tls, int request_update); |
1729 | | /** |
1730 | | * Returns if the context is a server context. |
1731 | | */ |
1732 | | int ptls_is_server(ptls_t *tls); |
1733 | | /** |
1734 | | * returns per-record overhead |
1735 | | */ |
1736 | | size_t ptls_get_record_overhead(ptls_t *tls); |
1737 | | /** |
1738 | | * sends an alert |
1739 | | */ |
1740 | | int ptls_send_alert(ptls_t *tls, ptls_buffer_t *sendbuf, uint8_t level, uint8_t description); |
1741 | | /** |
1742 | | * |
1743 | | */ |
1744 | | int ptls_export_secret(ptls_t *tls, void *output, size_t outlen, const char *label, ptls_iovec_t context_value, int is_early); |
1745 | | /** |
1746 | | * build the body of a Certificate message. Can be called with tls set to NULL in order to create a precompressed message. |
1747 | | */ |
1748 | | int ptls_build_certificate_message(ptls_buffer_t *buf, ptls_iovec_t request_context, ptls_iovec_t *certificates, |
1749 | | size_t num_certificates, ptls_iovec_t ocsp_status); |
1750 | | /** |
1751 | | * |
1752 | | */ |
1753 | | int ptls_calc_hash(ptls_hash_algorithm_t *algo, void *output, const void *src, size_t len); |
1754 | | /** |
1755 | | * |
1756 | | */ |
1757 | | ptls_hash_context_t *ptls_hmac_create(ptls_hash_algorithm_t *algo, const void *key, size_t key_size); |
1758 | | /** |
1759 | | * |
1760 | | */ |
1761 | | int ptls_hkdf_extract(ptls_hash_algorithm_t *hash, void *output, ptls_iovec_t salt, ptls_iovec_t ikm); |
1762 | | /** |
1763 | | * |
1764 | | */ |
1765 | | int ptls_hkdf_expand(ptls_hash_algorithm_t *hash, void *output, size_t outlen, ptls_iovec_t prk, ptls_iovec_t info); |
1766 | | /** |
1767 | | * |
1768 | | */ |
1769 | | int ptls_hkdf_expand_label(ptls_hash_algorithm_t *algo, void *output, size_t outlen, ptls_iovec_t secret, const char *label, |
1770 | | ptls_iovec_t hash_value, const char *label_prefix); |
1771 | | /** |
1772 | | * The expansion function of TLS 1.2 defined in RFC 5426 section 5. When `label` is NULL, acts as P_<hash>, or if non-NULL, as PRF. |
1773 | | */ |
1774 | | int ptls_tls12_phash(ptls_hash_algorithm_t *algo, void *output, size_t outlen, ptls_iovec_t secret, const char *label, |
1775 | | ptls_iovec_t seed); |
1776 | | /** |
1777 | | * instantiates a symmetric cipher |
1778 | | */ |
1779 | | ptls_cipher_context_t *ptls_cipher_new(ptls_cipher_algorithm_t *algo, int is_enc, const void *key); |
1780 | | /** |
1781 | | * destroys a symmetric cipher |
1782 | | */ |
1783 | | void ptls_cipher_free(ptls_cipher_context_t *ctx); |
1784 | | /** |
1785 | | * initializes the IV; this function must be called prior to calling ptls_cipher_encrypt |
1786 | | */ |
1787 | | static void ptls_cipher_init(ptls_cipher_context_t *ctx, const void *iv); |
1788 | | /** |
1789 | | * Encrypts given text. The function must be used in a way that the output length would be equal to the input length. For example, |
1790 | | * when using a block cipher in ECB mode, `len` must be a multiple of the block size when using a block cipher. The length can be |
1791 | | * of any value when using a stream cipher or a block cipher in CTR mode. |
1792 | | */ |
1793 | | static void ptls_cipher_encrypt(ptls_cipher_context_t *ctx, void *output, const void *input, size_t len); |
1794 | | /** |
1795 | | * instantiates an AEAD cipher given a secret, which is expanded using hkdf to a set of key and iv |
1796 | | * @param aead |
1797 | | * @param hash |
1798 | | * @param is_enc 1 if creating a context for encryption, 0 if creating a context for decryption |
1799 | | * @param secret the secret. The size must be the digest length of the hash algorithm |
1800 | | * @return pointer to an AEAD context if successful, otherwise NULL |
1801 | | */ |
1802 | | ptls_aead_context_t *ptls_aead_new(ptls_aead_algorithm_t *aead, ptls_hash_algorithm_t *hash, int is_enc, const void *secret, |
1803 | | const char *label_prefix); |
1804 | | /** |
1805 | | * instantiates an AEAD cipher given key and iv |
1806 | | * @param aead |
1807 | | * @param is_enc 1 if creating a context for encryption, 0 if creating a context for decryption |
1808 | | * @return pointer to an AEAD context if successful, otherwise NULL |
1809 | | */ |
1810 | | ptls_aead_context_t *ptls_aead_new_direct(ptls_aead_algorithm_t *aead, int is_enc, const void *key, const void *iv); |
1811 | | /** |
1812 | | * destroys an AEAD cipher context |
1813 | | */ |
1814 | | void ptls_aead_free(ptls_aead_context_t *ctx); |
1815 | | /** |
1816 | | * Permutes the static IV by applying given bytes using bit-wise XOR. This API can be used for supplying nonces longer than 64- |
1817 | | * bits. |
1818 | | */ |
1819 | | void ptls_aead_xor_iv(ptls_aead_context_t *ctx, const void *bytes, size_t len); |
1820 | | static void ptls_aead_get_iv(ptls_aead_context_t *ctx, void *iv); |
1821 | | static void ptls_aead_set_iv(ptls_aead_context_t *ctx, const void *iv); |
1822 | | /** |
1823 | | * Encrypts one AEAD block, given input and output vectors. |
1824 | | */ |
1825 | | static size_t ptls_aead_encrypt(ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen, uint64_t seq, |
1826 | | const void *aad, size_t aadlen); |
1827 | | /** |
1828 | | * Encrypts one AEAD block, as well as one block of ECB (for QUIC / DTLS packet number encryption). Depending on the AEAD engine |
1829 | | * being used, the two operations might run simultaneously. |
1830 | | */ |
1831 | | static void ptls_aead_encrypt_s(ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen, uint64_t seq, |
1832 | | const void *aad, size_t aadlen, ptls_aead_supplementary_encryption_t *supp); |
1833 | | /** |
1834 | | * Encrypts one AEAD block, given a vector of vectors. |
1835 | | */ |
1836 | | static void ptls_aead_encrypt_v(ptls_aead_context_t *ctx, void *output, ptls_iovec_t *input, size_t incnt, uint64_t seq, |
1837 | | const void *aad, size_t aadlen); |
1838 | | /** |
1839 | | * Obsolete; new applications should use one of: `ptls_aead_encrypt`, `ptls_aead_encrypt_s`, `ptls_aead_encrypt_v`. |
1840 | | */ |
1841 | | static void ptls_aead_encrypt_init(ptls_aead_context_t *ctx, uint64_t seq, const void *aad, size_t aadlen); |
1842 | | /** |
1843 | | * Obsolete; see `ptls_aead_encrypt_init`. |
1844 | | */ |
1845 | | static size_t ptls_aead_encrypt_update(ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen); |
1846 | | /** |
1847 | | * Obsolete; see `ptls_aead_encrypt_init`. |
1848 | | */ |
1849 | | static size_t ptls_aead_encrypt_final(ptls_aead_context_t *ctx, void *output); |
1850 | | /** |
1851 | | * decrypts an AEAD record |
1852 | | * @return number of bytes emitted to output if successful, or SIZE_MAX if the input is invalid (e.g. broken MAC) |
1853 | | */ |
1854 | | static size_t ptls_aead_decrypt(ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen, uint64_t seq, |
1855 | | const void *aad, size_t aadlen); |
1856 | | /** |
1857 | | * Return the current read epoch (i.e., that of the message being received or to be) |
1858 | | */ |
1859 | | size_t ptls_get_read_epoch(ptls_t *tls); |
1860 | | /** |
1861 | | * Runs the handshake by dealing directly with handshake messages. Callers MUST delay supplying input to this function until the |
1862 | | * epoch of the input becomes equal to the value returned by `ptls_get_read_epoch()`. |
1863 | | * @param tls the TLS context |
1864 | | * @param sendbuf buffer to which the output will be written |
1865 | | * @param epoch_offsets start and end offset of the messages in each epoch. For example, when the server emits ServerHello between |
1866 | | * offset 0 and 38, the following handshake messages between offset 39 and 348, and a post-handshake message |
1867 | | * between 349 and 451, epoch_offsets will be {0,39,39,349,452} and the length of the sendbuf will be 452. |
1868 | | * This argument is an I/O argument. Applications can either reset sendbuf to empty and epoch_offsets and to |
1869 | | * all zero every time they invoke the function, or retain the values until the handshake completes so that |
1870 | | * data will be appended to sendbuf and epoch_offsets will be adjusted. |
1871 | | * @param in_epoch epoch of the input |
1872 | | * @param input input bytes (must be NULL when starting the handshake on the client side) |
1873 | | * @param inlen length of the input |
1874 | | * @param properties properties specific to the running handshake |
1875 | | * @return same as `ptls_handshake` |
1876 | | */ |
1877 | | int ptls_handle_message(ptls_t *tls, ptls_buffer_t *sendbuf, size_t epoch_offsets[5], size_t in_epoch, const void *input, |
1878 | | size_t inlen, ptls_handshake_properties_t *properties); |
1879 | | int ptls_client_handle_message(ptls_t *tls, ptls_buffer_t *sendbuf, size_t epoch_offsets[5], size_t in_epoch, const void *input, |
1880 | | size_t inlen, ptls_handshake_properties_t *properties); |
1881 | | int ptls_server_handle_message(ptls_t *tls, ptls_buffer_t *sendbuf, size_t epoch_offsets[5], size_t in_epoch, const void *input, |
1882 | | size_t inlen, ptls_handshake_properties_t *properties); |
1883 | | /** |
1884 | | * internal |
1885 | | */ |
1886 | | void ptls_aead__build_iv(ptls_aead_algorithm_t *algo, uint8_t *iv, const uint8_t *static_iv, uint64_t seq); |
1887 | | /** |
1888 | | * |
1889 | | */ |
1890 | | static void ptls_aead__do_encrypt(ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen, uint64_t seq, |
1891 | | const void *aad, size_t aadlen, ptls_aead_supplementary_encryption_t *supp); |
1892 | | /** |
1893 | | * |
1894 | | */ |
1895 | | static void ptls_aead__do_encrypt_v(ptls_aead_context_t *ctx, void *_output, ptls_iovec_t *input, size_t incnt, uint64_t seq, |
1896 | | const void *aad, size_t aadlen); |
1897 | | /** |
1898 | | * internal |
1899 | | */ |
1900 | | void ptls__key_schedule_update_hash(ptls_key_schedule_t *sched, const uint8_t *msg, size_t msglen, int use_outer); |
1901 | | /** |
1902 | | * clears memory |
1903 | | */ |
1904 | | extern void (*volatile ptls_clear_memory)(void *p, size_t len); |
1905 | | /** |
1906 | | * constant-time memcmp |
1907 | | */ |
1908 | | extern int (*volatile ptls_mem_equal)(const void *x, const void *y, size_t len); |
1909 | | /** |
1910 | | * checks if a server name is an IP address. |
1911 | | */ |
1912 | | int ptls_server_name_is_ipaddr(const char *name); |
1913 | | /** |
1914 | | * encodes one ECH Config |
1915 | | */ |
1916 | | int ptls_ech_encode_config(ptls_buffer_t *buf, uint8_t config_id, ptls_hpke_kem_t *kem, ptls_iovec_t public_key, |
1917 | | ptls_hpke_cipher_suite_t **ciphers, uint8_t max_name_length, const char *public_name); |
1918 | | /** |
1919 | | * loads a certificate chain to ptls_context_t::certificates. `certificate.list` and each element of the list is allocated by |
1920 | | * malloc. It is the responsibility of the user to free them when discarding the TLS context. |
1921 | | */ |
1922 | | int ptls_load_certificates(ptls_context_t *ctx, char const *cert_pem_file); |
1923 | | /** |
1924 | | * SetupBaseS function of RFC 9180. Given `kem`, `algo`, `info`, and receiver's public key, returns an ephemeral public key and an |
1925 | | * AEAD context used for encrypting data. |
1926 | | */ |
1927 | | int ptls_hpke_setup_base_s(ptls_hpke_kem_t *kem, ptls_hpke_cipher_suite_t *cipher, ptls_iovec_t *pk_s, ptls_aead_context_t **ctx, |
1928 | | ptls_iovec_t pk_r, ptls_iovec_t info); |
1929 | | /** |
1930 | | * SetupBaseR function of RFC 9180. Given `kem`, `algo`, `info`, receiver's private key (`keyex`), and the esnder's public key, |
1931 | | * returns the AEAD context to be used for decrypting data. |
1932 | | */ |
1933 | | int ptls_hpke_setup_base_r(ptls_hpke_kem_t *kem, ptls_hpke_cipher_suite_t *cipher, ptls_key_exchange_context_t *keyex, |
1934 | | ptls_aead_context_t **ctx, ptls_iovec_t pk_s, ptls_iovec_t info); |
1935 | | /** |
1936 | | * |
1937 | | */ |
1938 | | char *ptls_hexdump(char *dst, const void *src, size_t len); |
1939 | | /** |
1940 | | * Builds a JSON-safe string without double quotes. Supplied buffer MUST be at least 6x + 1 bytes larger than the input. |
1941 | | */ |
1942 | | char *ptls_jsonescape(char *buf, const char *s, size_t len); |
1943 | | /** |
1944 | | * builds a v4-mapped address (i.e., ::ffff:192.0.2.1) |
1945 | | */ |
1946 | | void ptls_build_v4_mapped_v6_address(struct in6_addr *v6, const struct in_addr *v4); |
1947 | | |
1948 | | /** |
1949 | | * the default get_time callback |
1950 | | */ |
1951 | | extern ptls_get_time_t ptls_get_time; |
1952 | | /** |
1953 | | * default hash clone function that calls memcpy |
1954 | | */ |
1955 | | static void ptls_hash_clone_memcpy(void *dst, const void *src, size_t size); |
1956 | | |
1957 | | /* inline functions */ |
1958 | | |
1959 | | inline uint32_t ptls_log_point_maybe_active(struct st_ptls_log_point_t *point) |
1960 | 41.2k | { |
1961 | 41.2k | #if PTLS_HAVE_LOG |
1962 | 41.2k | if (PTLS_UNLIKELY(point->state.generation != ptls_log._generation)) |
1963 | 7 | ptls_log__recalc_point(0, point); |
1964 | 41.2k | return point->state.active_conns; |
1965 | | #else |
1966 | | return 0; |
1967 | | #endif |
1968 | 41.2k | } Unexecuted instantiation: driver.cc:ptls_log_point_maybe_active(st_ptls_log_point_t*) Unexecuted instantiation: driver_common.cc:ptls_log_point_maybe_active(st_ptls_log_point_t*) Unexecuted instantiation: multithread.c:ptls_log_point_maybe_active socket.c:ptls_log_point_maybe_active Line | Count | Source | 1960 | 20.1k | { | 1961 | 20.1k | #if PTLS_HAVE_LOG | 1962 | 20.1k | if (PTLS_UNLIKELY(point->state.generation != ptls_log._generation)) | 1963 | 3 | ptls_log__recalc_point(0, point); | 1964 | 20.1k | return point->state.active_conns; | 1965 | | #else | 1966 | | return 0; | 1967 | | #endif | 1968 | 20.1k | } |
Unexecuted instantiation: socketpool.c:ptls_log_point_maybe_active Unexecuted instantiation: roundrobin.c:ptls_log_point_maybe_active Unexecuted instantiation: config.c:ptls_log_point_maybe_active Unexecuted instantiation: configurator.c:ptls_log_point_maybe_active Unexecuted instantiation: context.c:ptls_log_point_maybe_active Unexecuted instantiation: headers.c:ptls_log_point_maybe_active Unexecuted instantiation: request.c:ptls_log_point_maybe_active Unexecuted instantiation: util.c:ptls_log_point_maybe_active Unexecuted instantiation: access_log.c:ptls_log_point_maybe_active Unexecuted instantiation: file.c:ptls_log_point_maybe_active Unexecuted instantiation: mimemap.c:ptls_log_point_maybe_active Unexecuted instantiation: proxy.c:ptls_log_point_maybe_active Unexecuted instantiation: http1.c:ptls_log_point_maybe_active connection.c:ptls_log_point_maybe_active Line | Count | Source | 1960 | 14.3k | { | 1961 | 14.3k | #if PTLS_HAVE_LOG | 1962 | 14.3k | if (PTLS_UNLIKELY(point->state.generation != ptls_log._generation)) | 1963 | 2 | ptls_log__recalc_point(0, point); | 1964 | 14.3k | return point->state.active_conns; | 1965 | | #else | 1966 | | return 0; | 1967 | | #endif | 1968 | 14.3k | } |
Unexecuted instantiation: scheduler.c:ptls_log_point_maybe_active stream.c:ptls_log_point_maybe_active Line | Count | Source | 1960 | 6.72k | { | 1961 | 6.72k | #if PTLS_HAVE_LOG | 1962 | 6.72k | if (PTLS_UNLIKELY(point->state.generation != ptls_log._generation)) | 1963 | 2 | ptls_log__recalc_point(0, point); | 1964 | 6.72k | return point->state.active_conns; | 1965 | | #else | 1966 | | return 0; | 1967 | | #endif | 1968 | 6.72k | } |
Unexecuted instantiation: http2_debug_state.c:ptls_log_point_maybe_active Unexecuted instantiation: common.c:ptls_log_point_maybe_active Unexecuted instantiation: server.c:ptls_log_point_maybe_active Unexecuted instantiation: picotls.c:ptls_log_point_maybe_active Unexecuted instantiation: openssl.c:ptls_log_point_maybe_active Unexecuted instantiation: cc-reno.c:ptls_log_point_maybe_active Unexecuted instantiation: defaults.c:ptls_log_point_maybe_active Unexecuted instantiation: quicly.c:ptls_log_point_maybe_active Unexecuted instantiation: ranges.c:ptls_log_point_maybe_active Unexecuted instantiation: rate.c:ptls_log_point_maybe_active Unexecuted instantiation: recvstate.c:ptls_log_point_maybe_active Unexecuted instantiation: remote_cid.c:ptls_log_point_maybe_active Unexecuted instantiation: retire_cid.c:ptls_log_point_maybe_active Unexecuted instantiation: sendstate.c:ptls_log_point_maybe_active Unexecuted instantiation: sentmap.c:ptls_log_point_maybe_active Unexecuted instantiation: streambuf.c:ptls_log_point_maybe_active Unexecuted instantiation: hostinfo.c:ptls_log_point_maybe_active Unexecuted instantiation: http3client.c:ptls_log_point_maybe_active Unexecuted instantiation: httpclient.c:ptls_log_point_maybe_active Unexecuted instantiation: memcached.c:ptls_log_point_maybe_active Unexecuted instantiation: redis.c:ptls_log_point_maybe_active Unexecuted instantiation: serverutil.c:ptls_log_point_maybe_active Unexecuted instantiation: rand.c:ptls_log_point_maybe_active Unexecuted instantiation: absprio.c:ptls_log_point_maybe_active Unexecuted instantiation: logconf.c:ptls_log_point_maybe_active Unexecuted instantiation: compress.c:ptls_log_point_maybe_active Unexecuted instantiation: gzip.c:ptls_log_point_maybe_active Unexecuted instantiation: headers_util.c:ptls_log_point_maybe_active Unexecuted instantiation: frame.c:ptls_log_point_maybe_active Unexecuted instantiation: qpack.c:ptls_log_point_maybe_active Unexecuted instantiation: hpke.c:ptls_log_point_maybe_active Unexecuted instantiation: cc-cubic.c:ptls_log_point_maybe_active Unexecuted instantiation: cc-pico.c:ptls_log_point_maybe_active Unexecuted instantiation: local_cid.c:ptls_log_point_maybe_active Unexecuted instantiation: loss.c:ptls_log_point_maybe_active Unexecuted instantiation: http1client.c:ptls_log_point_maybe_active Unexecuted instantiation: http2client.c:ptls_log_point_maybe_active |
1969 | | |
1970 | | inline void ptls_log_recalc_conn_state(ptls_log_conn_state_t *state) |
1971 | 0 | { |
1972 | 0 | state->state.generation = 0; |
1973 | 0 | } Unexecuted instantiation: driver.cc:ptls_log_recalc_conn_state(st_ptls_log_conn_state_t*) Unexecuted instantiation: driver_common.cc:ptls_log_recalc_conn_state(st_ptls_log_conn_state_t*) Unexecuted instantiation: multithread.c:ptls_log_recalc_conn_state Unexecuted instantiation: socket.c:ptls_log_recalc_conn_state Unexecuted instantiation: socketpool.c:ptls_log_recalc_conn_state Unexecuted instantiation: roundrobin.c:ptls_log_recalc_conn_state Unexecuted instantiation: config.c:ptls_log_recalc_conn_state Unexecuted instantiation: configurator.c:ptls_log_recalc_conn_state Unexecuted instantiation: context.c:ptls_log_recalc_conn_state Unexecuted instantiation: headers.c:ptls_log_recalc_conn_state Unexecuted instantiation: request.c:ptls_log_recalc_conn_state Unexecuted instantiation: util.c:ptls_log_recalc_conn_state Unexecuted instantiation: access_log.c:ptls_log_recalc_conn_state Unexecuted instantiation: file.c:ptls_log_recalc_conn_state Unexecuted instantiation: mimemap.c:ptls_log_recalc_conn_state Unexecuted instantiation: proxy.c:ptls_log_recalc_conn_state Unexecuted instantiation: http1.c:ptls_log_recalc_conn_state Unexecuted instantiation: connection.c:ptls_log_recalc_conn_state Unexecuted instantiation: scheduler.c:ptls_log_recalc_conn_state Unexecuted instantiation: stream.c:ptls_log_recalc_conn_state Unexecuted instantiation: http2_debug_state.c:ptls_log_recalc_conn_state Unexecuted instantiation: common.c:ptls_log_recalc_conn_state Unexecuted instantiation: server.c:ptls_log_recalc_conn_state Unexecuted instantiation: picotls.c:ptls_log_recalc_conn_state Unexecuted instantiation: openssl.c:ptls_log_recalc_conn_state Unexecuted instantiation: cc-reno.c:ptls_log_recalc_conn_state Unexecuted instantiation: defaults.c:ptls_log_recalc_conn_state Unexecuted instantiation: quicly.c:ptls_log_recalc_conn_state Unexecuted instantiation: ranges.c:ptls_log_recalc_conn_state Unexecuted instantiation: rate.c:ptls_log_recalc_conn_state Unexecuted instantiation: recvstate.c:ptls_log_recalc_conn_state Unexecuted instantiation: remote_cid.c:ptls_log_recalc_conn_state Unexecuted instantiation: retire_cid.c:ptls_log_recalc_conn_state Unexecuted instantiation: sendstate.c:ptls_log_recalc_conn_state Unexecuted instantiation: sentmap.c:ptls_log_recalc_conn_state Unexecuted instantiation: streambuf.c:ptls_log_recalc_conn_state Unexecuted instantiation: hostinfo.c:ptls_log_recalc_conn_state Unexecuted instantiation: http3client.c:ptls_log_recalc_conn_state Unexecuted instantiation: httpclient.c:ptls_log_recalc_conn_state Unexecuted instantiation: memcached.c:ptls_log_recalc_conn_state Unexecuted instantiation: redis.c:ptls_log_recalc_conn_state Unexecuted instantiation: serverutil.c:ptls_log_recalc_conn_state Unexecuted instantiation: rand.c:ptls_log_recalc_conn_state Unexecuted instantiation: absprio.c:ptls_log_recalc_conn_state Unexecuted instantiation: logconf.c:ptls_log_recalc_conn_state Unexecuted instantiation: compress.c:ptls_log_recalc_conn_state Unexecuted instantiation: gzip.c:ptls_log_recalc_conn_state Unexecuted instantiation: headers_util.c:ptls_log_recalc_conn_state Unexecuted instantiation: frame.c:ptls_log_recalc_conn_state Unexecuted instantiation: qpack.c:ptls_log_recalc_conn_state Unexecuted instantiation: hpke.c:ptls_log_recalc_conn_state Unexecuted instantiation: cc-cubic.c:ptls_log_recalc_conn_state Unexecuted instantiation: cc-pico.c:ptls_log_recalc_conn_state Unexecuted instantiation: local_cid.c:ptls_log_recalc_conn_state Unexecuted instantiation: loss.c:ptls_log_recalc_conn_state Unexecuted instantiation: http1client.c:ptls_log_recalc_conn_state Unexecuted instantiation: http2client.c:ptls_log_recalc_conn_state |
1974 | | |
1975 | | inline uint32_t ptls_log_conn_maybe_active(ptls_log_conn_state_t *conn, const char *(*get_sni)(void *), void *get_sni_arg) |
1976 | 0 | { |
1977 | 0 | #if PTLS_HAVE_LOG |
1978 | 0 | if (PTLS_UNLIKELY(conn->state.generation != ptls_log._generation)) |
1979 | 0 | ptls_log__recalc_conn(0, conn, get_sni, get_sni_arg); |
1980 | 0 | return conn->state.active_conns; |
1981 | | #else |
1982 | | return 0; |
1983 | | #endif |
1984 | 0 | } Unexecuted instantiation: driver.cc:ptls_log_conn_maybe_active(st_ptls_log_conn_state_t*, char const* (*)(void*), void*) Unexecuted instantiation: driver_common.cc:ptls_log_conn_maybe_active(st_ptls_log_conn_state_t*, char const* (*)(void*), void*) Unexecuted instantiation: multithread.c:ptls_log_conn_maybe_active Unexecuted instantiation: socket.c:ptls_log_conn_maybe_active Unexecuted instantiation: socketpool.c:ptls_log_conn_maybe_active Unexecuted instantiation: roundrobin.c:ptls_log_conn_maybe_active Unexecuted instantiation: config.c:ptls_log_conn_maybe_active Unexecuted instantiation: configurator.c:ptls_log_conn_maybe_active Unexecuted instantiation: context.c:ptls_log_conn_maybe_active Unexecuted instantiation: headers.c:ptls_log_conn_maybe_active Unexecuted instantiation: request.c:ptls_log_conn_maybe_active Unexecuted instantiation: util.c:ptls_log_conn_maybe_active Unexecuted instantiation: access_log.c:ptls_log_conn_maybe_active Unexecuted instantiation: file.c:ptls_log_conn_maybe_active Unexecuted instantiation: mimemap.c:ptls_log_conn_maybe_active Unexecuted instantiation: proxy.c:ptls_log_conn_maybe_active Unexecuted instantiation: http1.c:ptls_log_conn_maybe_active Unexecuted instantiation: connection.c:ptls_log_conn_maybe_active Unexecuted instantiation: scheduler.c:ptls_log_conn_maybe_active Unexecuted instantiation: stream.c:ptls_log_conn_maybe_active Unexecuted instantiation: http2_debug_state.c:ptls_log_conn_maybe_active Unexecuted instantiation: common.c:ptls_log_conn_maybe_active Unexecuted instantiation: server.c:ptls_log_conn_maybe_active Unexecuted instantiation: picotls.c:ptls_log_conn_maybe_active Unexecuted instantiation: openssl.c:ptls_log_conn_maybe_active Unexecuted instantiation: cc-reno.c:ptls_log_conn_maybe_active Unexecuted instantiation: defaults.c:ptls_log_conn_maybe_active Unexecuted instantiation: quicly.c:ptls_log_conn_maybe_active Unexecuted instantiation: ranges.c:ptls_log_conn_maybe_active Unexecuted instantiation: rate.c:ptls_log_conn_maybe_active Unexecuted instantiation: recvstate.c:ptls_log_conn_maybe_active Unexecuted instantiation: remote_cid.c:ptls_log_conn_maybe_active Unexecuted instantiation: retire_cid.c:ptls_log_conn_maybe_active Unexecuted instantiation: sendstate.c:ptls_log_conn_maybe_active Unexecuted instantiation: sentmap.c:ptls_log_conn_maybe_active Unexecuted instantiation: streambuf.c:ptls_log_conn_maybe_active Unexecuted instantiation: hostinfo.c:ptls_log_conn_maybe_active Unexecuted instantiation: http3client.c:ptls_log_conn_maybe_active Unexecuted instantiation: httpclient.c:ptls_log_conn_maybe_active Unexecuted instantiation: memcached.c:ptls_log_conn_maybe_active Unexecuted instantiation: redis.c:ptls_log_conn_maybe_active Unexecuted instantiation: serverutil.c:ptls_log_conn_maybe_active Unexecuted instantiation: rand.c:ptls_log_conn_maybe_active Unexecuted instantiation: absprio.c:ptls_log_conn_maybe_active Unexecuted instantiation: logconf.c:ptls_log_conn_maybe_active Unexecuted instantiation: compress.c:ptls_log_conn_maybe_active Unexecuted instantiation: gzip.c:ptls_log_conn_maybe_active Unexecuted instantiation: headers_util.c:ptls_log_conn_maybe_active Unexecuted instantiation: frame.c:ptls_log_conn_maybe_active Unexecuted instantiation: qpack.c:ptls_log_conn_maybe_active Unexecuted instantiation: hpke.c:ptls_log_conn_maybe_active Unexecuted instantiation: cc-cubic.c:ptls_log_conn_maybe_active Unexecuted instantiation: cc-pico.c:ptls_log_conn_maybe_active Unexecuted instantiation: local_cid.c:ptls_log_conn_maybe_active Unexecuted instantiation: loss.c:ptls_log_conn_maybe_active Unexecuted instantiation: http1client.c:ptls_log_conn_maybe_active Unexecuted instantiation: http2client.c:ptls_log_conn_maybe_active |
1985 | | |
1986 | | inline ptls_t *ptls_new(ptls_context_t *ctx, int is_server) |
1987 | 0 | { |
1988 | 0 | return is_server ? ptls_server_new(ctx) : ptls_client_new(ctx); |
1989 | 0 | } Unexecuted instantiation: driver.cc:ptls_new(st_ptls_context_t*, int) Unexecuted instantiation: driver_common.cc:ptls_new(st_ptls_context_t*, int) Unexecuted instantiation: multithread.c:ptls_new Unexecuted instantiation: socket.c:ptls_new Unexecuted instantiation: socketpool.c:ptls_new Unexecuted instantiation: roundrobin.c:ptls_new Unexecuted instantiation: config.c:ptls_new Unexecuted instantiation: configurator.c:ptls_new Unexecuted instantiation: context.c:ptls_new Unexecuted instantiation: headers.c:ptls_new Unexecuted instantiation: request.c:ptls_new Unexecuted instantiation: util.c:ptls_new Unexecuted instantiation: access_log.c:ptls_new Unexecuted instantiation: file.c:ptls_new Unexecuted instantiation: mimemap.c:ptls_new Unexecuted instantiation: proxy.c:ptls_new Unexecuted instantiation: http1.c:ptls_new Unexecuted instantiation: connection.c:ptls_new Unexecuted instantiation: scheduler.c:ptls_new Unexecuted instantiation: stream.c:ptls_new Unexecuted instantiation: http2_debug_state.c:ptls_new Unexecuted instantiation: common.c:ptls_new Unexecuted instantiation: server.c:ptls_new Unexecuted instantiation: picotls.c:ptls_new Unexecuted instantiation: openssl.c:ptls_new Unexecuted instantiation: cc-reno.c:ptls_new Unexecuted instantiation: defaults.c:ptls_new Unexecuted instantiation: quicly.c:ptls_new Unexecuted instantiation: ranges.c:ptls_new Unexecuted instantiation: rate.c:ptls_new Unexecuted instantiation: recvstate.c:ptls_new Unexecuted instantiation: remote_cid.c:ptls_new Unexecuted instantiation: retire_cid.c:ptls_new Unexecuted instantiation: sendstate.c:ptls_new Unexecuted instantiation: sentmap.c:ptls_new Unexecuted instantiation: streambuf.c:ptls_new Unexecuted instantiation: hostinfo.c:ptls_new Unexecuted instantiation: http3client.c:ptls_new Unexecuted instantiation: httpclient.c:ptls_new Unexecuted instantiation: memcached.c:ptls_new Unexecuted instantiation: redis.c:ptls_new Unexecuted instantiation: serverutil.c:ptls_new Unexecuted instantiation: rand.c:ptls_new Unexecuted instantiation: absprio.c:ptls_new Unexecuted instantiation: logconf.c:ptls_new Unexecuted instantiation: compress.c:ptls_new Unexecuted instantiation: gzip.c:ptls_new Unexecuted instantiation: headers_util.c:ptls_new Unexecuted instantiation: frame.c:ptls_new Unexecuted instantiation: qpack.c:ptls_new Unexecuted instantiation: hpke.c:ptls_new Unexecuted instantiation: cc-cubic.c:ptls_new Unexecuted instantiation: cc-pico.c:ptls_new Unexecuted instantiation: local_cid.c:ptls_new Unexecuted instantiation: loss.c:ptls_new Unexecuted instantiation: http1client.c:ptls_new Unexecuted instantiation: http2client.c:ptls_new |
1990 | | |
1991 | | inline ptls_iovec_t ptls_iovec_init(const void *p, size_t len) |
1992 | 0 | { |
1993 | | /* avoid the "return (ptls_iovec_t){(uint8_t *)p, len};" construct because it requires C99 |
1994 | | * and triggers a warning "C4204: nonstandard extension used: non-constant aggregate initializer" |
1995 | | * in Visual Studio */ |
1996 | 0 | ptls_iovec_t r; |
1997 | 0 | r.base = (uint8_t *)p; |
1998 | 0 | r.len = len; |
1999 | 0 | return r; |
2000 | 0 | } Unexecuted instantiation: driver.cc:ptls_iovec_init(void const*, unsigned long) Unexecuted instantiation: driver_common.cc:ptls_iovec_init(void const*, unsigned long) Unexecuted instantiation: multithread.c:ptls_iovec_init Unexecuted instantiation: socket.c:ptls_iovec_init Unexecuted instantiation: socketpool.c:ptls_iovec_init Unexecuted instantiation: roundrobin.c:ptls_iovec_init Unexecuted instantiation: config.c:ptls_iovec_init Unexecuted instantiation: configurator.c:ptls_iovec_init Unexecuted instantiation: context.c:ptls_iovec_init Unexecuted instantiation: headers.c:ptls_iovec_init Unexecuted instantiation: request.c:ptls_iovec_init Unexecuted instantiation: util.c:ptls_iovec_init Unexecuted instantiation: access_log.c:ptls_iovec_init Unexecuted instantiation: file.c:ptls_iovec_init Unexecuted instantiation: mimemap.c:ptls_iovec_init Unexecuted instantiation: proxy.c:ptls_iovec_init Unexecuted instantiation: http1.c:ptls_iovec_init Unexecuted instantiation: connection.c:ptls_iovec_init Unexecuted instantiation: scheduler.c:ptls_iovec_init Unexecuted instantiation: stream.c:ptls_iovec_init Unexecuted instantiation: http2_debug_state.c:ptls_iovec_init Unexecuted instantiation: common.c:ptls_iovec_init Unexecuted instantiation: server.c:ptls_iovec_init Unexecuted instantiation: picotls.c:ptls_iovec_init Unexecuted instantiation: openssl.c:ptls_iovec_init Unexecuted instantiation: cc-reno.c:ptls_iovec_init Unexecuted instantiation: defaults.c:ptls_iovec_init Unexecuted instantiation: quicly.c:ptls_iovec_init Unexecuted instantiation: ranges.c:ptls_iovec_init Unexecuted instantiation: rate.c:ptls_iovec_init Unexecuted instantiation: recvstate.c:ptls_iovec_init Unexecuted instantiation: remote_cid.c:ptls_iovec_init Unexecuted instantiation: retire_cid.c:ptls_iovec_init Unexecuted instantiation: sendstate.c:ptls_iovec_init Unexecuted instantiation: sentmap.c:ptls_iovec_init Unexecuted instantiation: streambuf.c:ptls_iovec_init Unexecuted instantiation: hostinfo.c:ptls_iovec_init Unexecuted instantiation: http3client.c:ptls_iovec_init Unexecuted instantiation: httpclient.c:ptls_iovec_init Unexecuted instantiation: memcached.c:ptls_iovec_init Unexecuted instantiation: redis.c:ptls_iovec_init Unexecuted instantiation: serverutil.c:ptls_iovec_init Unexecuted instantiation: rand.c:ptls_iovec_init Unexecuted instantiation: absprio.c:ptls_iovec_init Unexecuted instantiation: logconf.c:ptls_iovec_init Unexecuted instantiation: compress.c:ptls_iovec_init Unexecuted instantiation: gzip.c:ptls_iovec_init Unexecuted instantiation: headers_util.c:ptls_iovec_init Unexecuted instantiation: frame.c:ptls_iovec_init Unexecuted instantiation: qpack.c:ptls_iovec_init Unexecuted instantiation: hpke.c:ptls_iovec_init Unexecuted instantiation: cc-cubic.c:ptls_iovec_init Unexecuted instantiation: cc-pico.c:ptls_iovec_init Unexecuted instantiation: local_cid.c:ptls_iovec_init Unexecuted instantiation: loss.c:ptls_iovec_init Unexecuted instantiation: http1client.c:ptls_iovec_init Unexecuted instantiation: http2client.c:ptls_iovec_init |
2001 | | |
2002 | | inline void ptls_buffer_init(ptls_buffer_t *buf, void *smallbuf, size_t smallbuf_size) |
2003 | 0 | { |
2004 | 0 | assert(smallbuf != NULL); |
2005 | 0 | buf->base = (uint8_t *)smallbuf; |
2006 | 0 | buf->off = 0; |
2007 | 0 | buf->capacity = smallbuf_size; |
2008 | 0 | buf->is_allocated = 0; |
2009 | 0 | buf->align_bits = 0; |
2010 | 0 | } Unexecuted instantiation: driver.cc:ptls_buffer_init(st_ptls_buffer_t*, void*, unsigned long) Unexecuted instantiation: driver_common.cc:ptls_buffer_init(st_ptls_buffer_t*, void*, unsigned long) Unexecuted instantiation: multithread.c:ptls_buffer_init Unexecuted instantiation: socket.c:ptls_buffer_init Unexecuted instantiation: socketpool.c:ptls_buffer_init Unexecuted instantiation: roundrobin.c:ptls_buffer_init Unexecuted instantiation: config.c:ptls_buffer_init Unexecuted instantiation: configurator.c:ptls_buffer_init Unexecuted instantiation: context.c:ptls_buffer_init Unexecuted instantiation: headers.c:ptls_buffer_init Unexecuted instantiation: request.c:ptls_buffer_init Unexecuted instantiation: util.c:ptls_buffer_init Unexecuted instantiation: access_log.c:ptls_buffer_init Unexecuted instantiation: file.c:ptls_buffer_init Unexecuted instantiation: mimemap.c:ptls_buffer_init Unexecuted instantiation: proxy.c:ptls_buffer_init Unexecuted instantiation: http1.c:ptls_buffer_init Unexecuted instantiation: connection.c:ptls_buffer_init Unexecuted instantiation: scheduler.c:ptls_buffer_init Unexecuted instantiation: stream.c:ptls_buffer_init Unexecuted instantiation: http2_debug_state.c:ptls_buffer_init Unexecuted instantiation: common.c:ptls_buffer_init Unexecuted instantiation: server.c:ptls_buffer_init Unexecuted instantiation: picotls.c:ptls_buffer_init Unexecuted instantiation: openssl.c:ptls_buffer_init Unexecuted instantiation: cc-reno.c:ptls_buffer_init Unexecuted instantiation: defaults.c:ptls_buffer_init Unexecuted instantiation: quicly.c:ptls_buffer_init Unexecuted instantiation: ranges.c:ptls_buffer_init Unexecuted instantiation: rate.c:ptls_buffer_init Unexecuted instantiation: recvstate.c:ptls_buffer_init Unexecuted instantiation: remote_cid.c:ptls_buffer_init Unexecuted instantiation: retire_cid.c:ptls_buffer_init Unexecuted instantiation: sendstate.c:ptls_buffer_init Unexecuted instantiation: sentmap.c:ptls_buffer_init Unexecuted instantiation: streambuf.c:ptls_buffer_init Unexecuted instantiation: hostinfo.c:ptls_buffer_init Unexecuted instantiation: http3client.c:ptls_buffer_init Unexecuted instantiation: httpclient.c:ptls_buffer_init Unexecuted instantiation: memcached.c:ptls_buffer_init Unexecuted instantiation: redis.c:ptls_buffer_init Unexecuted instantiation: serverutil.c:ptls_buffer_init Unexecuted instantiation: rand.c:ptls_buffer_init Unexecuted instantiation: absprio.c:ptls_buffer_init Unexecuted instantiation: logconf.c:ptls_buffer_init Unexecuted instantiation: compress.c:ptls_buffer_init Unexecuted instantiation: gzip.c:ptls_buffer_init Unexecuted instantiation: headers_util.c:ptls_buffer_init Unexecuted instantiation: frame.c:ptls_buffer_init Unexecuted instantiation: qpack.c:ptls_buffer_init Unexecuted instantiation: hpke.c:ptls_buffer_init Unexecuted instantiation: cc-cubic.c:ptls_buffer_init Unexecuted instantiation: cc-pico.c:ptls_buffer_init Unexecuted instantiation: local_cid.c:ptls_buffer_init Unexecuted instantiation: loss.c:ptls_buffer_init Unexecuted instantiation: http1client.c:ptls_buffer_init Unexecuted instantiation: http2client.c:ptls_buffer_init |
2011 | | |
2012 | | inline void ptls_buffer_dispose(ptls_buffer_t *buf) |
2013 | 0 | { |
2014 | 0 | ptls_buffer__release_memory(buf); |
2015 | 0 | *buf = (ptls_buffer_t){NULL, 0, 0, 0, 0}; |
2016 | 0 | } Unexecuted instantiation: driver.cc:ptls_buffer_dispose(st_ptls_buffer_t*) Unexecuted instantiation: driver_common.cc:ptls_buffer_dispose(st_ptls_buffer_t*) Unexecuted instantiation: multithread.c:ptls_buffer_dispose Unexecuted instantiation: socket.c:ptls_buffer_dispose Unexecuted instantiation: socketpool.c:ptls_buffer_dispose Unexecuted instantiation: roundrobin.c:ptls_buffer_dispose Unexecuted instantiation: config.c:ptls_buffer_dispose Unexecuted instantiation: configurator.c:ptls_buffer_dispose Unexecuted instantiation: context.c:ptls_buffer_dispose Unexecuted instantiation: headers.c:ptls_buffer_dispose Unexecuted instantiation: request.c:ptls_buffer_dispose Unexecuted instantiation: util.c:ptls_buffer_dispose Unexecuted instantiation: access_log.c:ptls_buffer_dispose Unexecuted instantiation: file.c:ptls_buffer_dispose Unexecuted instantiation: mimemap.c:ptls_buffer_dispose Unexecuted instantiation: proxy.c:ptls_buffer_dispose Unexecuted instantiation: http1.c:ptls_buffer_dispose Unexecuted instantiation: connection.c:ptls_buffer_dispose Unexecuted instantiation: scheduler.c:ptls_buffer_dispose Unexecuted instantiation: stream.c:ptls_buffer_dispose Unexecuted instantiation: http2_debug_state.c:ptls_buffer_dispose Unexecuted instantiation: common.c:ptls_buffer_dispose Unexecuted instantiation: server.c:ptls_buffer_dispose Unexecuted instantiation: picotls.c:ptls_buffer_dispose Unexecuted instantiation: openssl.c:ptls_buffer_dispose Unexecuted instantiation: cc-reno.c:ptls_buffer_dispose Unexecuted instantiation: defaults.c:ptls_buffer_dispose Unexecuted instantiation: quicly.c:ptls_buffer_dispose Unexecuted instantiation: ranges.c:ptls_buffer_dispose Unexecuted instantiation: rate.c:ptls_buffer_dispose Unexecuted instantiation: recvstate.c:ptls_buffer_dispose Unexecuted instantiation: remote_cid.c:ptls_buffer_dispose Unexecuted instantiation: retire_cid.c:ptls_buffer_dispose Unexecuted instantiation: sendstate.c:ptls_buffer_dispose Unexecuted instantiation: sentmap.c:ptls_buffer_dispose Unexecuted instantiation: streambuf.c:ptls_buffer_dispose Unexecuted instantiation: hostinfo.c:ptls_buffer_dispose Unexecuted instantiation: http3client.c:ptls_buffer_dispose Unexecuted instantiation: httpclient.c:ptls_buffer_dispose Unexecuted instantiation: memcached.c:ptls_buffer_dispose Unexecuted instantiation: redis.c:ptls_buffer_dispose Unexecuted instantiation: serverutil.c:ptls_buffer_dispose Unexecuted instantiation: rand.c:ptls_buffer_dispose Unexecuted instantiation: absprio.c:ptls_buffer_dispose Unexecuted instantiation: logconf.c:ptls_buffer_dispose Unexecuted instantiation: compress.c:ptls_buffer_dispose Unexecuted instantiation: gzip.c:ptls_buffer_dispose Unexecuted instantiation: headers_util.c:ptls_buffer_dispose Unexecuted instantiation: frame.c:ptls_buffer_dispose Unexecuted instantiation: qpack.c:ptls_buffer_dispose Unexecuted instantiation: hpke.c:ptls_buffer_dispose Unexecuted instantiation: cc-cubic.c:ptls_buffer_dispose Unexecuted instantiation: cc-pico.c:ptls_buffer_dispose Unexecuted instantiation: local_cid.c:ptls_buffer_dispose Unexecuted instantiation: loss.c:ptls_buffer_dispose Unexecuted instantiation: http1client.c:ptls_buffer_dispose Unexecuted instantiation: http2client.c:ptls_buffer_dispose |
2017 | | |
2018 | | inline uint8_t *ptls_encode_quicint(uint8_t *p, uint64_t v) |
2019 | 0 | { |
2020 | 0 | if (PTLS_UNLIKELY(v > 63)) { |
2021 | 0 | if (PTLS_UNLIKELY(v > 16383)) { |
2022 | 0 | unsigned sb; |
2023 | 0 | if (PTLS_UNLIKELY(v > 1073741823)) { |
2024 | 0 | assert(v <= 4611686018427387903); |
2025 | 0 | *p++ = 0xc0 | (uint8_t)(v >> 56); |
2026 | 0 | sb = 6 * 8; |
2027 | 0 | } else { |
2028 | 0 | *p++ = 0x80 | (uint8_t)(v >> 24); |
2029 | 0 | sb = 2 * 8; |
2030 | 0 | } |
2031 | 0 | do { |
2032 | 0 | *p++ = (uint8_t)(v >> sb); |
2033 | 0 | } while ((sb -= 8) != 0); |
2034 | 0 | } else { |
2035 | 0 | *p++ = 0x40 | (uint8_t)((uint16_t)v >> 8); |
2036 | 0 | } |
2037 | 0 | } |
2038 | 0 | *p++ = (uint8_t)v; |
2039 | 0 | return p; |
2040 | 0 | } Unexecuted instantiation: driver.cc:ptls_encode_quicint(unsigned char*, unsigned long) Unexecuted instantiation: driver_common.cc:ptls_encode_quicint(unsigned char*, unsigned long) Unexecuted instantiation: multithread.c:ptls_encode_quicint Unexecuted instantiation: socket.c:ptls_encode_quicint Unexecuted instantiation: socketpool.c:ptls_encode_quicint Unexecuted instantiation: roundrobin.c:ptls_encode_quicint Unexecuted instantiation: config.c:ptls_encode_quicint Unexecuted instantiation: configurator.c:ptls_encode_quicint Unexecuted instantiation: context.c:ptls_encode_quicint Unexecuted instantiation: headers.c:ptls_encode_quicint Unexecuted instantiation: request.c:ptls_encode_quicint Unexecuted instantiation: util.c:ptls_encode_quicint Unexecuted instantiation: access_log.c:ptls_encode_quicint Unexecuted instantiation: file.c:ptls_encode_quicint Unexecuted instantiation: mimemap.c:ptls_encode_quicint Unexecuted instantiation: proxy.c:ptls_encode_quicint Unexecuted instantiation: http1.c:ptls_encode_quicint Unexecuted instantiation: connection.c:ptls_encode_quicint Unexecuted instantiation: scheduler.c:ptls_encode_quicint Unexecuted instantiation: stream.c:ptls_encode_quicint Unexecuted instantiation: http2_debug_state.c:ptls_encode_quicint Unexecuted instantiation: common.c:ptls_encode_quicint Unexecuted instantiation: server.c:ptls_encode_quicint Unexecuted instantiation: picotls.c:ptls_encode_quicint Unexecuted instantiation: openssl.c:ptls_encode_quicint Unexecuted instantiation: cc-reno.c:ptls_encode_quicint Unexecuted instantiation: defaults.c:ptls_encode_quicint Unexecuted instantiation: quicly.c:ptls_encode_quicint Unexecuted instantiation: ranges.c:ptls_encode_quicint Unexecuted instantiation: rate.c:ptls_encode_quicint Unexecuted instantiation: recvstate.c:ptls_encode_quicint Unexecuted instantiation: remote_cid.c:ptls_encode_quicint Unexecuted instantiation: retire_cid.c:ptls_encode_quicint Unexecuted instantiation: sendstate.c:ptls_encode_quicint Unexecuted instantiation: sentmap.c:ptls_encode_quicint Unexecuted instantiation: streambuf.c:ptls_encode_quicint Unexecuted instantiation: hostinfo.c:ptls_encode_quicint Unexecuted instantiation: http3client.c:ptls_encode_quicint Unexecuted instantiation: httpclient.c:ptls_encode_quicint Unexecuted instantiation: memcached.c:ptls_encode_quicint Unexecuted instantiation: redis.c:ptls_encode_quicint Unexecuted instantiation: serverutil.c:ptls_encode_quicint Unexecuted instantiation: rand.c:ptls_encode_quicint Unexecuted instantiation: absprio.c:ptls_encode_quicint Unexecuted instantiation: logconf.c:ptls_encode_quicint Unexecuted instantiation: compress.c:ptls_encode_quicint Unexecuted instantiation: gzip.c:ptls_encode_quicint Unexecuted instantiation: headers_util.c:ptls_encode_quicint Unexecuted instantiation: frame.c:ptls_encode_quicint Unexecuted instantiation: qpack.c:ptls_encode_quicint Unexecuted instantiation: hpke.c:ptls_encode_quicint Unexecuted instantiation: cc-cubic.c:ptls_encode_quicint Unexecuted instantiation: cc-pico.c:ptls_encode_quicint Unexecuted instantiation: local_cid.c:ptls_encode_quicint Unexecuted instantiation: loss.c:ptls_encode_quicint Unexecuted instantiation: http1client.c:ptls_encode_quicint Unexecuted instantiation: http2client.c:ptls_encode_quicint |
2041 | | |
2042 | | inline void ptls_cipher_init(ptls_cipher_context_t *ctx, const void *iv) |
2043 | 0 | { |
2044 | 0 | ctx->do_init(ctx, iv); |
2045 | 0 | } Unexecuted instantiation: driver.cc:ptls_cipher_init(st_ptls_cipher_context_t*, void const*) Unexecuted instantiation: driver_common.cc:ptls_cipher_init(st_ptls_cipher_context_t*, void const*) Unexecuted instantiation: multithread.c:ptls_cipher_init Unexecuted instantiation: socket.c:ptls_cipher_init Unexecuted instantiation: socketpool.c:ptls_cipher_init Unexecuted instantiation: roundrobin.c:ptls_cipher_init Unexecuted instantiation: config.c:ptls_cipher_init Unexecuted instantiation: configurator.c:ptls_cipher_init Unexecuted instantiation: context.c:ptls_cipher_init Unexecuted instantiation: headers.c:ptls_cipher_init Unexecuted instantiation: request.c:ptls_cipher_init Unexecuted instantiation: util.c:ptls_cipher_init Unexecuted instantiation: access_log.c:ptls_cipher_init Unexecuted instantiation: file.c:ptls_cipher_init Unexecuted instantiation: mimemap.c:ptls_cipher_init Unexecuted instantiation: proxy.c:ptls_cipher_init Unexecuted instantiation: http1.c:ptls_cipher_init Unexecuted instantiation: connection.c:ptls_cipher_init Unexecuted instantiation: scheduler.c:ptls_cipher_init Unexecuted instantiation: stream.c:ptls_cipher_init Unexecuted instantiation: http2_debug_state.c:ptls_cipher_init Unexecuted instantiation: common.c:ptls_cipher_init Unexecuted instantiation: server.c:ptls_cipher_init Unexecuted instantiation: picotls.c:ptls_cipher_init Unexecuted instantiation: openssl.c:ptls_cipher_init Unexecuted instantiation: cc-reno.c:ptls_cipher_init Unexecuted instantiation: defaults.c:ptls_cipher_init Unexecuted instantiation: quicly.c:ptls_cipher_init Unexecuted instantiation: ranges.c:ptls_cipher_init Unexecuted instantiation: rate.c:ptls_cipher_init Unexecuted instantiation: recvstate.c:ptls_cipher_init Unexecuted instantiation: remote_cid.c:ptls_cipher_init Unexecuted instantiation: retire_cid.c:ptls_cipher_init Unexecuted instantiation: sendstate.c:ptls_cipher_init Unexecuted instantiation: sentmap.c:ptls_cipher_init Unexecuted instantiation: streambuf.c:ptls_cipher_init Unexecuted instantiation: hostinfo.c:ptls_cipher_init Unexecuted instantiation: http3client.c:ptls_cipher_init Unexecuted instantiation: httpclient.c:ptls_cipher_init Unexecuted instantiation: memcached.c:ptls_cipher_init Unexecuted instantiation: redis.c:ptls_cipher_init Unexecuted instantiation: serverutil.c:ptls_cipher_init Unexecuted instantiation: rand.c:ptls_cipher_init Unexecuted instantiation: absprio.c:ptls_cipher_init Unexecuted instantiation: logconf.c:ptls_cipher_init Unexecuted instantiation: compress.c:ptls_cipher_init Unexecuted instantiation: gzip.c:ptls_cipher_init Unexecuted instantiation: headers_util.c:ptls_cipher_init Unexecuted instantiation: frame.c:ptls_cipher_init Unexecuted instantiation: qpack.c:ptls_cipher_init Unexecuted instantiation: hpke.c:ptls_cipher_init Unexecuted instantiation: cc-cubic.c:ptls_cipher_init Unexecuted instantiation: cc-pico.c:ptls_cipher_init Unexecuted instantiation: local_cid.c:ptls_cipher_init Unexecuted instantiation: loss.c:ptls_cipher_init Unexecuted instantiation: http1client.c:ptls_cipher_init Unexecuted instantiation: http2client.c:ptls_cipher_init |
2046 | | |
2047 | | inline void ptls_cipher_encrypt(ptls_cipher_context_t *ctx, void *output, const void *input, size_t len) |
2048 | 0 | { |
2049 | 0 | ctx->do_transform(ctx, output, input, len); |
2050 | 0 | } Unexecuted instantiation: driver.cc:ptls_cipher_encrypt(st_ptls_cipher_context_t*, void*, void const*, unsigned long) Unexecuted instantiation: driver_common.cc:ptls_cipher_encrypt(st_ptls_cipher_context_t*, void*, void const*, unsigned long) Unexecuted instantiation: multithread.c:ptls_cipher_encrypt Unexecuted instantiation: socket.c:ptls_cipher_encrypt Unexecuted instantiation: socketpool.c:ptls_cipher_encrypt Unexecuted instantiation: roundrobin.c:ptls_cipher_encrypt Unexecuted instantiation: config.c:ptls_cipher_encrypt Unexecuted instantiation: configurator.c:ptls_cipher_encrypt Unexecuted instantiation: context.c:ptls_cipher_encrypt Unexecuted instantiation: headers.c:ptls_cipher_encrypt Unexecuted instantiation: request.c:ptls_cipher_encrypt Unexecuted instantiation: util.c:ptls_cipher_encrypt Unexecuted instantiation: access_log.c:ptls_cipher_encrypt Unexecuted instantiation: file.c:ptls_cipher_encrypt Unexecuted instantiation: mimemap.c:ptls_cipher_encrypt Unexecuted instantiation: proxy.c:ptls_cipher_encrypt Unexecuted instantiation: http1.c:ptls_cipher_encrypt Unexecuted instantiation: connection.c:ptls_cipher_encrypt Unexecuted instantiation: scheduler.c:ptls_cipher_encrypt Unexecuted instantiation: stream.c:ptls_cipher_encrypt Unexecuted instantiation: http2_debug_state.c:ptls_cipher_encrypt Unexecuted instantiation: common.c:ptls_cipher_encrypt Unexecuted instantiation: server.c:ptls_cipher_encrypt Unexecuted instantiation: picotls.c:ptls_cipher_encrypt Unexecuted instantiation: openssl.c:ptls_cipher_encrypt Unexecuted instantiation: cc-reno.c:ptls_cipher_encrypt Unexecuted instantiation: defaults.c:ptls_cipher_encrypt Unexecuted instantiation: quicly.c:ptls_cipher_encrypt Unexecuted instantiation: ranges.c:ptls_cipher_encrypt Unexecuted instantiation: rate.c:ptls_cipher_encrypt Unexecuted instantiation: recvstate.c:ptls_cipher_encrypt Unexecuted instantiation: remote_cid.c:ptls_cipher_encrypt Unexecuted instantiation: retire_cid.c:ptls_cipher_encrypt Unexecuted instantiation: sendstate.c:ptls_cipher_encrypt Unexecuted instantiation: sentmap.c:ptls_cipher_encrypt Unexecuted instantiation: streambuf.c:ptls_cipher_encrypt Unexecuted instantiation: hostinfo.c:ptls_cipher_encrypt Unexecuted instantiation: http3client.c:ptls_cipher_encrypt Unexecuted instantiation: httpclient.c:ptls_cipher_encrypt Unexecuted instantiation: memcached.c:ptls_cipher_encrypt Unexecuted instantiation: redis.c:ptls_cipher_encrypt Unexecuted instantiation: serverutil.c:ptls_cipher_encrypt Unexecuted instantiation: rand.c:ptls_cipher_encrypt Unexecuted instantiation: absprio.c:ptls_cipher_encrypt Unexecuted instantiation: logconf.c:ptls_cipher_encrypt Unexecuted instantiation: compress.c:ptls_cipher_encrypt Unexecuted instantiation: gzip.c:ptls_cipher_encrypt Unexecuted instantiation: headers_util.c:ptls_cipher_encrypt Unexecuted instantiation: frame.c:ptls_cipher_encrypt Unexecuted instantiation: qpack.c:ptls_cipher_encrypt Unexecuted instantiation: hpke.c:ptls_cipher_encrypt Unexecuted instantiation: cc-cubic.c:ptls_cipher_encrypt Unexecuted instantiation: cc-pico.c:ptls_cipher_encrypt Unexecuted instantiation: local_cid.c:ptls_cipher_encrypt Unexecuted instantiation: loss.c:ptls_cipher_encrypt Unexecuted instantiation: http1client.c:ptls_cipher_encrypt Unexecuted instantiation: http2client.c:ptls_cipher_encrypt |
2051 | | |
2052 | | inline void ptls_aead_get_iv(ptls_aead_context_t *ctx, void *iv) |
2053 | 0 | { |
2054 | 0 | ctx->do_get_iv(ctx, iv); |
2055 | 0 | } Unexecuted instantiation: driver.cc:ptls_aead_get_iv(st_ptls_aead_context_t*, void*) Unexecuted instantiation: driver_common.cc:ptls_aead_get_iv(st_ptls_aead_context_t*, void*) Unexecuted instantiation: multithread.c:ptls_aead_get_iv Unexecuted instantiation: socket.c:ptls_aead_get_iv Unexecuted instantiation: socketpool.c:ptls_aead_get_iv Unexecuted instantiation: roundrobin.c:ptls_aead_get_iv Unexecuted instantiation: config.c:ptls_aead_get_iv Unexecuted instantiation: configurator.c:ptls_aead_get_iv Unexecuted instantiation: context.c:ptls_aead_get_iv Unexecuted instantiation: headers.c:ptls_aead_get_iv Unexecuted instantiation: request.c:ptls_aead_get_iv Unexecuted instantiation: util.c:ptls_aead_get_iv Unexecuted instantiation: access_log.c:ptls_aead_get_iv Unexecuted instantiation: file.c:ptls_aead_get_iv Unexecuted instantiation: mimemap.c:ptls_aead_get_iv Unexecuted instantiation: proxy.c:ptls_aead_get_iv Unexecuted instantiation: http1.c:ptls_aead_get_iv Unexecuted instantiation: connection.c:ptls_aead_get_iv Unexecuted instantiation: scheduler.c:ptls_aead_get_iv Unexecuted instantiation: stream.c:ptls_aead_get_iv Unexecuted instantiation: http2_debug_state.c:ptls_aead_get_iv Unexecuted instantiation: common.c:ptls_aead_get_iv Unexecuted instantiation: server.c:ptls_aead_get_iv Unexecuted instantiation: picotls.c:ptls_aead_get_iv Unexecuted instantiation: openssl.c:ptls_aead_get_iv Unexecuted instantiation: cc-reno.c:ptls_aead_get_iv Unexecuted instantiation: defaults.c:ptls_aead_get_iv Unexecuted instantiation: quicly.c:ptls_aead_get_iv Unexecuted instantiation: ranges.c:ptls_aead_get_iv Unexecuted instantiation: rate.c:ptls_aead_get_iv Unexecuted instantiation: recvstate.c:ptls_aead_get_iv Unexecuted instantiation: remote_cid.c:ptls_aead_get_iv Unexecuted instantiation: retire_cid.c:ptls_aead_get_iv Unexecuted instantiation: sendstate.c:ptls_aead_get_iv Unexecuted instantiation: sentmap.c:ptls_aead_get_iv Unexecuted instantiation: streambuf.c:ptls_aead_get_iv Unexecuted instantiation: hostinfo.c:ptls_aead_get_iv Unexecuted instantiation: http3client.c:ptls_aead_get_iv Unexecuted instantiation: httpclient.c:ptls_aead_get_iv Unexecuted instantiation: memcached.c:ptls_aead_get_iv Unexecuted instantiation: redis.c:ptls_aead_get_iv Unexecuted instantiation: serverutil.c:ptls_aead_get_iv Unexecuted instantiation: rand.c:ptls_aead_get_iv Unexecuted instantiation: absprio.c:ptls_aead_get_iv Unexecuted instantiation: logconf.c:ptls_aead_get_iv Unexecuted instantiation: compress.c:ptls_aead_get_iv Unexecuted instantiation: gzip.c:ptls_aead_get_iv Unexecuted instantiation: headers_util.c:ptls_aead_get_iv Unexecuted instantiation: frame.c:ptls_aead_get_iv Unexecuted instantiation: qpack.c:ptls_aead_get_iv Unexecuted instantiation: hpke.c:ptls_aead_get_iv Unexecuted instantiation: cc-cubic.c:ptls_aead_get_iv Unexecuted instantiation: cc-pico.c:ptls_aead_get_iv Unexecuted instantiation: local_cid.c:ptls_aead_get_iv Unexecuted instantiation: loss.c:ptls_aead_get_iv Unexecuted instantiation: http1client.c:ptls_aead_get_iv Unexecuted instantiation: http2client.c:ptls_aead_get_iv |
2056 | | |
2057 | | inline void ptls_aead_set_iv(ptls_aead_context_t *ctx, const void *iv) |
2058 | 0 | { |
2059 | 0 | ctx->do_set_iv(ctx, iv); |
2060 | 0 | } Unexecuted instantiation: driver.cc:ptls_aead_set_iv(st_ptls_aead_context_t*, void const*) Unexecuted instantiation: driver_common.cc:ptls_aead_set_iv(st_ptls_aead_context_t*, void const*) Unexecuted instantiation: multithread.c:ptls_aead_set_iv Unexecuted instantiation: socket.c:ptls_aead_set_iv Unexecuted instantiation: socketpool.c:ptls_aead_set_iv Unexecuted instantiation: roundrobin.c:ptls_aead_set_iv Unexecuted instantiation: config.c:ptls_aead_set_iv Unexecuted instantiation: configurator.c:ptls_aead_set_iv Unexecuted instantiation: context.c:ptls_aead_set_iv Unexecuted instantiation: headers.c:ptls_aead_set_iv Unexecuted instantiation: request.c:ptls_aead_set_iv Unexecuted instantiation: util.c:ptls_aead_set_iv Unexecuted instantiation: access_log.c:ptls_aead_set_iv Unexecuted instantiation: file.c:ptls_aead_set_iv Unexecuted instantiation: mimemap.c:ptls_aead_set_iv Unexecuted instantiation: proxy.c:ptls_aead_set_iv Unexecuted instantiation: http1.c:ptls_aead_set_iv Unexecuted instantiation: connection.c:ptls_aead_set_iv Unexecuted instantiation: scheduler.c:ptls_aead_set_iv Unexecuted instantiation: stream.c:ptls_aead_set_iv Unexecuted instantiation: http2_debug_state.c:ptls_aead_set_iv Unexecuted instantiation: common.c:ptls_aead_set_iv Unexecuted instantiation: server.c:ptls_aead_set_iv Unexecuted instantiation: picotls.c:ptls_aead_set_iv Unexecuted instantiation: openssl.c:ptls_aead_set_iv Unexecuted instantiation: cc-reno.c:ptls_aead_set_iv Unexecuted instantiation: defaults.c:ptls_aead_set_iv Unexecuted instantiation: quicly.c:ptls_aead_set_iv Unexecuted instantiation: ranges.c:ptls_aead_set_iv Unexecuted instantiation: rate.c:ptls_aead_set_iv Unexecuted instantiation: recvstate.c:ptls_aead_set_iv Unexecuted instantiation: remote_cid.c:ptls_aead_set_iv Unexecuted instantiation: retire_cid.c:ptls_aead_set_iv Unexecuted instantiation: sendstate.c:ptls_aead_set_iv Unexecuted instantiation: sentmap.c:ptls_aead_set_iv Unexecuted instantiation: streambuf.c:ptls_aead_set_iv Unexecuted instantiation: hostinfo.c:ptls_aead_set_iv Unexecuted instantiation: http3client.c:ptls_aead_set_iv Unexecuted instantiation: httpclient.c:ptls_aead_set_iv Unexecuted instantiation: memcached.c:ptls_aead_set_iv Unexecuted instantiation: redis.c:ptls_aead_set_iv Unexecuted instantiation: serverutil.c:ptls_aead_set_iv Unexecuted instantiation: rand.c:ptls_aead_set_iv Unexecuted instantiation: absprio.c:ptls_aead_set_iv Unexecuted instantiation: logconf.c:ptls_aead_set_iv Unexecuted instantiation: compress.c:ptls_aead_set_iv Unexecuted instantiation: gzip.c:ptls_aead_set_iv Unexecuted instantiation: headers_util.c:ptls_aead_set_iv Unexecuted instantiation: frame.c:ptls_aead_set_iv Unexecuted instantiation: qpack.c:ptls_aead_set_iv Unexecuted instantiation: hpke.c:ptls_aead_set_iv Unexecuted instantiation: cc-cubic.c:ptls_aead_set_iv Unexecuted instantiation: cc-pico.c:ptls_aead_set_iv Unexecuted instantiation: local_cid.c:ptls_aead_set_iv Unexecuted instantiation: loss.c:ptls_aead_set_iv Unexecuted instantiation: http1client.c:ptls_aead_set_iv Unexecuted instantiation: http2client.c:ptls_aead_set_iv |
2061 | | |
2062 | | inline size_t ptls_aead_encrypt(ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen, uint64_t seq, |
2063 | | const void *aad, size_t aadlen) |
2064 | 0 | { |
2065 | 0 | ctx->do_encrypt(ctx, output, input, inlen, seq, aad, aadlen, NULL); |
2066 | 0 | return inlen + ctx->algo->tag_size; |
2067 | 0 | } Unexecuted instantiation: driver.cc:ptls_aead_encrypt(st_ptls_aead_context_t*, void*, void const*, unsigned long, unsigned long, void const*, unsigned long) Unexecuted instantiation: driver_common.cc:ptls_aead_encrypt(st_ptls_aead_context_t*, void*, void const*, unsigned long, unsigned long, void const*, unsigned long) Unexecuted instantiation: multithread.c:ptls_aead_encrypt Unexecuted instantiation: socket.c:ptls_aead_encrypt Unexecuted instantiation: socketpool.c:ptls_aead_encrypt Unexecuted instantiation: roundrobin.c:ptls_aead_encrypt Unexecuted instantiation: config.c:ptls_aead_encrypt Unexecuted instantiation: configurator.c:ptls_aead_encrypt Unexecuted instantiation: context.c:ptls_aead_encrypt Unexecuted instantiation: headers.c:ptls_aead_encrypt Unexecuted instantiation: request.c:ptls_aead_encrypt Unexecuted instantiation: util.c:ptls_aead_encrypt Unexecuted instantiation: access_log.c:ptls_aead_encrypt Unexecuted instantiation: file.c:ptls_aead_encrypt Unexecuted instantiation: mimemap.c:ptls_aead_encrypt Unexecuted instantiation: proxy.c:ptls_aead_encrypt Unexecuted instantiation: http1.c:ptls_aead_encrypt Unexecuted instantiation: connection.c:ptls_aead_encrypt Unexecuted instantiation: scheduler.c:ptls_aead_encrypt Unexecuted instantiation: stream.c:ptls_aead_encrypt Unexecuted instantiation: http2_debug_state.c:ptls_aead_encrypt Unexecuted instantiation: common.c:ptls_aead_encrypt Unexecuted instantiation: server.c:ptls_aead_encrypt Unexecuted instantiation: picotls.c:ptls_aead_encrypt Unexecuted instantiation: openssl.c:ptls_aead_encrypt Unexecuted instantiation: cc-reno.c:ptls_aead_encrypt Unexecuted instantiation: defaults.c:ptls_aead_encrypt Unexecuted instantiation: quicly.c:ptls_aead_encrypt Unexecuted instantiation: ranges.c:ptls_aead_encrypt Unexecuted instantiation: rate.c:ptls_aead_encrypt Unexecuted instantiation: recvstate.c:ptls_aead_encrypt Unexecuted instantiation: remote_cid.c:ptls_aead_encrypt Unexecuted instantiation: retire_cid.c:ptls_aead_encrypt Unexecuted instantiation: sendstate.c:ptls_aead_encrypt Unexecuted instantiation: sentmap.c:ptls_aead_encrypt Unexecuted instantiation: streambuf.c:ptls_aead_encrypt Unexecuted instantiation: hostinfo.c:ptls_aead_encrypt Unexecuted instantiation: http3client.c:ptls_aead_encrypt Unexecuted instantiation: httpclient.c:ptls_aead_encrypt Unexecuted instantiation: memcached.c:ptls_aead_encrypt Unexecuted instantiation: redis.c:ptls_aead_encrypt Unexecuted instantiation: serverutil.c:ptls_aead_encrypt Unexecuted instantiation: rand.c:ptls_aead_encrypt Unexecuted instantiation: absprio.c:ptls_aead_encrypt Unexecuted instantiation: logconf.c:ptls_aead_encrypt Unexecuted instantiation: compress.c:ptls_aead_encrypt Unexecuted instantiation: gzip.c:ptls_aead_encrypt Unexecuted instantiation: headers_util.c:ptls_aead_encrypt Unexecuted instantiation: frame.c:ptls_aead_encrypt Unexecuted instantiation: qpack.c:ptls_aead_encrypt Unexecuted instantiation: hpke.c:ptls_aead_encrypt Unexecuted instantiation: cc-cubic.c:ptls_aead_encrypt Unexecuted instantiation: cc-pico.c:ptls_aead_encrypt Unexecuted instantiation: local_cid.c:ptls_aead_encrypt Unexecuted instantiation: loss.c:ptls_aead_encrypt Unexecuted instantiation: http1client.c:ptls_aead_encrypt Unexecuted instantiation: http2client.c:ptls_aead_encrypt |
2068 | | |
2069 | | inline void ptls_aead_encrypt_s(ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen, uint64_t seq, |
2070 | | const void *aad, size_t aadlen, ptls_aead_supplementary_encryption_t *supp) |
2071 | 0 | { |
2072 | 0 | ctx->do_encrypt(ctx, output, input, inlen, seq, aad, aadlen, supp); |
2073 | 0 | } Unexecuted instantiation: driver.cc:ptls_aead_encrypt_s(st_ptls_aead_context_t*, void*, void const*, unsigned long, unsigned long, void const*, unsigned long, st_ptls_aead_supplementary_encryption_t*) Unexecuted instantiation: driver_common.cc:ptls_aead_encrypt_s(st_ptls_aead_context_t*, void*, void const*, unsigned long, unsigned long, void const*, unsigned long, st_ptls_aead_supplementary_encryption_t*) Unexecuted instantiation: multithread.c:ptls_aead_encrypt_s Unexecuted instantiation: socket.c:ptls_aead_encrypt_s Unexecuted instantiation: socketpool.c:ptls_aead_encrypt_s Unexecuted instantiation: roundrobin.c:ptls_aead_encrypt_s Unexecuted instantiation: config.c:ptls_aead_encrypt_s Unexecuted instantiation: configurator.c:ptls_aead_encrypt_s Unexecuted instantiation: context.c:ptls_aead_encrypt_s Unexecuted instantiation: headers.c:ptls_aead_encrypt_s Unexecuted instantiation: request.c:ptls_aead_encrypt_s Unexecuted instantiation: util.c:ptls_aead_encrypt_s Unexecuted instantiation: access_log.c:ptls_aead_encrypt_s Unexecuted instantiation: file.c:ptls_aead_encrypt_s Unexecuted instantiation: mimemap.c:ptls_aead_encrypt_s Unexecuted instantiation: proxy.c:ptls_aead_encrypt_s Unexecuted instantiation: http1.c:ptls_aead_encrypt_s Unexecuted instantiation: connection.c:ptls_aead_encrypt_s Unexecuted instantiation: scheduler.c:ptls_aead_encrypt_s Unexecuted instantiation: stream.c:ptls_aead_encrypt_s Unexecuted instantiation: http2_debug_state.c:ptls_aead_encrypt_s Unexecuted instantiation: common.c:ptls_aead_encrypt_s Unexecuted instantiation: server.c:ptls_aead_encrypt_s Unexecuted instantiation: picotls.c:ptls_aead_encrypt_s Unexecuted instantiation: openssl.c:ptls_aead_encrypt_s Unexecuted instantiation: cc-reno.c:ptls_aead_encrypt_s Unexecuted instantiation: defaults.c:ptls_aead_encrypt_s Unexecuted instantiation: quicly.c:ptls_aead_encrypt_s Unexecuted instantiation: ranges.c:ptls_aead_encrypt_s Unexecuted instantiation: rate.c:ptls_aead_encrypt_s Unexecuted instantiation: recvstate.c:ptls_aead_encrypt_s Unexecuted instantiation: remote_cid.c:ptls_aead_encrypt_s Unexecuted instantiation: retire_cid.c:ptls_aead_encrypt_s Unexecuted instantiation: sendstate.c:ptls_aead_encrypt_s Unexecuted instantiation: sentmap.c:ptls_aead_encrypt_s Unexecuted instantiation: streambuf.c:ptls_aead_encrypt_s Unexecuted instantiation: hostinfo.c:ptls_aead_encrypt_s Unexecuted instantiation: http3client.c:ptls_aead_encrypt_s Unexecuted instantiation: httpclient.c:ptls_aead_encrypt_s Unexecuted instantiation: memcached.c:ptls_aead_encrypt_s Unexecuted instantiation: redis.c:ptls_aead_encrypt_s Unexecuted instantiation: serverutil.c:ptls_aead_encrypt_s Unexecuted instantiation: rand.c:ptls_aead_encrypt_s Unexecuted instantiation: absprio.c:ptls_aead_encrypt_s Unexecuted instantiation: logconf.c:ptls_aead_encrypt_s Unexecuted instantiation: compress.c:ptls_aead_encrypt_s Unexecuted instantiation: gzip.c:ptls_aead_encrypt_s Unexecuted instantiation: headers_util.c:ptls_aead_encrypt_s Unexecuted instantiation: frame.c:ptls_aead_encrypt_s Unexecuted instantiation: qpack.c:ptls_aead_encrypt_s Unexecuted instantiation: hpke.c:ptls_aead_encrypt_s Unexecuted instantiation: cc-cubic.c:ptls_aead_encrypt_s Unexecuted instantiation: cc-pico.c:ptls_aead_encrypt_s Unexecuted instantiation: local_cid.c:ptls_aead_encrypt_s Unexecuted instantiation: loss.c:ptls_aead_encrypt_s Unexecuted instantiation: http1client.c:ptls_aead_encrypt_s Unexecuted instantiation: http2client.c:ptls_aead_encrypt_s |
2074 | | |
2075 | | inline void ptls_aead_encrypt_v(ptls_aead_context_t *ctx, void *output, ptls_iovec_t *input, size_t incnt, uint64_t seq, |
2076 | | const void *aad, size_t aadlen) |
2077 | 0 | { |
2078 | 0 | ctx->do_encrypt_v(ctx, output, input, incnt, seq, aad, aadlen); |
2079 | 0 | } Unexecuted instantiation: driver.cc:ptls_aead_encrypt_v(st_ptls_aead_context_t*, void*, st_ptls_iovec_t*, unsigned long, unsigned long, void const*, unsigned long) Unexecuted instantiation: driver_common.cc:ptls_aead_encrypt_v(st_ptls_aead_context_t*, void*, st_ptls_iovec_t*, unsigned long, unsigned long, void const*, unsigned long) Unexecuted instantiation: multithread.c:ptls_aead_encrypt_v Unexecuted instantiation: socket.c:ptls_aead_encrypt_v Unexecuted instantiation: socketpool.c:ptls_aead_encrypt_v Unexecuted instantiation: roundrobin.c:ptls_aead_encrypt_v Unexecuted instantiation: config.c:ptls_aead_encrypt_v Unexecuted instantiation: configurator.c:ptls_aead_encrypt_v Unexecuted instantiation: context.c:ptls_aead_encrypt_v Unexecuted instantiation: headers.c:ptls_aead_encrypt_v Unexecuted instantiation: request.c:ptls_aead_encrypt_v Unexecuted instantiation: util.c:ptls_aead_encrypt_v Unexecuted instantiation: access_log.c:ptls_aead_encrypt_v Unexecuted instantiation: file.c:ptls_aead_encrypt_v Unexecuted instantiation: mimemap.c:ptls_aead_encrypt_v Unexecuted instantiation: proxy.c:ptls_aead_encrypt_v Unexecuted instantiation: http1.c:ptls_aead_encrypt_v Unexecuted instantiation: connection.c:ptls_aead_encrypt_v Unexecuted instantiation: scheduler.c:ptls_aead_encrypt_v Unexecuted instantiation: stream.c:ptls_aead_encrypt_v Unexecuted instantiation: http2_debug_state.c:ptls_aead_encrypt_v Unexecuted instantiation: common.c:ptls_aead_encrypt_v Unexecuted instantiation: server.c:ptls_aead_encrypt_v Unexecuted instantiation: picotls.c:ptls_aead_encrypt_v Unexecuted instantiation: openssl.c:ptls_aead_encrypt_v Unexecuted instantiation: cc-reno.c:ptls_aead_encrypt_v Unexecuted instantiation: defaults.c:ptls_aead_encrypt_v Unexecuted instantiation: quicly.c:ptls_aead_encrypt_v Unexecuted instantiation: ranges.c:ptls_aead_encrypt_v Unexecuted instantiation: rate.c:ptls_aead_encrypt_v Unexecuted instantiation: recvstate.c:ptls_aead_encrypt_v Unexecuted instantiation: remote_cid.c:ptls_aead_encrypt_v Unexecuted instantiation: retire_cid.c:ptls_aead_encrypt_v Unexecuted instantiation: sendstate.c:ptls_aead_encrypt_v Unexecuted instantiation: sentmap.c:ptls_aead_encrypt_v Unexecuted instantiation: streambuf.c:ptls_aead_encrypt_v Unexecuted instantiation: hostinfo.c:ptls_aead_encrypt_v Unexecuted instantiation: http3client.c:ptls_aead_encrypt_v Unexecuted instantiation: httpclient.c:ptls_aead_encrypt_v Unexecuted instantiation: memcached.c:ptls_aead_encrypt_v Unexecuted instantiation: redis.c:ptls_aead_encrypt_v Unexecuted instantiation: serverutil.c:ptls_aead_encrypt_v Unexecuted instantiation: rand.c:ptls_aead_encrypt_v Unexecuted instantiation: absprio.c:ptls_aead_encrypt_v Unexecuted instantiation: logconf.c:ptls_aead_encrypt_v Unexecuted instantiation: compress.c:ptls_aead_encrypt_v Unexecuted instantiation: gzip.c:ptls_aead_encrypt_v Unexecuted instantiation: headers_util.c:ptls_aead_encrypt_v Unexecuted instantiation: frame.c:ptls_aead_encrypt_v Unexecuted instantiation: qpack.c:ptls_aead_encrypt_v Unexecuted instantiation: hpke.c:ptls_aead_encrypt_v Unexecuted instantiation: cc-cubic.c:ptls_aead_encrypt_v Unexecuted instantiation: cc-pico.c:ptls_aead_encrypt_v Unexecuted instantiation: local_cid.c:ptls_aead_encrypt_v Unexecuted instantiation: loss.c:ptls_aead_encrypt_v Unexecuted instantiation: http1client.c:ptls_aead_encrypt_v Unexecuted instantiation: http2client.c:ptls_aead_encrypt_v |
2080 | | |
2081 | | inline void ptls_aead_encrypt_init(ptls_aead_context_t *ctx, uint64_t seq, const void *aad, size_t aadlen) |
2082 | 0 | { |
2083 | 0 | ctx->do_encrypt_init(ctx, seq, aad, aadlen); |
2084 | 0 | } Unexecuted instantiation: driver.cc:ptls_aead_encrypt_init(st_ptls_aead_context_t*, unsigned long, void const*, unsigned long) Unexecuted instantiation: driver_common.cc:ptls_aead_encrypt_init(st_ptls_aead_context_t*, unsigned long, void const*, unsigned long) Unexecuted instantiation: multithread.c:ptls_aead_encrypt_init Unexecuted instantiation: socket.c:ptls_aead_encrypt_init Unexecuted instantiation: socketpool.c:ptls_aead_encrypt_init Unexecuted instantiation: roundrobin.c:ptls_aead_encrypt_init Unexecuted instantiation: config.c:ptls_aead_encrypt_init Unexecuted instantiation: configurator.c:ptls_aead_encrypt_init Unexecuted instantiation: context.c:ptls_aead_encrypt_init Unexecuted instantiation: headers.c:ptls_aead_encrypt_init Unexecuted instantiation: request.c:ptls_aead_encrypt_init Unexecuted instantiation: util.c:ptls_aead_encrypt_init Unexecuted instantiation: access_log.c:ptls_aead_encrypt_init Unexecuted instantiation: file.c:ptls_aead_encrypt_init Unexecuted instantiation: mimemap.c:ptls_aead_encrypt_init Unexecuted instantiation: proxy.c:ptls_aead_encrypt_init Unexecuted instantiation: http1.c:ptls_aead_encrypt_init Unexecuted instantiation: connection.c:ptls_aead_encrypt_init Unexecuted instantiation: scheduler.c:ptls_aead_encrypt_init Unexecuted instantiation: stream.c:ptls_aead_encrypt_init Unexecuted instantiation: http2_debug_state.c:ptls_aead_encrypt_init Unexecuted instantiation: common.c:ptls_aead_encrypt_init Unexecuted instantiation: server.c:ptls_aead_encrypt_init Unexecuted instantiation: picotls.c:ptls_aead_encrypt_init Unexecuted instantiation: openssl.c:ptls_aead_encrypt_init Unexecuted instantiation: cc-reno.c:ptls_aead_encrypt_init Unexecuted instantiation: defaults.c:ptls_aead_encrypt_init Unexecuted instantiation: quicly.c:ptls_aead_encrypt_init Unexecuted instantiation: ranges.c:ptls_aead_encrypt_init Unexecuted instantiation: rate.c:ptls_aead_encrypt_init Unexecuted instantiation: recvstate.c:ptls_aead_encrypt_init Unexecuted instantiation: remote_cid.c:ptls_aead_encrypt_init Unexecuted instantiation: retire_cid.c:ptls_aead_encrypt_init Unexecuted instantiation: sendstate.c:ptls_aead_encrypt_init Unexecuted instantiation: sentmap.c:ptls_aead_encrypt_init Unexecuted instantiation: streambuf.c:ptls_aead_encrypt_init Unexecuted instantiation: hostinfo.c:ptls_aead_encrypt_init Unexecuted instantiation: http3client.c:ptls_aead_encrypt_init Unexecuted instantiation: httpclient.c:ptls_aead_encrypt_init Unexecuted instantiation: memcached.c:ptls_aead_encrypt_init Unexecuted instantiation: redis.c:ptls_aead_encrypt_init Unexecuted instantiation: serverutil.c:ptls_aead_encrypt_init Unexecuted instantiation: rand.c:ptls_aead_encrypt_init Unexecuted instantiation: absprio.c:ptls_aead_encrypt_init Unexecuted instantiation: logconf.c:ptls_aead_encrypt_init Unexecuted instantiation: compress.c:ptls_aead_encrypt_init Unexecuted instantiation: gzip.c:ptls_aead_encrypt_init Unexecuted instantiation: headers_util.c:ptls_aead_encrypt_init Unexecuted instantiation: frame.c:ptls_aead_encrypt_init Unexecuted instantiation: qpack.c:ptls_aead_encrypt_init Unexecuted instantiation: hpke.c:ptls_aead_encrypt_init Unexecuted instantiation: cc-cubic.c:ptls_aead_encrypt_init Unexecuted instantiation: cc-pico.c:ptls_aead_encrypt_init Unexecuted instantiation: local_cid.c:ptls_aead_encrypt_init Unexecuted instantiation: loss.c:ptls_aead_encrypt_init Unexecuted instantiation: http1client.c:ptls_aead_encrypt_init Unexecuted instantiation: http2client.c:ptls_aead_encrypt_init |
2085 | | |
2086 | | inline size_t ptls_aead_encrypt_update(ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen) |
2087 | 0 | { |
2088 | 0 | return ctx->do_encrypt_update(ctx, output, input, inlen); |
2089 | 0 | } Unexecuted instantiation: driver.cc:ptls_aead_encrypt_update(st_ptls_aead_context_t*, void*, void const*, unsigned long) Unexecuted instantiation: driver_common.cc:ptls_aead_encrypt_update(st_ptls_aead_context_t*, void*, void const*, unsigned long) Unexecuted instantiation: multithread.c:ptls_aead_encrypt_update Unexecuted instantiation: socket.c:ptls_aead_encrypt_update Unexecuted instantiation: socketpool.c:ptls_aead_encrypt_update Unexecuted instantiation: roundrobin.c:ptls_aead_encrypt_update Unexecuted instantiation: config.c:ptls_aead_encrypt_update Unexecuted instantiation: configurator.c:ptls_aead_encrypt_update Unexecuted instantiation: context.c:ptls_aead_encrypt_update Unexecuted instantiation: headers.c:ptls_aead_encrypt_update Unexecuted instantiation: request.c:ptls_aead_encrypt_update Unexecuted instantiation: util.c:ptls_aead_encrypt_update Unexecuted instantiation: access_log.c:ptls_aead_encrypt_update Unexecuted instantiation: file.c:ptls_aead_encrypt_update Unexecuted instantiation: mimemap.c:ptls_aead_encrypt_update Unexecuted instantiation: proxy.c:ptls_aead_encrypt_update Unexecuted instantiation: http1.c:ptls_aead_encrypt_update Unexecuted instantiation: connection.c:ptls_aead_encrypt_update Unexecuted instantiation: scheduler.c:ptls_aead_encrypt_update Unexecuted instantiation: stream.c:ptls_aead_encrypt_update Unexecuted instantiation: http2_debug_state.c:ptls_aead_encrypt_update Unexecuted instantiation: common.c:ptls_aead_encrypt_update Unexecuted instantiation: server.c:ptls_aead_encrypt_update Unexecuted instantiation: picotls.c:ptls_aead_encrypt_update Unexecuted instantiation: openssl.c:ptls_aead_encrypt_update Unexecuted instantiation: cc-reno.c:ptls_aead_encrypt_update Unexecuted instantiation: defaults.c:ptls_aead_encrypt_update Unexecuted instantiation: quicly.c:ptls_aead_encrypt_update Unexecuted instantiation: ranges.c:ptls_aead_encrypt_update Unexecuted instantiation: rate.c:ptls_aead_encrypt_update Unexecuted instantiation: recvstate.c:ptls_aead_encrypt_update Unexecuted instantiation: remote_cid.c:ptls_aead_encrypt_update Unexecuted instantiation: retire_cid.c:ptls_aead_encrypt_update Unexecuted instantiation: sendstate.c:ptls_aead_encrypt_update Unexecuted instantiation: sentmap.c:ptls_aead_encrypt_update Unexecuted instantiation: streambuf.c:ptls_aead_encrypt_update Unexecuted instantiation: hostinfo.c:ptls_aead_encrypt_update Unexecuted instantiation: http3client.c:ptls_aead_encrypt_update Unexecuted instantiation: httpclient.c:ptls_aead_encrypt_update Unexecuted instantiation: memcached.c:ptls_aead_encrypt_update Unexecuted instantiation: redis.c:ptls_aead_encrypt_update Unexecuted instantiation: serverutil.c:ptls_aead_encrypt_update Unexecuted instantiation: rand.c:ptls_aead_encrypt_update Unexecuted instantiation: absprio.c:ptls_aead_encrypt_update Unexecuted instantiation: logconf.c:ptls_aead_encrypt_update Unexecuted instantiation: compress.c:ptls_aead_encrypt_update Unexecuted instantiation: gzip.c:ptls_aead_encrypt_update Unexecuted instantiation: headers_util.c:ptls_aead_encrypt_update Unexecuted instantiation: frame.c:ptls_aead_encrypt_update Unexecuted instantiation: qpack.c:ptls_aead_encrypt_update Unexecuted instantiation: hpke.c:ptls_aead_encrypt_update Unexecuted instantiation: cc-cubic.c:ptls_aead_encrypt_update Unexecuted instantiation: cc-pico.c:ptls_aead_encrypt_update Unexecuted instantiation: local_cid.c:ptls_aead_encrypt_update Unexecuted instantiation: loss.c:ptls_aead_encrypt_update Unexecuted instantiation: http1client.c:ptls_aead_encrypt_update Unexecuted instantiation: http2client.c:ptls_aead_encrypt_update |
2090 | | |
2091 | | inline size_t ptls_aead_encrypt_final(ptls_aead_context_t *ctx, void *output) |
2092 | 0 | { |
2093 | 0 | return ctx->do_encrypt_final(ctx, output); |
2094 | 0 | } Unexecuted instantiation: driver.cc:ptls_aead_encrypt_final(st_ptls_aead_context_t*, void*) Unexecuted instantiation: driver_common.cc:ptls_aead_encrypt_final(st_ptls_aead_context_t*, void*) Unexecuted instantiation: multithread.c:ptls_aead_encrypt_final Unexecuted instantiation: socket.c:ptls_aead_encrypt_final Unexecuted instantiation: socketpool.c:ptls_aead_encrypt_final Unexecuted instantiation: roundrobin.c:ptls_aead_encrypt_final Unexecuted instantiation: config.c:ptls_aead_encrypt_final Unexecuted instantiation: configurator.c:ptls_aead_encrypt_final Unexecuted instantiation: context.c:ptls_aead_encrypt_final Unexecuted instantiation: headers.c:ptls_aead_encrypt_final Unexecuted instantiation: request.c:ptls_aead_encrypt_final Unexecuted instantiation: util.c:ptls_aead_encrypt_final Unexecuted instantiation: access_log.c:ptls_aead_encrypt_final Unexecuted instantiation: file.c:ptls_aead_encrypt_final Unexecuted instantiation: mimemap.c:ptls_aead_encrypt_final Unexecuted instantiation: proxy.c:ptls_aead_encrypt_final Unexecuted instantiation: http1.c:ptls_aead_encrypt_final Unexecuted instantiation: connection.c:ptls_aead_encrypt_final Unexecuted instantiation: scheduler.c:ptls_aead_encrypt_final Unexecuted instantiation: stream.c:ptls_aead_encrypt_final Unexecuted instantiation: http2_debug_state.c:ptls_aead_encrypt_final Unexecuted instantiation: common.c:ptls_aead_encrypt_final Unexecuted instantiation: server.c:ptls_aead_encrypt_final Unexecuted instantiation: picotls.c:ptls_aead_encrypt_final Unexecuted instantiation: openssl.c:ptls_aead_encrypt_final Unexecuted instantiation: cc-reno.c:ptls_aead_encrypt_final Unexecuted instantiation: defaults.c:ptls_aead_encrypt_final Unexecuted instantiation: quicly.c:ptls_aead_encrypt_final Unexecuted instantiation: ranges.c:ptls_aead_encrypt_final Unexecuted instantiation: rate.c:ptls_aead_encrypt_final Unexecuted instantiation: recvstate.c:ptls_aead_encrypt_final Unexecuted instantiation: remote_cid.c:ptls_aead_encrypt_final Unexecuted instantiation: retire_cid.c:ptls_aead_encrypt_final Unexecuted instantiation: sendstate.c:ptls_aead_encrypt_final Unexecuted instantiation: sentmap.c:ptls_aead_encrypt_final Unexecuted instantiation: streambuf.c:ptls_aead_encrypt_final Unexecuted instantiation: hostinfo.c:ptls_aead_encrypt_final Unexecuted instantiation: http3client.c:ptls_aead_encrypt_final Unexecuted instantiation: httpclient.c:ptls_aead_encrypt_final Unexecuted instantiation: memcached.c:ptls_aead_encrypt_final Unexecuted instantiation: redis.c:ptls_aead_encrypt_final Unexecuted instantiation: serverutil.c:ptls_aead_encrypt_final Unexecuted instantiation: rand.c:ptls_aead_encrypt_final Unexecuted instantiation: absprio.c:ptls_aead_encrypt_final Unexecuted instantiation: logconf.c:ptls_aead_encrypt_final Unexecuted instantiation: compress.c:ptls_aead_encrypt_final Unexecuted instantiation: gzip.c:ptls_aead_encrypt_final Unexecuted instantiation: headers_util.c:ptls_aead_encrypt_final Unexecuted instantiation: frame.c:ptls_aead_encrypt_final Unexecuted instantiation: qpack.c:ptls_aead_encrypt_final Unexecuted instantiation: hpke.c:ptls_aead_encrypt_final Unexecuted instantiation: cc-cubic.c:ptls_aead_encrypt_final Unexecuted instantiation: cc-pico.c:ptls_aead_encrypt_final Unexecuted instantiation: local_cid.c:ptls_aead_encrypt_final Unexecuted instantiation: loss.c:ptls_aead_encrypt_final Unexecuted instantiation: http1client.c:ptls_aead_encrypt_final Unexecuted instantiation: http2client.c:ptls_aead_encrypt_final |
2095 | | |
2096 | | inline void ptls_aead__do_encrypt(ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen, uint64_t seq, |
2097 | | const void *aad, size_t aadlen, ptls_aead_supplementary_encryption_t *supp) |
2098 | 0 | { |
2099 | 0 | ptls_iovec_t invec = ptls_iovec_init(input, inlen); |
2100 | 0 | ctx->do_encrypt_v(ctx, output, &invec, 1, seq, aad, aadlen); |
2101 | |
|
2102 | 0 | if (supp != NULL) { |
2103 | 0 | ptls_cipher_init(supp->ctx, supp->input); |
2104 | 0 | memset(supp->output, 0, sizeof(supp->output)); |
2105 | 0 | ptls_cipher_encrypt(supp->ctx, supp->output, supp->output, sizeof(supp->output)); |
2106 | 0 | } |
2107 | 0 | } Unexecuted instantiation: driver.cc:ptls_aead__do_encrypt(st_ptls_aead_context_t*, void*, void const*, unsigned long, unsigned long, void const*, unsigned long, st_ptls_aead_supplementary_encryption_t*) Unexecuted instantiation: driver_common.cc:ptls_aead__do_encrypt(st_ptls_aead_context_t*, void*, void const*, unsigned long, unsigned long, void const*, unsigned long, st_ptls_aead_supplementary_encryption_t*) Unexecuted instantiation: multithread.c:ptls_aead__do_encrypt Unexecuted instantiation: socket.c:ptls_aead__do_encrypt Unexecuted instantiation: socketpool.c:ptls_aead__do_encrypt Unexecuted instantiation: roundrobin.c:ptls_aead__do_encrypt Unexecuted instantiation: config.c:ptls_aead__do_encrypt Unexecuted instantiation: configurator.c:ptls_aead__do_encrypt Unexecuted instantiation: context.c:ptls_aead__do_encrypt Unexecuted instantiation: headers.c:ptls_aead__do_encrypt Unexecuted instantiation: request.c:ptls_aead__do_encrypt Unexecuted instantiation: util.c:ptls_aead__do_encrypt Unexecuted instantiation: access_log.c:ptls_aead__do_encrypt Unexecuted instantiation: file.c:ptls_aead__do_encrypt Unexecuted instantiation: mimemap.c:ptls_aead__do_encrypt Unexecuted instantiation: proxy.c:ptls_aead__do_encrypt Unexecuted instantiation: http1.c:ptls_aead__do_encrypt Unexecuted instantiation: connection.c:ptls_aead__do_encrypt Unexecuted instantiation: scheduler.c:ptls_aead__do_encrypt Unexecuted instantiation: stream.c:ptls_aead__do_encrypt Unexecuted instantiation: http2_debug_state.c:ptls_aead__do_encrypt Unexecuted instantiation: common.c:ptls_aead__do_encrypt Unexecuted instantiation: server.c:ptls_aead__do_encrypt Unexecuted instantiation: picotls.c:ptls_aead__do_encrypt Unexecuted instantiation: openssl.c:ptls_aead__do_encrypt Unexecuted instantiation: cc-reno.c:ptls_aead__do_encrypt Unexecuted instantiation: defaults.c:ptls_aead__do_encrypt Unexecuted instantiation: quicly.c:ptls_aead__do_encrypt Unexecuted instantiation: ranges.c:ptls_aead__do_encrypt Unexecuted instantiation: rate.c:ptls_aead__do_encrypt Unexecuted instantiation: recvstate.c:ptls_aead__do_encrypt Unexecuted instantiation: remote_cid.c:ptls_aead__do_encrypt Unexecuted instantiation: retire_cid.c:ptls_aead__do_encrypt Unexecuted instantiation: sendstate.c:ptls_aead__do_encrypt Unexecuted instantiation: sentmap.c:ptls_aead__do_encrypt Unexecuted instantiation: streambuf.c:ptls_aead__do_encrypt Unexecuted instantiation: hostinfo.c:ptls_aead__do_encrypt Unexecuted instantiation: http3client.c:ptls_aead__do_encrypt Unexecuted instantiation: httpclient.c:ptls_aead__do_encrypt Unexecuted instantiation: memcached.c:ptls_aead__do_encrypt Unexecuted instantiation: redis.c:ptls_aead__do_encrypt Unexecuted instantiation: serverutil.c:ptls_aead__do_encrypt Unexecuted instantiation: rand.c:ptls_aead__do_encrypt Unexecuted instantiation: absprio.c:ptls_aead__do_encrypt Unexecuted instantiation: logconf.c:ptls_aead__do_encrypt Unexecuted instantiation: compress.c:ptls_aead__do_encrypt Unexecuted instantiation: gzip.c:ptls_aead__do_encrypt Unexecuted instantiation: headers_util.c:ptls_aead__do_encrypt Unexecuted instantiation: frame.c:ptls_aead__do_encrypt Unexecuted instantiation: qpack.c:ptls_aead__do_encrypt Unexecuted instantiation: hpke.c:ptls_aead__do_encrypt Unexecuted instantiation: cc-cubic.c:ptls_aead__do_encrypt Unexecuted instantiation: cc-pico.c:ptls_aead__do_encrypt Unexecuted instantiation: local_cid.c:ptls_aead__do_encrypt Unexecuted instantiation: loss.c:ptls_aead__do_encrypt Unexecuted instantiation: http1client.c:ptls_aead__do_encrypt Unexecuted instantiation: http2client.c:ptls_aead__do_encrypt |
2108 | | |
2109 | | inline void ptls_aead__do_encrypt_v(ptls_aead_context_t *ctx, void *_output, ptls_iovec_t *input, size_t incnt, uint64_t seq, |
2110 | | const void *aad, size_t aadlen) |
2111 | 0 | { |
2112 | 0 | uint8_t *output = (uint8_t *)_output; |
2113 | |
|
2114 | 0 | ctx->do_encrypt_init(ctx, seq, aad, aadlen); |
2115 | 0 | for (size_t i = 0; i < incnt; ++i) |
2116 | 0 | output += ctx->do_encrypt_update(ctx, output, input[i].base, input[i].len); |
2117 | 0 | ctx->do_encrypt_final(ctx, output); |
2118 | 0 | } Unexecuted instantiation: driver.cc:ptls_aead__do_encrypt_v(st_ptls_aead_context_t*, void*, st_ptls_iovec_t*, unsigned long, unsigned long, void const*, unsigned long) Unexecuted instantiation: driver_common.cc:ptls_aead__do_encrypt_v(st_ptls_aead_context_t*, void*, st_ptls_iovec_t*, unsigned long, unsigned long, void const*, unsigned long) Unexecuted instantiation: multithread.c:ptls_aead__do_encrypt_v Unexecuted instantiation: socket.c:ptls_aead__do_encrypt_v Unexecuted instantiation: socketpool.c:ptls_aead__do_encrypt_v Unexecuted instantiation: roundrobin.c:ptls_aead__do_encrypt_v Unexecuted instantiation: config.c:ptls_aead__do_encrypt_v Unexecuted instantiation: configurator.c:ptls_aead__do_encrypt_v Unexecuted instantiation: context.c:ptls_aead__do_encrypt_v Unexecuted instantiation: headers.c:ptls_aead__do_encrypt_v Unexecuted instantiation: request.c:ptls_aead__do_encrypt_v Unexecuted instantiation: util.c:ptls_aead__do_encrypt_v Unexecuted instantiation: access_log.c:ptls_aead__do_encrypt_v Unexecuted instantiation: file.c:ptls_aead__do_encrypt_v Unexecuted instantiation: mimemap.c:ptls_aead__do_encrypt_v Unexecuted instantiation: proxy.c:ptls_aead__do_encrypt_v Unexecuted instantiation: http1.c:ptls_aead__do_encrypt_v Unexecuted instantiation: connection.c:ptls_aead__do_encrypt_v Unexecuted instantiation: scheduler.c:ptls_aead__do_encrypt_v Unexecuted instantiation: stream.c:ptls_aead__do_encrypt_v Unexecuted instantiation: http2_debug_state.c:ptls_aead__do_encrypt_v Unexecuted instantiation: common.c:ptls_aead__do_encrypt_v Unexecuted instantiation: server.c:ptls_aead__do_encrypt_v Unexecuted instantiation: picotls.c:ptls_aead__do_encrypt_v Unexecuted instantiation: openssl.c:ptls_aead__do_encrypt_v Unexecuted instantiation: cc-reno.c:ptls_aead__do_encrypt_v Unexecuted instantiation: defaults.c:ptls_aead__do_encrypt_v Unexecuted instantiation: quicly.c:ptls_aead__do_encrypt_v Unexecuted instantiation: ranges.c:ptls_aead__do_encrypt_v Unexecuted instantiation: rate.c:ptls_aead__do_encrypt_v Unexecuted instantiation: recvstate.c:ptls_aead__do_encrypt_v Unexecuted instantiation: remote_cid.c:ptls_aead__do_encrypt_v Unexecuted instantiation: retire_cid.c:ptls_aead__do_encrypt_v Unexecuted instantiation: sendstate.c:ptls_aead__do_encrypt_v Unexecuted instantiation: sentmap.c:ptls_aead__do_encrypt_v Unexecuted instantiation: streambuf.c:ptls_aead__do_encrypt_v Unexecuted instantiation: hostinfo.c:ptls_aead__do_encrypt_v Unexecuted instantiation: http3client.c:ptls_aead__do_encrypt_v Unexecuted instantiation: httpclient.c:ptls_aead__do_encrypt_v Unexecuted instantiation: memcached.c:ptls_aead__do_encrypt_v Unexecuted instantiation: redis.c:ptls_aead__do_encrypt_v Unexecuted instantiation: serverutil.c:ptls_aead__do_encrypt_v Unexecuted instantiation: rand.c:ptls_aead__do_encrypt_v Unexecuted instantiation: absprio.c:ptls_aead__do_encrypt_v Unexecuted instantiation: logconf.c:ptls_aead__do_encrypt_v Unexecuted instantiation: compress.c:ptls_aead__do_encrypt_v Unexecuted instantiation: gzip.c:ptls_aead__do_encrypt_v Unexecuted instantiation: headers_util.c:ptls_aead__do_encrypt_v Unexecuted instantiation: frame.c:ptls_aead__do_encrypt_v Unexecuted instantiation: qpack.c:ptls_aead__do_encrypt_v Unexecuted instantiation: hpke.c:ptls_aead__do_encrypt_v Unexecuted instantiation: cc-cubic.c:ptls_aead__do_encrypt_v Unexecuted instantiation: cc-pico.c:ptls_aead__do_encrypt_v Unexecuted instantiation: local_cid.c:ptls_aead__do_encrypt_v Unexecuted instantiation: loss.c:ptls_aead__do_encrypt_v Unexecuted instantiation: http1client.c:ptls_aead__do_encrypt_v Unexecuted instantiation: http2client.c:ptls_aead__do_encrypt_v |
2119 | | |
2120 | | inline size_t ptls_aead_decrypt(ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen, uint64_t seq, |
2121 | | const void *aad, size_t aadlen) |
2122 | 0 | { |
2123 | 0 | return ctx->do_decrypt(ctx, output, input, inlen, seq, aad, aadlen); |
2124 | 0 | } Unexecuted instantiation: driver.cc:ptls_aead_decrypt(st_ptls_aead_context_t*, void*, void const*, unsigned long, unsigned long, void const*, unsigned long) Unexecuted instantiation: driver_common.cc:ptls_aead_decrypt(st_ptls_aead_context_t*, void*, void const*, unsigned long, unsigned long, void const*, unsigned long) Unexecuted instantiation: multithread.c:ptls_aead_decrypt Unexecuted instantiation: socket.c:ptls_aead_decrypt Unexecuted instantiation: socketpool.c:ptls_aead_decrypt Unexecuted instantiation: roundrobin.c:ptls_aead_decrypt Unexecuted instantiation: config.c:ptls_aead_decrypt Unexecuted instantiation: configurator.c:ptls_aead_decrypt Unexecuted instantiation: context.c:ptls_aead_decrypt Unexecuted instantiation: headers.c:ptls_aead_decrypt Unexecuted instantiation: request.c:ptls_aead_decrypt Unexecuted instantiation: util.c:ptls_aead_decrypt Unexecuted instantiation: access_log.c:ptls_aead_decrypt Unexecuted instantiation: file.c:ptls_aead_decrypt Unexecuted instantiation: mimemap.c:ptls_aead_decrypt Unexecuted instantiation: proxy.c:ptls_aead_decrypt Unexecuted instantiation: http1.c:ptls_aead_decrypt Unexecuted instantiation: connection.c:ptls_aead_decrypt Unexecuted instantiation: scheduler.c:ptls_aead_decrypt Unexecuted instantiation: stream.c:ptls_aead_decrypt Unexecuted instantiation: http2_debug_state.c:ptls_aead_decrypt Unexecuted instantiation: common.c:ptls_aead_decrypt Unexecuted instantiation: server.c:ptls_aead_decrypt Unexecuted instantiation: picotls.c:ptls_aead_decrypt Unexecuted instantiation: openssl.c:ptls_aead_decrypt Unexecuted instantiation: cc-reno.c:ptls_aead_decrypt Unexecuted instantiation: defaults.c:ptls_aead_decrypt Unexecuted instantiation: quicly.c:ptls_aead_decrypt Unexecuted instantiation: ranges.c:ptls_aead_decrypt Unexecuted instantiation: rate.c:ptls_aead_decrypt Unexecuted instantiation: recvstate.c:ptls_aead_decrypt Unexecuted instantiation: remote_cid.c:ptls_aead_decrypt Unexecuted instantiation: retire_cid.c:ptls_aead_decrypt Unexecuted instantiation: sendstate.c:ptls_aead_decrypt Unexecuted instantiation: sentmap.c:ptls_aead_decrypt Unexecuted instantiation: streambuf.c:ptls_aead_decrypt Unexecuted instantiation: hostinfo.c:ptls_aead_decrypt Unexecuted instantiation: http3client.c:ptls_aead_decrypt Unexecuted instantiation: httpclient.c:ptls_aead_decrypt Unexecuted instantiation: memcached.c:ptls_aead_decrypt Unexecuted instantiation: redis.c:ptls_aead_decrypt Unexecuted instantiation: serverutil.c:ptls_aead_decrypt Unexecuted instantiation: rand.c:ptls_aead_decrypt Unexecuted instantiation: absprio.c:ptls_aead_decrypt Unexecuted instantiation: logconf.c:ptls_aead_decrypt Unexecuted instantiation: compress.c:ptls_aead_decrypt Unexecuted instantiation: gzip.c:ptls_aead_decrypt Unexecuted instantiation: headers_util.c:ptls_aead_decrypt Unexecuted instantiation: frame.c:ptls_aead_decrypt Unexecuted instantiation: qpack.c:ptls_aead_decrypt Unexecuted instantiation: hpke.c:ptls_aead_decrypt Unexecuted instantiation: cc-cubic.c:ptls_aead_decrypt Unexecuted instantiation: cc-pico.c:ptls_aead_decrypt Unexecuted instantiation: local_cid.c:ptls_aead_decrypt Unexecuted instantiation: loss.c:ptls_aead_decrypt Unexecuted instantiation: http1client.c:ptls_aead_decrypt Unexecuted instantiation: http2client.c:ptls_aead_decrypt |
2125 | | |
2126 | | inline void ptls_hash_clone_memcpy(void *dst, const void *src, size_t size) |
2127 | 0 | { |
2128 | 0 | memcpy(dst, src, size); |
2129 | 0 | } Unexecuted instantiation: driver.cc:ptls_hash_clone_memcpy(void*, void const*, unsigned long) Unexecuted instantiation: driver_common.cc:ptls_hash_clone_memcpy(void*, void const*, unsigned long) Unexecuted instantiation: multithread.c:ptls_hash_clone_memcpy Unexecuted instantiation: socket.c:ptls_hash_clone_memcpy Unexecuted instantiation: socketpool.c:ptls_hash_clone_memcpy Unexecuted instantiation: roundrobin.c:ptls_hash_clone_memcpy Unexecuted instantiation: config.c:ptls_hash_clone_memcpy Unexecuted instantiation: configurator.c:ptls_hash_clone_memcpy Unexecuted instantiation: context.c:ptls_hash_clone_memcpy Unexecuted instantiation: headers.c:ptls_hash_clone_memcpy Unexecuted instantiation: request.c:ptls_hash_clone_memcpy Unexecuted instantiation: util.c:ptls_hash_clone_memcpy Unexecuted instantiation: access_log.c:ptls_hash_clone_memcpy Unexecuted instantiation: file.c:ptls_hash_clone_memcpy Unexecuted instantiation: mimemap.c:ptls_hash_clone_memcpy Unexecuted instantiation: proxy.c:ptls_hash_clone_memcpy Unexecuted instantiation: http1.c:ptls_hash_clone_memcpy Unexecuted instantiation: connection.c:ptls_hash_clone_memcpy Unexecuted instantiation: scheduler.c:ptls_hash_clone_memcpy Unexecuted instantiation: stream.c:ptls_hash_clone_memcpy Unexecuted instantiation: http2_debug_state.c:ptls_hash_clone_memcpy Unexecuted instantiation: common.c:ptls_hash_clone_memcpy Unexecuted instantiation: server.c:ptls_hash_clone_memcpy Unexecuted instantiation: picotls.c:ptls_hash_clone_memcpy Unexecuted instantiation: openssl.c:ptls_hash_clone_memcpy Unexecuted instantiation: cc-reno.c:ptls_hash_clone_memcpy Unexecuted instantiation: defaults.c:ptls_hash_clone_memcpy Unexecuted instantiation: quicly.c:ptls_hash_clone_memcpy Unexecuted instantiation: ranges.c:ptls_hash_clone_memcpy Unexecuted instantiation: rate.c:ptls_hash_clone_memcpy Unexecuted instantiation: recvstate.c:ptls_hash_clone_memcpy Unexecuted instantiation: remote_cid.c:ptls_hash_clone_memcpy Unexecuted instantiation: retire_cid.c:ptls_hash_clone_memcpy Unexecuted instantiation: sendstate.c:ptls_hash_clone_memcpy Unexecuted instantiation: sentmap.c:ptls_hash_clone_memcpy Unexecuted instantiation: streambuf.c:ptls_hash_clone_memcpy Unexecuted instantiation: hostinfo.c:ptls_hash_clone_memcpy Unexecuted instantiation: http3client.c:ptls_hash_clone_memcpy Unexecuted instantiation: httpclient.c:ptls_hash_clone_memcpy Unexecuted instantiation: memcached.c:ptls_hash_clone_memcpy Unexecuted instantiation: redis.c:ptls_hash_clone_memcpy Unexecuted instantiation: serverutil.c:ptls_hash_clone_memcpy Unexecuted instantiation: rand.c:ptls_hash_clone_memcpy Unexecuted instantiation: absprio.c:ptls_hash_clone_memcpy Unexecuted instantiation: logconf.c:ptls_hash_clone_memcpy Unexecuted instantiation: compress.c:ptls_hash_clone_memcpy Unexecuted instantiation: gzip.c:ptls_hash_clone_memcpy Unexecuted instantiation: headers_util.c:ptls_hash_clone_memcpy Unexecuted instantiation: frame.c:ptls_hash_clone_memcpy Unexecuted instantiation: qpack.c:ptls_hash_clone_memcpy Unexecuted instantiation: hpke.c:ptls_hash_clone_memcpy Unexecuted instantiation: cc-cubic.c:ptls_hash_clone_memcpy Unexecuted instantiation: cc-pico.c:ptls_hash_clone_memcpy Unexecuted instantiation: local_cid.c:ptls_hash_clone_memcpy Unexecuted instantiation: loss.c:ptls_hash_clone_memcpy Unexecuted instantiation: http1client.c:ptls_hash_clone_memcpy Unexecuted instantiation: http2client.c:ptls_hash_clone_memcpy |
2130 | | |
2131 | | #define ptls_define_hash(name, ctx_type, init_func, update_func, final_func) \ |
2132 | | ptls_define_hash6(name, ctx_type, init_func, update_func, final_func, ptls_hash_clone_memcpy) |
2133 | | #define ptls_define_hash6(name, ctx_type, init_func, update_func, final_func, clone_func) \ |
2134 | | \ |
2135 | | struct name##_context_t { \ |
2136 | | ptls_hash_context_t super; \ |
2137 | | ctx_type ctx; \ |
2138 | | }; \ |
2139 | | \ |
2140 | | static void name##_update(ptls_hash_context_t *_ctx, const void *src, size_t len) \ |
2141 | 0 | { \ |
2142 | 0 | struct name##_context_t *ctx = (struct name##_context_t *)_ctx; \ |
2143 | 0 | update_func(&ctx->ctx, src, len); \ |
2144 | 0 | } \ Unexecuted instantiation: openssl.c:sha256_update Unexecuted instantiation: openssl.c:sha384_update Unexecuted instantiation: openssl.c:sha512_update |
2145 | | \ |
2146 | | static void name##_final(ptls_hash_context_t *_ctx, void *md, ptls_hash_final_mode_t mode) \ |
2147 | 0 | { \ |
2148 | 0 | struct name##_context_t *ctx = (struct name##_context_t *)_ctx; \ |
2149 | 0 | if (mode == PTLS_HASH_FINAL_MODE_SNAPSHOT) { \ |
2150 | 0 | ctx_type copy = ctx->ctx; \ |
2151 | 0 | final_func(©, md); \ |
2152 | 0 | ptls_clear_memory(©, sizeof(copy)); \ |
2153 | 0 | return; \ |
2154 | 0 | } \ |
2155 | 0 | if (md != NULL) \ |
2156 | 0 | final_func(&ctx->ctx, md); \ |
2157 | 0 | switch (mode) { \ |
2158 | 0 | case PTLS_HASH_FINAL_MODE_FREE: \ |
2159 | 0 | ptls_clear_memory(&ctx->ctx, sizeof(ctx->ctx)); \ |
2160 | 0 | free(ctx); \ |
2161 | 0 | break; \ |
2162 | 0 | case PTLS_HASH_FINAL_MODE_RESET: \ |
2163 | 0 | init_func(&ctx->ctx); \ |
2164 | 0 | break; \ |
2165 | 0 | default: \ |
2166 | 0 | assert(!"FIXME"); \ |
2167 | 0 | break; \ |
2168 | 0 | } \ |
2169 | 0 | } \ Unexecuted instantiation: openssl.c:sha256_final Unexecuted instantiation: openssl.c:sha384_final Unexecuted instantiation: openssl.c:sha512_final |
2170 | | \ |
2171 | | static ptls_hash_context_t *name##_clone(ptls_hash_context_t *_src) \ |
2172 | 0 | { \ |
2173 | 0 | struct name##_context_t *dst, *src = (struct name##_context_t *)_src; \ |
2174 | 0 | if ((dst = malloc(sizeof(*dst))) == NULL) \ |
2175 | 0 | return NULL; \ |
2176 | 0 | dst->super = src->super; \ |
2177 | 0 | clone_func(&dst->ctx, &src->ctx, sizeof(dst->ctx)); \ |
2178 | 0 | return &dst->super; \ |
2179 | 0 | } \ Unexecuted instantiation: openssl.c:sha256_clone Unexecuted instantiation: openssl.c:sha384_clone Unexecuted instantiation: openssl.c:sha512_clone |
2180 | | \ |
2181 | | static ptls_hash_context_t *name##_create(void) \ |
2182 | 0 | { \ |
2183 | 0 | struct name##_context_t *ctx; \ |
2184 | 0 | if ((ctx = malloc(sizeof(*ctx))) == NULL) \ |
2185 | 0 | return NULL; \ |
2186 | 0 | ctx->super = (ptls_hash_context_t){name##_update, name##_final, name##_clone}; \ |
2187 | 0 | init_func(&ctx->ctx); \ |
2188 | 0 | return &ctx->super; \ |
2189 | 0 | } Unexecuted instantiation: openssl.c:sha256_create Unexecuted instantiation: openssl.c:sha384_create Unexecuted instantiation: openssl.c:sha512_create |
2190 | | |
2191 | | #ifdef __cplusplus |
2192 | | } |
2193 | | #endif |
2194 | | |
2195 | | #endif |