Coverage Report

Created: 2025-12-31 06:58

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl33/ssl/ssl_local.h
Line
Count
Source
1
/*
2
 * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved.
3
 * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
4
 * Copyright 2005 Nokia. All rights reserved.
5
 *
6
 * Licensed under the Apache License 2.0 (the "License").  You may not use
7
 * this file except in compliance with the License.  You can obtain a copy
8
 * in the file LICENSE in the source distribution or at
9
 * https://www.openssl.org/source/license.html
10
 */
11
12
#ifndef OSSL_SSL_LOCAL_H
13
#define OSSL_SSL_LOCAL_H
14
15
#include "internal/e_os.h" /* struct timeval for DTLS */
16
#include <stdlib.h>
17
#include <time.h>
18
#include <errno.h>
19
#include "internal/common.h" /* for HAS_PREFIX */
20
21
#include <openssl/buffer.h>
22
#include <openssl/bio.h>
23
#include <openssl/comp.h>
24
#include <openssl/dsa.h>
25
#include <openssl/err.h>
26
#include <openssl/ssl.h>
27
#include <openssl/async.h>
28
#include <openssl/symhacks.h>
29
#include <openssl/ct.h>
30
#include "internal/recordmethod.h"
31
#include "internal/statem.h"
32
#include "internal/packet.h"
33
#include "internal/dane.h"
34
#include "internal/refcount.h"
35
#include "internal/tsan_assist.h"
36
#include "internal/bio.h"
37
#include "internal/ktls.h"
38
#include "internal/time.h"
39
#include "internal/ssl.h"
40
#include "record/record.h"
41
42
#ifdef OPENSSL_BUILD_SHLIBSSL
43
#undef OPENSSL_EXTERN
44
#define OPENSSL_EXTERN OPENSSL_EXPORT
45
#endif
46
47
215k
#define TLS_MAX_VERSION_INTERNAL TLS1_3_VERSION
48
143k
#define DTLS_MAX_VERSION_INTERNAL DTLS1_2_VERSION
49
50
/*
51
 * DTLS version numbers are strange because they're inverted. Except for
52
 * DTLS1_BAD_VER, which should be considered "lower" than the rest.
53
 */
54
21.6M
#define dtls_ver_ordinal(v1) (((v1) == DTLS1_BAD_VER) ? 0xff00 : (v1))
55
#define DTLS_VERSION_GT(v1, v2) (dtls_ver_ordinal(v1) < dtls_ver_ordinal(v2))
56
11.3k
#define DTLS_VERSION_GE(v1, v2) (dtls_ver_ordinal(v1) <= dtls_ver_ordinal(v2))
57
10.7M
#define DTLS_VERSION_LT(v1, v2) (dtls_ver_ordinal(v1) > dtls_ver_ordinal(v2))
58
80.9k
#define DTLS_VERSION_LE(v1, v2) (dtls_ver_ordinal(v1) >= dtls_ver_ordinal(v2))
59
60
1.37M
#define SSL_AD_NO_ALERT -1
61
62
/*
63
 * Define the Bitmasks for SSL_CIPHER.algorithms.
64
 * This bits are used packed as dense as possible. If new methods/ciphers
65
 * etc will be added, the bits a likely to change, so this information
66
 * is for internal library use only, even though SSL_CIPHER.algorithms
67
 * can be publicly accessed.
68
 * Use the according functions for cipher management instead.
69
 *
70
 * The bit mask handling in the selection and sorting scheme in
71
 * ssl_create_cipher_list() has only limited capabilities, reflecting
72
 * that the different entities within are mutually exclusive:
73
 * ONLY ONE BIT PER MASK CAN BE SET AT A TIME.
74
 */
75
76
/* Bits for algorithm_mkey (key exchange algorithm) */
77
/* RSA key exchange */
78
344k
#define SSL_kRSA 0x00000001U
79
/* tmp DH key no DH cert */
80
834k
#define SSL_kDHE 0x00000002U
81
/* synonym */
82
#define SSL_kEDH SSL_kDHE
83
/* ephemeral ECDH */
84
1.93M
#define SSL_kECDHE 0x00000004U
85
/* synonym */
86
#define SSL_kEECDH SSL_kECDHE
87
/* PSK */
88
922k
#define SSL_kPSK 0x00000008U
89
/* GOST key exchange */
90
43.0k
#define SSL_kGOST 0x00000010U
91
/* SRP */
92
900k
#define SSL_kSRP 0x00000020U
93
94
687k
#define SSL_kRSAPSK 0x00000040U
95
1.08M
#define SSL_kECDHEPSK 0x00000080U
96
864k
#define SSL_kDHEPSK 0x00000100U
97
/* GOST KDF key exchange, draft-smyshlyaev-tls12-gost-suites */
98
59.5k
#define SSL_kGOST18 0x00000200U
99
100
/* all PSK */
101
102
580k
#define SSL_PSK (SSL_kPSK | SSL_kRSAPSK | SSL_kECDHEPSK | SSL_kDHEPSK)
103
104
/* Any appropriate key exchange algorithm (for TLS 1.3 ciphersuites) */
105
0
#define SSL_kANY 0x00000000U
106
107
/* Bits for algorithm_auth (server authentication) */
108
/* RSA auth */
109
427k
#define SSL_aRSA 0x00000001U
110
/* DSS auth */
111
422k
#define SSL_aDSS 0x00000002U
112
/* no auth (i.e. use ADH or AECDH) */
113
564k
#define SSL_aNULL 0x00000004U
114
/* ECDSA auth*/
115
898k
#define SSL_aECDSA 0x00000008U
116
/* PSK auth */
117
446k
#define SSL_aPSK 0x00000010U
118
/* GOST R 34.10-2001 signature auth */
119
164k
#define SSL_aGOST01 0x00000020U
120
/* SRP auth */
121
439k
#define SSL_aSRP 0x00000040U
122
/* GOST R 34.10-2012 signature auth */
123
336k
#define SSL_aGOST12 0x00000080U
124
/* Any appropriate signature auth (for TLS 1.3 ciphersuites) */
125
272k
#define SSL_aANY 0x00000000U
126
/* All bits requiring a certificate */
127
#define SSL_aCERT \
128
34.5k
    (SSL_aRSA | SSL_aDSS | SSL_aECDSA | SSL_aGOST01 | SSL_aGOST12)
129
130
/* Bits for algorithm_enc (symmetric encryption) */
131
0
#define SSL_DES 0x00000001U
132
0
#define SSL_3DES 0x00000002U
133
283k
#define SSL_RC4 0x00000004U
134
0
#define SSL_RC2 0x00000008U
135
0
#define SSL_IDEA 0x00000010U
136
0
#define SSL_eNULL 0x00000020U
137
291k
#define SSL_AES128 0x00000040U
138
289k
#define SSL_AES256 0x00000080U
139
0
#define SSL_CAMELLIA128 0x00000100U
140
0
#define SSL_CAMELLIA256 0x00000200U
141
10.6k
#define SSL_eGOST2814789CNT 0x00000400U
142
0
#define SSL_SEED 0x00000800U
143
760k
#define SSL_AES128GCM 0x00001000U
144
760k
#define SSL_AES256GCM 0x00002000U
145
253k
#define SSL_AES128CCM 0x00004000U
146
253k
#define SSL_AES256CCM 0x00008000U
147
255k
#define SSL_AES128CCM8 0x00010000U
148
255k
#define SSL_AES256CCM8 0x00020000U
149
10.6k
#define SSL_eGOST2814789CNT12 0x00040000U
150
253k
#define SSL_CHACHA20POLY1305 0x00080000U
151
0
#define SSL_ARIA128GCM 0x00100000U
152
0
#define SSL_ARIA256GCM 0x00200000U
153
10.6k
#define SSL_MAGMA 0x00400000U
154
4.34k
#define SSL_KUZNYECHIK 0x00800000U
155
156
760k
#define SSL_AESGCM (SSL_AES128GCM | SSL_AES256GCM)
157
253k
#define SSL_AESCCM (SSL_AES128CCM | SSL_AES256CCM | SSL_AES128CCM8 | SSL_AES256CCM8)
158
253k
#define SSL_AES (SSL_AES128 | SSL_AES256 | SSL_AESGCM | SSL_AESCCM)
159
#define SSL_CAMELLIA (SSL_CAMELLIA128 | SSL_CAMELLIA256)
160
253k
#define SSL_CHACHA20 (SSL_CHACHA20POLY1305)
161
0
#define SSL_ARIAGCM (SSL_ARIA128GCM | SSL_ARIA256GCM)
162
#define SSL_ARIA (SSL_ARIAGCM)
163
#define SSL_CBC (SSL_DES | SSL_3DES | SSL_RC2 | SSL_IDEA \
164
    | SSL_AES128 | SSL_AES256 | SSL_CAMELLIA128          \
165
    | SSL_CAMELLIA256 | SSL_SEED)
166
167
/* Bits for algorithm_mac (symmetric authentication) */
168
169
452k
#define SSL_MD5 0x00000001U
170
1.48k
#define SSL_SHA1 0x00000002U
171
0
#define SSL_GOST94 0x00000004U
172
43.0k
#define SSL_GOST89MAC 0x00000008U
173
948
#define SSL_SHA256 0x00000010U
174
0
#define SSL_SHA384 0x00000020U
175
/* Not a real MAC, just an indication it is part of cipher */
176
527k
#define SSL_AEAD 0x00000040U
177
0
#define SSL_GOST12_256 0x00000080U
178
43.0k
#define SSL_GOST89MAC12 0x00000100U
179
0
#define SSL_GOST12_512 0x00000200U
180
43.0k
#define SSL_MAGMAOMAC 0x00000400U
181
43.0k
#define SSL_KUZNYECHIKOMAC 0x00000800U
182
183
/*
184
 * When adding new digest in the ssl_ciph.c and increment SSL_MD_NUM_IDX make
185
 * sure to update this constant too
186
 */
187
188
3.05M
#define SSL_MD_MD5_IDX 0
189
3.09M
#define SSL_MD_SHA1_IDX 1
190
#define SSL_MD_GOST94_IDX 2
191
86.1k
#define SSL_MD_GOST89MAC_IDX 3
192
93.2k
#define SSL_MD_SHA256_IDX 4
193
0
#define SSL_MD_SHA384_IDX 5
194
#define SSL_MD_GOST12_256_IDX 6
195
86.1k
#define SSL_MD_GOST89MAC12_IDX 7
196
#define SSL_MD_GOST12_512_IDX 8
197
1.04M
#define SSL_MD_MD5_SHA1_IDX 9
198
1.19M
#define SSL_MD_SHA224_IDX 10
199
#define SSL_MD_SHA512_IDX 11
200
86.1k
#define SSL_MD_MAGMAOMAC_IDX 12
201
86.1k
#define SSL_MD_KUZNYECHIKOMAC_IDX 13
202
11.1M
#define SSL_MAX_DIGEST 14
203
204
11.1M
#define SSL_MD_NUM_IDX SSL_MAX_DIGEST
205
206
/* Bits for algorithm2 (handshake digests and other extra flags) */
207
208
/* Bits 0-7 are handshake MAC */
209
4.92M
#define SSL_HANDSHAKE_MAC_MASK 0xFF
210
429k
#define SSL_HANDSHAKE_MAC_MD5_SHA1 SSL_MD_MD5_SHA1_IDX
211
46.6k
#define SSL_HANDSHAKE_MAC_SHA256 SSL_MD_SHA256_IDX
212
0
#define SSL_HANDSHAKE_MAC_SHA384 SSL_MD_SHA384_IDX
213
#define SSL_HANDSHAKE_MAC_GOST94 SSL_MD_GOST94_IDX
214
#define SSL_HANDSHAKE_MAC_GOST12_256 SSL_MD_GOST12_256_IDX
215
#define SSL_HANDSHAKE_MAC_GOST12_512 SSL_MD_GOST12_512_IDX
216
429k
#define SSL_HANDSHAKE_MAC_DEFAULT SSL_HANDSHAKE_MAC_MD5_SHA1
217
218
/* Bits 8-15 bits are PRF */
219
544k
#define TLS1_PRF_DGST_SHIFT 8
220
#define TLS1_PRF_SHA1_MD5 (SSL_MD_MD5_SHA1_IDX << TLS1_PRF_DGST_SHIFT)
221
46.6k
#define TLS1_PRF_SHA256 (SSL_MD_SHA256_IDX << TLS1_PRF_DGST_SHIFT)
222
0
#define TLS1_PRF_SHA384 (SSL_MD_SHA384_IDX << TLS1_PRF_DGST_SHIFT)
223
#define TLS1_PRF_GOST94 (SSL_MD_GOST94_IDX << TLS1_PRF_DGST_SHIFT)
224
#define TLS1_PRF_GOST12_256 (SSL_MD_GOST12_256_IDX << TLS1_PRF_DGST_SHIFT)
225
#define TLS1_PRF_GOST12_512 (SSL_MD_GOST12_512_IDX << TLS1_PRF_DGST_SHIFT)
226
429k
#define TLS1_PRF (SSL_MD_MD5_SHA1_IDX << TLS1_PRF_DGST_SHIFT)
227
228
/*
229
 * Stream MAC for GOST ciphersuites from cryptopro draft (currently this also
230
 * goes into algorithm2)
231
 */
232
27.0k
#define TLS1_STREAM_MAC 0x10000
233
/*
234
 * TLSTREE cipher/mac key derivation from draft-smyshlyaev-tls12-gost-suites
235
 * (currently this also  goes into algorithm2)
236
 */
237
27.0k
#define TLS1_TLSTREE 0x20000
238
239
/* Ciphersuite supported in QUIC */
240
0
#define SSL_QUIC 0x00040000U
241
242
243M
#define SSL_STRONG_MASK 0x0000001FU
243
263M
#define SSL_DEFAULT_MASK 0X00000020U
244
245
#define SSL_STRONG_NONE 0x00000001U
246
#define SSL_LOW 0x00000002U
247
#define SSL_MEDIUM 0x00000004U
248
#define SSL_HIGH 0x00000008U
249
#define SSL_FIPS 0x00000010U
250
#define SSL_NOT_DEFAULT 0x00000020U
251
252
/* we have used 0000003f - 26 bits left to go */
253
254
/* Flag used on OpenSSL ciphersuite ids to indicate they are for SSLv3+ */
255
7.47M
#define SSL3_CK_CIPHERSUITE_FLAG 0x03000000
256
257
/* Check if an SSL structure is using DTLS */
258
#define SSL_CONNECTION_IS_DTLS(s) \
259
364M
    (SSL_CONNECTION_GET_SSL(s)->method->ssl3_enc->enc_flags & SSL_ENC_FLAG_DTLS)
260
261
/* Check if we are using TLSv1.3 */
262
103M
#define SSL_CONNECTION_IS_TLS13(s) (!SSL_CONNECTION_IS_DTLS(s)      \
263
97.9M
    && SSL_CONNECTION_GET_SSL(s)->method->version >= TLS1_3_VERSION \
264
103M
    && SSL_CONNECTION_GET_SSL(s)->method->version != TLS_ANY_VERSION)
265
266
#define SSL_CONNECTION_TREAT_AS_TLS13(s)                         \
267
71.5k
    (SSL_CONNECTION_IS_TLS13(s)                                  \
268
71.5k
        || (s)->early_data_state == SSL_EARLY_DATA_CONNECTING    \
269
71.5k
        || (s)->early_data_state == SSL_EARLY_DATA_CONNECT_RETRY \
270
71.5k
        || (s)->early_data_state == SSL_EARLY_DATA_WRITING       \
271
71.5k
        || (s)->early_data_state == SSL_EARLY_DATA_WRITE_RETRY   \
272
71.5k
        || (s)->hello_retry_request == SSL_HRR_PENDING)
273
274
2.90M
#define SSL_IS_FIRST_HANDSHAKE(s) ((s)->s3.tmp.finish_md_len == 0 \
275
2.90M
    || (s)->s3.tmp.peer_finish_md_len == 0)
276
277
/* See if we need explicit IV */
278
#define SSL_USE_EXPLICIT_IV(s) \
279
    (SSL_CONNECTION_GET_SSL(s)->method->ssl3_enc->enc_flags & SSL_ENC_FLAG_EXPLICIT_IV)
280
/*
281
 * See if we use signature algorithms extension and signature algorithm
282
 * before signatures.
283
 */
284
#define SSL_USE_SIGALGS(s) \
285
579k
    (SSL_CONNECTION_GET_SSL(s)->method->ssl3_enc->enc_flags & SSL_ENC_FLAG_SIGALGS)
286
/*
287
 * Allow TLS 1.2 ciphersuites: applies to DTLS 1.2 as well as TLS 1.2: may
288
 * apply to others in future.
289
 */
290
#define SSL_USE_TLS1_2_CIPHERS(s) \
291
    (SSL_CONNECTION_GET_SSL(s)->method->ssl3_enc->enc_flags & SSL_ENC_FLAG_TLS1_2_CIPHERS)
292
/*
293
 * Determine if a client can use TLS 1.2 ciphersuites: can't rely on method
294
 * flags because it may not be set to correct version yet.
295
 */
296
#define SSL_CLIENT_USE_TLS1_2_CIPHERS(s) \
297
52.6k
    ((!SSL_CONNECTION_IS_DTLS(s) && s->client_version >= TLS1_2_VERSION) || (SSL_CONNECTION_IS_DTLS(s) && DTLS_VERSION_GE(s->client_version, DTLS1_2_VERSION)))
298
/*
299
 * Determine if a client should send signature algorithms extension:
300
 * as with TLS1.2 cipher we can't rely on method flags.
301
 */
302
#define SSL_CLIENT_USE_SIGALGS(s) \
303
52.6k
    SSL_CLIENT_USE_TLS1_2_CIPHERS(s)
304
305
#define IS_MAX_FRAGMENT_LENGTH_EXT_VALID(value) \
306
1.15M
    (((value) >= TLSEXT_max_fragment_length_512) && ((value) <= TLSEXT_max_fragment_length_4096))
307
#define USE_MAX_FRAGMENT_LENGTH_EXT(session) \
308
953k
    IS_MAX_FRAGMENT_LENGTH_EXT_VALID(session->ext.max_fragment_len_mode)
309
#define GET_MAX_FRAGMENT_LENGTH(session) \
310
17.9k
    (512U << (session->ext.max_fragment_len_mode - 1))
311
312
510k
#define SSL_READ_ETM(s) (s->s3.flags & TLS1_FLAGS_ENCRYPT_THEN_MAC_READ)
313
509k
#define SSL_WRITE_ETM(s) (s->s3.flags & TLS1_FLAGS_ENCRYPT_THEN_MAC_WRITE)
314
315
18.5M
#define SSL_IS_QUIC_HANDSHAKE(s) (((s)->s3.flags & TLS1_FLAGS_QUIC) != 0)
316
317
/* alert_dispatch values */
318
319
/* No alert pending */
320
45.4k
#define SSL_ALERT_DISPATCH_NONE 0
321
/* Alert pending */
322
71.5k
#define SSL_ALERT_DISPATCH_PENDING 1
323
/* Pending alert write needs to be retried */
324
0
#define SSL_ALERT_DISPATCH_RETRY 2
325
326
/* Mostly for SSLv3 */
327
332k
#define SSL_PKEY_RSA 0
328
39.4k
#define SSL_PKEY_RSA_PSS_SIGN 1
329
54.9k
#define SSL_PKEY_DSA_SIGN 2
330
282k
#define SSL_PKEY_ECC 3
331
95.7k
#define SSL_PKEY_GOST01 4
332
75.3k
#define SSL_PKEY_GOST12_256 5
333
54.9k
#define SSL_PKEY_GOST12_512 6
334
47.4k
#define SSL_PKEY_ED25519 7
335
47.4k
#define SSL_PKEY_ED448 8
336
4.23M
#define SSL_PKEY_NUM 9
337
338
#define SSL_ENC_DES_IDX 0
339
#define SSL_ENC_3DES_IDX 1
340
#define SSL_ENC_RC4_IDX 2
341
#define SSL_ENC_RC2_IDX 3
342
#define SSL_ENC_IDEA_IDX 4
343
51.2k
#define SSL_ENC_NULL_IDX 5
344
#define SSL_ENC_AES128_IDX 6
345
#define SSL_ENC_AES256_IDX 7
346
#define SSL_ENC_CAMELLIA128_IDX 8
347
#define SSL_ENC_CAMELLIA256_IDX 9
348
#define SSL_ENC_GOST89_IDX 10
349
#define SSL_ENC_SEED_IDX 11
350
#define SSL_ENC_AES128GCM_IDX 12
351
#define SSL_ENC_AES256GCM_IDX 13
352
#define SSL_ENC_AES128CCM_IDX 14
353
#define SSL_ENC_AES256CCM_IDX 15
354
#define SSL_ENC_AES128CCM8_IDX 16
355
#define SSL_ENC_AES256CCM8_IDX 17
356
#define SSL_ENC_GOST8912_IDX 18
357
#define SSL_ENC_CHACHA_IDX 19
358
#define SSL_ENC_ARIA128GCM_IDX 20
359
#define SSL_ENC_ARIA256GCM_IDX 21
360
#define SSL_ENC_MAGMA_IDX 22
361
#define SSL_ENC_KUZNYECHIK_IDX 23
362
4.87M
#define SSL_ENC_NUM_IDX 24
363
364
/*-
365
 * SSL_kRSA <- RSA_ENC
366
 * SSL_kDH  <- DH_ENC & (RSA_ENC | RSA_SIGN | DSA_SIGN)
367
 * SSL_kDHE <- RSA_ENC | RSA_SIGN | DSA_SIGN
368
 * SSL_aRSA <- RSA_ENC | RSA_SIGN
369
 * SSL_aDSS <- DSA_SIGN
370
 */
371
372
/*-
373
#define CERT_INVALID            0
374
#define CERT_PUBLIC_KEY         1
375
#define CERT_PRIVATE_KEY        2
376
*/
377
378
/* Certificate Type State */
379
352k
#define OSSL_CERT_TYPE_CTOS_NONE 0
380
0
#define OSSL_CERT_TYPE_CTOS_GOOD 1
381
53.4k
#define OSSL_CERT_TYPE_CTOS_ERROR 2
382
383
/* Post-Handshake Authentication state */
384
typedef enum {
385
    SSL_PHA_NONE = 0,
386
    SSL_PHA_EXT_SENT, /* client-side only: extension sent */
387
    SSL_PHA_EXT_RECEIVED, /* server-side only: extension received */
388
    SSL_PHA_REQUEST_PENDING, /* server-side only: request pending */
389
    SSL_PHA_REQUESTED /* request received by client, or sent by server */
390
} SSL_PHA_STATE;
391
392
/* CipherSuite length. SSLv3 and all TLS versions. */
393
463k
#define TLS_CIPHER_LEN 2
394
/* used to hold info on the particular ciphers used */
395
struct ssl_cipher_st {
396
    uint32_t valid;
397
    const char *name; /* text name */
398
    const char *stdname; /* RFC name */
399
    uint32_t id; /* id, 4 bytes, first is version */
400
    /*
401
     * changed in 1.0.0: these four used to be portions of a single value
402
     * 'algorithms'
403
     */
404
    uint32_t algorithm_mkey; /* key exchange algorithm */
405
    uint32_t algorithm_auth; /* server authentication */
406
    uint32_t algorithm_enc; /* symmetric encryption */
407
    uint32_t algorithm_mac; /* symmetric authentication */
408
    int min_tls; /* minimum SSL/TLS protocol version */
409
    int max_tls; /* maximum SSL/TLS protocol version */
410
    int min_dtls; /* minimum DTLS protocol version */
411
    int max_dtls; /* maximum DTLS protocol version */
412
    uint32_t algo_strength; /* strength and export flags */
413
    uint32_t algorithm2; /* Extra flags */
414
    int32_t strength_bits; /* Number of bits really used */
415
    uint32_t alg_bits; /* Number of bits for algorithm */
416
};
417
418
/* Used to hold SSL/TLS functions */
419
struct ssl_method_st {
420
    int version;
421
    unsigned flags;
422
    unsigned long mask;
423
    SSL *(*ssl_new)(SSL_CTX *ctx);
424
    void (*ssl_free)(SSL *s);
425
    int (*ssl_reset)(SSL *s);
426
    int (*ssl_init)(SSL *s);
427
    int (*ssl_clear)(SSL *s);
428
    void (*ssl_deinit)(SSL *s);
429
    int (*ssl_accept)(SSL *s);
430
    int (*ssl_connect)(SSL *s);
431
    int (*ssl_read)(SSL *s, void *buf, size_t len, size_t *readbytes);
432
    int (*ssl_peek)(SSL *s, void *buf, size_t len, size_t *readbytes);
433
    int (*ssl_write)(SSL *s, const void *buf, size_t len, size_t *written);
434
    int (*ssl_shutdown)(SSL *s);
435
    int (*ssl_renegotiate)(SSL *s);
436
    int (*ssl_renegotiate_check)(SSL *s, int);
437
    int (*ssl_read_bytes)(SSL *s, uint8_t type, uint8_t *recvd_type,
438
        unsigned char *buf, size_t len, int peek,
439
        size_t *readbytes);
440
    int (*ssl_write_bytes)(SSL *s, uint8_t type, const void *buf_, size_t len,
441
        size_t *written);
442
    int (*ssl_dispatch_alert)(SSL *s);
443
    long (*ssl_ctrl)(SSL *s, int cmd, long larg, void *parg);
444
    long (*ssl_ctx_ctrl)(SSL_CTX *ctx, int cmd, long larg, void *parg);
445
    const SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);
446
    int (*put_cipher_by_char)(const SSL_CIPHER *cipher, WPACKET *pkt,
447
        size_t *len);
448
    size_t (*ssl_pending)(const SSL *s);
449
    int (*num_ciphers)(void);
450
    const SSL_CIPHER *(*get_cipher)(unsigned ncipher);
451
    OSSL_TIME (*get_timeout)(void);
452
    const struct ssl3_enc_method *ssl3_enc; /* Extra SSLv3/TLS stuff */
453
    int (*ssl_version)(void);
454
    long (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)(void));
455
    long (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)(void));
456
};
457
458
/*
459
 * Matches the length of PSK_MAX_PSK_LEN. We keep it the same value for
460
 * consistency, even in the event of OPENSSL_NO_PSK being defined.
461
 */
462
2.55k
#define TLS13_MAX_RESUMPTION_PSK_LENGTH 512
463
464
/*-
465
 * Lets make this into an ASN.1 type structure as follows
466
 * SSL_SESSION_ID ::= SEQUENCE {
467
 *      version                 INTEGER,        -- structure version number
468
 *      SSLversion              INTEGER,        -- SSL version number
469
 *      Cipher                  OCTET STRING,   -- the 3 byte cipher ID
470
 *      Session_ID              OCTET STRING,   -- the Session ID
471
 *      Master_key              OCTET STRING,   -- the master key
472
 *      Key_Arg [ 0 ] IMPLICIT  OCTET STRING,   -- the optional Key argument
473
 *      Time [ 1 ] EXPLICIT     INTEGER,        -- optional Start Time
474
 *      Timeout [ 2 ] EXPLICIT  INTEGER,        -- optional Timeout ins seconds
475
 *      Peer [ 3 ] EXPLICIT     X509,           -- optional Peer Certificate
476
 *      Session_ID_context [ 4 ] EXPLICIT OCTET STRING,   -- the Session ID context
477
 *      Verify_result [ 5 ] EXPLICIT INTEGER,   -- X509_V_... code for `Peer'
478
 *      HostName [ 6 ] EXPLICIT OCTET STRING,   -- optional HostName from servername TLS extension
479
 *      PSK_identity_hint [ 7 ] EXPLICIT OCTET STRING, -- optional PSK identity hint
480
 *      PSK_identity [ 8 ] EXPLICIT OCTET STRING,  -- optional PSK identity
481
 *      Ticket_lifetime_hint [9] EXPLICIT INTEGER, -- server's lifetime hint for session ticket
482
 *      Ticket [10]             EXPLICIT OCTET STRING, -- session ticket (clients only)
483
 *      Compression_meth [11]   EXPLICIT OCTET STRING, -- optional compression method
484
 *      SRP_username [ 12 ] EXPLICIT OCTET STRING -- optional SRP username
485
 *      flags [ 13 ] EXPLICIT INTEGER -- optional flags
486
 *      }
487
 * Look in ssl/ssl_asn1.c for more details
488
 * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-).
489
 */
490
struct ssl_session_st {
491
    int ssl_version; /* what ssl version session info is being kept
492
                      * in here? */
493
    size_t master_key_length;
494
495
    /* TLSv1.3 early_secret used for external PSKs */
496
    unsigned char early_secret[EVP_MAX_MD_SIZE];
497
    /*
498
     * For <=TLS1.2 this is the master_key. For TLS1.3 this is the resumption
499
     * PSK
500
     */
501
    unsigned char master_key[TLS13_MAX_RESUMPTION_PSK_LENGTH];
502
    /* session_id - valid? */
503
    size_t session_id_length;
504
    unsigned char session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];
505
    /*
506
     * this is used to determine whether the session is being reused in the
507
     * appropriate context. It is up to the application to set this, via
508
     * SSL_new
509
     */
510
    size_t sid_ctx_length;
511
    unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
512
#ifndef OPENSSL_NO_PSK
513
    char *psk_identity_hint;
514
    char *psk_identity;
515
#endif
516
    /*
517
     * Used to indicate that session resumption is not allowed. Applications
518
     * can also set this bit for a new session via not_resumable_session_cb
519
     * to disable session caching and tickets.
520
     */
521
    int not_resumable;
522
    /* Peer raw public key, if available */
523
    EVP_PKEY *peer_rpk;
524
    /* This is the cert and type for the other end. */
525
    X509 *peer;
526
    /* Certificate chain peer sent. */
527
    STACK_OF(X509) *peer_chain;
528
    /*
529
     * when app_verify_callback accepts a session where the peer's
530
     * certificate is not ok, we must remember the error for session reuse:
531
     */
532
    long verify_result; /* only for servers */
533
    OSSL_TIME timeout;
534
    OSSL_TIME time;
535
    OSSL_TIME calc_timeout;
536
    unsigned int compress_meth; /* Need to lookup the method */
537
    const SSL_CIPHER *cipher;
538
    unsigned long cipher_id; /* when ASN.1 loaded, this needs to be used to
539
                              * load the 'cipher' structure */
540
    unsigned int kex_group; /* TLS group from key exchange */
541
    CRYPTO_EX_DATA ex_data; /* application specific data */
542
543
    struct {
544
        char *hostname;
545
        /* RFC4507 info */
546
        unsigned char *tick; /* Session ticket */
547
        size_t ticklen; /* Session ticket length */
548
        /* Session lifetime hint in seconds */
549
        unsigned long tick_lifetime_hint;
550
        uint32_t tick_age_add;
551
        /* Max number of bytes that can be sent as early data */
552
        uint32_t max_early_data;
553
        /* The ALPN protocol selected for this session */
554
        unsigned char *alpn_selected;
555
        size_t alpn_selected_len;
556
        /*
557
         * Maximum Fragment Length as per RFC 4366.
558
         * If this value does not contain RFC 4366 allowed values (1-4) then
559
         * either the Maximum Fragment Length Negotiation failed or was not
560
         * performed at all.
561
         */
562
        uint8_t max_fragment_len_mode;
563
    } ext;
564
#ifndef OPENSSL_NO_SRP
565
    char *srp_username;
566
#endif
567
    unsigned char *ticket_appdata;
568
    size_t ticket_appdata_len;
569
    uint32_t flags;
570
    SSL_CTX *owner;
571
572
    /*
573
     * These are used to make removal of session-ids more efficient and to
574
     * implement a maximum cache size. Access requires protection of ctx->lock.
575
     */
576
    struct ssl_session_st *prev, *next;
577
    CRYPTO_REF_COUNT references;
578
};
579
580
/* Extended master secret support */
581
44.0k
#define SSL_SESS_FLAG_EXTMS 0x1
582
583
#ifndef OPENSSL_NO_SRP
584
585
typedef struct srp_ctx_st {
586
    /* param for all the callbacks */
587
    void *SRP_cb_arg;
588
    /* set client Hello login callback */
589
    int (*TLS_ext_srp_username_callback)(SSL *, int *, void *);
590
    /* set SRP N/g param callback for verification */
591
    int (*SRP_verify_param_callback)(SSL *, void *);
592
    /* set SRP client passwd callback */
593
    char *(*SRP_give_srp_client_pwd_callback)(SSL *, void *);
594
    char *login;
595
    BIGNUM *N, *g, *s, *B, *A;
596
    BIGNUM *a, *b, *v;
597
    char *info;
598
    int strength;
599
    unsigned long srp_Mask;
600
} SRP_CTX;
601
602
#endif
603
604
typedef enum {
605
    SSL_EARLY_DATA_NONE = 0,
606
    SSL_EARLY_DATA_CONNECT_RETRY,
607
    SSL_EARLY_DATA_CONNECTING,
608
    SSL_EARLY_DATA_WRITE_RETRY,
609
    SSL_EARLY_DATA_WRITING,
610
    SSL_EARLY_DATA_WRITE_FLUSH,
611
    SSL_EARLY_DATA_UNAUTH_WRITING,
612
    SSL_EARLY_DATA_FINISHED_WRITING,
613
    SSL_EARLY_DATA_ACCEPT_RETRY,
614
    SSL_EARLY_DATA_ACCEPTING,
615
    SSL_EARLY_DATA_READ_RETRY,
616
    SSL_EARLY_DATA_READING,
617
    SSL_EARLY_DATA_FINISHED_READING
618
} SSL_EARLY_DATA_STATE;
619
620
/*
621
 * We check that the amount of unreadable early data doesn't exceed
622
 * max_early_data. max_early_data is given in plaintext bytes. However if it is
623
 * unreadable then we only know the number of ciphertext bytes. We also don't
624
 * know how much the overhead should be because it depends on the ciphersuite.
625
 * We make a small allowance. We assume 5 records of actual data plus the end
626
 * of early data alert record. Each record has a tag and a content type byte.
627
 * The longest tag length we know of is EVP_GCM_TLS_TAG_LEN. We don't count the
628
 * content of the alert record either which is 2 bytes.
629
 */
630
23.0k
#define EARLY_DATA_CIPHERTEXT_OVERHEAD ((6 * (EVP_GCM_TLS_TAG_LEN + 1)) + 2)
631
632
/*
633
 * The allowance we have between the client's calculated ticket age and our own.
634
 * We allow for 10 seconds. If a ticket is presented and the
635
 * client's age calculation is different by more than this than our own then we
636
 * do not allow that ticket for early_data.
637
 */
638
24
#define TICKET_AGE_ALLOWANCE ossl_seconds2time(10)
639
640
42.6k
#define MAX_COMPRESSIONS_SIZE 255
641
642
struct ssl_comp_st {
643
    int id;
644
    const char *name;
645
    COMP_METHOD *method;
646
};
647
648
typedef struct raw_extension_st {
649
    /* Raw packet data for the extension */
650
    PACKET data;
651
    /* Set to 1 if the extension is present or 0 otherwise */
652
    int present;
653
    /* Set to 1 if we have already parsed the extension or 0 otherwise */
654
    int parsed;
655
    /* The type of this extension, i.e. a TLSEXT_TYPE_* value */
656
    unsigned int type;
657
    /* Track what order extensions are received in (0-based). */
658
    size_t received_order;
659
} RAW_EXTENSION;
660
661
typedef struct {
662
    unsigned int isv2;
663
    unsigned int legacy_version;
664
    unsigned char random[SSL3_RANDOM_SIZE];
665
    size_t session_id_len;
666
    unsigned char session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];
667
    size_t dtls_cookie_len;
668
    unsigned char dtls_cookie[DTLS1_COOKIE_LENGTH];
669
    PACKET ciphersuites;
670
    size_t compressions_len;
671
    unsigned char compressions[MAX_COMPRESSIONS_SIZE];
672
    PACKET extensions;
673
    size_t pre_proc_exts_len;
674
    RAW_EXTENSION *pre_proc_exts;
675
} CLIENTHELLO_MSG;
676
677
/*
678
 * Extension index values NOTE: Any updates to these defines should be mirrored
679
 * with equivalent updates to ext_defs in extensions.c
680
 */
681
typedef enum tlsext_index_en {
682
    TLSEXT_IDX_renegotiate,
683
    TLSEXT_IDX_server_name,
684
    TLSEXT_IDX_max_fragment_length,
685
    TLSEXT_IDX_srp,
686
    TLSEXT_IDX_ec_point_formats,
687
    TLSEXT_IDX_supported_groups,
688
    TLSEXT_IDX_session_ticket,
689
    TLSEXT_IDX_status_request,
690
    TLSEXT_IDX_next_proto_neg,
691
    TLSEXT_IDX_application_layer_protocol_negotiation,
692
    TLSEXT_IDX_use_srtp,
693
    TLSEXT_IDX_encrypt_then_mac,
694
    TLSEXT_IDX_signed_certificate_timestamp,
695
    TLSEXT_IDX_extended_master_secret,
696
    TLSEXT_IDX_signature_algorithms_cert,
697
    TLSEXT_IDX_post_handshake_auth,
698
    TLSEXT_IDX_client_cert_type,
699
    TLSEXT_IDX_server_cert_type,
700
    TLSEXT_IDX_signature_algorithms,
701
    TLSEXT_IDX_supported_versions,
702
    TLSEXT_IDX_psk_kex_modes,
703
    TLSEXT_IDX_key_share,
704
    TLSEXT_IDX_cookie,
705
    TLSEXT_IDX_cryptopro_bug,
706
    TLSEXT_IDX_compress_certificate,
707
    TLSEXT_IDX_early_data,
708
    TLSEXT_IDX_certificate_authorities,
709
    TLSEXT_IDX_padding,
710
    TLSEXT_IDX_psk,
711
    /* Dummy index - must always be the last entry */
712
    TLSEXT_IDX_num_builtins
713
} TLSEXT_INDEX;
714
715
DEFINE_LHASH_OF_EX(SSL_SESSION);
716
/* Needed in ssl_cert.c */
717
DEFINE_LHASH_OF_EX(X509_NAME);
718
719
10.6k
#define TLSEXT_KEYNAME_LENGTH 16
720
#define TLSEXT_TICK_KEY_LENGTH 32
721
722
typedef struct ssl_ctx_ext_secure_st {
723
    unsigned char tick_hmac_key[TLSEXT_TICK_KEY_LENGTH];
724
    unsigned char tick_aes_key[TLSEXT_TICK_KEY_LENGTH];
725
} SSL_CTX_EXT_SECURE;
726
727
/*
728
 * Helper function for HMAC
729
 * The structure should be considered opaque, it will change once the low
730
 * level deprecated calls are removed.  At that point it can be replaced
731
 * by EVP_MAC_CTX and most of the functions converted to macros or inlined
732
 * directly.
733
 */
734
typedef struct ssl_hmac_st {
735
    EVP_MAC_CTX *ctx;
736
#ifndef OPENSSL_NO_DEPRECATED_3_0
737
    HMAC_CTX *old_ctx;
738
#endif
739
} SSL_HMAC;
740
741
SSL_HMAC *ssl_hmac_new(const SSL_CTX *ctx);
742
void ssl_hmac_free(SSL_HMAC *ctx);
743
#ifndef OPENSSL_NO_DEPRECATED_3_0
744
HMAC_CTX *ssl_hmac_get0_HMAC_CTX(SSL_HMAC *ctx);
745
#endif
746
EVP_MAC_CTX *ssl_hmac_get0_EVP_MAC_CTX(SSL_HMAC *ctx);
747
int ssl_hmac_init(SSL_HMAC *ctx, void *key, size_t len, char *md);
748
int ssl_hmac_update(SSL_HMAC *ctx, const unsigned char *data, size_t len);
749
int ssl_hmac_final(SSL_HMAC *ctx, unsigned char *md, size_t *len,
750
    size_t max_size);
751
size_t ssl_hmac_size(const SSL_HMAC *ctx);
752
753
int ssl_get_EC_curve_nid(const EVP_PKEY *pkey);
754
__owur int tls13_set_encoded_pub_key(EVP_PKEY *pkey,
755
    const unsigned char *enckey,
756
    size_t enckeylen);
757
758
typedef struct tls_group_info_st {
759
    char *tlsname; /* Curve Name as in TLS specs */
760
    char *realname; /* Curve Name according to provider */
761
    char *algorithm; /* Algorithm name to fetch */
762
    unsigned int secbits; /* Bits of security (from SP800-57) */
763
    uint16_t group_id; /* Group ID */
764
    int mintls; /* Minimum TLS version, -1 unsupported */
765
    int maxtls; /* Maximum TLS version (or 0 for undefined) */
766
    int mindtls; /* Minimum DTLS version, -1 unsupported */
767
    int maxdtls; /* Maximum DTLS version (or 0 for undefined) */
768
    char is_kem; /* Mode for this Group: 0 is KEX, 1 is KEM */
769
} TLS_GROUP_INFO;
770
771
typedef struct tls_sigalg_info_st {
772
    char *name; /* name as in IANA TLS specs */
773
    uint16_t code_point; /* IANA-specified code point of sigalg-name */
774
    char *sigalg_name; /* (combined) sigalg name */
775
    char *sigalg_oid; /* (combined) sigalg OID */
776
    char *sig_name; /* pure signature algorithm name */
777
    char *sig_oid; /* pure signature algorithm OID */
778
    char *hash_name; /* hash algorithm name */
779
    char *hash_oid; /* hash algorithm OID */
780
    char *keytype; /* keytype name */
781
    char *keytype_oid; /* keytype OID */
782
    unsigned int secbits; /* Bits of security (from SP800-57) */
783
    int mintls; /* Minimum TLS version, -1 unsupported */
784
    int maxtls; /* Maximum TLS version (or 0 for undefined) */
785
} TLS_SIGALG_INFO;
786
787
/*
788
 * Structure containing table entry of certificate info corresponding to
789
 * CERT_PKEY entries
790
 */
791
typedef struct {
792
    int pkey_nid; /* NID of public key algorithm */
793
    uint32_t amask; /* authmask corresponding to key type */
794
} SSL_CERT_LOOKUP;
795
796
/* flags values */
797
#define TLS_GROUP_TYPE 0x0000000FU /* Mask for group type */
798
#define TLS_GROUP_CURVE_PRIME 0x00000001U
799
#define TLS_GROUP_CURVE_CHAR2 0x00000002U
800
#define TLS_GROUP_CURVE_CUSTOM 0x00000004U
801
#define TLS_GROUP_FFDHE 0x00000008U
802
#define TLS_GROUP_ONLY_FOR_TLS1_3 0x00000010U
803
804
#define TLS_GROUP_FFDHE_FOR_TLS1_3 (TLS_GROUP_FFDHE | TLS_GROUP_ONLY_FOR_TLS1_3)
805
806
struct ssl_ctx_st {
807
    OSSL_LIB_CTX *libctx;
808
809
    const SSL_METHOD *method;
810
    STACK_OF(SSL_CIPHER) *cipher_list;
811
    /* same as above but sorted for lookup */
812
    STACK_OF(SSL_CIPHER) *cipher_list_by_id;
813
    /* TLSv1.3 specific ciphersuites */
814
    STACK_OF(SSL_CIPHER) *tls13_ciphersuites;
815
    struct x509_store_st /* X509_STORE */ *cert_store;
816
    LHASH_OF(SSL_SESSION) *sessions;
817
    /*
818
     * Most session-ids that will be cached, default is
819
     * SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited.
820
     */
821
    size_t session_cache_size;
822
    struct ssl_session_st *session_cache_head;
823
    struct ssl_session_st *session_cache_tail;
824
    /*
825
     * This can have one of 2 values, ored together, SSL_SESS_CACHE_CLIENT,
826
     * SSL_SESS_CACHE_SERVER, Default is SSL_SESSION_CACHE_SERVER, which
827
     * means only SSL_accept will cache SSL_SESSIONS.
828
     */
829
    uint32_t session_cache_mode;
830
    /*
831
     * If timeout is not 0, it is the default timeout value set when
832
     * SSL_new() is called.  This has been put in to make life easier to set
833
     * things up
834
     */
835
    OSSL_TIME session_timeout;
836
    /*
837
     * If this callback is not null, it will be called each time a session id
838
     * is added to the cache.  If this function returns 1, it means that the
839
     * callback will do a SSL_SESSION_free() when it has finished using it.
840
     * Otherwise, on 0, it means the callback has finished with it. If
841
     * remove_session_cb is not null, it will be called when a session-id is
842
     * removed from the cache.  After the call, OpenSSL will
843
     * SSL_SESSION_free() it.
844
     */
845
    int (*new_session_cb)(struct ssl_st *ssl, SSL_SESSION *sess);
846
    void (*remove_session_cb)(struct ssl_ctx_st *ctx, SSL_SESSION *sess);
847
    SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl,
848
        const unsigned char *data, int len,
849
        int *copy);
850
    struct {
851
        TSAN_QUALIFIER int sess_connect; /* SSL new conn - started */
852
        TSAN_QUALIFIER int sess_connect_renegotiate; /* SSL reneg - requested */
853
        TSAN_QUALIFIER int sess_connect_good; /* SSL new conne/reneg - finished */
854
        TSAN_QUALIFIER int sess_accept; /* SSL new accept - started */
855
        TSAN_QUALIFIER int sess_accept_renegotiate; /* SSL reneg - requested */
856
        TSAN_QUALIFIER int sess_accept_good; /* SSL accept/reneg - finished */
857
        TSAN_QUALIFIER int sess_miss; /* session lookup misses */
858
        TSAN_QUALIFIER int sess_timeout; /* reuse attempt on timeouted session */
859
        TSAN_QUALIFIER int sess_cache_full; /* session removed due to full cache */
860
        TSAN_QUALIFIER int sess_hit; /* session reuse actually done */
861
        TSAN_QUALIFIER int sess_cb_hit; /* session-id that was not in
862
                                         * the cache was passed back via
863
                                         * the callback. This indicates
864
                                         * that the application is
865
                                         * supplying session-id's from
866
                                         * other processes - spooky
867
                                         * :-) */
868
    } stats;
869
#ifdef TSAN_REQUIRES_LOCKING
870
    CRYPTO_RWLOCK *tsan_lock;
871
#endif
872
873
    CRYPTO_REF_COUNT references;
874
875
    /* if defined, these override the X509_verify_cert() calls */
876
    int (*app_verify_callback)(X509_STORE_CTX *, void *);
877
    void *app_verify_arg;
878
    /*
879
     * before OpenSSL 0.9.7, 'app_verify_arg' was ignored
880
     * ('app_verify_callback' was called with just one argument)
881
     */
882
883
    /* Default password callback. */
884
    pem_password_cb *default_passwd_callback;
885
886
    /* Default password callback user data. */
887
    void *default_passwd_callback_userdata;
888
889
    /* get client cert callback */
890
    int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey);
891
892
    /* cookie generate callback */
893
    int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie,
894
        unsigned int *cookie_len);
895
896
    /* verify cookie callback */
897
    int (*app_verify_cookie_cb)(SSL *ssl, const unsigned char *cookie,
898
        unsigned int cookie_len);
899
900
    /* TLS1.3 app-controlled cookie generate callback */
901
    int (*gen_stateless_cookie_cb)(SSL *ssl, unsigned char *cookie,
902
        size_t *cookie_len);
903
904
    /* TLS1.3 verify app-controlled cookie callback */
905
    int (*verify_stateless_cookie_cb)(SSL *ssl, const unsigned char *cookie,
906
        size_t cookie_len);
907
908
    CRYPTO_EX_DATA ex_data;
909
910
    const EVP_MD *md5; /* For SSLv3/TLSv1 'ssl3-md5' */
911
    const EVP_MD *sha1; /* For SSLv3/TLSv1 'ssl3-sha1' */
912
913
    STACK_OF(X509) *extra_certs;
914
    STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */
915
916
    /* Default values used when no per-SSL value is defined follow */
917
918
    /* used if SSL's info_callback is NULL */
919
    void (*info_callback)(const SSL *ssl, int type, int val);
920
921
    /*
922
     * What we put in certificate_authorities extension for TLS 1.3
923
     * (ClientHello and CertificateRequest) or just client cert requests for
924
     * earlier versions. If client_ca_names is populated then it is only used
925
     * for client cert requests, and in preference to ca_names.
926
     */
927
    STACK_OF(X509_NAME) *ca_names;
928
    STACK_OF(X509_NAME) *client_ca_names;
929
930
    /*
931
     * Default values to use in SSL structures follow (these are copied by
932
     * SSL_new)
933
     */
934
935
    uint64_t options;
936
    uint32_t mode;
937
    int min_proto_version;
938
    int max_proto_version;
939
    size_t max_cert_list;
940
941
    struct cert_st /* CERT */ *cert;
942
    SSL_CERT_LOOKUP *ssl_cert_info;
943
    int read_ahead;
944
945
    /* callback that allows applications to peek at protocol messages */
946
    ossl_msg_cb msg_callback;
947
    void *msg_callback_arg;
948
949
    uint32_t verify_mode;
950
    size_t sid_ctx_length;
951
    unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
952
    /* called 'verify_callback' in the SSL */
953
    int (*default_verify_callback)(int ok, X509_STORE_CTX *ctx);
954
955
    /* Default generate session ID callback. */
956
    GEN_SESSION_CB generate_session_id;
957
958
    X509_VERIFY_PARAM *param;
959
960
    int quiet_shutdown;
961
962
#ifndef OPENSSL_NO_CT
963
    CTLOG_STORE *ctlog_store; /* CT Log Store */
964
    /*
965
     * Validates that the SCTs (Signed Certificate Timestamps) are sufficient.
966
     * If they are not, the connection should be aborted.
967
     */
968
    ssl_ct_validation_cb ct_validation_callback;
969
    void *ct_validation_callback_arg;
970
#endif
971
972
    /*
973
     * If we're using more than one pipeline how should we divide the data
974
     * up between the pipes?
975
     */
976
    size_t split_send_fragment;
977
    /*
978
     * Maximum amount of data to send in one fragment. actual record size can
979
     * be more than this due to padding and MAC overheads.
980
     */
981
    size_t max_send_fragment;
982
983
    /* Up to how many pipelines should we use? If 0 then 1 is assumed */
984
    size_t max_pipelines;
985
986
    /* The default read buffer length to use (0 means not set) */
987
    size_t default_read_buf_len;
988
989
#ifndef OPENSSL_NO_ENGINE
990
    /*
991
     * Engine to pass requests for client certs to
992
     */
993
    ENGINE *client_cert_engine;
994
#endif
995
996
    /* ClientHello callback.  Mostly for extensions, but not entirely. */
997
    SSL_client_hello_cb_fn client_hello_cb;
998
    void *client_hello_cb_arg;
999
1000
    /* TLS extensions. */
1001
    struct {
1002
        /* TLS extensions servername callback */
1003
        int (*servername_cb)(SSL *, int *, void *);
1004
        void *servername_arg;
1005
        /* RFC 4507 session ticket keys */
1006
        unsigned char tick_key_name[TLSEXT_KEYNAME_LENGTH];
1007
        SSL_CTX_EXT_SECURE *secure;
1008
#ifndef OPENSSL_NO_DEPRECATED_3_0
1009
        /* Callback to support customisation of ticket key setting */
1010
        int (*ticket_key_cb)(SSL *ssl,
1011
            unsigned char *name, unsigned char *iv,
1012
            EVP_CIPHER_CTX *ectx, HMAC_CTX *hctx, int enc);
1013
#endif
1014
        int (*ticket_key_evp_cb)(SSL *ssl,
1015
            unsigned char *name, unsigned char *iv,
1016
            EVP_CIPHER_CTX *ectx, EVP_MAC_CTX *hctx,
1017
            int enc);
1018
1019
        /* certificate status request info */
1020
        /* Callback for status request */
1021
        int (*status_cb)(SSL *ssl, void *arg);
1022
        void *status_arg;
1023
        /* ext status type used for CSR extension (OCSP Stapling) */
1024
        int status_type;
1025
        /* RFC 4366 Maximum Fragment Length Negotiation */
1026
        uint8_t max_fragment_len_mode;
1027
1028
        /* EC extension values inherited by SSL structure */
1029
        size_t ecpointformats_len;
1030
        unsigned char *ecpointformats;
1031
1032
        size_t supportedgroups_len;
1033
        uint16_t *supportedgroups;
1034
1035
        uint16_t *supported_groups_default;
1036
        size_t supported_groups_default_len;
1037
        /*
1038
         * ALPN information (we are in the process of transitioning from NPN to
1039
         * ALPN.)
1040
         */
1041
1042
        /*-
1043
         * For a server, this contains a callback function that allows the
1044
         * server to select the protocol for the connection.
1045
         *   out: on successful return, this must point to the raw protocol
1046
         *        name (without the length prefix).
1047
         *   outlen: on successful return, this contains the length of |*out|.
1048
         *   in: points to the client's list of supported protocols in
1049
         *       wire-format.
1050
         *   inlen: the length of |in|.
1051
         */
1052
        int (*alpn_select_cb)(SSL *s,
1053
            const unsigned char **out,
1054
            unsigned char *outlen,
1055
            const unsigned char *in,
1056
            unsigned int inlen, void *arg);
1057
        void *alpn_select_cb_arg;
1058
1059
        /*
1060
         * For a client, this contains the list of supported protocols in wire
1061
         * format.
1062
         */
1063
        unsigned char *alpn;
1064
        size_t alpn_len;
1065
1066
#ifndef OPENSSL_NO_NEXTPROTONEG
1067
        /* Next protocol negotiation information */
1068
1069
        /*
1070
         * For a server, this contains a callback function by which the set of
1071
         * advertised protocols can be provided.
1072
         */
1073
        SSL_CTX_npn_advertised_cb_func npn_advertised_cb;
1074
        void *npn_advertised_cb_arg;
1075
        /*
1076
         * For a client, this contains a callback function that selects the next
1077
         * protocol from the list provided by the server.
1078
         */
1079
        SSL_CTX_npn_select_cb_func npn_select_cb;
1080
        void *npn_select_cb_arg;
1081
#endif
1082
1083
        unsigned char cookie_hmac_key[SHA256_DIGEST_LENGTH];
1084
    } ext;
1085
1086
#ifndef OPENSSL_NO_PSK
1087
    SSL_psk_client_cb_func psk_client_callback;
1088
    SSL_psk_server_cb_func psk_server_callback;
1089
#endif
1090
    SSL_psk_find_session_cb_func psk_find_session_cb;
1091
    SSL_psk_use_session_cb_func psk_use_session_cb;
1092
1093
#ifndef OPENSSL_NO_SRP
1094
    SRP_CTX srp_ctx; /* ctx for SRP authentication */
1095
#endif
1096
1097
    /* Shared DANE context */
1098
    struct dane_ctx_st dane;
1099
1100
#ifndef OPENSSL_NO_SRTP
1101
    /* SRTP profiles we are willing to do from RFC 5764 */
1102
    STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles;
1103
#endif
1104
    /*
1105
     * Callback for disabling session caching and ticket support on a session
1106
     * basis, depending on the chosen cipher.
1107
     */
1108
    int (*not_resumable_session_cb)(SSL *ssl, int is_forward_secure);
1109
1110
    CRYPTO_RWLOCK *lock;
1111
1112
    /*
1113
     * Callback for logging key material for use with debugging tools like
1114
     * Wireshark. The callback should log `line` followed by a newline.
1115
     */
1116
    SSL_CTX_keylog_cb_func keylog_callback;
1117
1118
    /*
1119
     * The maximum number of bytes advertised in session tickets that can be
1120
     * sent as early data.
1121
     */
1122
    uint32_t max_early_data;
1123
1124
    /*
1125
     * The maximum number of bytes of early data that a server will tolerate
1126
     * (which should be at least as much as max_early_data).
1127
     */
1128
    uint32_t recv_max_early_data;
1129
1130
    /* TLS1.3 padding callback */
1131
    size_t (*record_padding_cb)(SSL *s, int type, size_t len, void *arg);
1132
    void *record_padding_arg;
1133
    size_t block_padding;
1134
1135
    /* Session ticket appdata */
1136
    SSL_CTX_generate_session_ticket_fn generate_ticket_cb;
1137
    SSL_CTX_decrypt_session_ticket_fn decrypt_ticket_cb;
1138
    void *ticket_cb_data;
1139
1140
    /* The number of TLS1.3 tickets to automatically send */
1141
    size_t num_tickets;
1142
1143
    /* Callback to determine if early_data is acceptable or not */
1144
    SSL_allow_early_data_cb_fn allow_early_data_cb;
1145
    void *allow_early_data_cb_data;
1146
1147
    /* Do we advertise Post-handshake auth support? */
1148
    int pha_enabled;
1149
1150
    /* Callback for SSL async handling */
1151
    SSL_async_callback_fn async_cb;
1152
    void *async_cb_arg;
1153
1154
    char *propq;
1155
1156
    int ssl_mac_pkey_id[SSL_MD_NUM_IDX];
1157
    const EVP_CIPHER *ssl_cipher_methods[SSL_ENC_NUM_IDX];
1158
    const EVP_MD *ssl_digest_methods[SSL_MD_NUM_IDX];
1159
    size_t ssl_mac_secret_size[SSL_MD_NUM_IDX];
1160
1161
    size_t tls12_sigalgs_len;
1162
    /* Cache of all sigalgs we know and whether they are available or not */
1163
    struct sigalg_lookup_st *sigalg_lookup_cache;
1164
    /* List of all sigalgs (code points) available, incl. from providers */
1165
    uint16_t *tls12_sigalgs;
1166
1167
    TLS_GROUP_INFO *group_list;
1168
    size_t group_list_len;
1169
    size_t group_list_max_len;
1170
1171
    TLS_SIGALG_INFO *sigalg_list;
1172
    size_t sigalg_list_len;
1173
    size_t sigalg_list_max_len;
1174
1175
    /* masks of disabled algorithms */
1176
    uint32_t disabled_enc_mask;
1177
    uint32_t disabled_mac_mask;
1178
    uint32_t disabled_mkey_mask;
1179
    uint32_t disabled_auth_mask;
1180
1181
#ifndef OPENSSL_NO_COMP_ALG
1182
    /* certificate compression preferences */
1183
    int cert_comp_prefs[TLSEXT_comp_cert_limit];
1184
#endif
1185
1186
    /* Certificate Type stuff - for RPK vs X.509 */
1187
    unsigned char *client_cert_type;
1188
    size_t client_cert_type_len;
1189
    unsigned char *server_cert_type;
1190
    size_t server_cert_type_len;
1191
1192
#ifndef OPENSSL_NO_QLOG
1193
    char *qlog_title; /* Session title for qlog */
1194
#endif
1195
};
1196
1197
typedef struct cert_pkey_st CERT_PKEY;
1198
1199
502M
#define SSL_TYPE_SSL_CONNECTION 0
1200
719M
#define SSL_TYPE_QUIC_CONNECTION 1
1201
196M
#define SSL_TYPE_QUIC_XSO 2
1202
1203
struct ssl_st {
1204
    int type;
1205
    SSL_CTX *ctx;
1206
    const SSL_METHOD *defltmeth;
1207
    const SSL_METHOD *method;
1208
    CRYPTO_REF_COUNT references;
1209
    CRYPTO_RWLOCK *lock;
1210
    /* extra application data */
1211
    CRYPTO_EX_DATA ex_data;
1212
};
1213
1214
struct ssl_connection_st {
1215
    /* type identifier and common data */
1216
    struct ssl_st ssl;
1217
1218
    /*
1219
     * The actual end user's SSL object. Could be different to this one for
1220
     * QUIC
1221
     */
1222
    SSL *user_ssl;
1223
1224
    /*
1225
     * protocol version (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION,
1226
     * DTLS1_VERSION)
1227
     */
1228
    int version;
1229
    /*
1230
     * There are 2 BIO's even though they are normally both the same.  This
1231
     * is so data can be read and written to different handlers
1232
     */
1233
    /* used by SSL_read */
1234
    BIO *rbio;
1235
    /* used by SSL_write */
1236
    BIO *wbio;
1237
    /* used during session-id reuse to concatenate messages */
1238
    BIO *bbio;
1239
    /*
1240
     * This holds a variable that indicates what we were doing when a 0 or -1
1241
     * is returned.  This is needed for non-blocking IO so we know what
1242
     * request needs re-doing when in SSL_accept or SSL_connect
1243
     */
1244
    int rwstate;
1245
    int (*handshake_func)(SSL *);
1246
    /*
1247
     * Imagine that here's a boolean member "init" that is switched as soon
1248
     * as SSL_set_{accept/connect}_state is called for the first time, so
1249
     * that "state" and "handshake_func" are properly initialized.  But as
1250
     * handshake_func is == 0 until then, we use this test instead of an
1251
     * "init" member.
1252
     */
1253
    /* are we the server side? */
1254
    int server;
1255
    /*
1256
     * Generate a new session or reuse an old one.
1257
     * NB: For servers, the 'new' session may actually be a previously
1258
     * cached session or even the previous session unless
1259
     * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set
1260
     */
1261
    int new_session;
1262
    /* don't send shutdown packets */
1263
    int quiet_shutdown;
1264
    /* we have shut things down, 0x01 sent, 0x02 for received */
1265
    int shutdown;
1266
    /* Timestamps used to calculate the handshake RTT */
1267
    OSSL_TIME ts_msg_write;
1268
    OSSL_TIME ts_msg_read;
1269
    /* where we are */
1270
    OSSL_STATEM statem;
1271
    SSL_EARLY_DATA_STATE early_data_state;
1272
    BUF_MEM *init_buf; /* buffer used during init */
1273
    void *init_msg; /* pointer to handshake message body, set by
1274
                     * tls_get_message_header() */
1275
    size_t init_num; /* amount read/written */
1276
    size_t init_off; /* amount read/written */
1277
1278
    size_t ssl_pkey_num;
1279
1280
    struct {
1281
        long flags;
1282
        unsigned char server_random[SSL3_RANDOM_SIZE];
1283
        unsigned char client_random[SSL3_RANDOM_SIZE];
1284
1285
        /* used during startup, digest all incoming/outgoing packets */
1286
        BIO *handshake_buffer;
1287
        /*
1288
         * When handshake digest is determined, buffer is hashed and
1289
         * freed and MD_CTX for the required digest is stored here.
1290
         */
1291
        EVP_MD_CTX *handshake_dgst;
1292
        /*
1293
         * Set whenever an expected ChangeCipherSpec message is processed.
1294
         * Unset when the peer's Finished message is received.
1295
         * Unexpected ChangeCipherSpec messages trigger a fatal alert.
1296
         */
1297
        int change_cipher_spec;
1298
        int warn_alert;
1299
        int fatal_alert;
1300
        /*
1301
         * we allow one fatal and one warning alert to be outstanding, send close
1302
         * alert via the warning alert
1303
         */
1304
        int alert_dispatch;
1305
        unsigned char send_alert[2];
1306
        /*
1307
         * This flag is set when we should renegotiate ASAP, basically when there
1308
         * is no more data in the read or write buffers
1309
         */
1310
        int renegotiate;
1311
        int total_renegotiations;
1312
        int num_renegotiations;
1313
        int in_read_app_data;
1314
1315
        struct {
1316
            /* actually only need to be 16+20 for SSLv3 and 12 for TLS */
1317
            unsigned char finish_md[EVP_MAX_MD_SIZE * 2];
1318
            size_t finish_md_len;
1319
            unsigned char peer_finish_md[EVP_MAX_MD_SIZE * 2];
1320
            size_t peer_finish_md_len;
1321
            size_t message_size;
1322
            int message_type;
1323
            /* used to hold the new cipher we are going to use */
1324
            const SSL_CIPHER *new_cipher;
1325
            EVP_PKEY *pkey; /* holds short lived key exchange key */
1326
            /* used for certificate requests */
1327
            int cert_req;
1328
            /* Certificate types in certificate request message. */
1329
            uint8_t *ctype;
1330
            size_t ctype_len;
1331
            /* Certificate authorities list peer sent */
1332
            STACK_OF(X509_NAME) *peer_ca_names;
1333
            size_t key_block_length;
1334
            unsigned char *key_block;
1335
            const EVP_CIPHER *new_sym_enc;
1336
            const EVP_MD *new_hash;
1337
            int new_mac_pkey_type;
1338
            size_t new_mac_secret_size;
1339
#ifndef OPENSSL_NO_COMP
1340
            const SSL_COMP *new_compression;
1341
#else
1342
            char *new_compression;
1343
#endif
1344
            int cert_request;
1345
            /* Raw values of the cipher list from a client */
1346
            unsigned char *ciphers_raw;
1347
            size_t ciphers_rawlen;
1348
            /* Temporary storage for premaster secret */
1349
            unsigned char *pms;
1350
            size_t pmslen;
1351
#ifndef OPENSSL_NO_PSK
1352
            /* Temporary storage for PSK key */
1353
            unsigned char *psk;
1354
            size_t psklen;
1355
#endif
1356
            /* Signature algorithm we actually use */
1357
            const struct sigalg_lookup_st *sigalg;
1358
            /* Pointer to certificate we use */
1359
            CERT_PKEY *cert;
1360
            /*
1361
             * signature algorithms peer reports: e.g. supported signature
1362
             * algorithms extension for server or as part of a certificate
1363
             * request for client.
1364
             * Keep track of the algorithms for TLS and X.509 usage separately.
1365
             */
1366
            uint16_t *peer_sigalgs;
1367
            uint16_t *peer_cert_sigalgs;
1368
            /* Size of above arrays */
1369
            size_t peer_sigalgslen;
1370
            size_t peer_cert_sigalgslen;
1371
            /* Sigalg peer actually uses */
1372
            const struct sigalg_lookup_st *peer_sigalg;
1373
            /*
1374
             * Set if corresponding CERT_PKEY can be used with current
1375
             * SSL session: e.g. appropriate curve, signature algorithms etc.
1376
             * If zero it can't be used at all.
1377
             */
1378
            uint32_t *valid_flags;
1379
            /*
1380
             * For servers the following masks are for the key and auth algorithms
1381
             * that are supported by the certs below. For clients they are masks of
1382
             * *disabled* algorithms based on the current session.
1383
             */
1384
            uint32_t mask_k;
1385
            uint32_t mask_a;
1386
            /*
1387
             * The following are used by the client to see if a cipher is allowed or
1388
             * not.  It contains the minimum and maximum version the client's using
1389
             * based on what it knows so far.
1390
             */
1391
            int min_ver;
1392
            int max_ver;
1393
        } tmp;
1394
1395
        /* Connection binding to prevent renegotiation attacks */
1396
        unsigned char previous_client_finished[EVP_MAX_MD_SIZE];
1397
        size_t previous_client_finished_len;
1398
        unsigned char previous_server_finished[EVP_MAX_MD_SIZE];
1399
        size_t previous_server_finished_len;
1400
        int send_connection_binding;
1401
1402
#ifndef OPENSSL_NO_NEXTPROTONEG
1403
        /*
1404
         * Set if we saw the Next Protocol Negotiation extension from our peer.
1405
         */
1406
        int npn_seen;
1407
#endif
1408
1409
        /*
1410
         * ALPN information (we are in the process of transitioning from NPN to
1411
         * ALPN.)
1412
         */
1413
1414
        /*
1415
         * In a server these point to the selected ALPN protocol after the
1416
         * ClientHello has been processed. In a client these contain the protocol
1417
         * that the server selected once the ServerHello has been processed.
1418
         */
1419
        unsigned char *alpn_selected;
1420
        size_t alpn_selected_len;
1421
        /* used by the server to know what options were proposed */
1422
        unsigned char *alpn_proposed;
1423
        size_t alpn_proposed_len;
1424
        /* used by the client to know if it actually sent alpn */
1425
        int alpn_sent;
1426
1427
        /*
1428
         * This is set to true if we believe that this is a version of Safari
1429
         * running on OS X 10.6 or newer. We wish to know this because Safari on
1430
         * 10.8 .. 10.8.3 has broken ECDHE-ECDSA support.
1431
         */
1432
        char is_probably_safari;
1433
1434
        /*
1435
         * Track whether we did a key exchange this handshake or not, so
1436
         * SSL_get_negotiated_group() knows whether to fall back to the
1437
         * value in the SSL_SESSION.
1438
         */
1439
        char did_kex;
1440
        /* For clients: peer temporary key */
1441
        /* The group_id for the key exchange key */
1442
        uint16_t group_id;
1443
        EVP_PKEY *peer_tmp;
1444
1445
    } s3;
1446
1447
    struct dtls1_state_st *d1; /* DTLSv1 variables */
1448
    /* callback that allows applications to peek at protocol messages */
1449
    void (*msg_callback)(int write_p, int version, int content_type,
1450
        const void *buf, size_t len, SSL *ssl, void *arg);
1451
    void *msg_callback_arg;
1452
    int hit; /* reusing a previous session */
1453
    X509_VERIFY_PARAM *param;
1454
    /* Per connection DANE state */
1455
    SSL_DANE dane;
1456
    /* crypto */
1457
    STACK_OF(SSL_CIPHER) *peer_ciphers;
1458
    STACK_OF(SSL_CIPHER) *cipher_list;
1459
    STACK_OF(SSL_CIPHER) *cipher_list_by_id;
1460
    /* TLSv1.3 specific ciphersuites */
1461
    STACK_OF(SSL_CIPHER) *tls13_ciphersuites;
1462
    /*
1463
     * These are the ones being used, the ones in SSL_SESSION are the ones to
1464
     * be 'copied' into these ones
1465
     */
1466
    uint32_t mac_flags;
1467
    /*
1468
     * The TLS1.3 secrets.
1469
     */
1470
    unsigned char early_secret[EVP_MAX_MD_SIZE];
1471
    unsigned char handshake_secret[EVP_MAX_MD_SIZE];
1472
    unsigned char master_secret[EVP_MAX_MD_SIZE];
1473
    unsigned char resumption_master_secret[EVP_MAX_MD_SIZE];
1474
    unsigned char client_finished_secret[EVP_MAX_MD_SIZE];
1475
    unsigned char server_finished_secret[EVP_MAX_MD_SIZE];
1476
    unsigned char server_finished_hash[EVP_MAX_MD_SIZE];
1477
    unsigned char handshake_traffic_hash[EVP_MAX_MD_SIZE];
1478
    unsigned char client_app_traffic_secret[EVP_MAX_MD_SIZE];
1479
    unsigned char server_app_traffic_secret[EVP_MAX_MD_SIZE];
1480
    unsigned char exporter_master_secret[EVP_MAX_MD_SIZE];
1481
    unsigned char early_exporter_master_secret[EVP_MAX_MD_SIZE];
1482
1483
    /* session info */
1484
    /* client cert? */
1485
    /* This is used to hold the server certificate used */
1486
    struct cert_st /* CERT */ *cert;
1487
1488
    /*
1489
     * The hash of all messages prior to the CertificateVerify, and the length
1490
     * of that hash.
1491
     */
1492
    unsigned char cert_verify_hash[EVP_MAX_MD_SIZE];
1493
    size_t cert_verify_hash_len;
1494
1495
    /* Flag to indicate whether we should send a HelloRetryRequest or not */
1496
    enum { SSL_HRR_NONE = 0,
1497
        SSL_HRR_PENDING,
1498
        SSL_HRR_COMPLETE } hello_retry_request;
1499
1500
    /*
1501
     * the session_id_context is used to ensure sessions are only reused in
1502
     * the appropriate context
1503
     */
1504
    size_t sid_ctx_length;
1505
    unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
1506
    /* This can also be in the session once a session is established */
1507
    SSL_SESSION *session;
1508
    /* TLSv1.3 PSK session */
1509
    SSL_SESSION *psksession;
1510
    unsigned char *psksession_id;
1511
    size_t psksession_id_len;
1512
    /* Default generate session ID callback. */
1513
    GEN_SESSION_CB generate_session_id;
1514
    /*
1515
     * The temporary TLSv1.3 session id. This isn't really a session id at all
1516
     * but is a random value sent in the legacy session id field.
1517
     */
1518
    unsigned char tmp_session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];
1519
    size_t tmp_session_id_len;
1520
    /* Used in SSL3 */
1521
    /*
1522
     * 0 don't care about verify failure.
1523
     * 1 fail if verify fails
1524
     */
1525
    uint32_t verify_mode;
1526
    /* fail if callback returns 0 */
1527
    int (*verify_callback)(int ok, X509_STORE_CTX *ctx);
1528
    /* optional informational callback */
1529
    void (*info_callback)(const SSL *ssl, int type, int val);
1530
    /* error bytes to be written */
1531
    int error;
1532
    /* actual code */
1533
    int error_code;
1534
#ifndef OPENSSL_NO_PSK
1535
    SSL_psk_client_cb_func psk_client_callback;
1536
    SSL_psk_server_cb_func psk_server_callback;
1537
#endif
1538
    SSL_psk_find_session_cb_func psk_find_session_cb;
1539
    SSL_psk_use_session_cb_func psk_use_session_cb;
1540
1541
    /* Verified chain of peer */
1542
    STACK_OF(X509) *verified_chain;
1543
    long verify_result;
1544
    /*
1545
     * What we put in certificate_authorities extension for TLS 1.3
1546
     * (ClientHello and CertificateRequest) or just client cert requests for
1547
     * earlier versions. If client_ca_names is populated then it is only used
1548
     * for client cert requests, and in preference to ca_names.
1549
     */
1550
    STACK_OF(X509_NAME) *ca_names;
1551
    STACK_OF(X509_NAME) *client_ca_names;
1552
    /* protocol behaviour */
1553
    uint64_t options;
1554
    /* API behaviour */
1555
    uint32_t mode;
1556
    int min_proto_version;
1557
    int max_proto_version;
1558
    size_t max_cert_list;
1559
    int first_packet;
1560
    /*
1561
     * What was passed in ClientHello.legacy_version. Used for RSA pre-master
1562
     * secret and SSLv3/TLS (<=1.2) rollback check
1563
     */
1564
    int client_version;
1565
    /*
1566
     * If we're using more than one pipeline how should we divide the data
1567
     * up between the pipes?
1568
     */
1569
    size_t split_send_fragment;
1570
    /*
1571
     * Maximum amount of data to send in one fragment. actual record size can
1572
     * be more than this due to padding and MAC overheads.
1573
     */
1574
    size_t max_send_fragment;
1575
    /* Up to how many pipelines should we use? If 0 then 1 is assumed */
1576
    size_t max_pipelines;
1577
1578
    struct {
1579
        /* Built-in extension flags */
1580
        uint8_t extflags[TLSEXT_IDX_num_builtins];
1581
        /* TLS extension debug callback */
1582
        void (*debug_cb)(SSL *s, int client_server, int type,
1583
            const unsigned char *data, int len, void *arg);
1584
        void *debug_arg;
1585
        char *hostname;
1586
        /* certificate status request info */
1587
        /* Status type or -1 if no status type */
1588
        int status_type;
1589
        /* Raw extension data, if seen */
1590
        unsigned char *scts;
1591
        /* Length of raw extension data, if seen */
1592
        uint16_t scts_len;
1593
        /* Expect OCSP CertificateStatus message */
1594
        int status_expected;
1595
1596
        struct {
1597
            /* OCSP status request only */
1598
            STACK_OF(OCSP_RESPID) *ids;
1599
            X509_EXTENSIONS *exts;
1600
            /* OCSP response received or to be sent */
1601
            unsigned char *resp;
1602
            size_t resp_len;
1603
        } ocsp;
1604
1605
        /* RFC4507 session ticket expected to be received or sent */
1606
        int ticket_expected;
1607
        /* TLS 1.3 tickets requested by the application. */
1608
        int extra_tickets_expected;
1609
        size_t ecpointformats_len;
1610
        /* our list */
1611
        unsigned char *ecpointformats;
1612
1613
        size_t peer_ecpointformats_len;
1614
        /* peer's list */
1615
        unsigned char *peer_ecpointformats;
1616
        size_t supportedgroups_len;
1617
        /* our list */
1618
        uint16_t *supportedgroups;
1619
1620
        size_t peer_supportedgroups_len;
1621
        /* peer's list */
1622
        uint16_t *peer_supportedgroups;
1623
1624
        /* TLS Session Ticket extension override */
1625
        TLS_SESSION_TICKET_EXT *session_ticket;
1626
        /* TLS Session Ticket extension callback */
1627
        tls_session_ticket_ext_cb_fn session_ticket_cb;
1628
        void *session_ticket_cb_arg;
1629
        /* TLS pre-shared secret session resumption */
1630
        tls_session_secret_cb_fn session_secret_cb;
1631
        void *session_secret_cb_arg;
1632
        /*
1633
         * For a client, this contains the list of supported protocols in wire
1634
         * format.
1635
         */
1636
        unsigned char *alpn;
1637
        size_t alpn_len;
1638
        /*
1639
         * Next protocol negotiation. For the client, this is the protocol that
1640
         * we sent in NextProtocol and is set when handling ServerHello
1641
         * extensions. For a server, this is the client's selected_protocol from
1642
         * NextProtocol and is set when handling the NextProtocol message, before
1643
         * the Finished message.
1644
         */
1645
        unsigned char *npn;
1646
        size_t npn_len;
1647
1648
        /* The available PSK key exchange modes */
1649
        int psk_kex_mode;
1650
1651
        /* Set to one if we have negotiated ETM */
1652
        int use_etm;
1653
1654
        /* Are we expecting to receive early data? */
1655
        int early_data;
1656
        /* Is the session suitable for early data? */
1657
        int early_data_ok;
1658
1659
        /* May be sent by a server in HRR. Must be echoed back in ClientHello */
1660
        unsigned char *tls13_cookie;
1661
        size_t tls13_cookie_len;
1662
        /* Have we received a cookie from the client? */
1663
        int cookieok;
1664
1665
        /*
1666
         * Maximum Fragment Length as per RFC 4366.
1667
         * If this member contains one of the allowed values (1-4)
1668
         * then we should include Maximum Fragment Length Negotiation
1669
         * extension in Client Hello.
1670
         * Please note that value of this member does not have direct
1671
         * effect. The actual (binding) value is stored in SSL_SESSION,
1672
         * as this extension is optional on server side.
1673
         */
1674
        uint8_t max_fragment_len_mode;
1675
1676
        /*
1677
         * On the client side the number of ticket identities we sent in the
1678
         * ClientHello. On the server side the identity of the ticket we
1679
         * selected.
1680
         */
1681
        int tick_identity;
1682
1683
        /* This is the list of algorithms the peer supports that we also support */
1684
        int compress_certificate_from_peer[TLSEXT_comp_cert_limit];
1685
        /* indicate that we sent the extension, so we'll accept it */
1686
        int compress_certificate_sent;
1687
1688
        uint8_t client_cert_type;
1689
        uint8_t client_cert_type_ctos;
1690
        uint8_t server_cert_type;
1691
        uint8_t server_cert_type_ctos;
1692
    } ext;
1693
1694
    /*
1695
     * Parsed form of the ClientHello, kept around across client_hello_cb
1696
     * calls.
1697
     */
1698
    CLIENTHELLO_MSG *clienthello;
1699
1700
    /*-
1701
     * no further mod of servername
1702
     * 0 : call the servername extension callback.
1703
     * 1 : prepare 2, allow last ack just after in server callback.
1704
     * 2 : don't call servername callback, no ack in server hello
1705
     */
1706
    int servername_done;
1707
#ifndef OPENSSL_NO_CT
1708
    /*
1709
     * Validates that the SCTs (Signed Certificate Timestamps) are sufficient.
1710
     * If they are not, the connection should be aborted.
1711
     */
1712
    ssl_ct_validation_cb ct_validation_callback;
1713
    /* User-supplied argument that is passed to the ct_validation_callback */
1714
    void *ct_validation_callback_arg;
1715
    /*
1716
     * Consolidated stack of SCTs from all sources.
1717
     * Lazily populated by CT_get_peer_scts(SSL*)
1718
     */
1719
    STACK_OF(SCT) *scts;
1720
    /* Have we attempted to find/parse SCTs yet? */
1721
    int scts_parsed;
1722
#endif
1723
    SSL_CTX *session_ctx; /* initial ctx, used to store sessions */
1724
#ifndef OPENSSL_NO_SRTP
1725
    /* What we'll do */
1726
    STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles;
1727
    /* What's been chosen */
1728
    SRTP_PROTECTION_PROFILE *srtp_profile;
1729
#endif
1730
    /*-
1731
     * 1 if we are renegotiating.
1732
     * 2 if we are a server and are inside a handshake
1733
     * (i.e. not just sending a HelloRequest)
1734
     */
1735
    int renegotiate;
1736
    /* If sending a KeyUpdate is pending */
1737
    int key_update;
1738
    /* Post-handshake authentication state */
1739
    SSL_PHA_STATE post_handshake_auth;
1740
    int pha_enabled;
1741
    uint8_t *pha_context;
1742
    size_t pha_context_len;
1743
    int certreqs_sent;
1744
    EVP_MD_CTX *pha_dgst; /* this is just the digest through ClientFinished */
1745
1746
#ifndef OPENSSL_NO_SRP
1747
    /* ctx for SRP authentication */
1748
    SRP_CTX srp_ctx;
1749
#endif
1750
    /*
1751
     * Callback for disabling session caching and ticket support on a session
1752
     * basis, depending on the chosen cipher.
1753
     */
1754
    int (*not_resumable_session_cb)(SSL *ssl, int is_forward_secure);
1755
1756
    /* Record layer data */
1757
    RECORD_LAYER rlayer;
1758
1759
    /* Default password callback. */
1760
    pem_password_cb *default_passwd_callback;
1761
    /* Default password callback user data. */
1762
    void *default_passwd_callback_userdata;
1763
    /* Async Job info */
1764
    ASYNC_JOB *job;
1765
    ASYNC_WAIT_CTX *waitctx;
1766
    size_t asyncrw;
1767
1768
    /*
1769
     * The maximum number of bytes advertised in session tickets that can be
1770
     * sent as early data.
1771
     */
1772
    uint32_t max_early_data;
1773
    /*
1774
     * The maximum number of bytes of early data that a server will tolerate
1775
     * (which should be at least as much as max_early_data).
1776
     */
1777
    uint32_t recv_max_early_data;
1778
1779
    /*
1780
     * The number of bytes of early data received so far. If we accepted early
1781
     * data then this is a count of the plaintext bytes. If we rejected it then
1782
     * this is a count of the ciphertext bytes.
1783
     */
1784
    uint32_t early_data_count;
1785
1786
    /* The number of TLS1.3 tickets to automatically send */
1787
    size_t num_tickets;
1788
    /* The number of TLS1.3 tickets actually sent so far */
1789
    size_t sent_tickets;
1790
    /* The next nonce value to use when we send a ticket on this connection */
1791
    uint64_t next_ticket_nonce;
1792
1793
    /* Callback to determine if early_data is acceptable or not */
1794
    SSL_allow_early_data_cb_fn allow_early_data_cb;
1795
    void *allow_early_data_cb_data;
1796
1797
    /* Callback for SSL async handling */
1798
    SSL_async_callback_fn async_cb;
1799
    void *async_cb_arg;
1800
1801
    /*
1802
     * Signature algorithms shared by client and server: cached because these
1803
     * are used most often.
1804
     */
1805
    const struct sigalg_lookup_st **shared_sigalgs;
1806
    size_t shared_sigalgslen;
1807
1808
#ifndef OPENSSL_NO_COMP_ALG
1809
    /* certificate compression preferences */
1810
    int cert_comp_prefs[TLSEXT_comp_cert_limit];
1811
#endif
1812
1813
    /* Certificate Type stuff - for RPK vs X.509 */
1814
    unsigned char *client_cert_type;
1815
    size_t client_cert_type_len;
1816
    unsigned char *server_cert_type;
1817
    size_t server_cert_type_len;
1818
};
1819
1820
#define SSL_CONNECTION_FROM_SSL_ONLY_int(ssl, c)             \
1821
157M
    ((ssl) == NULL ? NULL                                    \
1822
157M
                   : ((ssl)->type == SSL_TYPE_SSL_CONNECTION \
1823
157M
                             ? (c SSL_CONNECTION *)(ssl)     \
1824
157M
                             : NULL))
1825
#define SSL_CONNECTION_NO_CONST
1826
#define SSL_CONNECTION_FROM_SSL_ONLY(ssl) \
1827
157M
    SSL_CONNECTION_FROM_SSL_ONLY_int(ssl, SSL_CONNECTION_NO_CONST)
1828
#define SSL_CONNECTION_FROM_CONST_SSL_ONLY(ssl) \
1829
0
    SSL_CONNECTION_FROM_SSL_ONLY_int(ssl, const)
1830
399M
#define SSL_CONNECTION_GET_CTX(sc) ((sc)->ssl.ctx)
1831
647M
#define SSL_CONNECTION_GET_SSL(sc) (&(sc)->ssl)
1832
184M
#define SSL_CONNECTION_GET_USER_SSL(sc) ((sc)->user_ssl)
1833
#ifndef OPENSSL_NO_QUIC
1834
#include "quic/quic_local.h"
1835
#define SSL_CONNECTION_FROM_SSL_int(ssl, c)                                                    \
1836
344M
    ((ssl) == NULL ? NULL                                                                      \
1837
344M
                   : ((ssl)->type == SSL_TYPE_SSL_CONNECTION                                   \
1838
344M
                             ? (c SSL_CONNECTION *)(ssl)                                       \
1839
344M
                             : ((ssl)->type == SSL_TYPE_QUIC_CONNECTION                        \
1840
65.3M
                                       ? (c SSL_CONNECTION *)((c QUIC_CONNECTION *)(ssl))->tls \
1841
65.3M
                                       : NULL)))
1842
#define SSL_CONNECTION_FROM_SSL(ssl) \
1843
93.5M
    SSL_CONNECTION_FROM_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
1844
#define SSL_CONNECTION_FROM_CONST_SSL(ssl) \
1845
250M
    SSL_CONNECTION_FROM_SSL_int(ssl, const)
1846
#else
1847
#define SSL_CONNECTION_FROM_SSL(ssl) \
1848
    SSL_CONNECTION_FROM_SSL_ONLY_int(ssl, SSL_CONNECTION_NO_CONST)
1849
#define SSL_CONNECTION_FROM_CONST_SSL(ssl) \
1850
    SSL_CONNECTION_FROM_SSL_ONLY_int(ssl, const)
1851
#endif
1852
1853
/*
1854
 * Structure containing table entry of values associated with the signature
1855
 * algorithms (signature scheme) extension
1856
 */
1857
typedef struct sigalg_lookup_st {
1858
    /* TLS 1.3 signature scheme name */
1859
    const char *name;
1860
    /* Raw value used in extension */
1861
    uint16_t sigalg;
1862
    /* NID of hash algorithm or NID_undef if no hash */
1863
    int hash;
1864
    /* Index of hash algorithm or -1 if no hash algorithm */
1865
    int hash_idx;
1866
    /* NID of signature algorithm */
1867
    int sig;
1868
    /* Index of signature algorithm */
1869
    int sig_idx;
1870
    /* Combined hash and signature NID, if any */
1871
    int sigandhash;
1872
    /* Required public key curve (ECDSA only) */
1873
    int curve;
1874
    /* Whether this signature algorithm is actually available for use */
1875
    int enabled;
1876
} SIGALG_LOOKUP;
1877
1878
/* DTLS structures */
1879
1880
#ifndef OPENSSL_NO_SCTP
1881
#define DTLS1_SCTP_AUTH_LABEL "EXPORTER_DTLS_OVER_SCTP"
1882
#endif
1883
1884
/* Max MTU overhead we know about so far is 40 for IPv6 + 8 for UDP */
1885
0
#define DTLS1_MAX_MTU_OVERHEAD 48
1886
1887
/*
1888
 * Flag used in message reuse to indicate the buffer contains the record
1889
 * header as well as the handshake message header.
1890
 */
1891
#define DTLS1_SKIP_RECORD_HEADER 2
1892
1893
struct dtls1_retransmit_state {
1894
    const OSSL_RECORD_METHOD *wrlmethod;
1895
    OSSL_RECORD_LAYER *wrl;
1896
};
1897
1898
struct hm_header_st {
1899
    unsigned char type;
1900
    size_t msg_len;
1901
    unsigned short seq;
1902
    size_t frag_off;
1903
    size_t frag_len;
1904
    unsigned int is_ccs;
1905
    struct dtls1_retransmit_state saved_retransmit_state;
1906
};
1907
1908
typedef struct hm_fragment_st {
1909
    struct hm_header_st msg_header;
1910
    unsigned char *fragment;
1911
    unsigned char *reassembly;
1912
} hm_fragment;
1913
1914
typedef struct pqueue_st pqueue;
1915
typedef struct pitem_st pitem;
1916
1917
struct pitem_st {
1918
    unsigned char priority[8]; /* 64-bit value in big-endian encoding */
1919
    void *data;
1920
    pitem *next;
1921
};
1922
1923
typedef struct pitem_st *piterator;
1924
1925
pitem *pitem_new(unsigned char *prio64be, void *data);
1926
void pitem_free(pitem *item);
1927
pqueue *pqueue_new(void);
1928
void pqueue_free(pqueue *pq);
1929
pitem *pqueue_insert(pqueue *pq, pitem *item);
1930
pitem *pqueue_peek(pqueue *pq);
1931
pitem *pqueue_pop(pqueue *pq);
1932
pitem *pqueue_find(pqueue *pq, unsigned char *prio64be);
1933
pitem *pqueue_iterator(pqueue *pq);
1934
pitem *pqueue_next(piterator *iter);
1935
size_t pqueue_size(pqueue *pq);
1936
1937
typedef struct dtls1_state_st {
1938
    unsigned char cookie[DTLS1_COOKIE_LENGTH];
1939
    size_t cookie_len;
1940
    unsigned int cookie_verified;
1941
    /* handshake message numbers */
1942
    unsigned short handshake_write_seq;
1943
    unsigned short next_handshake_write_seq;
1944
    unsigned short handshake_read_seq;
1945
    /* Buffered handshake messages */
1946
    pqueue *buffered_messages;
1947
    /* Buffered (sent) handshake records */
1948
    pqueue *sent_messages;
1949
    size_t link_mtu; /* max on-the-wire DTLS packet size */
1950
    size_t mtu; /* max DTLS packet size */
1951
    struct hm_header_st w_msg_hdr;
1952
    struct hm_header_st r_msg_hdr;
1953
    /* Number of alerts received so far */
1954
    unsigned int timeout_num_alerts;
1955
    /*
1956
     * Indicates when the last handshake msg sent will timeout
1957
     */
1958
    OSSL_TIME next_timeout;
1959
    /* Timeout duration */
1960
    unsigned int timeout_duration_us;
1961
1962
    unsigned int retransmitting;
1963
#ifndef OPENSSL_NO_SCTP
1964
    int shutdown_received;
1965
#endif
1966
1967
    DTLS_timer_cb timer_cb;
1968
1969
} DTLS1_STATE;
1970
1971
/*
1972
 * From ECC-TLS draft, used in encoding the curve type in ECParameters
1973
 */
1974
#define EXPLICIT_PRIME_CURVE_TYPE 1
1975
#define EXPLICIT_CHAR2_CURVE_TYPE 2
1976
16.9k
#define NAMED_CURVE_TYPE 3
1977
1978
#ifndef OPENSSL_NO_COMP_ALG
1979
struct ossl_comp_cert_st {
1980
    unsigned char *data;
1981
    size_t len;
1982
    size_t orig_len;
1983
    CRYPTO_REF_COUNT references;
1984
    int alg;
1985
};
1986
typedef struct ossl_comp_cert_st OSSL_COMP_CERT;
1987
1988
void OSSL_COMP_CERT_free(OSSL_COMP_CERT *c);
1989
int OSSL_COMP_CERT_up_ref(OSSL_COMP_CERT *c);
1990
#endif
1991
1992
struct cert_pkey_st {
1993
    X509 *x509;
1994
    EVP_PKEY *privatekey;
1995
    /* Chain for this certificate */
1996
    STACK_OF(X509) *chain;
1997
    /*-
1998
     * serverinfo data for this certificate.  The data is in TLS Extension
1999
     * wire format, specifically it's a series of records like:
2000
     *   uint16_t extension_type; // (RFC 5246, 7.4.1.4, Extension)
2001
     *   uint16_t length;
2002
     *   uint8_t data[length];
2003
     */
2004
    unsigned char *serverinfo;
2005
    size_t serverinfo_length;
2006
#ifndef OPENSSL_NO_COMP_ALG
2007
    /* Compressed certificate data - index 0 is unused */
2008
    OSSL_COMP_CERT *comp_cert[TLSEXT_comp_cert_limit];
2009
    int cert_comp_used;
2010
#endif
2011
};
2012
/* Retrieve Suite B flags */
2013
2.85M
#define tls1_suiteb(s) (s->cert->cert_flags & SSL_CERT_FLAG_SUITEB_128_LOS)
2014
/* Uses to check strict mode: suite B modes are always strict */
2015
#define SSL_CERT_FLAGS_CHECK_TLS_STRICT \
2016
236k
    (SSL_CERT_FLAG_SUITEB_128_LOS | SSL_CERT_FLAG_TLS_STRICT)
2017
2018
typedef enum {
2019
    ENDPOINT_CLIENT = 0,
2020
    ENDPOINT_SERVER,
2021
    ENDPOINT_BOTH
2022
} ENDPOINT;
2023
2024
typedef struct {
2025
    unsigned short ext_type;
2026
    ENDPOINT role;
2027
    /* The context which this extension applies to */
2028
    unsigned int context;
2029
    /*
2030
     * Per-connection flags relating to this extension type: not used if
2031
     * part of an SSL_CTX structure.
2032
     */
2033
    uint32_t ext_flags;
2034
    SSL_custom_ext_add_cb_ex add_cb;
2035
    SSL_custom_ext_free_cb_ex free_cb;
2036
    void *add_arg;
2037
    SSL_custom_ext_parse_cb_ex parse_cb;
2038
    void *parse_arg;
2039
} custom_ext_method;
2040
2041
/* ext_flags values */
2042
2043
/*
2044
 * Indicates an extension has been received. Used to check for unsolicited or
2045
 * duplicate extensions.
2046
 */
2047
0
#define SSL_EXT_FLAG_RECEIVED 0x1
2048
/*
2049
 * Indicates an extension has been sent: used to enable sending of
2050
 * corresponding ServerHello extension.
2051
 */
2052
1.28M
#define SSL_EXT_FLAG_SENT 0x2
2053
2054
typedef struct {
2055
    custom_ext_method *meths;
2056
    size_t meths_count;
2057
} custom_ext_methods;
2058
2059
typedef struct cert_st {
2060
    /* Current active set */
2061
    /*
2062
     * ALWAYS points to an element of the pkeys array
2063
     * Probably it would make more sense to store
2064
     * an index, not a pointer.
2065
     */
2066
    CERT_PKEY *key;
2067
2068
    EVP_PKEY *dh_tmp;
2069
    DH *(*dh_tmp_cb)(SSL *ssl, int is_export, int keysize);
2070
    int dh_tmp_auto;
2071
    /* Flags related to certificates */
2072
    uint32_t cert_flags;
2073
    CERT_PKEY *pkeys;
2074
    size_t ssl_pkey_num;
2075
    /* Custom certificate types sent in certificate request message. */
2076
    uint8_t *ctype;
2077
    size_t ctype_len;
2078
    /*
2079
     * supported signature algorithms. When set on a client this is sent in
2080
     * the client hello as the supported signature algorithms extension. For
2081
     * servers it represents the signature algorithms we are willing to use.
2082
     */
2083
    uint16_t *conf_sigalgs;
2084
    /* Size of above array */
2085
    size_t conf_sigalgslen;
2086
    /*
2087
     * Client authentication signature algorithms, if not set then uses
2088
     * conf_sigalgs. On servers these will be the signature algorithms sent
2089
     * to the client in a certificate request for TLS 1.2. On a client this
2090
     * represents the signature algorithms we are willing to use for client
2091
     * authentication.
2092
     */
2093
    uint16_t *client_sigalgs;
2094
    /* Size of above array */
2095
    size_t client_sigalgslen;
2096
    /*
2097
     * Certificate setup callback: if set is called whenever a certificate
2098
     * may be required (client or server). the callback can then examine any
2099
     * appropriate parameters and setup any certificates required. This
2100
     * allows advanced applications to select certificates on the fly: for
2101
     * example based on supported signature algorithms or curves.
2102
     */
2103
    int (*cert_cb)(SSL *ssl, void *arg);
2104
    void *cert_cb_arg;
2105
    /*
2106
     * Optional X509_STORE for chain building or certificate validation If
2107
     * NULL the parent SSL_CTX store is used instead.
2108
     */
2109
    X509_STORE *chain_store;
2110
    X509_STORE *verify_store;
2111
    /* Custom extensions */
2112
    custom_ext_methods custext;
2113
    /* Security callback */
2114
    int (*sec_cb)(const SSL *s, const SSL_CTX *ctx, int op, int bits, int nid,
2115
        void *other, void *ex);
2116
    /* Security level */
2117
    int sec_level;
2118
    void *sec_ex;
2119
#ifndef OPENSSL_NO_PSK
2120
    /* If not NULL psk identity hint to use for servers */
2121
    char *psk_identity_hint;
2122
#endif
2123
    CRYPTO_REF_COUNT references; /* >1 only if SSL_copy_session_id is used */
2124
} CERT;
2125
2126
#define FP_ICC (int (*)(const void *, const void *))
2127
2128
/*
2129
 * This is for the SSLv3/TLSv1.0 differences in crypto/hash stuff It is a bit
2130
 * of a mess of functions, but hell, think of it as an opaque structure :-)
2131
 */
2132
typedef struct ssl3_enc_method {
2133
    int (*setup_key_block)(SSL_CONNECTION *);
2134
    int (*generate_master_secret)(SSL_CONNECTION *, unsigned char *,
2135
        unsigned char *, size_t, size_t *);
2136
    int (*change_cipher_state)(SSL_CONNECTION *, int);
2137
    size_t (*final_finish_mac)(SSL_CONNECTION *, const char *, size_t,
2138
        unsigned char *);
2139
    const char *client_finished_label;
2140
    size_t client_finished_label_len;
2141
    const char *server_finished_label;
2142
    size_t server_finished_label_len;
2143
    int (*alert_value)(int);
2144
    int (*export_keying_material)(SSL_CONNECTION *, unsigned char *, size_t,
2145
        const char *, size_t,
2146
        const unsigned char *, size_t,
2147
        int use_context);
2148
    /* Various flags indicating protocol version requirements */
2149
    uint32_t enc_flags;
2150
    /* Set the handshake header */
2151
    int (*set_handshake_header)(SSL_CONNECTION *s, WPACKET *pkt, int type);
2152
    /* Close construction of the handshake message */
2153
    int (*close_construct_packet)(SSL_CONNECTION *s, WPACKET *pkt, int htype);
2154
    /* Write out handshake message */
2155
    int (*do_write)(SSL_CONNECTION *s);
2156
} SSL3_ENC_METHOD;
2157
2158
#define ssl_set_handshake_header(s, pkt, htype) \
2159
104k
    SSL_CONNECTION_GET_SSL(s)->method->ssl3_enc->set_handshake_header((s), (pkt), (htype))
2160
#define ssl_close_construct_packet(s, pkt, htype) \
2161
103k
    SSL_CONNECTION_GET_SSL(s)->method->ssl3_enc->close_construct_packet((s), (pkt), (htype))
2162
259k
#define ssl_do_write(s) SSL_CONNECTION_GET_SSL(s)->method->ssl3_enc->do_write(s)
2163
2164
/* Values for enc_flags */
2165
2166
/* Uses explicit IV for CBC mode */
2167
#define SSL_ENC_FLAG_EXPLICIT_IV 0x1
2168
/* Uses signature algorithms extension */
2169
319k
#define SSL_ENC_FLAG_SIGALGS 0x2
2170
/* Uses SHA256 default PRF */
2171
460k
#define SSL_ENC_FLAG_SHA256_PRF 0x4
2172
/* Is DTLS */
2173
330M
#define SSL_ENC_FLAG_DTLS 0x8
2174
/*
2175
 * Allow TLS 1.2 ciphersuites: applies to DTLS 1.2 as well as TLS 1.2: may
2176
 * apply to others in future.
2177
 */
2178
0
#define SSL_ENC_FLAG_TLS1_2_CIPHERS 0x10
2179
2180
typedef enum downgrade_en {
2181
    DOWNGRADE_NONE,
2182
    DOWNGRADE_TO_1_2,
2183
    DOWNGRADE_TO_1_1
2184
} DOWNGRADE;
2185
2186
/*
2187
 * Dummy status type for the status_type extension. Indicates no status type
2188
 * set
2189
 */
2190
163k
#define TLSEXT_STATUSTYPE_nothing -1
2191
2192
/* Sigalgs values */
2193
0
#define TLSEXT_SIGALG_ecdsa_secp256r1_sha256 0x0403
2194
0
#define TLSEXT_SIGALG_ecdsa_secp384r1_sha384 0x0503
2195
#define TLSEXT_SIGALG_ecdsa_secp521r1_sha512 0x0603
2196
#define TLSEXT_SIGALG_ecdsa_sha224 0x0303
2197
#define TLSEXT_SIGALG_ecdsa_sha1 0x0203
2198
#define TLSEXT_SIGALG_rsa_pss_rsae_sha256 0x0804
2199
#define TLSEXT_SIGALG_rsa_pss_rsae_sha384 0x0805
2200
#define TLSEXT_SIGALG_rsa_pss_rsae_sha512 0x0806
2201
#define TLSEXT_SIGALG_rsa_pss_pss_sha256 0x0809
2202
#define TLSEXT_SIGALG_rsa_pss_pss_sha384 0x080a
2203
#define TLSEXT_SIGALG_rsa_pss_pss_sha512 0x080b
2204
#define TLSEXT_SIGALG_rsa_pkcs1_sha256 0x0401
2205
#define TLSEXT_SIGALG_rsa_pkcs1_sha384 0x0501
2206
#define TLSEXT_SIGALG_rsa_pkcs1_sha512 0x0601
2207
#define TLSEXT_SIGALG_rsa_pkcs1_sha224 0x0301
2208
#define TLSEXT_SIGALG_rsa_pkcs1_sha1 0x0201
2209
#define TLSEXT_SIGALG_dsa_sha256 0x0402
2210
#define TLSEXT_SIGALG_dsa_sha384 0x0502
2211
#define TLSEXT_SIGALG_dsa_sha512 0x0602
2212
#define TLSEXT_SIGALG_dsa_sha224 0x0302
2213
#define TLSEXT_SIGALG_dsa_sha1 0x0202
2214
#define TLSEXT_SIGALG_gostr34102012_256_intrinsic 0x0840
2215
#define TLSEXT_SIGALG_gostr34102012_512_intrinsic 0x0841
2216
#define TLSEXT_SIGALG_gostr34102012_256_gostr34112012_256 0xeeee
2217
#define TLSEXT_SIGALG_gostr34102012_512_gostr34112012_512 0xefef
2218
#define TLSEXT_SIGALG_gostr34102001_gostr3411 0xeded
2219
2220
47.4k
#define TLSEXT_SIGALG_ed25519 0x0807
2221
24.4k
#define TLSEXT_SIGALG_ed448 0x0808
2222
#define TLSEXT_SIGALG_ecdsa_brainpoolP256r1_sha256 0x081a
2223
#define TLSEXT_SIGALG_ecdsa_brainpoolP384r1_sha384 0x081b
2224
#define TLSEXT_SIGALG_ecdsa_brainpoolP512r1_sha512 0x081c
2225
2226
/* Known PSK key exchange modes */
2227
11.4k
#define TLSEXT_KEX_MODE_KE 0x00
2228
8.05k
#define TLSEXT_KEX_MODE_KE_DHE 0x01
2229
2230
/*
2231
 * Internal representations of key exchange modes
2232
 */
2233
416
#define TLSEXT_KEX_MODE_FLAG_NONE 0
2234
1.66k
#define TLSEXT_KEX_MODE_FLAG_KE 1
2235
92.8k
#define TLSEXT_KEX_MODE_FLAG_KE_DHE 2
2236
2237
18.2k
#define SSL_USE_PSS(s) (s->s3.tmp.peer_sigalg != NULL && s->s3.tmp.peer_sigalg->sig == EVP_PKEY_RSA_PSS)
2238
2239
/* A dummy signature value not valid for TLSv1.2 signature algs */
2240
#define TLSEXT_signature_rsa_pss 0x0101
2241
2242
/* TLSv1.3 downgrade protection sentinel values */
2243
extern const unsigned char tls11downgrade[8];
2244
extern const unsigned char tls12downgrade[8];
2245
2246
extern const SSL3_ENC_METHOD ssl3_undef_enc_method;
2247
2248
__owur const SSL_METHOD *sslv3_method(void);
2249
__owur const SSL_METHOD *sslv3_server_method(void);
2250
__owur const SSL_METHOD *sslv3_client_method(void);
2251
__owur const SSL_METHOD *tlsv1_method(void);
2252
__owur const SSL_METHOD *tlsv1_server_method(void);
2253
__owur const SSL_METHOD *tlsv1_client_method(void);
2254
__owur const SSL_METHOD *tlsv1_1_method(void);
2255
__owur const SSL_METHOD *tlsv1_1_server_method(void);
2256
__owur const SSL_METHOD *tlsv1_1_client_method(void);
2257
__owur const SSL_METHOD *tlsv1_2_method(void);
2258
__owur const SSL_METHOD *tlsv1_2_server_method(void);
2259
__owur const SSL_METHOD *tlsv1_2_client_method(void);
2260
__owur const SSL_METHOD *tlsv1_3_method(void);
2261
__owur const SSL_METHOD *tlsv1_3_server_method(void);
2262
__owur const SSL_METHOD *tlsv1_3_client_method(void);
2263
__owur const SSL_METHOD *dtlsv1_method(void);
2264
__owur const SSL_METHOD *dtlsv1_server_method(void);
2265
__owur const SSL_METHOD *dtlsv1_client_method(void);
2266
__owur const SSL_METHOD *dtls_bad_ver_client_method(void);
2267
__owur const SSL_METHOD *dtlsv1_2_method(void);
2268
__owur const SSL_METHOD *dtlsv1_2_server_method(void);
2269
__owur const SSL_METHOD *dtlsv1_2_client_method(void);
2270
2271
extern const SSL3_ENC_METHOD TLSv1_enc_data;
2272
extern const SSL3_ENC_METHOD TLSv1_1_enc_data;
2273
extern const SSL3_ENC_METHOD TLSv1_2_enc_data;
2274
extern const SSL3_ENC_METHOD TLSv1_3_enc_data;
2275
extern const SSL3_ENC_METHOD SSLv3_enc_data;
2276
extern const SSL3_ENC_METHOD DTLSv1_enc_data;
2277
extern const SSL3_ENC_METHOD DTLSv1_2_enc_data;
2278
2279
/*
2280
 * Flags for SSL methods
2281
 */
2282
#define SSL_METHOD_NO_FIPS (1U << 0)
2283
2.95M
#define SSL_METHOD_NO_SUITEB (1U << 1)
2284
2285
#define IMPLEMENT_tls_meth_func(version, flags, mask, func_name, s_accept, \
2286
    s_connect, enc_data)                                                   \
2287
    const SSL_METHOD *func_name(void)                                      \
2288
3.84M
    {                                                                      \
2289
3.84M
        static const SSL_METHOD func_name##_data = {                       \
2290
3.84M
            version,                                                       \
2291
3.84M
            flags,                                                         \
2292
3.84M
            mask,                                                          \
2293
3.84M
            ossl_ssl_connection_new,                                       \
2294
3.84M
            ossl_ssl_connection_free,                                      \
2295
3.84M
            ossl_ssl_connection_reset,                                     \
2296
3.84M
            tls1_new,                                                      \
2297
3.84M
            tls1_clear,                                                    \
2298
3.84M
            tls1_free,                                                     \
2299
3.84M
            s_accept,                                                      \
2300
3.84M
            s_connect,                                                     \
2301
3.84M
            ssl3_read,                                                     \
2302
3.84M
            ssl3_peek,                                                     \
2303
3.84M
            ssl3_write,                                                    \
2304
3.84M
            ssl3_shutdown,                                                 \
2305
3.84M
            ssl3_renegotiate,                                              \
2306
3.84M
            ssl3_renegotiate_check,                                        \
2307
3.84M
            ssl3_read_bytes,                                               \
2308
3.84M
            ssl3_write_bytes,                                              \
2309
3.84M
            ssl3_dispatch_alert,                                           \
2310
3.84M
            ssl3_ctrl,                                                     \
2311
3.84M
            ssl3_ctx_ctrl,                                                 \
2312
3.84M
            ssl3_get_cipher_by_char,                                       \
2313
3.84M
            ssl3_put_cipher_by_char,                                       \
2314
3.84M
            ssl3_pending,                                                  \
2315
3.84M
            ssl3_num_ciphers,                                              \
2316
3.84M
            ssl3_get_cipher,                                               \
2317
3.84M
            tls1_default_timeout,                                          \
2318
3.84M
            &enc_data,                                                     \
2319
3.84M
            ssl_undefined_void_function,                                   \
2320
3.84M
            ssl3_callback_ctrl,                                            \
2321
3.84M
            ssl3_ctx_callback_ctrl,                                        \
2322
3.84M
        };                                                                 \
2323
3.84M
        return &func_name##_data;                                          \
2324
3.84M
    }
TLS_method
Line
Count
Source
2288
120k
    {                                                                      \
2289
120k
        static const SSL_METHOD func_name##_data = {                       \
2290
120k
            version,                                                       \
2291
120k
            flags,                                                         \
2292
120k
            mask,                                                          \
2293
120k
            ossl_ssl_connection_new,                                       \
2294
120k
            ossl_ssl_connection_free,                                      \
2295
120k
            ossl_ssl_connection_reset,                                     \
2296
120k
            tls1_new,                                                      \
2297
120k
            tls1_clear,                                                    \
2298
120k
            tls1_free,                                                     \
2299
120k
            s_accept,                                                      \
2300
120k
            s_connect,                                                     \
2301
120k
            ssl3_read,                                                     \
2302
120k
            ssl3_peek,                                                     \
2303
120k
            ssl3_write,                                                    \
2304
120k
            ssl3_shutdown,                                                 \
2305
120k
            ssl3_renegotiate,                                              \
2306
120k
            ssl3_renegotiate_check,                                        \
2307
120k
            ssl3_read_bytes,                                               \
2308
120k
            ssl3_write_bytes,                                              \
2309
120k
            ssl3_dispatch_alert,                                           \
2310
120k
            ssl3_ctrl,                                                     \
2311
120k
            ssl3_ctx_ctrl,                                                 \
2312
120k
            ssl3_get_cipher_by_char,                                       \
2313
120k
            ssl3_put_cipher_by_char,                                       \
2314
120k
            ssl3_pending,                                                  \
2315
120k
            ssl3_num_ciphers,                                              \
2316
120k
            ssl3_get_cipher,                                               \
2317
120k
            tls1_default_timeout,                                          \
2318
120k
            &enc_data,                                                     \
2319
120k
            ssl_undefined_void_function,                                   \
2320
120k
            ssl3_callback_ctrl,                                            \
2321
120k
            ssl3_ctx_callback_ctrl,                                        \
2322
120k
        };                                                                 \
2323
120k
        return &func_name##_data;                                          \
2324
120k
    }
Unexecuted instantiation: tlsv1_3_method
Unexecuted instantiation: tlsv1_2_method
Unexecuted instantiation: tlsv1_1_method
Unexecuted instantiation: tlsv1_method
Unexecuted instantiation: TLS_server_method
tlsv1_3_server_method
Line
Count
Source
2288
23.4k
    {                                                                      \
2289
23.4k
        static const SSL_METHOD func_name##_data = {                       \
2290
23.4k
            version,                                                       \
2291
23.4k
            flags,                                                         \
2292
23.4k
            mask,                                                          \
2293
23.4k
            ossl_ssl_connection_new,                                       \
2294
23.4k
            ossl_ssl_connection_free,                                      \
2295
23.4k
            ossl_ssl_connection_reset,                                     \
2296
23.4k
            tls1_new,                                                      \
2297
23.4k
            tls1_clear,                                                    \
2298
23.4k
            tls1_free,                                                     \
2299
23.4k
            s_accept,                                                      \
2300
23.4k
            s_connect,                                                     \
2301
23.4k
            ssl3_read,                                                     \
2302
23.4k
            ssl3_peek,                                                     \
2303
23.4k
            ssl3_write,                                                    \
2304
23.4k
            ssl3_shutdown,                                                 \
2305
23.4k
            ssl3_renegotiate,                                              \
2306
23.4k
            ssl3_renegotiate_check,                                        \
2307
23.4k
            ssl3_read_bytes,                                               \
2308
23.4k
            ssl3_write_bytes,                                              \
2309
23.4k
            ssl3_dispatch_alert,                                           \
2310
23.4k
            ssl3_ctrl,                                                     \
2311
23.4k
            ssl3_ctx_ctrl,                                                 \
2312
23.4k
            ssl3_get_cipher_by_char,                                       \
2313
23.4k
            ssl3_put_cipher_by_char,                                       \
2314
23.4k
            ssl3_pending,                                                  \
2315
23.4k
            ssl3_num_ciphers,                                              \
2316
23.4k
            ssl3_get_cipher,                                               \
2317
23.4k
            tls1_default_timeout,                                          \
2318
23.4k
            &enc_data,                                                     \
2319
23.4k
            ssl_undefined_void_function,                                   \
2320
23.4k
            ssl3_callback_ctrl,                                            \
2321
23.4k
            ssl3_ctx_callback_ctrl,                                        \
2322
23.4k
        };                                                                 \
2323
23.4k
        return &func_name##_data;                                          \
2324
23.4k
    }
tlsv1_2_server_method
Line
Count
Source
2288
24.4k
    {                                                                      \
2289
24.4k
        static const SSL_METHOD func_name##_data = {                       \
2290
24.4k
            version,                                                       \
2291
24.4k
            flags,                                                         \
2292
24.4k
            mask,                                                          \
2293
24.4k
            ossl_ssl_connection_new,                                       \
2294
24.4k
            ossl_ssl_connection_free,                                      \
2295
24.4k
            ossl_ssl_connection_reset,                                     \
2296
24.4k
            tls1_new,                                                      \
2297
24.4k
            tls1_clear,                                                    \
2298
24.4k
            tls1_free,                                                     \
2299
24.4k
            s_accept,                                                      \
2300
24.4k
            s_connect,                                                     \
2301
24.4k
            ssl3_read,                                                     \
2302
24.4k
            ssl3_peek,                                                     \
2303
24.4k
            ssl3_write,                                                    \
2304
24.4k
            ssl3_shutdown,                                                 \
2305
24.4k
            ssl3_renegotiate,                                              \
2306
24.4k
            ssl3_renegotiate_check,                                        \
2307
24.4k
            ssl3_read_bytes,                                               \
2308
24.4k
            ssl3_write_bytes,                                              \
2309
24.4k
            ssl3_dispatch_alert,                                           \
2310
24.4k
            ssl3_ctrl,                                                     \
2311
24.4k
            ssl3_ctx_ctrl,                                                 \
2312
24.4k
            ssl3_get_cipher_by_char,                                       \
2313
24.4k
            ssl3_put_cipher_by_char,                                       \
2314
24.4k
            ssl3_pending,                                                  \
2315
24.4k
            ssl3_num_ciphers,                                              \
2316
24.4k
            ssl3_get_cipher,                                               \
2317
24.4k
            tls1_default_timeout,                                          \
2318
24.4k
            &enc_data,                                                     \
2319
24.4k
            ssl_undefined_void_function,                                   \
2320
24.4k
            ssl3_callback_ctrl,                                            \
2321
24.4k
            ssl3_ctx_callback_ctrl,                                        \
2322
24.4k
        };                                                                 \
2323
24.4k
        return &func_name##_data;                                          \
2324
24.4k
    }
tlsv1_1_server_method
Line
Count
Source
2288
2.26k
    {                                                                      \
2289
2.26k
        static const SSL_METHOD func_name##_data = {                       \
2290
2.26k
            version,                                                       \
2291
2.26k
            flags,                                                         \
2292
2.26k
            mask,                                                          \
2293
2.26k
            ossl_ssl_connection_new,                                       \
2294
2.26k
            ossl_ssl_connection_free,                                      \
2295
2.26k
            ossl_ssl_connection_reset,                                     \
2296
2.26k
            tls1_new,                                                      \
2297
2.26k
            tls1_clear,                                                    \
2298
2.26k
            tls1_free,                                                     \
2299
2.26k
            s_accept,                                                      \
2300
2.26k
            s_connect,                                                     \
2301
2.26k
            ssl3_read,                                                     \
2302
2.26k
            ssl3_peek,                                                     \
2303
2.26k
            ssl3_write,                                                    \
2304
2.26k
            ssl3_shutdown,                                                 \
2305
2.26k
            ssl3_renegotiate,                                              \
2306
2.26k
            ssl3_renegotiate_check,                                        \
2307
2.26k
            ssl3_read_bytes,                                               \
2308
2.26k
            ssl3_write_bytes,                                              \
2309
2.26k
            ssl3_dispatch_alert,                                           \
2310
2.26k
            ssl3_ctrl,                                                     \
2311
2.26k
            ssl3_ctx_ctrl,                                                 \
2312
2.26k
            ssl3_get_cipher_by_char,                                       \
2313
2.26k
            ssl3_put_cipher_by_char,                                       \
2314
2.26k
            ssl3_pending,                                                  \
2315
2.26k
            ssl3_num_ciphers,                                              \
2316
2.26k
            ssl3_get_cipher,                                               \
2317
2.26k
            tls1_default_timeout,                                          \
2318
2.26k
            &enc_data,                                                     \
2319
2.26k
            ssl_undefined_void_function,                                   \
2320
2.26k
            ssl3_callback_ctrl,                                            \
2321
2.26k
            ssl3_ctx_callback_ctrl,                                        \
2322
2.26k
        };                                                                 \
2323
2.26k
        return &func_name##_data;                                          \
2324
2.26k
    }
tlsv1_server_method
Line
Count
Source
2288
2.06k
    {                                                                      \
2289
2.06k
        static const SSL_METHOD func_name##_data = {                       \
2290
2.06k
            version,                                                       \
2291
2.06k
            flags,                                                         \
2292
2.06k
            mask,                                                          \
2293
2.06k
            ossl_ssl_connection_new,                                       \
2294
2.06k
            ossl_ssl_connection_free,                                      \
2295
2.06k
            ossl_ssl_connection_reset,                                     \
2296
2.06k
            tls1_new,                                                      \
2297
2.06k
            tls1_clear,                                                    \
2298
2.06k
            tls1_free,                                                     \
2299
2.06k
            s_accept,                                                      \
2300
2.06k
            s_connect,                                                     \
2301
2.06k
            ssl3_read,                                                     \
2302
2.06k
            ssl3_peek,                                                     \
2303
2.06k
            ssl3_write,                                                    \
2304
2.06k
            ssl3_shutdown,                                                 \
2305
2.06k
            ssl3_renegotiate,                                              \
2306
2.06k
            ssl3_renegotiate_check,                                        \
2307
2.06k
            ssl3_read_bytes,                                               \
2308
2.06k
            ssl3_write_bytes,                                              \
2309
2.06k
            ssl3_dispatch_alert,                                           \
2310
2.06k
            ssl3_ctrl,                                                     \
2311
2.06k
            ssl3_ctx_ctrl,                                                 \
2312
2.06k
            ssl3_get_cipher_by_char,                                       \
2313
2.06k
            ssl3_put_cipher_by_char,                                       \
2314
2.06k
            ssl3_pending,                                                  \
2315
2.06k
            ssl3_num_ciphers,                                              \
2316
2.06k
            ssl3_get_cipher,                                               \
2317
2.06k
            tls1_default_timeout,                                          \
2318
2.06k
            &enc_data,                                                     \
2319
2.06k
            ssl_undefined_void_function,                                   \
2320
2.06k
            ssl3_callback_ctrl,                                            \
2321
2.06k
            ssl3_ctx_callback_ctrl,                                        \
2322
2.06k
        };                                                                 \
2323
2.06k
        return &func_name##_data;                                          \
2324
2.06k
    }
Unexecuted instantiation: TLS_client_method
tlsv1_3_client_method
Line
Count
Source
2288
933k
    {                                                                      \
2289
933k
        static const SSL_METHOD func_name##_data = {                       \
2290
933k
            version,                                                       \
2291
933k
            flags,                                                         \
2292
933k
            mask,                                                          \
2293
933k
            ossl_ssl_connection_new,                                       \
2294
933k
            ossl_ssl_connection_free,                                      \
2295
933k
            ossl_ssl_connection_reset,                                     \
2296
933k
            tls1_new,                                                      \
2297
933k
            tls1_clear,                                                    \
2298
933k
            tls1_free,                                                     \
2299
933k
            s_accept,                                                      \
2300
933k
            s_connect,                                                     \
2301
933k
            ssl3_read,                                                     \
2302
933k
            ssl3_peek,                                                     \
2303
933k
            ssl3_write,                                                    \
2304
933k
            ssl3_shutdown,                                                 \
2305
933k
            ssl3_renegotiate,                                              \
2306
933k
            ssl3_renegotiate_check,                                        \
2307
933k
            ssl3_read_bytes,                                               \
2308
933k
            ssl3_write_bytes,                                              \
2309
933k
            ssl3_dispatch_alert,                                           \
2310
933k
            ssl3_ctrl,                                                     \
2311
933k
            ssl3_ctx_ctrl,                                                 \
2312
933k
            ssl3_get_cipher_by_char,                                       \
2313
933k
            ssl3_put_cipher_by_char,                                       \
2314
933k
            ssl3_pending,                                                  \
2315
933k
            ssl3_num_ciphers,                                              \
2316
933k
            ssl3_get_cipher,                                               \
2317
933k
            tls1_default_timeout,                                          \
2318
933k
            &enc_data,                                                     \
2319
933k
            ssl_undefined_void_function,                                   \
2320
933k
            ssl3_callback_ctrl,                                            \
2321
933k
            ssl3_ctx_callback_ctrl,                                        \
2322
933k
        };                                                                 \
2323
933k
        return &func_name##_data;                                          \
2324
933k
    }
tlsv1_2_client_method
Line
Count
Source
2288
926k
    {                                                                      \
2289
926k
        static const SSL_METHOD func_name##_data = {                       \
2290
926k
            version,                                                       \
2291
926k
            flags,                                                         \
2292
926k
            mask,                                                          \
2293
926k
            ossl_ssl_connection_new,                                       \
2294
926k
            ossl_ssl_connection_free,                                      \
2295
926k
            ossl_ssl_connection_reset,                                     \
2296
926k
            tls1_new,                                                      \
2297
926k
            tls1_clear,                                                    \
2298
926k
            tls1_free,                                                     \
2299
926k
            s_accept,                                                      \
2300
926k
            s_connect,                                                     \
2301
926k
            ssl3_read,                                                     \
2302
926k
            ssl3_peek,                                                     \
2303
926k
            ssl3_write,                                                    \
2304
926k
            ssl3_shutdown,                                                 \
2305
926k
            ssl3_renegotiate,                                              \
2306
926k
            ssl3_renegotiate_check,                                        \
2307
926k
            ssl3_read_bytes,                                               \
2308
926k
            ssl3_write_bytes,                                              \
2309
926k
            ssl3_dispatch_alert,                                           \
2310
926k
            ssl3_ctrl,                                                     \
2311
926k
            ssl3_ctx_ctrl,                                                 \
2312
926k
            ssl3_get_cipher_by_char,                                       \
2313
926k
            ssl3_put_cipher_by_char,                                       \
2314
926k
            ssl3_pending,                                                  \
2315
926k
            ssl3_num_ciphers,                                              \
2316
926k
            ssl3_get_cipher,                                               \
2317
926k
            tls1_default_timeout,                                          \
2318
926k
            &enc_data,                                                     \
2319
926k
            ssl_undefined_void_function,                                   \
2320
926k
            ssl3_callback_ctrl,                                            \
2321
926k
            ssl3_ctx_callback_ctrl,                                        \
2322
926k
        };                                                                 \
2323
926k
        return &func_name##_data;                                          \
2324
926k
    }
tlsv1_1_client_method
Line
Count
Source
2288
904k
    {                                                                      \
2289
904k
        static const SSL_METHOD func_name##_data = {                       \
2290
904k
            version,                                                       \
2291
904k
            flags,                                                         \
2292
904k
            mask,                                                          \
2293
904k
            ossl_ssl_connection_new,                                       \
2294
904k
            ossl_ssl_connection_free,                                      \
2295
904k
            ossl_ssl_connection_reset,                                     \
2296
904k
            tls1_new,                                                      \
2297
904k
            tls1_clear,                                                    \
2298
904k
            tls1_free,                                                     \
2299
904k
            s_accept,                                                      \
2300
904k
            s_connect,                                                     \
2301
904k
            ssl3_read,                                                     \
2302
904k
            ssl3_peek,                                                     \
2303
904k
            ssl3_write,                                                    \
2304
904k
            ssl3_shutdown,                                                 \
2305
904k
            ssl3_renegotiate,                                              \
2306
904k
            ssl3_renegotiate_check,                                        \
2307
904k
            ssl3_read_bytes,                                               \
2308
904k
            ssl3_write_bytes,                                              \
2309
904k
            ssl3_dispatch_alert,                                           \
2310
904k
            ssl3_ctrl,                                                     \
2311
904k
            ssl3_ctx_ctrl,                                                 \
2312
904k
            ssl3_get_cipher_by_char,                                       \
2313
904k
            ssl3_put_cipher_by_char,                                       \
2314
904k
            ssl3_pending,                                                  \
2315
904k
            ssl3_num_ciphers,                                              \
2316
904k
            ssl3_get_cipher,                                               \
2317
904k
            tls1_default_timeout,                                          \
2318
904k
            &enc_data,                                                     \
2319
904k
            ssl_undefined_void_function,                                   \
2320
904k
            ssl3_callback_ctrl,                                            \
2321
904k
            ssl3_ctx_callback_ctrl,                                        \
2322
904k
        };                                                                 \
2323
904k
        return &func_name##_data;                                          \
2324
904k
    }
tlsv1_client_method
Line
Count
Source
2288
909k
    {                                                                      \
2289
909k
        static const SSL_METHOD func_name##_data = {                       \
2290
909k
            version,                                                       \
2291
909k
            flags,                                                         \
2292
909k
            mask,                                                          \
2293
909k
            ossl_ssl_connection_new,                                       \
2294
909k
            ossl_ssl_connection_free,                                      \
2295
909k
            ossl_ssl_connection_reset,                                     \
2296
909k
            tls1_new,                                                      \
2297
909k
            tls1_clear,                                                    \
2298
909k
            tls1_free,                                                     \
2299
909k
            s_accept,                                                      \
2300
909k
            s_connect,                                                     \
2301
909k
            ssl3_read,                                                     \
2302
909k
            ssl3_peek,                                                     \
2303
909k
            ssl3_write,                                                    \
2304
909k
            ssl3_shutdown,                                                 \
2305
909k
            ssl3_renegotiate,                                              \
2306
909k
            ssl3_renegotiate_check,                                        \
2307
909k
            ssl3_read_bytes,                                               \
2308
909k
            ssl3_write_bytes,                                              \
2309
909k
            ssl3_dispatch_alert,                                           \
2310
909k
            ssl3_ctrl,                                                     \
2311
909k
            ssl3_ctx_ctrl,                                                 \
2312
909k
            ssl3_get_cipher_by_char,                                       \
2313
909k
            ssl3_put_cipher_by_char,                                       \
2314
909k
            ssl3_pending,                                                  \
2315
909k
            ssl3_num_ciphers,                                              \
2316
909k
            ssl3_get_cipher,                                               \
2317
909k
            tls1_default_timeout,                                          \
2318
909k
            &enc_data,                                                     \
2319
909k
            ssl_undefined_void_function,                                   \
2320
909k
            ssl3_callback_ctrl,                                            \
2321
909k
            ssl3_ctx_callback_ctrl,                                        \
2322
909k
        };                                                                 \
2323
909k
        return &func_name##_data;                                          \
2324
909k
    }
2325
2326
#define IMPLEMENT_ssl3_meth_func(func_name, s_accept, s_connect) \
2327
    const SSL_METHOD *func_name(void)                            \
2328
    {                                                            \
2329
        static const SSL_METHOD func_name##_data = {             \
2330
            SSL3_VERSION,                                        \
2331
            SSL_METHOD_NO_FIPS | SSL_METHOD_NO_SUITEB,           \
2332
            SSL_OP_NO_SSLv3,                                     \
2333
            ossl_ssl_connection_new,                             \
2334
            ossl_ssl_connection_free,                            \
2335
            ossl_ssl_connection_reset,                           \
2336
            ssl3_new,                                            \
2337
            ssl3_clear,                                          \
2338
            ssl3_free,                                           \
2339
            s_accept,                                            \
2340
            s_connect,                                           \
2341
            ssl3_read,                                           \
2342
            ssl3_peek,                                           \
2343
            ssl3_write,                                          \
2344
            ssl3_shutdown,                                       \
2345
            ssl3_renegotiate,                                    \
2346
            ssl3_renegotiate_check,                              \
2347
            ssl3_read_bytes,                                     \
2348
            ssl3_write_bytes,                                    \
2349
            ssl3_dispatch_alert,                                 \
2350
            ssl3_ctrl,                                           \
2351
            ssl3_ctx_ctrl,                                       \
2352
            ssl3_get_cipher_by_char,                             \
2353
            ssl3_put_cipher_by_char,                             \
2354
            ssl3_pending,                                        \
2355
            ssl3_num_ciphers,                                    \
2356
            ssl3_get_cipher,                                     \
2357
            ssl3_default_timeout,                                \
2358
            &SSLv3_enc_data,                                     \
2359
            ssl_undefined_void_function,                         \
2360
            ssl3_callback_ctrl,                                  \
2361
            ssl3_ctx_callback_ctrl,                              \
2362
        };                                                       \
2363
        return &func_name##_data;                                \
2364
    }
2365
2366
#define IMPLEMENT_dtls1_meth_func(version, flags, mask, func_name, s_accept, \
2367
    s_connect, enc_data)                                                     \
2368
    const SSL_METHOD *func_name(void)                                        \
2369
787k
    {                                                                        \
2370
787k
        static const SSL_METHOD func_name##_data = {                         \
2371
787k
            version,                                                         \
2372
787k
            flags,                                                           \
2373
787k
            mask,                                                            \
2374
787k
            ossl_ssl_connection_new,                                         \
2375
787k
            ossl_ssl_connection_free,                                        \
2376
787k
            ossl_ssl_connection_reset,                                       \
2377
787k
            dtls1_new,                                                       \
2378
787k
            dtls1_clear,                                                     \
2379
787k
            dtls1_free,                                                      \
2380
787k
            s_accept,                                                        \
2381
787k
            s_connect,                                                       \
2382
787k
            ssl3_read,                                                       \
2383
787k
            ssl3_peek,                                                       \
2384
787k
            ssl3_write,                                                      \
2385
787k
            dtls1_shutdown,                                                  \
2386
787k
            ssl3_renegotiate,                                                \
2387
787k
            ssl3_renegotiate_check,                                          \
2388
787k
            dtls1_read_bytes,                                                \
2389
787k
            dtls1_write_app_data_bytes,                                      \
2390
787k
            dtls1_dispatch_alert,                                            \
2391
787k
            dtls1_ctrl,                                                      \
2392
787k
            ssl3_ctx_ctrl,                                                   \
2393
787k
            ssl3_get_cipher_by_char,                                         \
2394
787k
            ssl3_put_cipher_by_char,                                         \
2395
787k
            ssl3_pending,                                                    \
2396
787k
            ssl3_num_ciphers,                                                \
2397
787k
            ssl3_get_cipher,                                                 \
2398
787k
            dtls1_default_timeout,                                           \
2399
787k
            &enc_data,                                                       \
2400
787k
            ssl_undefined_void_function,                                     \
2401
787k
            ssl3_callback_ctrl,                                              \
2402
787k
            ssl3_ctx_callback_ctrl,                                          \
2403
787k
        };                                                                   \
2404
787k
        return &func_name##_data;                                            \
2405
787k
    }
Unexecuted instantiation: dtlsv1_method
Unexecuted instantiation: dtlsv1_2_method
DTLS_method
Line
Count
Source
2369
321
    {                                                                        \
2370
321
        static const SSL_METHOD func_name##_data = {                         \
2371
321
            version,                                                         \
2372
321
            flags,                                                           \
2373
321
            mask,                                                            \
2374
321
            ossl_ssl_connection_new,                                         \
2375
321
            ossl_ssl_connection_free,                                        \
2376
321
            ossl_ssl_connection_reset,                                       \
2377
321
            dtls1_new,                                                       \
2378
321
            dtls1_clear,                                                     \
2379
321
            dtls1_free,                                                      \
2380
321
            s_accept,                                                        \
2381
321
            s_connect,                                                       \
2382
321
            ssl3_read,                                                       \
2383
321
            ssl3_peek,                                                       \
2384
321
            ssl3_write,                                                      \
2385
321
            dtls1_shutdown,                                                  \
2386
321
            ssl3_renegotiate,                                                \
2387
321
            ssl3_renegotiate_check,                                          \
2388
321
            dtls1_read_bytes,                                                \
2389
321
            dtls1_write_app_data_bytes,                                      \
2390
321
            dtls1_dispatch_alert,                                            \
2391
321
            dtls1_ctrl,                                                      \
2392
321
            ssl3_ctx_ctrl,                                                   \
2393
321
            ssl3_get_cipher_by_char,                                         \
2394
321
            ssl3_put_cipher_by_char,                                         \
2395
321
            ssl3_pending,                                                    \
2396
321
            ssl3_num_ciphers,                                                \
2397
321
            ssl3_get_cipher,                                                 \
2398
321
            dtls1_default_timeout,                                           \
2399
321
            &enc_data,                                                       \
2400
321
            ssl_undefined_void_function,                                     \
2401
321
            ssl3_callback_ctrl,                                              \
2402
321
            ssl3_ctx_callback_ctrl,                                          \
2403
321
        };                                                                   \
2404
321
        return &func_name##_data;                                            \
2405
321
    }
dtlsv1_server_method
Line
Count
Source
2369
4.07k
    {                                                                        \
2370
4.07k
        static const SSL_METHOD func_name##_data = {                         \
2371
4.07k
            version,                                                         \
2372
4.07k
            flags,                                                           \
2373
4.07k
            mask,                                                            \
2374
4.07k
            ossl_ssl_connection_new,                                         \
2375
4.07k
            ossl_ssl_connection_free,                                        \
2376
4.07k
            ossl_ssl_connection_reset,                                       \
2377
4.07k
            dtls1_new,                                                       \
2378
4.07k
            dtls1_clear,                                                     \
2379
4.07k
            dtls1_free,                                                      \
2380
4.07k
            s_accept,                                                        \
2381
4.07k
            s_connect,                                                       \
2382
4.07k
            ssl3_read,                                                       \
2383
4.07k
            ssl3_peek,                                                       \
2384
4.07k
            ssl3_write,                                                      \
2385
4.07k
            dtls1_shutdown,                                                  \
2386
4.07k
            ssl3_renegotiate,                                                \
2387
4.07k
            ssl3_renegotiate_check,                                          \
2388
4.07k
            dtls1_read_bytes,                                                \
2389
4.07k
            dtls1_write_app_data_bytes,                                      \
2390
4.07k
            dtls1_dispatch_alert,                                            \
2391
4.07k
            dtls1_ctrl,                                                      \
2392
4.07k
            ssl3_ctx_ctrl,                                                   \
2393
4.07k
            ssl3_get_cipher_by_char,                                         \
2394
4.07k
            ssl3_put_cipher_by_char,                                         \
2395
4.07k
            ssl3_pending,                                                    \
2396
4.07k
            ssl3_num_ciphers,                                                \
2397
4.07k
            ssl3_get_cipher,                                                 \
2398
4.07k
            dtls1_default_timeout,                                           \
2399
4.07k
            &enc_data,                                                       \
2400
4.07k
            ssl_undefined_void_function,                                     \
2401
4.07k
            ssl3_callback_ctrl,                                              \
2402
4.07k
            ssl3_ctx_callback_ctrl,                                          \
2403
4.07k
        };                                                                   \
2404
4.07k
        return &func_name##_data;                                            \
2405
4.07k
    }
dtlsv1_2_server_method
Line
Count
Source
2369
12.3k
    {                                                                        \
2370
12.3k
        static const SSL_METHOD func_name##_data = {                         \
2371
12.3k
            version,                                                         \
2372
12.3k
            flags,                                                           \
2373
12.3k
            mask,                                                            \
2374
12.3k
            ossl_ssl_connection_new,                                         \
2375
12.3k
            ossl_ssl_connection_free,                                        \
2376
12.3k
            ossl_ssl_connection_reset,                                       \
2377
12.3k
            dtls1_new,                                                       \
2378
12.3k
            dtls1_clear,                                                     \
2379
12.3k
            dtls1_free,                                                      \
2380
12.3k
            s_accept,                                                        \
2381
12.3k
            s_connect,                                                       \
2382
12.3k
            ssl3_read,                                                       \
2383
12.3k
            ssl3_peek,                                                       \
2384
12.3k
            ssl3_write,                                                      \
2385
12.3k
            dtls1_shutdown,                                                  \
2386
12.3k
            ssl3_renegotiate,                                                \
2387
12.3k
            ssl3_renegotiate_check,                                          \
2388
12.3k
            dtls1_read_bytes,                                                \
2389
12.3k
            dtls1_write_app_data_bytes,                                      \
2390
12.3k
            dtls1_dispatch_alert,                                            \
2391
12.3k
            dtls1_ctrl,                                                      \
2392
12.3k
            ssl3_ctx_ctrl,                                                   \
2393
12.3k
            ssl3_get_cipher_by_char,                                         \
2394
12.3k
            ssl3_put_cipher_by_char,                                         \
2395
12.3k
            ssl3_pending,                                                    \
2396
12.3k
            ssl3_num_ciphers,                                                \
2397
12.3k
            ssl3_get_cipher,                                                 \
2398
12.3k
            dtls1_default_timeout,                                           \
2399
12.3k
            &enc_data,                                                       \
2400
12.3k
            ssl_undefined_void_function,                                     \
2401
12.3k
            ssl3_callback_ctrl,                                              \
2402
12.3k
            ssl3_ctx_callback_ctrl,                                          \
2403
12.3k
        };                                                                   \
2404
12.3k
        return &func_name##_data;                                            \
2405
12.3k
    }
DTLS_server_method
Line
Count
Source
2369
21.6k
    {                                                                        \
2370
21.6k
        static const SSL_METHOD func_name##_data = {                         \
2371
21.6k
            version,                                                         \
2372
21.6k
            flags,                                                           \
2373
21.6k
            mask,                                                            \
2374
21.6k
            ossl_ssl_connection_new,                                         \
2375
21.6k
            ossl_ssl_connection_free,                                        \
2376
21.6k
            ossl_ssl_connection_reset,                                       \
2377
21.6k
            dtls1_new,                                                       \
2378
21.6k
            dtls1_clear,                                                     \
2379
21.6k
            dtls1_free,                                                      \
2380
21.6k
            s_accept,                                                        \
2381
21.6k
            s_connect,                                                       \
2382
21.6k
            ssl3_read,                                                       \
2383
21.6k
            ssl3_peek,                                                       \
2384
21.6k
            ssl3_write,                                                      \
2385
21.6k
            dtls1_shutdown,                                                  \
2386
21.6k
            ssl3_renegotiate,                                                \
2387
21.6k
            ssl3_renegotiate_check,                                          \
2388
21.6k
            dtls1_read_bytes,                                                \
2389
21.6k
            dtls1_write_app_data_bytes,                                      \
2390
21.6k
            dtls1_dispatch_alert,                                            \
2391
21.6k
            dtls1_ctrl,                                                      \
2392
21.6k
            ssl3_ctx_ctrl,                                                   \
2393
21.6k
            ssl3_get_cipher_by_char,                                         \
2394
21.6k
            ssl3_put_cipher_by_char,                                         \
2395
21.6k
            ssl3_pending,                                                    \
2396
21.6k
            ssl3_num_ciphers,                                                \
2397
21.6k
            ssl3_get_cipher,                                                 \
2398
21.6k
            dtls1_default_timeout,                                           \
2399
21.6k
            &enc_data,                                                       \
2400
21.6k
            ssl_undefined_void_function,                                     \
2401
21.6k
            ssl3_callback_ctrl,                                              \
2402
21.6k
            ssl3_ctx_callback_ctrl,                                          \
2403
21.6k
        };                                                                   \
2404
21.6k
        return &func_name##_data;                                            \
2405
21.6k
    }
dtlsv1_client_method
Line
Count
Source
2369
240k
    {                                                                        \
2370
240k
        static const SSL_METHOD func_name##_data = {                         \
2371
240k
            version,                                                         \
2372
240k
            flags,                                                           \
2373
240k
            mask,                                                            \
2374
240k
            ossl_ssl_connection_new,                                         \
2375
240k
            ossl_ssl_connection_free,                                        \
2376
240k
            ossl_ssl_connection_reset,                                       \
2377
240k
            dtls1_new,                                                       \
2378
240k
            dtls1_clear,                                                     \
2379
240k
            dtls1_free,                                                      \
2380
240k
            s_accept,                                                        \
2381
240k
            s_connect,                                                       \
2382
240k
            ssl3_read,                                                       \
2383
240k
            ssl3_peek,                                                       \
2384
240k
            ssl3_write,                                                      \
2385
240k
            dtls1_shutdown,                                                  \
2386
240k
            ssl3_renegotiate,                                                \
2387
240k
            ssl3_renegotiate_check,                                          \
2388
240k
            dtls1_read_bytes,                                                \
2389
240k
            dtls1_write_app_data_bytes,                                      \
2390
240k
            dtls1_dispatch_alert,                                            \
2391
240k
            dtls1_ctrl,                                                      \
2392
240k
            ssl3_ctx_ctrl,                                                   \
2393
240k
            ssl3_get_cipher_by_char,                                         \
2394
240k
            ssl3_put_cipher_by_char,                                         \
2395
240k
            ssl3_pending,                                                    \
2396
240k
            ssl3_num_ciphers,                                                \
2397
240k
            ssl3_get_cipher,                                                 \
2398
240k
            dtls1_default_timeout,                                           \
2399
240k
            &enc_data,                                                       \
2400
240k
            ssl_undefined_void_function,                                     \
2401
240k
            ssl3_callback_ctrl,                                              \
2402
240k
            ssl3_ctx_callback_ctrl,                                          \
2403
240k
        };                                                                   \
2404
240k
        return &func_name##_data;                                            \
2405
240k
    }
dtls_bad_ver_client_method
Line
Count
Source
2369
238k
    {                                                                        \
2370
238k
        static const SSL_METHOD func_name##_data = {                         \
2371
238k
            version,                                                         \
2372
238k
            flags,                                                           \
2373
238k
            mask,                                                            \
2374
238k
            ossl_ssl_connection_new,                                         \
2375
238k
            ossl_ssl_connection_free,                                        \
2376
238k
            ossl_ssl_connection_reset,                                       \
2377
238k
            dtls1_new,                                                       \
2378
238k
            dtls1_clear,                                                     \
2379
238k
            dtls1_free,                                                      \
2380
238k
            s_accept,                                                        \
2381
238k
            s_connect,                                                       \
2382
238k
            ssl3_read,                                                       \
2383
238k
            ssl3_peek,                                                       \
2384
238k
            ssl3_write,                                                      \
2385
238k
            dtls1_shutdown,                                                  \
2386
238k
            ssl3_renegotiate,                                                \
2387
238k
            ssl3_renegotiate_check,                                          \
2388
238k
            dtls1_read_bytes,                                                \
2389
238k
            dtls1_write_app_data_bytes,                                      \
2390
238k
            dtls1_dispatch_alert,                                            \
2391
238k
            dtls1_ctrl,                                                      \
2392
238k
            ssl3_ctx_ctrl,                                                   \
2393
238k
            ssl3_get_cipher_by_char,                                         \
2394
238k
            ssl3_put_cipher_by_char,                                         \
2395
238k
            ssl3_pending,                                                    \
2396
238k
            ssl3_num_ciphers,                                                \
2397
238k
            ssl3_get_cipher,                                                 \
2398
238k
            dtls1_default_timeout,                                           \
2399
238k
            &enc_data,                                                       \
2400
238k
            ssl_undefined_void_function,                                     \
2401
238k
            ssl3_callback_ctrl,                                              \
2402
238k
            ssl3_ctx_callback_ctrl,                                          \
2403
238k
        };                                                                   \
2404
238k
        return &func_name##_data;                                            \
2405
238k
    }
dtlsv1_2_client_method
Line
Count
Source
2369
248k
    {                                                                        \
2370
248k
        static const SSL_METHOD func_name##_data = {                         \
2371
248k
            version,                                                         \
2372
248k
            flags,                                                           \
2373
248k
            mask,                                                            \
2374
248k
            ossl_ssl_connection_new,                                         \
2375
248k
            ossl_ssl_connection_free,                                        \
2376
248k
            ossl_ssl_connection_reset,                                       \
2377
248k
            dtls1_new,                                                       \
2378
248k
            dtls1_clear,                                                     \
2379
248k
            dtls1_free,                                                      \
2380
248k
            s_accept,                                                        \
2381
248k
            s_connect,                                                       \
2382
248k
            ssl3_read,                                                       \
2383
248k
            ssl3_peek,                                                       \
2384
248k
            ssl3_write,                                                      \
2385
248k
            dtls1_shutdown,                                                  \
2386
248k
            ssl3_renegotiate,                                                \
2387
248k
            ssl3_renegotiate_check,                                          \
2388
248k
            dtls1_read_bytes,                                                \
2389
248k
            dtls1_write_app_data_bytes,                                      \
2390
248k
            dtls1_dispatch_alert,                                            \
2391
248k
            dtls1_ctrl,                                                      \
2392
248k
            ssl3_ctx_ctrl,                                                   \
2393
248k
            ssl3_get_cipher_by_char,                                         \
2394
248k
            ssl3_put_cipher_by_char,                                         \
2395
248k
            ssl3_pending,                                                    \
2396
248k
            ssl3_num_ciphers,                                                \
2397
248k
            ssl3_get_cipher,                                                 \
2398
248k
            dtls1_default_timeout,                                           \
2399
248k
            &enc_data,                                                       \
2400
248k
            ssl_undefined_void_function,                                     \
2401
248k
            ssl3_callback_ctrl,                                              \
2402
248k
            ssl3_ctx_callback_ctrl,                                          \
2403
248k
        };                                                                   \
2404
248k
        return &func_name##_data;                                            \
2405
248k
    }
DTLS_client_method
Line
Count
Source
2369
21.9k
    {                                                                        \
2370
21.9k
        static const SSL_METHOD func_name##_data = {                         \
2371
21.9k
            version,                                                         \
2372
21.9k
            flags,                                                           \
2373
21.9k
            mask,                                                            \
2374
21.9k
            ossl_ssl_connection_new,                                         \
2375
21.9k
            ossl_ssl_connection_free,                                        \
2376
21.9k
            ossl_ssl_connection_reset,                                       \
2377
21.9k
            dtls1_new,                                                       \
2378
21.9k
            dtls1_clear,                                                     \
2379
21.9k
            dtls1_free,                                                      \
2380
21.9k
            s_accept,                                                        \
2381
21.9k
            s_connect,                                                       \
2382
21.9k
            ssl3_read,                                                       \
2383
21.9k
            ssl3_peek,                                                       \
2384
21.9k
            ssl3_write,                                                      \
2385
21.9k
            dtls1_shutdown,                                                  \
2386
21.9k
            ssl3_renegotiate,                                                \
2387
21.9k
            ssl3_renegotiate_check,                                          \
2388
21.9k
            dtls1_read_bytes,                                                \
2389
21.9k
            dtls1_write_app_data_bytes,                                      \
2390
21.9k
            dtls1_dispatch_alert,                                            \
2391
21.9k
            dtls1_ctrl,                                                      \
2392
21.9k
            ssl3_ctx_ctrl,                                                   \
2393
21.9k
            ssl3_get_cipher_by_char,                                         \
2394
21.9k
            ssl3_put_cipher_by_char,                                         \
2395
21.9k
            ssl3_pending,                                                    \
2396
21.9k
            ssl3_num_ciphers,                                                \
2397
21.9k
            ssl3_get_cipher,                                                 \
2398
21.9k
            dtls1_default_timeout,                                           \
2399
21.9k
            &enc_data,                                                       \
2400
21.9k
            ssl_undefined_void_function,                                     \
2401
21.9k
            ssl3_callback_ctrl,                                              \
2402
21.9k
            ssl3_ctx_callback_ctrl,                                          \
2403
21.9k
        };                                                                   \
2404
21.9k
        return &func_name##_data;                                            \
2405
21.9k
    }
2406
2407
struct openssl_ssl_test_functions {
2408
    int (*p_ssl_init_wbio_buffer)(SSL_CONNECTION *s);
2409
};
2410
2411
const char *ssl_protocol_to_string(int version);
2412
2413
static ossl_inline int tls12_rpk_and_privkey(const SSL_CONNECTION *sc, int idx)
2414
254k
{
2415
    /*
2416
     * This is to check for special cases when using RPK with just
2417
     * a private key, and NO CERTIFICATE
2418
     */
2419
254k
    return ((sc->server && sc->ext.server_cert_type == TLSEXT_cert_type_rpk)
2420
254k
               || (!sc->server && sc->ext.client_cert_type == TLSEXT_cert_type_rpk))
2421
0
        && sc->cert->pkeys[idx].privatekey != NULL
2422
0
        && sc->cert->pkeys[idx].x509 == NULL;
2423
254k
}
Unexecuted instantiation: ssl_cert.c:tls12_rpk_and_privkey
Unexecuted instantiation: ssl_ciph.c:tls12_rpk_and_privkey
Unexecuted instantiation: ssl_init.c:tls12_rpk_and_privkey
Unexecuted instantiation: ssl_lib.c:tls12_rpk_and_privkey
Unexecuted instantiation: ssl_mcnf.c:tls12_rpk_and_privkey
Unexecuted instantiation: ssl_sess.c:tls12_rpk_and_privkey
t1_lib.c:tls12_rpk_and_privkey
Line
Count
Source
2414
254k
{
2415
    /*
2416
     * This is to check for special cases when using RPK with just
2417
     * a private key, and NO CERTIFICATE
2418
     */
2419
254k
    return ((sc->server && sc->ext.server_cert_type == TLSEXT_cert_type_rpk)
2420
254k
               || (!sc->server && sc->ext.client_cert_type == TLSEXT_cert_type_rpk))
2421
0
        && sc->cert->pkeys[idx].privatekey != NULL
2422
0
        && sc->cert->pkeys[idx].x509 == NULL;
2423
254k
}
Unexecuted instantiation: tls13_enc.c:tls12_rpk_and_privkey
Unexecuted instantiation: tls_depr.c:tls12_rpk_and_privkey
Unexecuted instantiation: tls_srp.c:tls12_rpk_and_privkey
Unexecuted instantiation: quic_impl.c:tls12_rpk_and_privkey
Unexecuted instantiation: quic_method.c:tls12_rpk_and_privkey
Unexecuted instantiation: quic_port.c:tls12_rpk_and_privkey
Unexecuted instantiation: quic_record_rx.c:tls12_rpk_and_privkey
Unexecuted instantiation: quic_record_shared.c:tls12_rpk_and_privkey
Unexecuted instantiation: quic_record_tx.c:tls12_rpk_and_privkey
Unexecuted instantiation: quic_record_util.c:tls12_rpk_and_privkey
Unexecuted instantiation: quic_thread_assist.c:tls12_rpk_and_privkey
Unexecuted instantiation: rec_layer_s3.c:tls12_rpk_and_privkey
Unexecuted instantiation: dtls_meth.c:tls12_rpk_and_privkey
Unexecuted instantiation: tls1_meth.c:tls12_rpk_and_privkey
Unexecuted instantiation: tls_common.c:tls12_rpk_and_privkey
Unexecuted instantiation: tls_multib.c:tls12_rpk_and_privkey
Unexecuted instantiation: tlsany_meth.c:tls12_rpk_and_privkey
Unexecuted instantiation: extensions.c:tls12_rpk_and_privkey
Unexecuted instantiation: extensions_clnt.c:tls12_rpk_and_privkey
Unexecuted instantiation: extensions_cust.c:tls12_rpk_and_privkey
Unexecuted instantiation: extensions_srvr.c:tls12_rpk_and_privkey
Unexecuted instantiation: statem.c:tls12_rpk_and_privkey
Unexecuted instantiation: statem_clnt.c:tls12_rpk_and_privkey
Unexecuted instantiation: statem_dtls.c:tls12_rpk_and_privkey
Unexecuted instantiation: statem_lib.c:tls12_rpk_and_privkey
Unexecuted instantiation: statem_srvr.c:tls12_rpk_and_privkey
Unexecuted instantiation: d1_lib.c:tls12_rpk_and_privkey
Unexecuted instantiation: d1_srtp.c:tls12_rpk_and_privkey
Unexecuted instantiation: methods.c:tls12_rpk_and_privkey
Unexecuted instantiation: pqueue.c:tls12_rpk_and_privkey
Unexecuted instantiation: s3_enc.c:tls12_rpk_and_privkey
Unexecuted instantiation: s3_lib.c:tls12_rpk_and_privkey
Unexecuted instantiation: s3_msg.c:tls12_rpk_and_privkey
Unexecuted instantiation: ssl_asn1.c:tls12_rpk_and_privkey
Unexecuted instantiation: ssl_conf.c:tls12_rpk_and_privkey
Unexecuted instantiation: ssl_rsa.c:tls12_rpk_and_privkey
Unexecuted instantiation: t1_enc.c:tls12_rpk_and_privkey
Unexecuted instantiation: quic_channel.c:tls12_rpk_and_privkey
Unexecuted instantiation: quic_engine.c:tls12_rpk_and_privkey
Unexecuted instantiation: quic_rx_depack.c:tls12_rpk_and_privkey
Unexecuted instantiation: quic_tls.c:tls12_rpk_and_privkey
Unexecuted instantiation: rec_layer_d1.c:tls12_rpk_and_privkey
Unexecuted instantiation: ssl3_meth.c:tls12_rpk_and_privkey
Unexecuted instantiation: tls13_meth.c:tls12_rpk_and_privkey
Unexecuted instantiation: d1_msg.c:tls12_rpk_and_privkey
Unexecuted instantiation: ssl_txt.c:tls12_rpk_and_privkey
2424
2425
static ossl_inline int ssl_has_cert_type(const SSL_CONNECTION *sc, unsigned char ct)
2426
149k
{
2427
149k
    unsigned char *ptr;
2428
149k
    size_t len;
2429
2430
149k
    if (sc->server) {
2431
149k
        ptr = sc->server_cert_type;
2432
149k
        len = sc->server_cert_type_len;
2433
149k
    } else {
2434
41
        ptr = sc->client_cert_type;
2435
41
        len = sc->client_cert_type_len;
2436
41
    }
2437
2438
149k
    if (ptr == NULL)
2439
149k
        return 0;
2440
2441
0
    return memchr(ptr, ct, len) != NULL;
2442
149k
}
Unexecuted instantiation: ssl_cert.c:ssl_has_cert_type
Unexecuted instantiation: ssl_ciph.c:ssl_has_cert_type
Unexecuted instantiation: ssl_init.c:ssl_has_cert_type
ssl_lib.c:ssl_has_cert_type
Line
Count
Source
2426
94.9k
{
2427
94.9k
    unsigned char *ptr;
2428
94.9k
    size_t len;
2429
2430
94.9k
    if (sc->server) {
2431
94.9k
        ptr = sc->server_cert_type;
2432
94.9k
        len = sc->server_cert_type_len;
2433
94.9k
    } else {
2434
0
        ptr = sc->client_cert_type;
2435
0
        len = sc->client_cert_type_len;
2436
0
    }
2437
2438
94.9k
    if (ptr == NULL)
2439
94.9k
        return 0;
2440
2441
0
    return memchr(ptr, ct, len) != NULL;
2442
94.9k
}
Unexecuted instantiation: ssl_mcnf.c:ssl_has_cert_type
Unexecuted instantiation: ssl_sess.c:ssl_has_cert_type
t1_lib.c:ssl_has_cert_type
Line
Count
Source
2426
36.6k
{
2427
36.6k
    unsigned char *ptr;
2428
36.6k
    size_t len;
2429
2430
36.6k
    if (sc->server) {
2431
36.5k
        ptr = sc->server_cert_type;
2432
36.5k
        len = sc->server_cert_type_len;
2433
36.5k
    } else {
2434
41
        ptr = sc->client_cert_type;
2435
41
        len = sc->client_cert_type_len;
2436
41
    }
2437
2438
36.6k
    if (ptr == NULL)
2439
36.6k
        return 0;
2440
2441
0
    return memchr(ptr, ct, len) != NULL;
2442
36.6k
}
Unexecuted instantiation: tls13_enc.c:ssl_has_cert_type
Unexecuted instantiation: tls_depr.c:ssl_has_cert_type
Unexecuted instantiation: tls_srp.c:ssl_has_cert_type
Unexecuted instantiation: quic_impl.c:ssl_has_cert_type
Unexecuted instantiation: quic_method.c:ssl_has_cert_type
Unexecuted instantiation: quic_port.c:ssl_has_cert_type
Unexecuted instantiation: quic_record_rx.c:ssl_has_cert_type
Unexecuted instantiation: quic_record_shared.c:ssl_has_cert_type
Unexecuted instantiation: quic_record_tx.c:ssl_has_cert_type
Unexecuted instantiation: quic_record_util.c:ssl_has_cert_type
Unexecuted instantiation: quic_thread_assist.c:ssl_has_cert_type
Unexecuted instantiation: rec_layer_s3.c:ssl_has_cert_type
Unexecuted instantiation: dtls_meth.c:ssl_has_cert_type
Unexecuted instantiation: tls1_meth.c:ssl_has_cert_type
Unexecuted instantiation: tls_common.c:ssl_has_cert_type
Unexecuted instantiation: tls_multib.c:ssl_has_cert_type
Unexecuted instantiation: tlsany_meth.c:ssl_has_cert_type
Unexecuted instantiation: extensions.c:ssl_has_cert_type
Unexecuted instantiation: extensions_clnt.c:ssl_has_cert_type
Unexecuted instantiation: extensions_cust.c:ssl_has_cert_type
Unexecuted instantiation: extensions_srvr.c:ssl_has_cert_type
Unexecuted instantiation: statem.c:ssl_has_cert_type
Unexecuted instantiation: statem_clnt.c:ssl_has_cert_type
Unexecuted instantiation: statem_dtls.c:ssl_has_cert_type
statem_lib.c:ssl_has_cert_type
Line
Count
Source
2426
18.3k
{
2427
18.3k
    unsigned char *ptr;
2428
18.3k
    size_t len;
2429
2430
18.3k
    if (sc->server) {
2431
18.3k
        ptr = sc->server_cert_type;
2432
18.3k
        len = sc->server_cert_type_len;
2433
18.3k
    } else {
2434
0
        ptr = sc->client_cert_type;
2435
0
        len = sc->client_cert_type_len;
2436
0
    }
2437
2438
18.3k
    if (ptr == NULL)
2439
18.3k
        return 0;
2440
2441
0
    return memchr(ptr, ct, len) != NULL;
2442
18.3k
}
Unexecuted instantiation: statem_srvr.c:ssl_has_cert_type
Unexecuted instantiation: d1_lib.c:ssl_has_cert_type
Unexecuted instantiation: d1_srtp.c:ssl_has_cert_type
Unexecuted instantiation: methods.c:ssl_has_cert_type
Unexecuted instantiation: pqueue.c:ssl_has_cert_type
Unexecuted instantiation: s3_enc.c:ssl_has_cert_type
Unexecuted instantiation: s3_lib.c:ssl_has_cert_type
Unexecuted instantiation: s3_msg.c:ssl_has_cert_type
Unexecuted instantiation: ssl_asn1.c:ssl_has_cert_type
Unexecuted instantiation: ssl_conf.c:ssl_has_cert_type
Unexecuted instantiation: ssl_rsa.c:ssl_has_cert_type
Unexecuted instantiation: t1_enc.c:ssl_has_cert_type
Unexecuted instantiation: quic_channel.c:ssl_has_cert_type
Unexecuted instantiation: quic_engine.c:ssl_has_cert_type
Unexecuted instantiation: quic_rx_depack.c:ssl_has_cert_type
Unexecuted instantiation: quic_tls.c:ssl_has_cert_type
Unexecuted instantiation: rec_layer_d1.c:ssl_has_cert_type
Unexecuted instantiation: ssl3_meth.c:ssl_has_cert_type
Unexecuted instantiation: tls13_meth.c:ssl_has_cert_type
Unexecuted instantiation: d1_msg.c:ssl_has_cert_type
Unexecuted instantiation: ssl_txt.c:ssl_has_cert_type
2443
2444
/* Returns true if certificate and private key for 'idx' are present */
2445
static ossl_inline int ssl_has_cert(const SSL_CONNECTION *s, int idx)
2446
149k
{
2447
149k
    if (idx < 0 || idx >= (int)s->ssl_pkey_num)
2448
0
        return 0;
2449
2450
    /* If RPK is enabled for this SSL... only require private key */
2451
149k
    if (ssl_has_cert_type(s, TLSEXT_cert_type_rpk))
2452
0
        return s->cert->pkeys[idx].privatekey != NULL;
2453
2454
149k
    return s->cert->pkeys[idx].x509 != NULL
2455
54.6k
        && s->cert->pkeys[idx].privatekey != NULL;
2456
149k
}
Unexecuted instantiation: ssl_cert.c:ssl_has_cert
Unexecuted instantiation: ssl_ciph.c:ssl_has_cert
Unexecuted instantiation: ssl_init.c:ssl_has_cert
ssl_lib.c:ssl_has_cert
Line
Count
Source
2446
94.9k
{
2447
94.9k
    if (idx < 0 || idx >= (int)s->ssl_pkey_num)
2448
0
        return 0;
2449
2450
    /* If RPK is enabled for this SSL... only require private key */
2451
94.9k
    if (ssl_has_cert_type(s, TLSEXT_cert_type_rpk))
2452
0
        return s->cert->pkeys[idx].privatekey != NULL;
2453
2454
94.9k
    return s->cert->pkeys[idx].x509 != NULL
2455
0
        && s->cert->pkeys[idx].privatekey != NULL;
2456
94.9k
}
Unexecuted instantiation: ssl_mcnf.c:ssl_has_cert
Unexecuted instantiation: ssl_sess.c:ssl_has_cert
t1_lib.c:ssl_has_cert
Line
Count
Source
2446
36.6k
{
2447
36.6k
    if (idx < 0 || idx >= (int)s->ssl_pkey_num)
2448
0
        return 0;
2449
2450
    /* If RPK is enabled for this SSL... only require private key */
2451
36.6k
    if (ssl_has_cert_type(s, TLSEXT_cert_type_rpk))
2452
0
        return s->cert->pkeys[idx].privatekey != NULL;
2453
2454
36.6k
    return s->cert->pkeys[idx].x509 != NULL
2455
36.2k
        && s->cert->pkeys[idx].privatekey != NULL;
2456
36.6k
}
Unexecuted instantiation: tls13_enc.c:ssl_has_cert
Unexecuted instantiation: tls_depr.c:ssl_has_cert
Unexecuted instantiation: tls_srp.c:ssl_has_cert
Unexecuted instantiation: quic_impl.c:ssl_has_cert
Unexecuted instantiation: quic_method.c:ssl_has_cert
Unexecuted instantiation: quic_port.c:ssl_has_cert
Unexecuted instantiation: quic_record_rx.c:ssl_has_cert
Unexecuted instantiation: quic_record_shared.c:ssl_has_cert
Unexecuted instantiation: quic_record_tx.c:ssl_has_cert
Unexecuted instantiation: quic_record_util.c:ssl_has_cert
Unexecuted instantiation: quic_thread_assist.c:ssl_has_cert
Unexecuted instantiation: rec_layer_s3.c:ssl_has_cert
Unexecuted instantiation: dtls_meth.c:ssl_has_cert
Unexecuted instantiation: tls1_meth.c:ssl_has_cert
Unexecuted instantiation: tls_common.c:ssl_has_cert
Unexecuted instantiation: tls_multib.c:ssl_has_cert
Unexecuted instantiation: tlsany_meth.c:ssl_has_cert
Unexecuted instantiation: extensions.c:ssl_has_cert
Unexecuted instantiation: extensions_clnt.c:ssl_has_cert
Unexecuted instantiation: extensions_cust.c:ssl_has_cert
Unexecuted instantiation: extensions_srvr.c:ssl_has_cert
Unexecuted instantiation: statem.c:ssl_has_cert
Unexecuted instantiation: statem_clnt.c:ssl_has_cert
Unexecuted instantiation: statem_dtls.c:ssl_has_cert
statem_lib.c:ssl_has_cert
Line
Count
Source
2446
18.3k
{
2447
18.3k
    if (idx < 0 || idx >= (int)s->ssl_pkey_num)
2448
0
        return 0;
2449
2450
    /* If RPK is enabled for this SSL... only require private key */
2451
18.3k
    if (ssl_has_cert_type(s, TLSEXT_cert_type_rpk))
2452
0
        return s->cert->pkeys[idx].privatekey != NULL;
2453
2454
18.3k
    return s->cert->pkeys[idx].x509 != NULL
2455
18.3k
        && s->cert->pkeys[idx].privatekey != NULL;
2456
18.3k
}
Unexecuted instantiation: statem_srvr.c:ssl_has_cert
Unexecuted instantiation: d1_lib.c:ssl_has_cert
Unexecuted instantiation: d1_srtp.c:ssl_has_cert
Unexecuted instantiation: methods.c:ssl_has_cert
Unexecuted instantiation: pqueue.c:ssl_has_cert
Unexecuted instantiation: s3_enc.c:ssl_has_cert
Unexecuted instantiation: s3_lib.c:ssl_has_cert
Unexecuted instantiation: s3_msg.c:ssl_has_cert
Unexecuted instantiation: ssl_asn1.c:ssl_has_cert
Unexecuted instantiation: ssl_conf.c:ssl_has_cert
Unexecuted instantiation: ssl_rsa.c:ssl_has_cert
Unexecuted instantiation: t1_enc.c:ssl_has_cert
Unexecuted instantiation: quic_channel.c:ssl_has_cert
Unexecuted instantiation: quic_engine.c:ssl_has_cert
Unexecuted instantiation: quic_rx_depack.c:ssl_has_cert
Unexecuted instantiation: quic_tls.c:ssl_has_cert
Unexecuted instantiation: rec_layer_d1.c:ssl_has_cert
Unexecuted instantiation: ssl3_meth.c:ssl_has_cert
Unexecuted instantiation: tls13_meth.c:ssl_has_cert
Unexecuted instantiation: d1_msg.c:ssl_has_cert
Unexecuted instantiation: ssl_txt.c:ssl_has_cert
2457
2458
static ossl_inline void tls1_get_peer_groups(SSL_CONNECTION *s,
2459
    const uint16_t **pgroups,
2460
    size_t *pgroupslen)
2461
81.0k
{
2462
81.0k
    *pgroups = s->ext.peer_supportedgroups;
2463
81.0k
    *pgroupslen = s->ext.peer_supportedgroups_len;
2464
81.0k
}
Unexecuted instantiation: ssl_cert.c:tls1_get_peer_groups
Unexecuted instantiation: ssl_ciph.c:tls1_get_peer_groups
Unexecuted instantiation: ssl_init.c:tls1_get_peer_groups
Unexecuted instantiation: ssl_lib.c:tls1_get_peer_groups
Unexecuted instantiation: ssl_mcnf.c:tls1_get_peer_groups
Unexecuted instantiation: ssl_sess.c:tls1_get_peer_groups
t1_lib.c:tls1_get_peer_groups
Line
Count
Source
2461
76.2k
{
2462
76.2k
    *pgroups = s->ext.peer_supportedgroups;
2463
76.2k
    *pgroupslen = s->ext.peer_supportedgroups_len;
2464
76.2k
}
Unexecuted instantiation: tls13_enc.c:tls1_get_peer_groups
Unexecuted instantiation: tls_depr.c:tls1_get_peer_groups
Unexecuted instantiation: tls_srp.c:tls1_get_peer_groups
Unexecuted instantiation: quic_impl.c:tls1_get_peer_groups
Unexecuted instantiation: quic_method.c:tls1_get_peer_groups
Unexecuted instantiation: quic_port.c:tls1_get_peer_groups
Unexecuted instantiation: quic_record_rx.c:tls1_get_peer_groups
Unexecuted instantiation: quic_record_shared.c:tls1_get_peer_groups
Unexecuted instantiation: quic_record_tx.c:tls1_get_peer_groups
Unexecuted instantiation: quic_record_util.c:tls1_get_peer_groups
Unexecuted instantiation: quic_thread_assist.c:tls1_get_peer_groups
Unexecuted instantiation: rec_layer_s3.c:tls1_get_peer_groups
Unexecuted instantiation: dtls_meth.c:tls1_get_peer_groups
Unexecuted instantiation: tls1_meth.c:tls1_get_peer_groups
Unexecuted instantiation: tls_common.c:tls1_get_peer_groups
Unexecuted instantiation: tls_multib.c:tls1_get_peer_groups
Unexecuted instantiation: tlsany_meth.c:tls1_get_peer_groups
extensions.c:tls1_get_peer_groups
Line
Count
Source
2461
393
{
2462
393
    *pgroups = s->ext.peer_supportedgroups;
2463
393
    *pgroupslen = s->ext.peer_supportedgroups_len;
2464
393
}
Unexecuted instantiation: extensions_clnt.c:tls1_get_peer_groups
Unexecuted instantiation: extensions_cust.c:tls1_get_peer_groups
extensions_srvr.c:tls1_get_peer_groups
Line
Count
Source
2461
4.37k
{
2462
4.37k
    *pgroups = s->ext.peer_supportedgroups;
2463
4.37k
    *pgroupslen = s->ext.peer_supportedgroups_len;
2464
4.37k
}
Unexecuted instantiation: statem.c:tls1_get_peer_groups
Unexecuted instantiation: statem_clnt.c:tls1_get_peer_groups
Unexecuted instantiation: statem_dtls.c:tls1_get_peer_groups
Unexecuted instantiation: statem_lib.c:tls1_get_peer_groups
Unexecuted instantiation: statem_srvr.c:tls1_get_peer_groups
Unexecuted instantiation: d1_lib.c:tls1_get_peer_groups
Unexecuted instantiation: d1_srtp.c:tls1_get_peer_groups
Unexecuted instantiation: methods.c:tls1_get_peer_groups
Unexecuted instantiation: pqueue.c:tls1_get_peer_groups
Unexecuted instantiation: s3_enc.c:tls1_get_peer_groups
Unexecuted instantiation: s3_lib.c:tls1_get_peer_groups
Unexecuted instantiation: s3_msg.c:tls1_get_peer_groups
Unexecuted instantiation: ssl_asn1.c:tls1_get_peer_groups
Unexecuted instantiation: ssl_conf.c:tls1_get_peer_groups
Unexecuted instantiation: ssl_rsa.c:tls1_get_peer_groups
Unexecuted instantiation: t1_enc.c:tls1_get_peer_groups
Unexecuted instantiation: quic_channel.c:tls1_get_peer_groups
Unexecuted instantiation: quic_engine.c:tls1_get_peer_groups
Unexecuted instantiation: quic_rx_depack.c:tls1_get_peer_groups
Unexecuted instantiation: quic_tls.c:tls1_get_peer_groups
Unexecuted instantiation: rec_layer_d1.c:tls1_get_peer_groups
Unexecuted instantiation: ssl3_meth.c:tls1_get_peer_groups
Unexecuted instantiation: tls13_meth.c:tls1_get_peer_groups
Unexecuted instantiation: d1_msg.c:tls1_get_peer_groups
Unexecuted instantiation: ssl_txt.c:tls1_get_peer_groups
2465
2466
#ifndef OPENSSL_UNIT_TEST
2467
2468
__owur int ossl_ssl_init(SSL *ssl, SSL_CTX *ctx, const SSL_METHOD *method,
2469
    int type);
2470
__owur SSL *ossl_ssl_connection_new_int(SSL_CTX *ctx, SSL *user_ssl,
2471
    const SSL_METHOD *method);
2472
__owur SSL *ossl_ssl_connection_new(SSL_CTX *ctx);
2473
void ossl_ssl_connection_free(SSL *ssl);
2474
__owur int ossl_ssl_connection_reset(SSL *ssl);
2475
2476
__owur int ssl_read_internal(SSL *s, void *buf, size_t num, size_t *readbytes);
2477
__owur int ssl_write_internal(SSL *s, const void *buf, size_t num,
2478
    uint64_t flags, size_t *written);
2479
int ssl_clear_bad_session(SSL_CONNECTION *s);
2480
__owur CERT *ssl_cert_new(size_t ssl_pkey_num);
2481
__owur CERT *ssl_cert_dup(CERT *cert);
2482
void ssl_cert_clear_certs(CERT *c);
2483
void ssl_cert_free(CERT *c);
2484
__owur int ssl_generate_session_id(SSL_CONNECTION *s, SSL_SESSION *ss);
2485
__owur int ssl_get_new_session(SSL_CONNECTION *s, int session);
2486
__owur SSL_SESSION *lookup_sess_in_cache(SSL_CONNECTION *s,
2487
    const unsigned char *sess_id,
2488
    size_t sess_id_len);
2489
__owur int ssl_get_prev_session(SSL_CONNECTION *s, CLIENTHELLO_MSG *hello);
2490
__owur SSL_SESSION *ssl_session_dup(const SSL_SESSION *src, int ticket);
2491
__owur int ssl_cipher_id_cmp(const SSL_CIPHER *a, const SSL_CIPHER *b);
2492
DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, ssl_cipher_id);
2493
__owur int ssl_cipher_ptr_id_cmp(const SSL_CIPHER *const *ap,
2494
    const SSL_CIPHER *const *bp);
2495
__owur STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(SSL_CTX *ctx,
2496
    STACK_OF(SSL_CIPHER) *tls13_ciphersuites,
2497
    STACK_OF(SSL_CIPHER) **cipher_list,
2498
    STACK_OF(SSL_CIPHER) **cipher_list_by_id,
2499
    const char *rule_str,
2500
    CERT *c);
2501
__owur int ssl_cache_cipherlist(SSL_CONNECTION *s, PACKET *cipher_suites,
2502
    int sslv2format);
2503
__owur int ossl_bytes_to_cipher_list(SSL_CONNECTION *s, PACKET *cipher_suites,
2504
    STACK_OF(SSL_CIPHER) **skp,
2505
    STACK_OF(SSL_CIPHER) **scsvs, int sslv2format,
2506
    int fatal);
2507
void ssl_update_cache(SSL_CONNECTION *s, int mode);
2508
__owur int ssl_cipher_get_evp_cipher(SSL_CTX *ctx, const SSL_CIPHER *sslc,
2509
    const EVP_CIPHER **enc);
2510
__owur int ssl_cipher_get_evp(SSL_CTX *ctxc, const SSL_SESSION *s,
2511
    const EVP_CIPHER **enc, const EVP_MD **md,
2512
    int *mac_pkey_type, size_t *mac_secret_size,
2513
    SSL_COMP **comp, int use_etm);
2514
__owur int ssl_cipher_get_overhead(const SSL_CIPHER *c, size_t *mac_overhead,
2515
    size_t *int_overhead, size_t *blocksize,
2516
    size_t *ext_overhead);
2517
__owur int ssl_cert_is_disabled(SSL_CTX *ctx, size_t idx);
2518
__owur const SSL_CIPHER *ssl_get_cipher_by_char(SSL_CONNECTION *ssl,
2519
    const unsigned char *ptr,
2520
    int all);
2521
__owur int ssl_cert_set0_chain(SSL_CONNECTION *s, SSL_CTX *ctx,
2522
    STACK_OF(X509) *chain);
2523
__owur int ssl_cert_set1_chain(SSL_CONNECTION *s, SSL_CTX *ctx,
2524
    STACK_OF(X509) *chain);
2525
__owur int ssl_cert_add0_chain_cert(SSL_CONNECTION *s, SSL_CTX *ctx, X509 *x);
2526
__owur int ssl_cert_add1_chain_cert(SSL_CONNECTION *s, SSL_CTX *ctx, X509 *x);
2527
__owur int ssl_cert_select_current(CERT *c, X509 *x);
2528
__owur int ssl_cert_set_current(CERT *c, long arg);
2529
void ssl_cert_set_cert_cb(CERT *c, int (*cb)(SSL *ssl, void *arg), void *arg);
2530
2531
__owur int ssl_verify_cert_chain(SSL_CONNECTION *s, STACK_OF(X509) *sk);
2532
__owur int ssl_verify_rpk(SSL_CONNECTION *s, EVP_PKEY *rpk);
2533
__owur int ssl_build_cert_chain(SSL_CONNECTION *s, SSL_CTX *ctx, int flags);
2534
__owur int ssl_cert_set_cert_store(CERT *c, X509_STORE *store, int chain,
2535
    int ref);
2536
__owur int ssl_cert_get_cert_store(CERT *c, X509_STORE **pstore, int chain);
2537
2538
__owur int ssl_security(const SSL_CONNECTION *s, int op, int bits, int nid,
2539
    void *other);
2540
__owur int ssl_ctx_security(const SSL_CTX *ctx, int op, int bits, int nid,
2541
    void *other);
2542
int ssl_get_security_level_bits(const SSL *s, const SSL_CTX *ctx, int *levelp);
2543
2544
__owur int ssl_cert_lookup_by_nid(int nid, size_t *pidx, SSL_CTX *ctx);
2545
__owur const SSL_CERT_LOOKUP *ssl_cert_lookup_by_pkey(const EVP_PKEY *pk,
2546
    size_t *pidx,
2547
    SSL_CTX *ctx);
2548
__owur const SSL_CERT_LOOKUP *ssl_cert_lookup_by_idx(size_t idx, SSL_CTX *ctx);
2549
2550
int ssl_undefined_function(SSL *s);
2551
__owur int ssl_undefined_void_function(void);
2552
__owur int ssl_undefined_const_function(const SSL *s);
2553
__owur int ssl_get_server_cert_serverinfo(SSL_CONNECTION *s,
2554
    const unsigned char **serverinfo,
2555
    size_t *serverinfo_length);
2556
void ssl_set_masks(SSL_CONNECTION *s);
2557
__owur STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL_CONNECTION *sc);
2558
__owur int ssl_x509err2alert(int type);
2559
void ssl_sort_cipher_list(void);
2560
int ssl_load_ciphers(SSL_CTX *ctx);
2561
__owur int ssl_setup_sigalgs(SSL_CTX *ctx);
2562
int ssl_load_groups(SSL_CTX *ctx);
2563
int ssl_load_sigalgs(SSL_CTX *ctx);
2564
__owur int ssl_fill_hello_random(SSL_CONNECTION *s, int server,
2565
    unsigned char *field, size_t len,
2566
    DOWNGRADE dgrd);
2567
__owur int ssl_generate_master_secret(SSL_CONNECTION *s, unsigned char *pms,
2568
    size_t pmslen, int free_pms);
2569
__owur EVP_PKEY *ssl_generate_pkey(SSL_CONNECTION *s, EVP_PKEY *pm);
2570
__owur int ssl_gensecret(SSL_CONNECTION *s, unsigned char *pms, size_t pmslen);
2571
__owur int ssl_derive(SSL_CONNECTION *s, EVP_PKEY *privkey, EVP_PKEY *pubkey,
2572
    int genmaster);
2573
__owur int ssl_decapsulate(SSL_CONNECTION *s, EVP_PKEY *privkey,
2574
    const unsigned char *ct, size_t ctlen,
2575
    int gensecret);
2576
__owur int ssl_encapsulate(SSL_CONNECTION *s, EVP_PKEY *pubkey,
2577
    unsigned char **ctp, size_t *ctlenp,
2578
    int gensecret);
2579
__owur EVP_PKEY *ssl_dh_to_pkey(DH *dh);
2580
__owur int ssl_set_tmp_ecdh_groups(uint16_t **pext, size_t *pextlen,
2581
    void *key);
2582
__owur unsigned int ssl_get_max_send_fragment(const SSL_CONNECTION *sc);
2583
__owur unsigned int ssl_get_split_send_fragment(const SSL_CONNECTION *sc);
2584
2585
__owur const SSL_CIPHER *ssl3_get_cipher_by_id(uint32_t id);
2586
__owur const SSL_CIPHER *ssl3_get_cipher_by_std_name(const char *stdname);
2587
__owur const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p);
2588
__owur int ssl3_put_cipher_by_char(const SSL_CIPHER *c, WPACKET *pkt,
2589
    size_t *len);
2590
int ssl3_init_finished_mac(SSL_CONNECTION *s);
2591
__owur int ssl3_setup_key_block(SSL_CONNECTION *s);
2592
__owur int ssl3_change_cipher_state(SSL_CONNECTION *s, int which);
2593
void ssl3_cleanup_key_block(SSL_CONNECTION *s);
2594
__owur int ssl3_do_write(SSL_CONNECTION *s, uint8_t type);
2595
int ssl3_send_alert(SSL_CONNECTION *s, int level, int desc);
2596
__owur int ssl3_generate_master_secret(SSL_CONNECTION *s, unsigned char *out,
2597
    unsigned char *p, size_t len,
2598
    size_t *secret_size);
2599
__owur int ssl3_get_req_cert_type(SSL_CONNECTION *s, WPACKET *pkt);
2600
__owur int ssl3_num_ciphers(void);
2601
__owur const SSL_CIPHER *ssl3_get_cipher(unsigned int u);
2602
int ssl3_renegotiate(SSL *ssl);
2603
int ssl3_renegotiate_check(SSL *ssl, int initok);
2604
void ssl3_digest_master_key_set_params(const SSL_SESSION *session,
2605
    OSSL_PARAM params[]);
2606
__owur int ssl3_dispatch_alert(SSL *s);
2607
__owur size_t ssl3_final_finish_mac(SSL_CONNECTION *s, const char *sender,
2608
    size_t slen, unsigned char *p);
2609
__owur int ssl3_finish_mac(SSL_CONNECTION *s, const unsigned char *buf,
2610
    size_t len);
2611
void ssl3_free_digest_list(SSL_CONNECTION *s);
2612
__owur unsigned long ssl3_output_cert_chain(SSL_CONNECTION *s, WPACKET *pkt,
2613
    CERT_PKEY *cpk, int for_comp);
2614
__owur const SSL_CIPHER *ssl3_choose_cipher(SSL_CONNECTION *s,
2615
    STACK_OF(SSL_CIPHER) *clnt,
2616
    STACK_OF(SSL_CIPHER) *srvr);
2617
__owur int ssl3_digest_cached_records(SSL_CONNECTION *s, int keep);
2618
__owur int ssl3_new(SSL *s);
2619
void ssl3_free(SSL *s);
2620
__owur int ssl3_read(SSL *s, void *buf, size_t len, size_t *readbytes);
2621
__owur int ssl3_peek(SSL *s, void *buf, size_t len, size_t *readbytes);
2622
__owur int ssl3_write(SSL *s, const void *buf, size_t len, size_t *written);
2623
__owur int ssl3_shutdown(SSL *s);
2624
int ssl3_clear(SSL *s);
2625
__owur long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg);
2626
__owur long ssl3_ctx_ctrl(SSL_CTX *s, int cmd, long larg, void *parg);
2627
__owur long ssl3_callback_ctrl(SSL *s, int cmd, void (*fp)(void));
2628
__owur long ssl3_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp)(void));
2629
2630
__owur int ssl3_do_change_cipher_spec(SSL_CONNECTION *s);
2631
__owur OSSL_TIME ssl3_default_timeout(void);
2632
2633
__owur int ssl3_set_handshake_header(SSL_CONNECTION *s, WPACKET *pkt,
2634
    int htype);
2635
__owur int tls_close_construct_packet(SSL_CONNECTION *s, WPACKET *pkt, int htype);
2636
__owur int tls_setup_handshake(SSL_CONNECTION *s);
2637
__owur int dtls1_set_handshake_header(SSL_CONNECTION *s, WPACKET *pkt, int htype);
2638
__owur int dtls1_close_construct_packet(SSL_CONNECTION *s, WPACKET *pkt, int htype);
2639
__owur int ssl3_handshake_write(SSL_CONNECTION *s);
2640
2641
__owur int ssl_allow_compression(SSL_CONNECTION *s);
2642
2643
__owur int ssl_version_cmp(const SSL_CONNECTION *s, int versiona, int versionb);
2644
__owur int ssl_version_supported(const SSL_CONNECTION *s, int version,
2645
    const SSL_METHOD **meth);
2646
2647
__owur int ssl_set_client_hello_version(SSL_CONNECTION *s);
2648
__owur int ssl_check_version_downgrade(SSL_CONNECTION *s);
2649
__owur int ssl_set_version_bound(int method_version, int version, int *bound);
2650
__owur int ssl_choose_server_version(SSL_CONNECTION *s, CLIENTHELLO_MSG *hello,
2651
    DOWNGRADE *dgrd);
2652
__owur int ssl_choose_client_version(SSL_CONNECTION *s, int version,
2653
    RAW_EXTENSION *extensions);
2654
__owur int ssl_get_min_max_version(const SSL_CONNECTION *s, int *min_version,
2655
    int *max_version, int *real_max);
2656
2657
__owur OSSL_TIME tls1_default_timeout(void);
2658
__owur int dtls1_do_write(SSL_CONNECTION *s, uint8_t type);
2659
void dtls1_set_message_header(SSL_CONNECTION *s,
2660
    unsigned char mt,
2661
    size_t len,
2662
    size_t frag_off, size_t frag_len);
2663
2664
int dtls1_write_app_data_bytes(SSL *s, uint8_t type, const void *buf_,
2665
    size_t len, size_t *written);
2666
2667
__owur int dtls1_read_failed(SSL_CONNECTION *s, int code);
2668
__owur int dtls1_buffer_message(SSL_CONNECTION *s, int ccs);
2669
__owur int dtls1_retransmit_message(SSL_CONNECTION *s, unsigned short seq,
2670
    int *found);
2671
__owur int dtls1_get_queue_priority(unsigned short seq, int is_ccs);
2672
int dtls1_retransmit_buffered_messages(SSL_CONNECTION *s);
2673
void dtls1_clear_received_buffer(SSL_CONNECTION *s);
2674
void dtls1_clear_sent_buffer(SSL_CONNECTION *s);
2675
void dtls1_get_message_header(const unsigned char *data,
2676
    struct hm_header_st *msg_hdr);
2677
__owur OSSL_TIME dtls1_default_timeout(void);
2678
__owur int dtls1_get_timeout(const SSL_CONNECTION *s, OSSL_TIME *timeleft);
2679
__owur int dtls1_check_timeout_num(SSL_CONNECTION *s);
2680
__owur int dtls1_handle_timeout(SSL_CONNECTION *s);
2681
void dtls1_start_timer(SSL_CONNECTION *s);
2682
void dtls1_stop_timer(SSL_CONNECTION *s);
2683
__owur int dtls1_is_timer_expired(SSL_CONNECTION *s);
2684
__owur int dtls_raw_hello_verify_request(WPACKET *pkt, unsigned char *cookie,
2685
    size_t cookie_len);
2686
__owur size_t dtls1_min_mtu(SSL_CONNECTION *s);
2687
void dtls1_hm_fragment_free(hm_fragment *frag);
2688
__owur int dtls1_query_mtu(SSL_CONNECTION *s);
2689
2690
__owur int tls1_new(SSL *s);
2691
void tls1_free(SSL *s);
2692
int tls1_clear(SSL *s);
2693
2694
__owur int dtls1_new(SSL *s);
2695
void dtls1_free(SSL *s);
2696
int dtls1_clear(SSL *s);
2697
long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg);
2698
__owur int dtls1_shutdown(SSL *s);
2699
2700
__owur int dtls1_dispatch_alert(SSL *s);
2701
2702
__owur int ssl_init_wbio_buffer(SSL_CONNECTION *s);
2703
int ssl_free_wbio_buffer(SSL_CONNECTION *s);
2704
2705
__owur int tls1_change_cipher_state(SSL_CONNECTION *s, int which);
2706
__owur int tls1_setup_key_block(SSL_CONNECTION *s);
2707
__owur size_t tls1_final_finish_mac(SSL_CONNECTION *s, const char *str,
2708
    size_t slen, unsigned char *p);
2709
__owur int tls1_generate_master_secret(SSL_CONNECTION *s, unsigned char *out,
2710
    unsigned char *p, size_t len,
2711
    size_t *secret_size);
2712
__owur int tls13_setup_key_block(SSL_CONNECTION *s);
2713
__owur size_t tls13_final_finish_mac(SSL_CONNECTION *s, const char *str, size_t slen,
2714
    unsigned char *p);
2715
__owur int tls13_change_cipher_state(SSL_CONNECTION *s, int which);
2716
__owur int tls13_update_key(SSL_CONNECTION *s, int send);
2717
__owur int tls13_hkdf_expand(SSL_CONNECTION *s,
2718
    const EVP_MD *md,
2719
    const unsigned char *secret,
2720
    const unsigned char *label, size_t labellen,
2721
    const unsigned char *data, size_t datalen,
2722
    unsigned char *out, size_t outlen, int fatal);
2723
__owur int tls13_hkdf_expand_ex(OSSL_LIB_CTX *libctx, const char *propq,
2724
    const EVP_MD *md,
2725
    const unsigned char *secret,
2726
    const unsigned char *label, size_t labellen,
2727
    const unsigned char *data, size_t datalen,
2728
    unsigned char *out, size_t outlen,
2729
    int raise_error);
2730
__owur int tls13_derive_key(SSL_CONNECTION *s, const EVP_MD *md,
2731
    const unsigned char *secret, unsigned char *key,
2732
    size_t keylen);
2733
__owur int tls13_derive_iv(SSL_CONNECTION *s, const EVP_MD *md,
2734
    const unsigned char *secret, unsigned char *iv,
2735
    size_t ivlen);
2736
__owur int tls13_derive_finishedkey(SSL_CONNECTION *s, const EVP_MD *md,
2737
    const unsigned char *secret,
2738
    unsigned char *fin, size_t finlen);
2739
int tls13_generate_secret(SSL_CONNECTION *s, const EVP_MD *md,
2740
    const unsigned char *prevsecret,
2741
    const unsigned char *insecret,
2742
    size_t insecretlen,
2743
    unsigned char *outsecret);
2744
__owur int tls13_generate_handshake_secret(SSL_CONNECTION *s,
2745
    const unsigned char *insecret,
2746
    size_t insecretlen);
2747
__owur int tls13_generate_master_secret(SSL_CONNECTION *s, unsigned char *out,
2748
    unsigned char *prev, size_t prevlen,
2749
    size_t *secret_size);
2750
__owur int tls1_export_keying_material(SSL_CONNECTION *s,
2751
    unsigned char *out, size_t olen,
2752
    const char *label, size_t llen,
2753
    const unsigned char *p, size_t plen,
2754
    int use_context);
2755
__owur int tls13_export_keying_material(SSL_CONNECTION *s,
2756
    unsigned char *out, size_t olen,
2757
    const char *label, size_t llen,
2758
    const unsigned char *context,
2759
    size_t contextlen, int use_context);
2760
__owur int tls13_export_keying_material_early(SSL_CONNECTION *s,
2761
    unsigned char *out, size_t olen,
2762
    const char *label, size_t llen,
2763
    const unsigned char *context,
2764
    size_t contextlen);
2765
__owur int tls1_alert_code(int code);
2766
__owur int tls13_alert_code(int code);
2767
__owur int ssl3_alert_code(int code);
2768
2769
__owur int ssl_check_srvr_ecc_cert_and_alg(X509 *x, SSL_CONNECTION *s);
2770
2771
SSL_COMP *ssl3_comp_find(STACK_OF(SSL_COMP) *sk, int n);
2772
2773
__owur const TLS_GROUP_INFO *tls1_group_id_lookup(SSL_CTX *ctx, uint16_t curve_id);
2774
__owur const char *tls1_group_id2name(SSL_CTX *ctx, uint16_t group_id);
2775
__owur int tls1_group_id2nid(uint16_t group_id, int include_unknown);
2776
__owur uint16_t tls1_nid2group_id(int nid);
2777
__owur int tls1_check_group_id(SSL_CONNECTION *s, uint16_t group_id,
2778
    int check_own_curves);
2779
__owur uint16_t tls1_shared_group(SSL_CONNECTION *s, int nmatch);
2780
__owur int tls1_set_groups(uint16_t **pext, size_t *pextlen,
2781
    int *curves, size_t ncurves);
2782
__owur int tls1_set_groups_list(SSL_CTX *ctx, uint16_t **pext, size_t *pextlen,
2783
    const char *str);
2784
__owur EVP_PKEY *ssl_generate_pkey_group(SSL_CONNECTION *s, uint16_t id);
2785
__owur int tls_valid_group(SSL_CONNECTION *s, uint16_t group_id, int minversion,
2786
    int maxversion, int isec, int *okfortls13);
2787
__owur EVP_PKEY *ssl_generate_param_group(SSL_CONNECTION *s, uint16_t id);
2788
void tls1_get_formatlist(SSL_CONNECTION *s, const unsigned char **pformats,
2789
    size_t *num_formats);
2790
__owur int tls1_check_ec_tmp_key(SSL_CONNECTION *s, unsigned long id);
2791
2792
__owur int tls_group_allowed(SSL_CONNECTION *s, uint16_t curve, int op);
2793
void tls1_get_supported_groups(SSL_CONNECTION *s, const uint16_t **pgroups,
2794
    size_t *pgroupslen);
2795
2796
__owur int tls1_set_server_sigalgs(SSL_CONNECTION *s);
2797
2798
__owur SSL_TICKET_STATUS tls_get_ticket_from_client(SSL_CONNECTION *s,
2799
    CLIENTHELLO_MSG *hello,
2800
    SSL_SESSION **ret);
2801
__owur SSL_TICKET_STATUS tls_decrypt_ticket(SSL_CONNECTION *s,
2802
    const unsigned char *etick,
2803
    size_t eticklen,
2804
    const unsigned char *sess_id,
2805
    size_t sesslen, SSL_SESSION **psess);
2806
2807
__owur int tls_use_ticket(SSL_CONNECTION *s);
2808
2809
void ssl_set_sig_mask(uint32_t *pmask_a, SSL_CONNECTION *s, int op);
2810
2811
__owur int tls1_set_sigalgs_list(SSL_CTX *ctx, CERT *c, const char *str, int client);
2812
__owur int tls1_set_raw_sigalgs(CERT *c, const uint16_t *psigs, size_t salglen,
2813
    int client);
2814
__owur int tls1_set_sigalgs(CERT *c, const int *salg, size_t salglen,
2815
    int client);
2816
int tls1_check_chain(SSL_CONNECTION *s, X509 *x, EVP_PKEY *pk,
2817
    STACK_OF(X509) *chain, int idx);
2818
void tls1_set_cert_validity(SSL_CONNECTION *s);
2819
2820
#ifndef OPENSSL_NO_CT
2821
__owur int ssl_validate_ct(SSL_CONNECTION *s);
2822
#endif
2823
2824
__owur EVP_PKEY *ssl_get_auto_dh(SSL_CONNECTION *s);
2825
2826
__owur int ssl_security_cert(SSL_CONNECTION *s, SSL_CTX *ctx, X509 *x, int vfy,
2827
    int is_ee);
2828
__owur int ssl_security_cert_chain(SSL_CONNECTION *s, STACK_OF(X509) *sk,
2829
    X509 *ex, int vfy);
2830
2831
int tls_choose_sigalg(SSL_CONNECTION *s, int fatalerrs);
2832
2833
__owur long ssl_get_algorithm2(SSL_CONNECTION *s);
2834
__owur int tls12_copy_sigalgs(SSL_CONNECTION *s, WPACKET *pkt,
2835
    const uint16_t *psig, size_t psiglen);
2836
__owur int tls1_save_u16(PACKET *pkt, uint16_t **pdest, size_t *pdestlen);
2837
__owur int tls1_save_sigalgs(SSL_CONNECTION *s, PACKET *pkt, int cert);
2838
__owur int tls1_process_sigalgs(SSL_CONNECTION *s);
2839
__owur int tls1_set_peer_legacy_sigalg(SSL_CONNECTION *s, const EVP_PKEY *pkey);
2840
__owur int tls1_lookup_md(SSL_CTX *ctx, const SIGALG_LOOKUP *lu,
2841
    const EVP_MD **pmd);
2842
__owur size_t tls12_get_psigalgs(SSL_CONNECTION *s, int sent,
2843
    const uint16_t **psigs);
2844
__owur int tls_check_sigalg_curve(const SSL_CONNECTION *s, int curve);
2845
__owur int tls12_check_peer_sigalg(SSL_CONNECTION *s, uint16_t, EVP_PKEY *pkey);
2846
__owur int ssl_set_client_disabled(SSL_CONNECTION *s);
2847
__owur int ssl_cipher_disabled(const SSL_CONNECTION *s, const SSL_CIPHER *c,
2848
    int op, int echde);
2849
2850
__owur int ssl_handshake_hash(SSL_CONNECTION *s,
2851
    unsigned char *out, size_t outlen,
2852
    size_t *hashlen);
2853
__owur const EVP_MD *ssl_md(SSL_CTX *ctx, int idx);
2854
int ssl_get_md_idx(int md_nid);
2855
__owur const EVP_MD *ssl_handshake_md(SSL_CONNECTION *s);
2856
__owur const EVP_MD *ssl_prf_md(SSL_CONNECTION *s);
2857
2858
/*
2859
 * ssl_log_rsa_client_key_exchange logs |premaster| to the SSL_CTX associated
2860
 * with |ssl|, if logging is enabled. It returns one on success and zero on
2861
 * failure. The entry is identified by the first 8 bytes of
2862
 * |encrypted_premaster|.
2863
 */
2864
__owur int ssl_log_rsa_client_key_exchange(SSL_CONNECTION *s,
2865
    const uint8_t *encrypted_premaster,
2866
    size_t encrypted_premaster_len,
2867
    const uint8_t *premaster,
2868
    size_t premaster_len);
2869
2870
/*
2871
 * ssl_log_secret logs |secret| to the SSL_CTX associated with |ssl|, if
2872
 * logging is available. It returns one on success and zero on failure. It tags
2873
 * the entry with |label|.
2874
 */
2875
__owur int ssl_log_secret(SSL_CONNECTION *s, const char *label,
2876
    const uint8_t *secret, size_t secret_len);
2877
2878
4.59k
#define MASTER_SECRET_LABEL "CLIENT_RANDOM"
2879
0
#define CLIENT_EARLY_LABEL "CLIENT_EARLY_TRAFFIC_SECRET"
2880
5.48k
#define CLIENT_HANDSHAKE_LABEL "CLIENT_HANDSHAKE_TRAFFIC_SECRET"
2881
5.60k
#define SERVER_HANDSHAKE_LABEL "SERVER_HANDSHAKE_TRAFFIC_SECRET"
2882
2.61k
#define CLIENT_APPLICATION_LABEL "CLIENT_TRAFFIC_SECRET_0"
2883
0
#define CLIENT_APPLICATION_N_LABEL "CLIENT_TRAFFIC_SECRET_N"
2884
3.07k
#define SERVER_APPLICATION_LABEL "SERVER_TRAFFIC_SECRET_0"
2885
0
#define SERVER_APPLICATION_N_LABEL "SERVER_TRAFFIC_SECRET_N"
2886
0
#define EARLY_EXPORTER_SECRET_LABEL "EARLY_EXPORTER_SECRET"
2887
3.07k
#define EXPORTER_SECRET_LABEL "EXPORTER_SECRET"
2888
2889
__owur int srp_generate_server_master_secret(SSL_CONNECTION *s);
2890
__owur int srp_generate_client_master_secret(SSL_CONNECTION *s);
2891
__owur int srp_verify_server_param(SSL_CONNECTION *s);
2892
2893
/* statem/statem_srvr.c */
2894
2895
__owur int send_certificate_request(SSL_CONNECTION *s);
2896
2897
/* statem/extensions_cust.c */
2898
2899
custom_ext_method *custom_ext_find(const custom_ext_methods *exts,
2900
    ENDPOINT role, unsigned int ext_type,
2901
    size_t *idx);
2902
2903
void custom_ext_init(custom_ext_methods *meths);
2904
2905
int ossl_tls_add_custom_ext_intern(SSL_CTX *ctx, custom_ext_methods *exts,
2906
    ENDPOINT role, unsigned int ext_type,
2907
    unsigned int context,
2908
    SSL_custom_ext_add_cb_ex add_cb,
2909
    SSL_custom_ext_free_cb_ex free_cb,
2910
    void *add_arg,
2911
    SSL_custom_ext_parse_cb_ex parse_cb,
2912
    void *parse_arg);
2913
__owur int custom_ext_parse(SSL_CONNECTION *s, unsigned int context,
2914
    unsigned int ext_type,
2915
    const unsigned char *ext_data, size_t ext_size,
2916
    X509 *x, size_t chainidx);
2917
__owur int custom_ext_add(SSL_CONNECTION *s, int context, WPACKET *pkt, X509 *x,
2918
    size_t chainidx, int maxversion);
2919
2920
__owur int custom_exts_copy(custom_ext_methods *dst,
2921
    const custom_ext_methods *src);
2922
__owur int custom_exts_copy_flags(custom_ext_methods *dst,
2923
    const custom_ext_methods *src);
2924
void custom_exts_free(custom_ext_methods *exts);
2925
2926
void ssl_comp_free_compression_methods_int(void);
2927
2928
/* ssl_mcnf.c */
2929
void ssl_ctx_system_config(SSL_CTX *ctx);
2930
2931
const EVP_CIPHER *ssl_evp_cipher_fetch(OSSL_LIB_CTX *libctx,
2932
    int nid,
2933
    const char *properties);
2934
int ssl_evp_cipher_up_ref(const EVP_CIPHER *cipher);
2935
void ssl_evp_cipher_free(const EVP_CIPHER *cipher);
2936
const EVP_MD *ssl_evp_md_fetch(OSSL_LIB_CTX *libctx,
2937
    int nid,
2938
    const char *properties);
2939
int ssl_evp_md_up_ref(const EVP_MD *md);
2940
void ssl_evp_md_free(const EVP_MD *md);
2941
2942
void tls_engine_finish(ENGINE *e);
2943
const EVP_CIPHER *tls_get_cipher_from_engine(int nid);
2944
const EVP_MD *tls_get_digest_from_engine(int nid);
2945
int tls_engine_load_ssl_client_cert(SSL_CONNECTION *s, X509 **px509,
2946
    EVP_PKEY **ppkey);
2947
int ssl_hmac_old_new(SSL_HMAC *ret);
2948
void ssl_hmac_old_free(SSL_HMAC *ctx);
2949
int ssl_hmac_old_init(SSL_HMAC *ctx, void *key, size_t len, char *md);
2950
int ssl_hmac_old_update(SSL_HMAC *ctx, const unsigned char *data, size_t len);
2951
int ssl_hmac_old_final(SSL_HMAC *ctx, unsigned char *md, size_t *len);
2952
size_t ssl_hmac_old_size(const SSL_HMAC *ctx);
2953
2954
int ssl_ctx_srp_ctx_free_intern(SSL_CTX *ctx);
2955
int ssl_ctx_srp_ctx_init_intern(SSL_CTX *ctx);
2956
int ssl_srp_ctx_free_intern(SSL_CONNECTION *s);
2957
int ssl_srp_ctx_init_intern(SSL_CONNECTION *s);
2958
2959
int ssl_srp_calc_a_param_intern(SSL_CONNECTION *s);
2960
int ssl_srp_server_param_with_username_intern(SSL_CONNECTION *s, int *ad);
2961
2962
void ssl_session_calculate_timeout(SSL_SESSION *ss);
2963
2964
#else /* OPENSSL_UNIT_TEST */
2965
2966
#define ssl_init_wbio_buffer SSL_test_functions()->p_ssl_init_wbio_buffer
2967
2968
#endif
2969
2970
/* Some helper routines to support TSAN operations safely */
2971
static ossl_unused ossl_inline int ssl_tsan_lock(const SSL_CTX *ctx)
2972
214k
{
2973
#ifdef TSAN_REQUIRES_LOCKING
2974
    if (!CRYPTO_THREAD_write_lock(ctx->tsan_lock))
2975
        return 0;
2976
#endif
2977
214k
    return 1;
2978
214k
}
Unexecuted instantiation: ssl_cert.c:ssl_tsan_lock
Unexecuted instantiation: ssl_ciph.c:ssl_tsan_lock
Unexecuted instantiation: ssl_init.c:ssl_tsan_lock
ssl_lib.c:ssl_tsan_lock
Line
Count
Source
2972
1.46k
{
2973
#ifdef TSAN_REQUIRES_LOCKING
2974
    if (!CRYPTO_THREAD_write_lock(ctx->tsan_lock))
2975
        return 0;
2976
#endif
2977
1.46k
    return 1;
2978
1.46k
}
Unexecuted instantiation: ssl_mcnf.c:ssl_tsan_lock
ssl_sess.c:ssl_tsan_lock
Line
Count
Source
2972
3.96k
{
2973
#ifdef TSAN_REQUIRES_LOCKING
2974
    if (!CRYPTO_THREAD_write_lock(ctx->tsan_lock))
2975
        return 0;
2976
#endif
2977
3.96k
    return 1;
2978
3.96k
}
Unexecuted instantiation: t1_lib.c:ssl_tsan_lock
Unexecuted instantiation: tls13_enc.c:ssl_tsan_lock
Unexecuted instantiation: tls_depr.c:ssl_tsan_lock
Unexecuted instantiation: tls_srp.c:ssl_tsan_lock
Unexecuted instantiation: quic_impl.c:ssl_tsan_lock
Unexecuted instantiation: quic_method.c:ssl_tsan_lock
Unexecuted instantiation: quic_port.c:ssl_tsan_lock
Unexecuted instantiation: quic_record_rx.c:ssl_tsan_lock
Unexecuted instantiation: quic_record_shared.c:ssl_tsan_lock
Unexecuted instantiation: quic_record_tx.c:ssl_tsan_lock
Unexecuted instantiation: quic_record_util.c:ssl_tsan_lock
Unexecuted instantiation: quic_thread_assist.c:ssl_tsan_lock
Unexecuted instantiation: rec_layer_s3.c:ssl_tsan_lock
Unexecuted instantiation: dtls_meth.c:ssl_tsan_lock
Unexecuted instantiation: tls1_meth.c:ssl_tsan_lock
Unexecuted instantiation: tls_common.c:ssl_tsan_lock
Unexecuted instantiation: tls_multib.c:ssl_tsan_lock
Unexecuted instantiation: tlsany_meth.c:ssl_tsan_lock
Unexecuted instantiation: extensions.c:ssl_tsan_lock
Unexecuted instantiation: extensions_clnt.c:ssl_tsan_lock
Unexecuted instantiation: extensions_cust.c:ssl_tsan_lock
Unexecuted instantiation: extensions_srvr.c:ssl_tsan_lock
Unexecuted instantiation: statem.c:ssl_tsan_lock
statem_clnt.c:ssl_tsan_lock
Line
Count
Source
2972
50
{
2973
#ifdef TSAN_REQUIRES_LOCKING
2974
    if (!CRYPTO_THREAD_write_lock(ctx->tsan_lock))
2975
        return 0;
2976
#endif
2977
50
    return 1;
2978
50
}
Unexecuted instantiation: statem_dtls.c:ssl_tsan_lock
statem_lib.c:ssl_tsan_lock
Line
Count
Source
2972
208k
{
2973
#ifdef TSAN_REQUIRES_LOCKING
2974
    if (!CRYPTO_THREAD_write_lock(ctx->tsan_lock))
2975
        return 0;
2976
#endif
2977
208k
    return 1;
2978
208k
}
Unexecuted instantiation: statem_srvr.c:ssl_tsan_lock
Unexecuted instantiation: d1_lib.c:ssl_tsan_lock
Unexecuted instantiation: d1_srtp.c:ssl_tsan_lock
Unexecuted instantiation: methods.c:ssl_tsan_lock
Unexecuted instantiation: pqueue.c:ssl_tsan_lock
Unexecuted instantiation: s3_enc.c:ssl_tsan_lock
Unexecuted instantiation: s3_lib.c:ssl_tsan_lock
Unexecuted instantiation: s3_msg.c:ssl_tsan_lock
Unexecuted instantiation: ssl_asn1.c:ssl_tsan_lock
Unexecuted instantiation: ssl_conf.c:ssl_tsan_lock
Unexecuted instantiation: ssl_rsa.c:ssl_tsan_lock
Unexecuted instantiation: t1_enc.c:ssl_tsan_lock
Unexecuted instantiation: quic_channel.c:ssl_tsan_lock
Unexecuted instantiation: quic_engine.c:ssl_tsan_lock
Unexecuted instantiation: quic_rx_depack.c:ssl_tsan_lock
Unexecuted instantiation: quic_tls.c:ssl_tsan_lock
Unexecuted instantiation: rec_layer_d1.c:ssl_tsan_lock
Unexecuted instantiation: ssl3_meth.c:ssl_tsan_lock
Unexecuted instantiation: tls13_meth.c:ssl_tsan_lock
Unexecuted instantiation: d1_msg.c:ssl_tsan_lock
Unexecuted instantiation: ssl_txt.c:ssl_tsan_lock
2979
2980
static ossl_unused ossl_inline void ssl_tsan_unlock(const SSL_CTX *ctx)
2981
214k
{
2982
#ifdef TSAN_REQUIRES_LOCKING
2983
    CRYPTO_THREAD_unlock(ctx->tsan_lock);
2984
#endif
2985
214k
}
Unexecuted instantiation: ssl_cert.c:ssl_tsan_unlock
Unexecuted instantiation: ssl_ciph.c:ssl_tsan_unlock
Unexecuted instantiation: ssl_init.c:ssl_tsan_unlock
ssl_lib.c:ssl_tsan_unlock
Line
Count
Source
2981
1.46k
{
2982
#ifdef TSAN_REQUIRES_LOCKING
2983
    CRYPTO_THREAD_unlock(ctx->tsan_lock);
2984
#endif
2985
1.46k
}
Unexecuted instantiation: ssl_mcnf.c:ssl_tsan_unlock
ssl_sess.c:ssl_tsan_unlock
Line
Count
Source
2981
3.96k
{
2982
#ifdef TSAN_REQUIRES_LOCKING
2983
    CRYPTO_THREAD_unlock(ctx->tsan_lock);
2984
#endif
2985
3.96k
}
Unexecuted instantiation: t1_lib.c:ssl_tsan_unlock
Unexecuted instantiation: tls13_enc.c:ssl_tsan_unlock
Unexecuted instantiation: tls_depr.c:ssl_tsan_unlock
Unexecuted instantiation: tls_srp.c:ssl_tsan_unlock
Unexecuted instantiation: quic_impl.c:ssl_tsan_unlock
Unexecuted instantiation: quic_method.c:ssl_tsan_unlock
Unexecuted instantiation: quic_port.c:ssl_tsan_unlock
Unexecuted instantiation: quic_record_rx.c:ssl_tsan_unlock
Unexecuted instantiation: quic_record_shared.c:ssl_tsan_unlock
Unexecuted instantiation: quic_record_tx.c:ssl_tsan_unlock
Unexecuted instantiation: quic_record_util.c:ssl_tsan_unlock
Unexecuted instantiation: quic_thread_assist.c:ssl_tsan_unlock
Unexecuted instantiation: rec_layer_s3.c:ssl_tsan_unlock
Unexecuted instantiation: dtls_meth.c:ssl_tsan_unlock
Unexecuted instantiation: tls1_meth.c:ssl_tsan_unlock
Unexecuted instantiation: tls_common.c:ssl_tsan_unlock
Unexecuted instantiation: tls_multib.c:ssl_tsan_unlock
Unexecuted instantiation: tlsany_meth.c:ssl_tsan_unlock
Unexecuted instantiation: extensions.c:ssl_tsan_unlock
Unexecuted instantiation: extensions_clnt.c:ssl_tsan_unlock
Unexecuted instantiation: extensions_cust.c:ssl_tsan_unlock
Unexecuted instantiation: extensions_srvr.c:ssl_tsan_unlock
Unexecuted instantiation: statem.c:ssl_tsan_unlock
statem_clnt.c:ssl_tsan_unlock
Line
Count
Source
2981
50
{
2982
#ifdef TSAN_REQUIRES_LOCKING
2983
    CRYPTO_THREAD_unlock(ctx->tsan_lock);
2984
#endif
2985
50
}
Unexecuted instantiation: statem_dtls.c:ssl_tsan_unlock
statem_lib.c:ssl_tsan_unlock
Line
Count
Source
2981
208k
{
2982
#ifdef TSAN_REQUIRES_LOCKING
2983
    CRYPTO_THREAD_unlock(ctx->tsan_lock);
2984
#endif
2985
208k
}
Unexecuted instantiation: statem_srvr.c:ssl_tsan_unlock
Unexecuted instantiation: d1_lib.c:ssl_tsan_unlock
Unexecuted instantiation: d1_srtp.c:ssl_tsan_unlock
Unexecuted instantiation: methods.c:ssl_tsan_unlock
Unexecuted instantiation: pqueue.c:ssl_tsan_unlock
Unexecuted instantiation: s3_enc.c:ssl_tsan_unlock
Unexecuted instantiation: s3_lib.c:ssl_tsan_unlock
Unexecuted instantiation: s3_msg.c:ssl_tsan_unlock
Unexecuted instantiation: ssl_asn1.c:ssl_tsan_unlock
Unexecuted instantiation: ssl_conf.c:ssl_tsan_unlock
Unexecuted instantiation: ssl_rsa.c:ssl_tsan_unlock
Unexecuted instantiation: t1_enc.c:ssl_tsan_unlock
Unexecuted instantiation: quic_channel.c:ssl_tsan_unlock
Unexecuted instantiation: quic_engine.c:ssl_tsan_unlock
Unexecuted instantiation: quic_rx_depack.c:ssl_tsan_unlock
Unexecuted instantiation: quic_tls.c:ssl_tsan_unlock
Unexecuted instantiation: rec_layer_d1.c:ssl_tsan_unlock
Unexecuted instantiation: ssl3_meth.c:ssl_tsan_unlock
Unexecuted instantiation: tls13_meth.c:ssl_tsan_unlock
Unexecuted instantiation: d1_msg.c:ssl_tsan_unlock
Unexecuted instantiation: ssl_txt.c:ssl_tsan_unlock
2986
2987
static ossl_unused ossl_inline void ssl_tsan_counter(const SSL_CTX *ctx,
2988
    TSAN_QUALIFIER int *stat)
2989
212k
{
2990
212k
    if (ssl_tsan_lock(ctx)) {
2991
212k
        tsan_counter(stat);
2992
212k
        ssl_tsan_unlock(ctx);
2993
212k
    }
2994
212k
}
Unexecuted instantiation: ssl_cert.c:ssl_tsan_counter
Unexecuted instantiation: ssl_ciph.c:ssl_tsan_counter
Unexecuted instantiation: ssl_init.c:ssl_tsan_counter
Unexecuted instantiation: ssl_lib.c:ssl_tsan_counter
Unexecuted instantiation: ssl_mcnf.c:ssl_tsan_counter
ssl_sess.c:ssl_tsan_counter
Line
Count
Source
2989
3.96k
{
2990
3.96k
    if (ssl_tsan_lock(ctx)) {
2991
        tsan_counter(stat);
2992
3.96k
        ssl_tsan_unlock(ctx);
2993
3.96k
    }
2994
3.96k
}
Unexecuted instantiation: t1_lib.c:ssl_tsan_counter
Unexecuted instantiation: tls13_enc.c:ssl_tsan_counter
Unexecuted instantiation: tls_depr.c:ssl_tsan_counter
Unexecuted instantiation: tls_srp.c:ssl_tsan_counter
Unexecuted instantiation: quic_impl.c:ssl_tsan_counter
Unexecuted instantiation: quic_method.c:ssl_tsan_counter
Unexecuted instantiation: quic_port.c:ssl_tsan_counter
Unexecuted instantiation: quic_record_rx.c:ssl_tsan_counter
Unexecuted instantiation: quic_record_shared.c:ssl_tsan_counter
Unexecuted instantiation: quic_record_tx.c:ssl_tsan_counter
Unexecuted instantiation: quic_record_util.c:ssl_tsan_counter
Unexecuted instantiation: quic_thread_assist.c:ssl_tsan_counter
Unexecuted instantiation: rec_layer_s3.c:ssl_tsan_counter
Unexecuted instantiation: dtls_meth.c:ssl_tsan_counter
Unexecuted instantiation: tls1_meth.c:ssl_tsan_counter
Unexecuted instantiation: tls_common.c:ssl_tsan_counter
Unexecuted instantiation: tls_multib.c:ssl_tsan_counter
Unexecuted instantiation: tlsany_meth.c:ssl_tsan_counter
Unexecuted instantiation: extensions.c:ssl_tsan_counter
Unexecuted instantiation: extensions_clnt.c:ssl_tsan_counter
Unexecuted instantiation: extensions_cust.c:ssl_tsan_counter
Unexecuted instantiation: extensions_srvr.c:ssl_tsan_counter
Unexecuted instantiation: statem.c:ssl_tsan_counter
statem_clnt.c:ssl_tsan_counter
Line
Count
Source
2989
50
{
2990
50
    if (ssl_tsan_lock(ctx)) {
2991
        tsan_counter(stat);
2992
50
        ssl_tsan_unlock(ctx);
2993
50
    }
2994
50
}
Unexecuted instantiation: statem_dtls.c:ssl_tsan_counter
statem_lib.c:ssl_tsan_counter
Line
Count
Source
2989
208k
{
2990
208k
    if (ssl_tsan_lock(ctx)) {
2991
        tsan_counter(stat);
2992
208k
        ssl_tsan_unlock(ctx);
2993
208k
    }
2994
208k
}
Unexecuted instantiation: statem_srvr.c:ssl_tsan_counter
Unexecuted instantiation: d1_lib.c:ssl_tsan_counter
Unexecuted instantiation: d1_srtp.c:ssl_tsan_counter
Unexecuted instantiation: methods.c:ssl_tsan_counter
Unexecuted instantiation: pqueue.c:ssl_tsan_counter
Unexecuted instantiation: s3_enc.c:ssl_tsan_counter
Unexecuted instantiation: s3_lib.c:ssl_tsan_counter
Unexecuted instantiation: s3_msg.c:ssl_tsan_counter
Unexecuted instantiation: ssl_asn1.c:ssl_tsan_counter
Unexecuted instantiation: ssl_conf.c:ssl_tsan_counter
Unexecuted instantiation: ssl_rsa.c:ssl_tsan_counter
Unexecuted instantiation: t1_enc.c:ssl_tsan_counter
Unexecuted instantiation: quic_channel.c:ssl_tsan_counter
Unexecuted instantiation: quic_engine.c:ssl_tsan_counter
Unexecuted instantiation: quic_rx_depack.c:ssl_tsan_counter
Unexecuted instantiation: quic_tls.c:ssl_tsan_counter
Unexecuted instantiation: rec_layer_d1.c:ssl_tsan_counter
Unexecuted instantiation: ssl3_meth.c:ssl_tsan_counter
Unexecuted instantiation: tls13_meth.c:ssl_tsan_counter
Unexecuted instantiation: d1_msg.c:ssl_tsan_counter
Unexecuted instantiation: ssl_txt.c:ssl_tsan_counter
2995
2996
int ossl_comp_has_alg(int a);
2997
size_t ossl_calculate_comp_expansion(int alg, size_t length);
2998
2999
void ossl_ssl_set_custom_record_layer(SSL_CONNECTION *s,
3000
    const OSSL_RECORD_METHOD *meth,
3001
    void *rlarg);
3002
3003
long ossl_ctrl_internal(SSL *s, int cmd, long larg, void *parg, int no_quic);
3004
3005
/*
3006
 * Options which no longer have any effect, but which can be implemented
3007
 * as no-ops for QUIC.
3008
 */
3009
#define OSSL_LEGACY_SSL_OPTIONS \
3010
75.2k
    (SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG | SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER | SSL_OP_SSLEAY_080_CLIENT_DH_BUG | SSL_OP_TLS_D5_BUG | SSL_OP_TLS_BLOCK_PADDING_BUG | SSL_OP_MSIE_SSLV2_RSA_PADDING | SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG | SSL_OP_MICROSOFT_SESS_ID_BUG | SSL_OP_NETSCAPE_CHALLENGE_BUG | SSL_OP_PKCS1_CHECK_1 | SSL_OP_PKCS1_CHECK_2 | SSL_OP_SINGLE_DH_USE | SSL_OP_SINGLE_ECDH_USE | SSL_OP_EPHEMERAL_RSA)
3011
3012
/* This option is undefined in public headers with no-dtls1-method. */
3013
#ifndef SSL_OP_CISCO_ANYCONNECT
3014
#define SSL_OP_CISCO_ANYCONNECT 0
3015
#endif
3016
/*
3017
 * Options which are no-ops under QUIC or TLSv1.3 and which are therefore
3018
 * allowed but ignored under QUIC.
3019
 */
3020
#define OSSL_TLS1_2_OPTIONS \
3021
75.2k
    (SSL_OP_CRYPTOPRO_TLSEXT_BUG | SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS | SSL_OP_ALLOW_CLIENT_RENEGOTIATION | SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION | SSL_OP_NO_COMPRESSION | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_2 | SSL_OP_NO_DTLSv1 | SSL_OP_NO_DTLSv1_2 | SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION | SSL_OP_CISCO_ANYCONNECT | SSL_OP_NO_RENEGOTIATION | SSL_OP_NO_EXTENDED_MASTER_SECRET | SSL_OP_NO_ENCRYPT_THEN_MAC | SSL_OP_COOKIE_EXCHANGE | SSL_OP_LEGACY_SERVER_CONNECT | SSL_OP_IGNORE_UNEXPECTED_EOF)
3022
3023
/* Total mask of connection-level options permitted or ignored under QUIC. */
3024
#define OSSL_QUIC_PERMITTED_OPTIONS_CONN \
3025
41.8k
    (OSSL_LEGACY_SSL_OPTIONS | OSSL_TLS1_2_OPTIONS | SSL_OP_CIPHER_SERVER_PREFERENCE | SSL_OP_DISABLE_TLSEXT_CA_NAMES | SSL_OP_NO_TX_CERTIFICATE_COMPRESSION | SSL_OP_NO_RX_CERTIFICATE_COMPRESSION | SSL_OP_PRIORITIZE_CHACHA | SSL_OP_NO_QUERY_MTU | SSL_OP_NO_TICKET | SSL_OP_NO_ANTI_REPLAY)
3026
3027
/* Total mask of stream-level options permitted or ignored under QUIC. */
3028
#define OSSL_QUIC_PERMITTED_OPTIONS_STREAM \
3029
33.3k
    (OSSL_LEGACY_SSL_OPTIONS | OSSL_TLS1_2_OPTIONS | SSL_OP_CLEANSE_PLAINTEXT)
3030
3031
/* Total mask of options permitted on either connections or streams. */
3032
#define OSSL_QUIC_PERMITTED_OPTIONS \
3033
20.9k
    (OSSL_QUIC_PERMITTED_OPTIONS_CONN | OSSL_QUIC_PERMITTED_OPTIONS_STREAM)
3034
3035
#endif