s3_lib.c 112.1 KB
Newer Older
R
Rich Salz 已提交
1
/*
P
Pauli 已提交
2
 * Copyright 1995-2017 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.
B
Bodo Möller 已提交
5
 *
R
Rich Salz 已提交
6 7 8 9
 * Licensed under the OpenSSL license (the "License").  You may not use
 * this file except in compliance with the License.  You can obtain a copy
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
B
Bodo Möller 已提交
10
 */
R
Rich Salz 已提交
11

12
#include <stdio.h>
13
#include <openssl/objects.h>
14
#include "ssl_locl.h"
15
#include <openssl/md5.h>
R
Rich Salz 已提交
16
#include <openssl/dh.h>
17
#include <openssl/rand.h>
R
Rich Salz 已提交
18
#include "internal/cryptlib.h"
19

D
Dr. Stephen Henson 已提交
20
#define SSL3_NUM_CIPHERS        OSSL_NELEM(ssl3_ciphers)
21
#define SSL3_NUM_SCSVS          OSSL_NELEM(ssl3_scsvs)
22

23 24 25 26 27 28 29 30
/* TLSv1.3 downgrade protection sentinel values */
const unsigned char tls11downgrade[] = {
    0x44, 0x4f, 0x57, 0x4e, 0x47, 0x52, 0x44, 0x00
};
const unsigned char tls12downgrade[] = {
    0x44, 0x4f, 0x57, 0x4e, 0x47, 0x52, 0x44, 0x01
};

R
Rich Salz 已提交
31
/*
R
Rich Salz 已提交
32
 * The list of available ciphers, mostly organized into the following
R
Rich Salz 已提交
33 34 35 36 37
 * groups:
 *      Always there
 *      EC
 *      PSK
 *      SRP (within that: RSA EC PSK)
P
Pauli 已提交
38
 *      Cipher families: Chacha/poly, Camellia, Gost, IDEA, SEED
R
Rich Salz 已提交
39 40
 *      Weak ciphers
 */
E
Emilia Kasper 已提交
41
static SSL_CIPHER ssl3_ciphers[] = {
42 43 44
    {
     1,
     SSL3_TXT_RSA_NULL_MD5,
45
     SSL3_RFC_RSA_NULL_MD5,
46 47 48 49 50
     SSL3_CK_RSA_NULL_MD5,
     SSL_kRSA,
     SSL_aRSA,
     SSL_eNULL,
     SSL_MD5,
51
     SSL3_VERSION, TLS1_2_VERSION,
52
     DTLS1_BAD_VER, DTLS1_2_VERSION,
53
     SSL_STRONG_NONE,
54 55 56 57 58 59 60
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     0,
     0,
     },
    {
     1,
     SSL3_TXT_RSA_NULL_SHA,
61
     SSL3_RFC_RSA_NULL_SHA,
62 63 64 65 66
     SSL3_CK_RSA_NULL_SHA,
     SSL_kRSA,
     SSL_aRSA,
     SSL_eNULL,
     SSL_SHA1,
67
     SSL3_VERSION, TLS1_2_VERSION,
68
     DTLS1_BAD_VER, DTLS1_2_VERSION,
69
     SSL_STRONG_NONE | SSL_FIPS,
70 71 72 73
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     0,
     0,
     },
74
#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
75 76 77
    {
     1,
     SSL3_TXT_RSA_DES_192_CBC3_SHA,
78
     SSL3_RFC_RSA_DES_192_CBC3_SHA,
79 80 81 82 83
     SSL3_CK_RSA_DES_192_CBC3_SHA,
     SSL_kRSA,
     SSL_aRSA,
     SSL_3DES,
     SSL_SHA1,
84
     SSL3_VERSION, TLS1_2_VERSION,
85
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
86
     SSL_NOT_DEFAULT | SSL_MEDIUM | SSL_FIPS,
87 88 89 90 91 92 93
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     112,
     168,
     },
    {
     1,
     SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA,
94
     SSL3_RFC_DHE_DSS_DES_192_CBC3_SHA,
95 96 97 98 99
     SSL3_CK_DHE_DSS_DES_192_CBC3_SHA,
     SSL_kDHE,
     SSL_aDSS,
     SSL_3DES,
     SSL_SHA1,
100
     SSL3_VERSION, TLS1_2_VERSION,
101
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
102
     SSL_NOT_DEFAULT | SSL_MEDIUM | SSL_FIPS,
103 104 105 106 107 108 109
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     112,
     168,
     },
    {
     1,
     SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA,
110
     SSL3_RFC_DHE_RSA_DES_192_CBC3_SHA,
111 112 113 114 115
     SSL3_CK_DHE_RSA_DES_192_CBC3_SHA,
     SSL_kDHE,
     SSL_aRSA,
     SSL_3DES,
     SSL_SHA1,
116
     SSL3_VERSION, TLS1_2_VERSION,
117
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
118
     SSL_NOT_DEFAULT | SSL_MEDIUM | SSL_FIPS,
119 120 121 122 123 124 125
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     112,
     168,
     },
    {
     1,
     SSL3_TXT_ADH_DES_192_CBC_SHA,
126
     SSL3_RFC_ADH_DES_192_CBC_SHA,
127 128 129 130 131
     SSL3_CK_ADH_DES_192_CBC_SHA,
     SSL_kDHE,
     SSL_aNULL,
     SSL_3DES,
     SSL_SHA1,
132
     SSL3_VERSION, TLS1_2_VERSION,
133
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
134
     SSL_NOT_DEFAULT | SSL_MEDIUM | SSL_FIPS,
135 136 137 138
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     112,
     168,
     },
139
#endif
140 141 142
    {
     1,
     TLS1_TXT_RSA_WITH_AES_128_SHA,
143
     TLS1_RFC_RSA_WITH_AES_128_SHA,
144 145 146 147 148
     TLS1_CK_RSA_WITH_AES_128_SHA,
     SSL_kRSA,
     SSL_aRSA,
     SSL_AES128,
     SSL_SHA1,
149
     SSL3_VERSION, TLS1_2_VERSION,
150
     DTLS1_BAD_VER, DTLS1_2_VERSION,
151
     SSL_HIGH | SSL_FIPS,
152 153 154 155 156 157 158
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_DHE_DSS_WITH_AES_128_SHA,
159
     TLS1_RFC_DHE_DSS_WITH_AES_128_SHA,
160 161 162 163 164
     TLS1_CK_DHE_DSS_WITH_AES_128_SHA,
     SSL_kDHE,
     SSL_aDSS,
     SSL_AES128,
     SSL_SHA1,
165
     SSL3_VERSION, TLS1_2_VERSION,
166
     DTLS1_BAD_VER, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
167
     SSL_NOT_DEFAULT | SSL_HIGH | SSL_FIPS,
168 169 170 171 172 173 174
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_DHE_RSA_WITH_AES_128_SHA,
175
     TLS1_RFC_DHE_RSA_WITH_AES_128_SHA,
176 177 178 179 180
     TLS1_CK_DHE_RSA_WITH_AES_128_SHA,
     SSL_kDHE,
     SSL_aRSA,
     SSL_AES128,
     SSL_SHA1,
181
     SSL3_VERSION, TLS1_2_VERSION,
182
     DTLS1_BAD_VER, DTLS1_2_VERSION,
183
     SSL_HIGH | SSL_FIPS,
184 185 186 187 188 189 190
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_ADH_WITH_AES_128_SHA,
191
     TLS1_RFC_ADH_WITH_AES_128_SHA,
192 193 194 195 196
     TLS1_CK_ADH_WITH_AES_128_SHA,
     SSL_kDHE,
     SSL_aNULL,
     SSL_AES128,
     SSL_SHA1,
197
     SSL3_VERSION, TLS1_2_VERSION,
198
     DTLS1_BAD_VER, DTLS1_2_VERSION,
199
     SSL_NOT_DEFAULT | SSL_HIGH | SSL_FIPS,
200 201 202 203 204 205 206
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_RSA_WITH_AES_256_SHA,
207
     TLS1_RFC_RSA_WITH_AES_256_SHA,
208 209 210 211 212
     TLS1_CK_RSA_WITH_AES_256_SHA,
     SSL_kRSA,
     SSL_aRSA,
     SSL_AES256,
     SSL_SHA1,
213
     SSL3_VERSION, TLS1_2_VERSION,
214
     DTLS1_BAD_VER, DTLS1_2_VERSION,
215
     SSL_HIGH | SSL_FIPS,
216 217 218 219 220 221 222
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_DHE_DSS_WITH_AES_256_SHA,
223
     TLS1_RFC_DHE_DSS_WITH_AES_256_SHA,
224 225 226 227 228
     TLS1_CK_DHE_DSS_WITH_AES_256_SHA,
     SSL_kDHE,
     SSL_aDSS,
     SSL_AES256,
     SSL_SHA1,
229
     SSL3_VERSION, TLS1_2_VERSION,
230
     DTLS1_BAD_VER, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
231
     SSL_NOT_DEFAULT | SSL_HIGH | SSL_FIPS,
232 233 234 235 236 237 238
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_DHE_RSA_WITH_AES_256_SHA,
239
     TLS1_RFC_DHE_RSA_WITH_AES_256_SHA,
240 241 242 243 244
     TLS1_CK_DHE_RSA_WITH_AES_256_SHA,
     SSL_kDHE,
     SSL_aRSA,
     SSL_AES256,
     SSL_SHA1,
245
     SSL3_VERSION, TLS1_2_VERSION,
246
     DTLS1_BAD_VER, DTLS1_2_VERSION,
247
     SSL_HIGH | SSL_FIPS,
248 249 250 251 252 253 254
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_ADH_WITH_AES_256_SHA,
255
     TLS1_RFC_ADH_WITH_AES_256_SHA,
256 257 258 259 260
     TLS1_CK_ADH_WITH_AES_256_SHA,
     SSL_kDHE,
     SSL_aNULL,
     SSL_AES256,
     SSL_SHA1,
261
     SSL3_VERSION, TLS1_2_VERSION,
262
     DTLS1_BAD_VER, DTLS1_2_VERSION,
263
     SSL_NOT_DEFAULT | SSL_HIGH | SSL_FIPS,
264 265 266 267 268 269 270
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_RSA_WITH_NULL_SHA256,
271
     TLS1_RFC_RSA_WITH_NULL_SHA256,
272 273 274 275 276
     TLS1_CK_RSA_WITH_NULL_SHA256,
     SSL_kRSA,
     SSL_aRSA,
     SSL_eNULL,
     SSL_SHA256,
277 278
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
279
     SSL_STRONG_NONE | SSL_FIPS,
280 281 282 283 284 285 286
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     0,
     0,
     },
    {
     1,
     TLS1_TXT_RSA_WITH_AES_128_SHA256,
287
     TLS1_RFC_RSA_WITH_AES_128_SHA256,
288 289 290 291 292
     TLS1_CK_RSA_WITH_AES_128_SHA256,
     SSL_kRSA,
     SSL_aRSA,
     SSL_AES128,
     SSL_SHA256,
293 294
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
295
     SSL_HIGH | SSL_FIPS,
296 297 298 299 300 301 302
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_RSA_WITH_AES_256_SHA256,
303
     TLS1_RFC_RSA_WITH_AES_256_SHA256,
304 305 306 307 308
     TLS1_CK_RSA_WITH_AES_256_SHA256,
     SSL_kRSA,
     SSL_aRSA,
     SSL_AES256,
     SSL_SHA256,
309 310
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
311
     SSL_HIGH | SSL_FIPS,
312 313 314 315 316 317 318
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256,
319
     TLS1_RFC_DHE_DSS_WITH_AES_128_SHA256,
320 321 322 323 324
     TLS1_CK_DHE_DSS_WITH_AES_128_SHA256,
     SSL_kDHE,
     SSL_aDSS,
     SSL_AES128,
     SSL_SHA256,
325 326
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
327
     SSL_NOT_DEFAULT | SSL_HIGH | SSL_FIPS,
328 329 330 331 332 333 334
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256,
335
     TLS1_RFC_DHE_RSA_WITH_AES_128_SHA256,
336 337 338 339 340
     TLS1_CK_DHE_RSA_WITH_AES_128_SHA256,
     SSL_kDHE,
     SSL_aRSA,
     SSL_AES128,
     SSL_SHA256,
341 342
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
343
     SSL_HIGH | SSL_FIPS,
344 345 346 347 348 349 350
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256,
351
     TLS1_RFC_DHE_DSS_WITH_AES_256_SHA256,
352 353 354 355 356
     TLS1_CK_DHE_DSS_WITH_AES_256_SHA256,
     SSL_kDHE,
     SSL_aDSS,
     SSL_AES256,
     SSL_SHA256,
357 358
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
359
     SSL_NOT_DEFAULT | SSL_HIGH | SSL_FIPS,
360 361 362 363 364 365 366
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256,
367
     TLS1_RFC_DHE_RSA_WITH_AES_256_SHA256,
368 369 370 371 372
     TLS1_CK_DHE_RSA_WITH_AES_256_SHA256,
     SSL_kDHE,
     SSL_aRSA,
     SSL_AES256,
     SSL_SHA256,
373 374
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
375
     SSL_HIGH | SSL_FIPS,
376 377 378 379 380 381 382
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_ADH_WITH_AES_128_SHA256,
383
     TLS1_RFC_ADH_WITH_AES_128_SHA256,
384 385 386 387 388
     TLS1_CK_ADH_WITH_AES_128_SHA256,
     SSL_kDHE,
     SSL_aNULL,
     SSL_AES128,
     SSL_SHA256,
389 390
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
391
     SSL_NOT_DEFAULT | SSL_HIGH | SSL_FIPS,
392 393 394 395 396 397 398
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_ADH_WITH_AES_256_SHA256,
399
     TLS1_RFC_ADH_WITH_AES_256_SHA256,
400 401 402 403 404
     TLS1_CK_ADH_WITH_AES_256_SHA256,
     SSL_kDHE,
     SSL_aNULL,
     SSL_AES256,
     SSL_SHA256,
405 406
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
407
     SSL_NOT_DEFAULT | SSL_HIGH | SSL_FIPS,
408 409 410 411 412 413
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
414
     TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256,
415
     TLS1_RFC_RSA_WITH_AES_128_GCM_SHA256,
R
Rich Salz 已提交
416 417 418 419 420 421 422 423 424 425 426 427
     TLS1_CK_RSA_WITH_AES_128_GCM_SHA256,
     SSL_kRSA,
     SSL_aRSA,
     SSL_AES128GCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
     },
428 429
    {
     1,
R
Rich Salz 已提交
430
     TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384,
431
     TLS1_RFC_RSA_WITH_AES_256_GCM_SHA384,
R
Rich Salz 已提交
432
     TLS1_CK_RSA_WITH_AES_256_GCM_SHA384,
433 434
     SSL_kRSA,
     SSL_aRSA,
R
Rich Salz 已提交
435 436 437 438 439 440
     SSL_AES256GCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
441 442 443 444 445
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
446
     TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256,
447
     TLS1_RFC_DHE_RSA_WITH_AES_128_GCM_SHA256,
R
Rich Salz 已提交
448
     TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256,
449
     SSL_kDHE,
R
Rich Salz 已提交
450 451 452 453 454 455 456 457 458
     SSL_aRSA,
     SSL_AES128GCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
459 460 461
     },
    {
     1,
R
Rich Salz 已提交
462
     TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384,
463
     TLS1_RFC_DHE_RSA_WITH_AES_256_GCM_SHA384,
R
Rich Salz 已提交
464
     TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384,
465 466
     SSL_kDHE,
     SSL_aRSA,
R
Rich Salz 已提交
467 468 469 470 471 472
     SSL_AES256GCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
473 474 475 476 477
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
478
     TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256,
479
     TLS1_RFC_DHE_DSS_WITH_AES_128_GCM_SHA256,
R
Rich Salz 已提交
480
     TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256,
481
     SSL_kDHE,
R
Rich Salz 已提交
482 483 484 485 486 487 488
     SSL_aDSS,
     SSL_AES128GCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
489 490 491 492 493
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
494
     TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384,
495
     TLS1_RFC_DHE_DSS_WITH_AES_256_GCM_SHA384,
R
Rich Salz 已提交
496 497 498 499 500 501 502 503 504 505 506
     TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384,
     SSL_kDHE,
     SSL_aDSS,
     SSL_AES256GCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
     256,
     256,
507 508 509
     },
    {
     1,
R
Rich Salz 已提交
510
     TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256,
511
     TLS1_RFC_ADH_WITH_AES_128_GCM_SHA256,
R
Rich Salz 已提交
512 513 514 515 516 517 518 519 520
     TLS1_CK_ADH_WITH_AES_128_GCM_SHA256,
     SSL_kDHE,
     SSL_aNULL,
     SSL_AES128GCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
521 522 523 524 525
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
526
     TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384,
527
     TLS1_RFC_ADH_WITH_AES_256_GCM_SHA384,
R
Rich Salz 已提交
528 529 530 531 532 533 534 535 536
     TLS1_CK_ADH_WITH_AES_256_GCM_SHA384,
     SSL_kDHE,
     SSL_aNULL,
     SSL_AES256GCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
537 538 539
     256,
     256,
     },
540 541
    {
     1,
R
Rich Salz 已提交
542
     TLS1_TXT_RSA_WITH_AES_128_CCM,
543
     TLS1_RFC_RSA_WITH_AES_128_CCM,
R
Rich Salz 已提交
544 545 546 547 548 549 550 551 552
     TLS1_CK_RSA_WITH_AES_128_CCM,
     SSL_kRSA,
     SSL_aRSA,
     SSL_AES128CCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
553 554 555 556 557
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
558
     TLS1_TXT_RSA_WITH_AES_256_CCM,
559
     TLS1_RFC_RSA_WITH_AES_256_CCM,
R
Rich Salz 已提交
560 561 562 563 564 565 566 567 568 569 570
     TLS1_CK_RSA_WITH_AES_256_CCM,
     SSL_kRSA,
     SSL_aRSA,
     SSL_AES256CCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     256,
     256,
571 572 573
     },
    {
     1,
R
Rich Salz 已提交
574
     TLS1_TXT_DHE_RSA_WITH_AES_128_CCM,
575
     TLS1_RFC_DHE_RSA_WITH_AES_128_CCM,
R
Rich Salz 已提交
576 577 578 579 580 581 582 583 584
     TLS1_CK_DHE_RSA_WITH_AES_128_CCM,
     SSL_kDHE,
     SSL_aRSA,
     SSL_AES128CCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
585 586 587 588 589
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
590
     TLS1_TXT_DHE_RSA_WITH_AES_256_CCM,
591
     TLS1_RFC_DHE_RSA_WITH_AES_256_CCM,
R
Rich Salz 已提交
592 593 594 595 596 597 598 599 600
     TLS1_CK_DHE_RSA_WITH_AES_256_CCM,
     SSL_kDHE,
     SSL_aRSA,
     SSL_AES256CCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
601 602 603 604 605
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
606
     TLS1_TXT_RSA_WITH_AES_128_CCM_8,
607
     TLS1_RFC_RSA_WITH_AES_128_CCM_8,
R
Rich Salz 已提交
608 609
     TLS1_CK_RSA_WITH_AES_128_CCM_8,
     SSL_kRSA,
610
     SSL_aRSA,
R
Rich Salz 已提交
611
     SSL_AES128CCM8,
612
     SSL_AEAD,
613 614
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
615
     SSL_NOT_DEFAULT | SSL_HIGH,
616 617 618 619 620 621
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
622
     TLS1_TXT_RSA_WITH_AES_256_CCM_8,
623
     TLS1_RFC_RSA_WITH_AES_256_CCM_8,
R
Rich Salz 已提交
624
     TLS1_CK_RSA_WITH_AES_256_CCM_8,
625 626
     SSL_kRSA,
     SSL_aRSA,
R
Rich Salz 已提交
627
     SSL_AES256CCM8,
628
     SSL_AEAD,
629 630
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
631 632
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
633 634 635 636 637
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
638
     TLS1_TXT_DHE_RSA_WITH_AES_128_CCM_8,
639
     TLS1_RFC_DHE_RSA_WITH_AES_128_CCM_8,
R
Rich Salz 已提交
640
     TLS1_CK_DHE_RSA_WITH_AES_128_CCM_8,
641 642
     SSL_kDHE,
     SSL_aRSA,
R
Rich Salz 已提交
643
     SSL_AES128CCM8,
644
     SSL_AEAD,
645 646
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
647
     SSL_NOT_DEFAULT | SSL_HIGH,
648 649 650 651 652 653
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
654
     TLS1_TXT_DHE_RSA_WITH_AES_256_CCM_8,
655
     TLS1_RFC_DHE_RSA_WITH_AES_256_CCM_8,
R
Rich Salz 已提交
656
     TLS1_CK_DHE_RSA_WITH_AES_256_CCM_8,
657 658
     SSL_kDHE,
     SSL_aRSA,
R
Rich Salz 已提交
659
     SSL_AES256CCM8,
660
     SSL_AEAD,
661 662
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
663 664
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
665 666 667 668 669
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
670
     TLS1_TXT_PSK_WITH_AES_128_CCM,
671
     TLS1_RFC_PSK_WITH_AES_128_CCM,
R
Rich Salz 已提交
672 673 674 675
     TLS1_CK_PSK_WITH_AES_128_CCM,
     SSL_kPSK,
     SSL_aPSK,
     SSL_AES128CCM,
676
     SSL_AEAD,
677 678
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
679
     SSL_NOT_DEFAULT | SSL_HIGH,
680 681 682 683 684 685
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
686
     TLS1_TXT_PSK_WITH_AES_256_CCM,
687
     TLS1_RFC_PSK_WITH_AES_256_CCM,
R
Rich Salz 已提交
688 689 690 691
     TLS1_CK_PSK_WITH_AES_256_CCM,
     SSL_kPSK,
     SSL_aPSK,
     SSL_AES256CCM,
692
     SSL_AEAD,
693 694
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
695 696
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
697 698 699 700 701
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
702
     TLS1_TXT_DHE_PSK_WITH_AES_128_CCM,
703
     TLS1_RFC_DHE_PSK_WITH_AES_128_CCM,
R
Rich Salz 已提交
704 705 706 707
     TLS1_CK_DHE_PSK_WITH_AES_128_CCM,
     SSL_kDHEPSK,
     SSL_aPSK,
     SSL_AES128CCM,
708
     SSL_AEAD,
709 710
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
711
     SSL_NOT_DEFAULT | SSL_HIGH,
712 713 714 715 716 717
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
718
     TLS1_TXT_DHE_PSK_WITH_AES_256_CCM,
719
     TLS1_RFC_DHE_PSK_WITH_AES_256_CCM,
R
Rich Salz 已提交
720 721 722 723
     TLS1_CK_DHE_PSK_WITH_AES_256_CCM,
     SSL_kDHEPSK,
     SSL_aPSK,
     SSL_AES256CCM,
724
     SSL_AEAD,
725 726
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
727 728
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
729 730 731
     256,
     256,
     },
732 733
    {
     1,
R
Rich Salz 已提交
734
     TLS1_TXT_PSK_WITH_AES_128_CCM_8,
735
     TLS1_RFC_PSK_WITH_AES_128_CCM_8,
R
Rich Salz 已提交
736
     TLS1_CK_PSK_WITH_AES_128_CCM_8,
737 738
     SSL_kPSK,
     SSL_aPSK,
R
Rich Salz 已提交
739
     SSL_AES128CCM8,
740
     SSL_AEAD,
741 742
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
743
     SSL_NOT_DEFAULT | SSL_HIGH,
744 745 746 747 748 749
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
750
     TLS1_TXT_PSK_WITH_AES_256_CCM_8,
751
     TLS1_RFC_PSK_WITH_AES_256_CCM_8,
R
Rich Salz 已提交
752
     TLS1_CK_PSK_WITH_AES_256_CCM_8,
753 754
     SSL_kPSK,
     SSL_aPSK,
R
Rich Salz 已提交
755
     SSL_AES256CCM8,
756
     SSL_AEAD,
757 758
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
759 760
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
761 762 763
     256,
     256,
     },
764 765
    {
     1,
R
Rich Salz 已提交
766
     TLS1_TXT_DHE_PSK_WITH_AES_128_CCM_8,
767
     TLS1_RFC_DHE_PSK_WITH_AES_128_CCM_8,
R
Rich Salz 已提交
768
     TLS1_CK_DHE_PSK_WITH_AES_128_CCM_8,
769 770
     SSL_kDHEPSK,
     SSL_aPSK,
R
Rich Salz 已提交
771
     SSL_AES128CCM8,
772
     SSL_AEAD,
773 774
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
775
     SSL_NOT_DEFAULT | SSL_HIGH,
776 777 778 779 780 781
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
782
     TLS1_TXT_DHE_PSK_WITH_AES_256_CCM_8,
783
     TLS1_RFC_DHE_PSK_WITH_AES_256_CCM_8,
R
Rich Salz 已提交
784 785
     TLS1_CK_DHE_PSK_WITH_AES_256_CCM_8,
     SSL_kDHEPSK,
786
     SSL_aPSK,
R
Rich Salz 已提交
787
     SSL_AES256CCM8,
788
     SSL_AEAD,
789 790
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
791 792
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
793 794 795 796 797
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
798
     TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM,
799
     TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM,
R
Rich Salz 已提交
800 801 802 803
     TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM,
     SSL_kECDHE,
     SSL_aECDSA,
     SSL_AES128CCM,
804
     SSL_AEAD,
805 806
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
807
     SSL_NOT_DEFAULT | SSL_HIGH,
808 809 810 811 812 813
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
814
     TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM,
815
     TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM,
R
Rich Salz 已提交
816 817 818 819
     TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM,
     SSL_kECDHE,
     SSL_aECDSA,
     SSL_AES256CCM,
820
     SSL_AEAD,
821 822
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
823 824
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
825 826 827 828 829
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
830
     TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM_8,
831
     TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM_8,
R
Rich Salz 已提交
832 833 834 835 836 837 838 839 840
     TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM_8,
     SSL_kECDHE,
     SSL_aECDSA,
     SSL_AES128CCM8,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
841 842 843 844 845
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
846
     TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM_8,
847
     TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM_8,
R
Rich Salz 已提交
848 849 850 851 852 853 854 855 856
     TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM_8,
     SSL_kECDHE,
     SSL_aECDSA,
     SSL_AES256CCM8,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
857 858 859
     256,
     256,
     },
860 861 862
    {
     1,
     TLS1_3_TXT_AES_128_GCM_SHA256,
863
     TLS1_3_RFC_AES_128_GCM_SHA256,
864
     TLS1_3_CK_AES_128_GCM_SHA256,
D
Dr. Stephen Henson 已提交
865
     0, 0,
866 867 868
     SSL_AES128GCM,
     SSL_AEAD,
     TLS1_3_VERSION, TLS1_3_VERSION,
869 870 871 872 873 874 875 876 877 878
     SSL_kANY,
     SSL_aANY,
     SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256,
     128,
     128,
     },
    {
     1,
     TLS1_3_TXT_AES_256_GCM_SHA384,
879
     TLS1_3_RFC_AES_256_GCM_SHA384,
880 881 882 883 884 885
     TLS1_3_CK_AES_256_GCM_SHA384,
     SSL_kANY,
     SSL_aANY,
     SSL_AES256GCM,
     SSL_AEAD,
     TLS1_3_VERSION, TLS1_3_VERSION,
886 887
     0, 0,
     SSL_HIGH,
888 889 890 891 892 893 894 895
     SSL_HANDSHAKE_MAC_SHA384,
     256,
     256,
     },
#if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305)
    {
     1,
     TLS1_3_TXT_CHACHA20_POLY1305_SHA256,
896
     TLS1_3_RFC_CHACHA20_POLY1305_SHA256,
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912
     TLS1_3_CK_CHACHA20_POLY1305_SHA256,
     SSL_kANY,
     SSL_aANY,
     SSL_CHACHA20POLY1305,
     SSL_AEAD,
     TLS1_3_VERSION, TLS1_3_VERSION,
     0, 0,
     SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256,
     256,
     256,
     },
#endif
    {
     1,
     TLS1_3_TXT_AES_128_CCM_SHA256,
913
     TLS1_3_RFC_AES_128_CCM_SHA256,
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928
     TLS1_3_CK_AES_128_CCM_SHA256,
     SSL_kANY,
     SSL_aANY,
     SSL_AES128CCM,
     SSL_AEAD,
     TLS1_3_VERSION, TLS1_3_VERSION,
     0, 0,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256,
     128,
     128,
     },
    {
     1,
     TLS1_3_TXT_AES_128_CCM_8_SHA256,
929
     TLS1_3_RFC_AES_128_CCM_8_SHA256,
930 931 932 933 934 935 936 937 938
     TLS1_3_CK_AES_128_CCM_8_SHA256,
     SSL_kANY,
     SSL_aANY,
     SSL_AES128CCM8,
     SSL_AEAD,
     TLS1_3_VERSION, TLS1_3_VERSION,
     0, 0,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256,
939 940 941
     128,
     128,
     },
942

R
Rich Salz 已提交
943
#ifndef OPENSSL_NO_EC
944 945
    {
     1,
R
Rich Salz 已提交
946
     TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA,
947
     TLS1_RFC_ECDHE_ECDSA_WITH_NULL_SHA,
R
Rich Salz 已提交
948 949 950
     TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA,
     SSL_kECDHE,
     SSL_aECDSA,
951
     SSL_eNULL,
R
Rich Salz 已提交
952
     SSL_SHA1,
T
Todd Short 已提交
953
     TLS1_VERSION, TLS1_2_VERSION,
954
     DTLS1_BAD_VER, DTLS1_2_VERSION,
955
     SSL_STRONG_NONE | SSL_FIPS,
956 957 958 959
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     0,
     0,
     },
960
# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
961 962
    {
     1,
R
Rich Salz 已提交
963
     TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA,
964
     TLS1_RFC_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA,
R
Rich Salz 已提交
965 966 967 968 969
     TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA,
     SSL_kECDHE,
     SSL_aECDSA,
     SSL_3DES,
     SSL_SHA1,
T
Todd Short 已提交
970
     TLS1_VERSION, TLS1_2_VERSION,
971
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
972
     SSL_NOT_DEFAULT | SSL_MEDIUM | SSL_FIPS,
R
Rich Salz 已提交
973 974 975
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     112,
     168,
976
     },
977
# endif
978 979
    {
     1,
R
Rich Salz 已提交
980
     TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
981
     TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
R
Rich Salz 已提交
982 983 984
     TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
     SSL_kECDHE,
     SSL_aECDSA,
985
     SSL_AES128,
R
Rich Salz 已提交
986
     SSL_SHA1,
T
Todd Short 已提交
987
     TLS1_VERSION, TLS1_2_VERSION,
988
     DTLS1_BAD_VER, DTLS1_2_VERSION,
989
     SSL_HIGH | SSL_FIPS,
990 991 992 993 994 995
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
996
     TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
997
     TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
R
Rich Salz 已提交
998 999 1000
     TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
     SSL_kECDHE,
     SSL_aECDSA,
1001
     SSL_AES256,
R
Rich Salz 已提交
1002
     SSL_SHA1,
T
Todd Short 已提交
1003
     TLS1_VERSION, TLS1_2_VERSION,
1004
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1005
     SSL_HIGH | SSL_FIPS,
R
Rich Salz 已提交
1006
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1007 1008 1009 1010 1011
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
1012
     TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA,
1013
     TLS1_RFC_ECDHE_RSA_WITH_NULL_SHA,
R
Rich Salz 已提交
1014 1015 1016
     TLS1_CK_ECDHE_RSA_WITH_NULL_SHA,
     SSL_kECDHE,
     SSL_aRSA,
1017
     SSL_eNULL,
R
Rich Salz 已提交
1018
     SSL_SHA1,
T
Todd Short 已提交
1019
     TLS1_VERSION, TLS1_2_VERSION,
1020
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1021
     SSL_STRONG_NONE | SSL_FIPS,
1022 1023 1024 1025
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     0,
     0,
     },
1026
# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
1027 1028
    {
     1,
R
Rich Salz 已提交
1029
     TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA,
1030
     TLS1_RFC_ECDHE_RSA_WITH_DES_192_CBC3_SHA,
R
Rich Salz 已提交
1031 1032 1033 1034 1035
     TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA,
     SSL_kECDHE,
     SSL_aRSA,
     SSL_3DES,
     SSL_SHA1,
T
Todd Short 已提交
1036
     TLS1_VERSION, TLS1_2_VERSION,
1037
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1038
     SSL_NOT_DEFAULT | SSL_MEDIUM | SSL_FIPS,
R
Rich Salz 已提交
1039 1040 1041
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     112,
     168,
1042
     },
1043
# endif
1044 1045
    {
     1,
R
Rich Salz 已提交
1046
     TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA,
1047
     TLS1_RFC_ECDHE_RSA_WITH_AES_128_CBC_SHA,
R
Rich Salz 已提交
1048 1049
     TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA,
     SSL_kECDHE,
1050 1051
     SSL_aRSA,
     SSL_AES128,
R
Rich Salz 已提交
1052
     SSL_SHA1,
T
Todd Short 已提交
1053
     TLS1_VERSION, TLS1_2_VERSION,
1054
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1055
     SSL_HIGH | SSL_FIPS,
1056 1057 1058 1059 1060 1061
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
1062
     TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA,
1063
     TLS1_RFC_ECDHE_RSA_WITH_AES_256_CBC_SHA,
R
Rich Salz 已提交
1064 1065
     TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA,
     SSL_kECDHE,
1066 1067
     SSL_aRSA,
     SSL_AES256,
R
Rich Salz 已提交
1068
     SSL_SHA1,
T
Todd Short 已提交
1069
     TLS1_VERSION, TLS1_2_VERSION,
1070
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1071
     SSL_HIGH | SSL_FIPS,
R
Rich Salz 已提交
1072
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1073 1074 1075 1076 1077
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
1078
     TLS1_TXT_ECDH_anon_WITH_NULL_SHA,
1079
     TLS1_RFC_ECDH_anon_WITH_NULL_SHA,
R
Rich Salz 已提交
1080 1081 1082
     TLS1_CK_ECDH_anon_WITH_NULL_SHA,
     SSL_kECDHE,
     SSL_aNULL,
1083
     SSL_eNULL,
R
Rich Salz 已提交
1084
     SSL_SHA1,
T
Todd Short 已提交
1085
     TLS1_VERSION, TLS1_2_VERSION,
1086
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1087
     SSL_STRONG_NONE | SSL_FIPS,
1088 1089 1090 1091
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     0,
     0,
     },
1092
# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
1093 1094
    {
     1,
R
Rich Salz 已提交
1095
     TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA,
1096
     TLS1_RFC_ECDH_anon_WITH_DES_192_CBC3_SHA,
R
Rich Salz 已提交
1097 1098 1099 1100 1101
     TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA,
     SSL_kECDHE,
     SSL_aNULL,
     SSL_3DES,
     SSL_SHA1,
T
Todd Short 已提交
1102
     TLS1_VERSION, TLS1_2_VERSION,
1103
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1104
     SSL_NOT_DEFAULT | SSL_MEDIUM | SSL_FIPS,
R
Rich Salz 已提交
1105 1106 1107
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     112,
     168,
1108
     },
1109
# endif
1110 1111
    {
     1,
R
Rich Salz 已提交
1112
     TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA,
1113
     TLS1_RFC_ECDH_anon_WITH_AES_128_CBC_SHA,
R
Rich Salz 已提交
1114 1115 1116 1117 1118
     TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA,
     SSL_kECDHE,
     SSL_aNULL,
     SSL_AES128,
     SSL_SHA1,
T
Todd Short 已提交
1119
     TLS1_VERSION, TLS1_2_VERSION,
1120
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1121 1122 1123 1124 1125
     SSL_NOT_DEFAULT | SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
1126 1127
    {
     1,
R
Rich Salz 已提交
1128
     TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA,
1129
     TLS1_RFC_ECDH_anon_WITH_AES_256_CBC_SHA,
R
Rich Salz 已提交
1130 1131 1132 1133 1134
     TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA,
     SSL_kECDHE,
     SSL_aNULL,
     SSL_AES256,
     SSL_SHA1,
T
Todd Short 已提交
1135
     TLS1_VERSION, TLS1_2_VERSION,
1136
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1137 1138 1139 1140 1141 1142 1143 1144
     SSL_NOT_DEFAULT | SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256,
1145
     TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_SHA256,
R
Rich Salz 已提交
1146 1147 1148 1149
     TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256,
     SSL_kECDHE,
     SSL_aECDSA,
     SSL_AES128,
1150
     SSL_SHA256,
1151 1152
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
1153
     SSL_HIGH | SSL_FIPS,
1154 1155 1156 1157 1158 1159
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
1160
     TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384,
1161
     TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_SHA384,
R
Rich Salz 已提交
1162 1163 1164 1165 1166
     TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384,
     SSL_kECDHE,
     SSL_aECDSA,
     SSL_AES256,
     SSL_SHA384,
1167 1168
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
1169 1170 1171 1172
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
     256,
     256,
1173 1174 1175
     },
    {
     1,
R
Rich Salz 已提交
1176
     TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256,
1177
     TLS1_RFC_ECDHE_RSA_WITH_AES_128_SHA256,
R
Rich Salz 已提交
1178 1179 1180 1181
     TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256,
     SSL_kECDHE,
     SSL_aRSA,
     SSL_AES128,
1182
     SSL_SHA256,
1183 1184
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
1185
     SSL_HIGH | SSL_FIPS,
1186 1187 1188 1189 1190 1191
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
1192
     TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384,
1193
     TLS1_RFC_ECDHE_RSA_WITH_AES_256_SHA384,
R
Rich Salz 已提交
1194 1195
     TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384,
     SSL_kECDHE,
1196
     SSL_aRSA,
R
Rich Salz 已提交
1197 1198
     SSL_AES256,
     SSL_SHA384,
1199 1200
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
1201 1202
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
1203 1204 1205 1206 1207
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
1208
     TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
1209
     TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
R
Rich Salz 已提交
1210 1211 1212 1213 1214
     TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
     SSL_kECDHE,
     SSL_aECDSA,
     SSL_AES128GCM,
     SSL_AEAD,
1215 1216
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
1217
     SSL_HIGH | SSL_FIPS,
1218
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
R
Rich Salz 已提交
1219 1220 1221 1222 1223 1224
     128,
     128,
     },
    {
     1,
     TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
1225
     TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
R
Rich Salz 已提交
1226 1227 1228 1229 1230 1231 1232 1233 1234
     TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
     SSL_kECDHE,
     SSL_aECDSA,
     SSL_AES256GCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
1235 1236 1237 1238 1239
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
1240
     TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
1241
     TLS1_RFC_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
R
Rich Salz 已提交
1242 1243
     TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
     SSL_kECDHE,
1244
     SSL_aRSA,
R
Rich Salz 已提交
1245 1246
     SSL_AES128GCM,
     SSL_AEAD,
1247 1248
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
1249
     SSL_HIGH | SSL_FIPS,
1250
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
R
Rich Salz 已提交
1251 1252
     128,
     128,
1253 1254 1255
     },
    {
     1,
R
Rich Salz 已提交
1256
     TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
1257
     TLS1_RFC_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
R
Rich Salz 已提交
1258 1259 1260 1261 1262
     TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
     SSL_kECDHE,
     SSL_aRSA,
     SSL_AES256GCM,
     SSL_AEAD,
1263 1264
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
R
Rich Salz 已提交
1265 1266
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
1267 1268 1269
     256,
     256,
     },
E
Emilia Kasper 已提交
1270
#endif                          /* OPENSSL_NO_EC */
1271

R
Rich Salz 已提交
1272
#ifndef OPENSSL_NO_PSK
1273 1274
    {
     1,
R
Rich Salz 已提交
1275
     TLS1_TXT_PSK_WITH_NULL_SHA,
1276
     TLS1_RFC_PSK_WITH_NULL_SHA,
R
Rich Salz 已提交
1277 1278 1279
     TLS1_CK_PSK_WITH_NULL_SHA,
     SSL_kPSK,
     SSL_aPSK,
1280 1281
     SSL_eNULL,
     SSL_SHA1,
1282
     SSL3_VERSION, TLS1_2_VERSION,
1283
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1284
     SSL_STRONG_NONE | SSL_FIPS,
1285 1286 1287 1288 1289 1290
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     0,
     0,
     },
    {
     1,
R
Rich Salz 已提交
1291
     TLS1_TXT_DHE_PSK_WITH_NULL_SHA,
1292
     TLS1_RFC_DHE_PSK_WITH_NULL_SHA,
R
Rich Salz 已提交
1293 1294 1295 1296
     TLS1_CK_DHE_PSK_WITH_NULL_SHA,
     SSL_kDHEPSK,
     SSL_aPSK,
     SSL_eNULL,
1297
     SSL_SHA1,
1298
     SSL3_VERSION, TLS1_2_VERSION,
1299
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1300
     SSL_STRONG_NONE | SSL_FIPS,
1301
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
R
Rich Salz 已提交
1302 1303
     0,
     0,
1304 1305 1306
     },
    {
     1,
R
Rich Salz 已提交
1307
     TLS1_TXT_RSA_PSK_WITH_NULL_SHA,
1308
     TLS1_RFC_RSA_PSK_WITH_NULL_SHA,
R
Rich Salz 已提交
1309 1310 1311 1312 1313 1314
     TLS1_CK_RSA_PSK_WITH_NULL_SHA,
     SSL_kRSAPSK,
     SSL_aRSA,
     SSL_eNULL,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
1315
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1316 1317 1318 1319 1320
     SSL_STRONG_NONE | SSL_FIPS,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     0,
     0,
     },
1321
# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
R
Rich Salz 已提交
1322 1323 1324
    {
     1,
     TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA,
1325
     TLS1_RFC_PSK_WITH_3DES_EDE_CBC_SHA,
R
Rich Salz 已提交
1326 1327 1328
     TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA,
     SSL_kPSK,
     SSL_aPSK,
1329 1330
     SSL_3DES,
     SSL_SHA1,
1331
     SSL3_VERSION, TLS1_2_VERSION,
1332
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1333
     SSL_NOT_DEFAULT | SSL_MEDIUM | SSL_FIPS,
1334 1335 1336 1337
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     112,
     168,
     },
1338
# endif
1339 1340
    {
     1,
R
Rich Salz 已提交
1341
     TLS1_TXT_PSK_WITH_AES_128_CBC_SHA,
1342
     TLS1_RFC_PSK_WITH_AES_128_CBC_SHA,
R
Rich Salz 已提交
1343 1344 1345
     TLS1_CK_PSK_WITH_AES_128_CBC_SHA,
     SSL_kPSK,
     SSL_aPSK,
1346 1347
     SSL_AES128,
     SSL_SHA1,
1348
     SSL3_VERSION, TLS1_2_VERSION,
1349
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1350
     SSL_HIGH | SSL_FIPS,
1351 1352 1353 1354 1355 1356
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
1357
     TLS1_TXT_PSK_WITH_AES_256_CBC_SHA,
1358
     TLS1_RFC_PSK_WITH_AES_256_CBC_SHA,
R
Rich Salz 已提交
1359 1360 1361
     TLS1_CK_PSK_WITH_AES_256_CBC_SHA,
     SSL_kPSK,
     SSL_aPSK,
1362 1363
     SSL_AES256,
     SSL_SHA1,
1364
     SSL3_VERSION, TLS1_2_VERSION,
1365
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1366
     SSL_HIGH | SSL_FIPS,
1367 1368 1369 1370
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
1371
# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
1372 1373
    {
     1,
R
Rich Salz 已提交
1374
     TLS1_TXT_DHE_PSK_WITH_3DES_EDE_CBC_SHA,
1375
     TLS1_RFC_DHE_PSK_WITH_3DES_EDE_CBC_SHA,
R
Rich Salz 已提交
1376 1377 1378 1379
     TLS1_CK_DHE_PSK_WITH_3DES_EDE_CBC_SHA,
     SSL_kDHEPSK,
     SSL_aPSK,
     SSL_3DES,
1380
     SSL_SHA1,
1381
     SSL3_VERSION, TLS1_2_VERSION,
1382
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1383
     SSL_NOT_DEFAULT | SSL_MEDIUM | SSL_FIPS,
1384
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
R
Rich Salz 已提交
1385 1386
     112,
     168,
1387
     },
1388
# endif
1389 1390
    {
     1,
R
Rich Salz 已提交
1391
     TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA,
1392
     TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA,
R
Rich Salz 已提交
1393 1394 1395 1396 1397 1398
     TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA,
     SSL_kDHEPSK,
     SSL_aPSK,
     SSL_AES128,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
1399
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1400
     SSL_HIGH | SSL_FIPS,
1401 1402 1403 1404 1405 1406
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
1407
     TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA,
1408
     TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA,
R
Rich Salz 已提交
1409 1410 1411 1412 1413 1414
     TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA,
     SSL_kDHEPSK,
     SSL_aPSK,
     SSL_AES256,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
1415
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1416 1417 1418 1419 1420
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
1421
# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
R
Rich Salz 已提交
1422 1423 1424
    {
     1,
     TLS1_TXT_RSA_PSK_WITH_3DES_EDE_CBC_SHA,
1425
     TLS1_RFC_RSA_PSK_WITH_3DES_EDE_CBC_SHA,
R
Rich Salz 已提交
1426 1427
     TLS1_CK_RSA_PSK_WITH_3DES_EDE_CBC_SHA,
     SSL_kRSAPSK,
1428 1429 1430
     SSL_aRSA,
     SSL_3DES,
     SSL_SHA1,
1431
     SSL3_VERSION, TLS1_2_VERSION,
1432
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1433
     SSL_NOT_DEFAULT | SSL_MEDIUM | SSL_FIPS,
1434 1435 1436 1437
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     112,
     168,
     },
1438
# endif
1439 1440
    {
     1,
R
Rich Salz 已提交
1441
     TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA,
1442
     TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA,
R
Rich Salz 已提交
1443 1444
     TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA,
     SSL_kRSAPSK,
1445 1446 1447
     SSL_aRSA,
     SSL_AES128,
     SSL_SHA1,
1448
     SSL3_VERSION, TLS1_2_VERSION,
1449
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1450
     SSL_HIGH | SSL_FIPS,
1451 1452 1453 1454 1455 1456
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
1457
     TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA,
1458
     TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA,
R
Rich Salz 已提交
1459 1460
     TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA,
     SSL_kRSAPSK,
1461 1462 1463
     SSL_aRSA,
     SSL_AES256,
     SSL_SHA1,
1464
     SSL3_VERSION, TLS1_2_VERSION,
1465
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1466
     SSL_HIGH | SSL_FIPS,
1467 1468 1469 1470 1471 1472
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
1473
     TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256,
1474
     TLS1_RFC_PSK_WITH_AES_128_GCM_SHA256,
R
Rich Salz 已提交
1475 1476 1477 1478 1479 1480 1481 1482 1483
     TLS1_CK_PSK_WITH_AES_128_GCM_SHA256,
     SSL_kPSK,
     SSL_aPSK,
     SSL_AES128GCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1484 1485 1486 1487 1488
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
1489
     TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384,
1490
     TLS1_RFC_PSK_WITH_AES_256_GCM_SHA384,
R
Rich Salz 已提交
1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501
     TLS1_CK_PSK_WITH_AES_256_GCM_SHA384,
     SSL_kPSK,
     SSL_aPSK,
     SSL_AES256GCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
     256,
     256,
1502 1503 1504
     },
    {
     1,
R
Rich Salz 已提交
1505
     TLS1_TXT_DHE_PSK_WITH_AES_128_GCM_SHA256,
1506
     TLS1_RFC_DHE_PSK_WITH_AES_128_GCM_SHA256,
R
Rich Salz 已提交
1507 1508 1509 1510 1511 1512 1513 1514 1515
     TLS1_CK_DHE_PSK_WITH_AES_128_GCM_SHA256,
     SSL_kDHEPSK,
     SSL_aPSK,
     SSL_AES128GCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1516 1517 1518 1519 1520
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
1521
     TLS1_TXT_DHE_PSK_WITH_AES_256_GCM_SHA384,
1522
     TLS1_RFC_DHE_PSK_WITH_AES_256_GCM_SHA384,
R
Rich Salz 已提交
1523 1524 1525 1526 1527 1528 1529 1530 1531
     TLS1_CK_DHE_PSK_WITH_AES_256_GCM_SHA384,
     SSL_kDHEPSK,
     SSL_aPSK,
     SSL_AES256GCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
1532 1533 1534 1535 1536
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
1537
     TLS1_TXT_RSA_PSK_WITH_AES_128_GCM_SHA256,
1538
     TLS1_RFC_RSA_PSK_WITH_AES_128_GCM_SHA256,
R
Rich Salz 已提交
1539 1540
     TLS1_CK_RSA_PSK_WITH_AES_128_GCM_SHA256,
     SSL_kRSAPSK,
1541
     SSL_aRSA,
R
Rich Salz 已提交
1542 1543 1544 1545 1546 1547 1548 1549
     SSL_AES128GCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
1550 1551 1552
     },
    {
     1,
R
Rich Salz 已提交
1553
     TLS1_TXT_RSA_PSK_WITH_AES_256_GCM_SHA384,
1554
     TLS1_RFC_RSA_PSK_WITH_AES_256_GCM_SHA384,
R
Rich Salz 已提交
1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565
     TLS1_CK_RSA_PSK_WITH_AES_256_GCM_SHA384,
     SSL_kRSAPSK,
     SSL_aRSA,
     SSL_AES256GCM,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
     256,
     256,
1566 1567 1568
     },
    {
     1,
R
Rich Salz 已提交
1569
     TLS1_TXT_PSK_WITH_AES_128_CBC_SHA256,
1570
     TLS1_RFC_PSK_WITH_AES_128_CBC_SHA256,
R
Rich Salz 已提交
1571 1572 1573
     TLS1_CK_PSK_WITH_AES_128_CBC_SHA256,
     SSL_kPSK,
     SSL_aPSK,
1574
     SSL_AES128,
R
Rich Salz 已提交
1575 1576
     SSL_SHA256,
     TLS1_VERSION, TLS1_2_VERSION,
1577
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1578
     SSL_HIGH | SSL_FIPS,
1579 1580 1581 1582 1583 1584
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
1585
     TLS1_TXT_PSK_WITH_AES_256_CBC_SHA384,
1586
     TLS1_RFC_PSK_WITH_AES_256_CBC_SHA384,
R
Rich Salz 已提交
1587 1588 1589 1590 1591 1592
     TLS1_CK_PSK_WITH_AES_256_CBC_SHA384,
     SSL_kPSK,
     SSL_aPSK,
     SSL_AES256,
     SSL_SHA384,
     TLS1_VERSION, TLS1_2_VERSION,
1593
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1594 1595 1596 1597
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
     256,
     256,
1598 1599 1600
     },
    {
     1,
R
Rich Salz 已提交
1601
     TLS1_TXT_PSK_WITH_NULL_SHA256,
1602
     TLS1_RFC_PSK_WITH_NULL_SHA256,
R
Rich Salz 已提交
1603 1604 1605 1606 1607 1608
     TLS1_CK_PSK_WITH_NULL_SHA256,
     SSL_kPSK,
     SSL_aPSK,
     SSL_eNULL,
     SSL_SHA256,
     TLS1_VERSION, TLS1_2_VERSION,
1609
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1610
     SSL_STRONG_NONE | SSL_FIPS,
1611
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
R
Rich Salz 已提交
1612 1613
     0,
     0,
1614 1615 1616
     },
    {
     1,
R
Rich Salz 已提交
1617
     TLS1_TXT_PSK_WITH_NULL_SHA384,
1618
     TLS1_RFC_PSK_WITH_NULL_SHA384,
R
Rich Salz 已提交
1619 1620 1621 1622 1623 1624
     TLS1_CK_PSK_WITH_NULL_SHA384,
     SSL_kPSK,
     SSL_aPSK,
     SSL_eNULL,
     SSL_SHA384,
     TLS1_VERSION, TLS1_2_VERSION,
1625
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1626 1627 1628 1629
     SSL_STRONG_NONE | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
     0,
     0,
1630 1631 1632
     },
    {
     1,
R
Rich Salz 已提交
1633
     TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA256,
1634
     TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA256,
R
Rich Salz 已提交
1635 1636 1637 1638 1639 1640
     TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA256,
     SSL_kDHEPSK,
     SSL_aPSK,
     SSL_AES128,
     SSL_SHA256,
     TLS1_VERSION, TLS1_2_VERSION,
1641
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1642
     SSL_HIGH | SSL_FIPS,
1643
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
R
Rich Salz 已提交
1644 1645
     128,
     128,
1646 1647 1648
     },
    {
     1,
R
Rich Salz 已提交
1649
     TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA384,
1650
     TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA384,
R
Rich Salz 已提交
1651 1652 1653
     TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA384,
     SSL_kDHEPSK,
     SSL_aPSK,
1654
     SSL_AES256,
R
Rich Salz 已提交
1655 1656
     SSL_SHA384,
     TLS1_VERSION, TLS1_2_VERSION,
1657
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1658 1659
     SSL_HIGH | SSL_FIPS,
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
1660 1661 1662 1663 1664
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
1665
     TLS1_TXT_DHE_PSK_WITH_NULL_SHA256,
1666
     TLS1_RFC_DHE_PSK_WITH_NULL_SHA256,
R
Rich Salz 已提交
1667 1668 1669 1670
     TLS1_CK_DHE_PSK_WITH_NULL_SHA256,
     SSL_kDHEPSK,
     SSL_aPSK,
     SSL_eNULL,
1671
     SSL_SHA256,
R
Rich Salz 已提交
1672
     TLS1_VERSION, TLS1_2_VERSION,
1673
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1674 1675 1676 1677
     SSL_STRONG_NONE | SSL_FIPS,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     0,
     0,
1678 1679 1680
     },
    {
     1,
R
Rich Salz 已提交
1681
     TLS1_TXT_DHE_PSK_WITH_NULL_SHA384,
1682
     TLS1_RFC_DHE_PSK_WITH_NULL_SHA384,
R
Rich Salz 已提交
1683 1684 1685 1686
     TLS1_CK_DHE_PSK_WITH_NULL_SHA384,
     SSL_kDHEPSK,
     SSL_aPSK,
     SSL_eNULL,
1687
     SSL_SHA384,
R
Rich Salz 已提交
1688
     TLS1_VERSION, TLS1_2_VERSION,
1689
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1690
     SSL_STRONG_NONE | SSL_FIPS,
1691
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
R
Rich Salz 已提交
1692 1693
     0,
     0,
1694 1695 1696
     },
    {
     1,
R
Rich Salz 已提交
1697
     TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA256,
1698
     TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA256,
R
Rich Salz 已提交
1699 1700
     TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA256,
     SSL_kRSAPSK,
1701 1702 1703
     SSL_aRSA,
     SSL_AES128,
     SSL_SHA256,
R
Rich Salz 已提交
1704
     TLS1_VERSION, TLS1_2_VERSION,
1705
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1706
     SSL_HIGH | SSL_FIPS,
R
Rich Salz 已提交
1707
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1708 1709 1710 1711 1712
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
1713
     TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA384,
1714
     TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA384,
R
Rich Salz 已提交
1715 1716
     TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA384,
     SSL_kRSAPSK,
1717 1718 1719
     SSL_aRSA,
     SSL_AES256,
     SSL_SHA384,
R
Rich Salz 已提交
1720
     TLS1_VERSION, TLS1_2_VERSION,
1721
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1722
     SSL_HIGH | SSL_FIPS,
1723 1724 1725 1726 1727 1728
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
     256,
     256,
     },
    {
     1,
R
Rich Salz 已提交
1729
     TLS1_TXT_RSA_PSK_WITH_NULL_SHA256,
1730
     TLS1_RFC_RSA_PSK_WITH_NULL_SHA256,
R
Rich Salz 已提交
1731 1732
     TLS1_CK_RSA_PSK_WITH_NULL_SHA256,
     SSL_kRSAPSK,
1733
     SSL_aRSA,
R
Rich Salz 已提交
1734 1735 1736
     SSL_eNULL,
     SSL_SHA256,
     TLS1_VERSION, TLS1_2_VERSION,
1737
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1738 1739 1740 1741
     SSL_STRONG_NONE | SSL_FIPS,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     0,
     0,
1742 1743 1744
     },
    {
     1,
R
Rich Salz 已提交
1745
     TLS1_TXT_RSA_PSK_WITH_NULL_SHA384,
1746
     TLS1_RFC_RSA_PSK_WITH_NULL_SHA384,
R
Rich Salz 已提交
1747 1748
     TLS1_CK_RSA_PSK_WITH_NULL_SHA384,
     SSL_kRSAPSK,
1749
     SSL_aRSA,
R
Rich Salz 已提交
1750 1751 1752
     SSL_eNULL,
     SSL_SHA384,
     TLS1_VERSION, TLS1_2_VERSION,
1753
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1754
     SSL_STRONG_NONE | SSL_FIPS,
1755
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
R
Rich Salz 已提交
1756 1757
     0,
     0,
1758
     },
R
Rich Salz 已提交
1759
# ifndef OPENSSL_NO_EC
1760
#  ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
1761 1762 1763
    {
     1,
     TLS1_TXT_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA,
1764
     TLS1_RFC_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA,
1765 1766 1767 1768 1769
     TLS1_CK_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA,
     SSL_kECDHEPSK,
     SSL_aPSK,
     SSL_3DES,
     SSL_SHA1,
T
Todd Short 已提交
1770
     TLS1_VERSION, TLS1_2_VERSION,
1771
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1772
     SSL_NOT_DEFAULT | SSL_MEDIUM | SSL_FIPS,
1773 1774 1775 1776
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     112,
     168,
     },
1777
#  endif
1778 1779 1780
    {
     1,
     TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA,
1781
     TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA,
1782 1783 1784 1785 1786
     TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA,
     SSL_kECDHEPSK,
     SSL_aPSK,
     SSL_AES128,
     SSL_SHA1,
T
Todd Short 已提交
1787
     TLS1_VERSION, TLS1_2_VERSION,
1788
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1789
     SSL_HIGH | SSL_FIPS,
1790 1791 1792 1793 1794 1795 1796
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA,
1797
     TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA,
1798 1799 1800 1801 1802
     TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA,
     SSL_kECDHEPSK,
     SSL_aPSK,
     SSL_AES256,
     SSL_SHA1,
T
Todd Short 已提交
1803
     TLS1_VERSION, TLS1_2_VERSION,
1804
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1805
     SSL_HIGH | SSL_FIPS,
1806 1807 1808 1809 1810 1811 1812
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA256,
1813
     TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA256,
1814 1815 1816 1817 1818
     TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA256,
     SSL_kECDHEPSK,
     SSL_aPSK,
     SSL_AES128,
     SSL_SHA256,
1819
     TLS1_VERSION, TLS1_2_VERSION,
1820
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1821
     SSL_HIGH | SSL_FIPS,
1822 1823 1824 1825 1826 1827 1828
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA384,
1829
     TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA384,
1830 1831 1832 1833 1834
     TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA384,
     SSL_kECDHEPSK,
     SSL_aPSK,
     SSL_AES256,
     SSL_SHA384,
1835
     TLS1_VERSION, TLS1_2_VERSION,
1836
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1837
     SSL_HIGH | SSL_FIPS,
1838 1839 1840 1841 1842 1843 1844
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA,
1845
     TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA,
1846 1847 1848 1849 1850
     TLS1_CK_ECDHE_PSK_WITH_NULL_SHA,
     SSL_kECDHEPSK,
     SSL_aPSK,
     SSL_eNULL,
     SSL_SHA1,
T
Todd Short 已提交
1851
     TLS1_VERSION, TLS1_2_VERSION,
1852
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1853
     SSL_STRONG_NONE | SSL_FIPS,
1854 1855 1856 1857 1858 1859 1860
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     0,
     0,
     },
    {
     1,
     TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA256,
1861
     TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA256,
1862 1863 1864 1865 1866
     TLS1_CK_ECDHE_PSK_WITH_NULL_SHA256,
     SSL_kECDHEPSK,
     SSL_aPSK,
     SSL_eNULL,
     SSL_SHA256,
1867
     TLS1_VERSION, TLS1_2_VERSION,
1868
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1869
     SSL_STRONG_NONE | SSL_FIPS,
1870 1871 1872 1873 1874 1875 1876
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     0,
     0,
     },
    {
     1,
     TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA384,
1877
     TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA384,
1878 1879 1880 1881 1882
     TLS1_CK_ECDHE_PSK_WITH_NULL_SHA384,
     SSL_kECDHEPSK,
     SSL_aPSK,
     SSL_eNULL,
     SSL_SHA384,
1883
     TLS1_VERSION, TLS1_2_VERSION,
1884
     DTLS1_BAD_VER, DTLS1_2_VERSION,
1885
     SSL_STRONG_NONE | SSL_FIPS,
1886 1887 1888 1889
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
     0,
     0,
     },
E
Emilia Kasper 已提交
1890 1891
# endif                         /* OPENSSL_NO_EC */
#endif                          /* OPENSSL_NO_PSK */
1892

R
Rich Salz 已提交
1893
#ifndef OPENSSL_NO_SRP
1894
# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
R
Rich Salz 已提交
1895 1896 1897
    {
     1,
     TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA,
1898
     TLS1_RFC_SRP_SHA_WITH_3DES_EDE_CBC_SHA,
R
Rich Salz 已提交
1899 1900 1901 1902 1903 1904
     TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA,
     SSL_kSRP,
     SSL_aSRP,
     SSL_3DES,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
1905
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1906
     SSL_NOT_DEFAULT | SSL_MEDIUM,
R
Rich Salz 已提交
1907 1908 1909 1910 1911 1912 1913
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     112,
     168,
     },
    {
     1,
     TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA,
1914
     TLS1_RFC_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA,
R
Rich Salz 已提交
1915 1916 1917 1918 1919 1920
     TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA,
     SSL_kSRP,
     SSL_aRSA,
     SSL_3DES,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
1921
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1922
     SSL_NOT_DEFAULT | SSL_MEDIUM,
R
Rich Salz 已提交
1923 1924 1925 1926 1927 1928 1929
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     112,
     168,
     },
    {
     1,
     TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA,
1930
     TLS1_RFC_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA,
R
Rich Salz 已提交
1931 1932 1933 1934 1935 1936
     TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA,
     SSL_kSRP,
     SSL_aDSS,
     SSL_3DES,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
1937
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1938
     SSL_NOT_DEFAULT | SSL_MEDIUM,
R
Rich Salz 已提交
1939 1940 1941 1942
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     112,
     168,
     },
1943
# endif
R
Rich Salz 已提交
1944 1945 1946
    {
     1,
     TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA,
1947
     TLS1_RFC_SRP_SHA_WITH_AES_128_CBC_SHA,
R
Rich Salz 已提交
1948 1949 1950 1951 1952 1953
     TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA,
     SSL_kSRP,
     SSL_aSRP,
     SSL_AES128,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
1954
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1955 1956 1957 1958 1959 1960 1961 1962
     SSL_HIGH,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA,
1963
     TLS1_RFC_SRP_SHA_RSA_WITH_AES_128_CBC_SHA,
R
Rich Salz 已提交
1964 1965 1966 1967 1968 1969
     TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA,
     SSL_kSRP,
     SSL_aRSA,
     SSL_AES128,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
1970
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1971 1972 1973 1974 1975 1976 1977 1978
     SSL_HIGH,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA,
1979
     TLS1_RFC_SRP_SHA_DSS_WITH_AES_128_CBC_SHA,
R
Rich Salz 已提交
1980 1981 1982 1983 1984 1985
     TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA,
     SSL_kSRP,
     SSL_aDSS,
     SSL_AES128,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
1986
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
1987 1988 1989 1990 1991 1992 1993 1994
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA,
1995
     TLS1_RFC_SRP_SHA_WITH_AES_256_CBC_SHA,
R
Rich Salz 已提交
1996 1997 1998 1999 2000 2001
     TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA,
     SSL_kSRP,
     SSL_aSRP,
     SSL_AES256,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
2002
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
2003 2004 2005 2006 2007 2008 2009 2010
     SSL_HIGH,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA,
2011
     TLS1_RFC_SRP_SHA_RSA_WITH_AES_256_CBC_SHA,
R
Rich Salz 已提交
2012 2013 2014 2015 2016 2017
     TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA,
     SSL_kSRP,
     SSL_aRSA,
     SSL_AES256,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
2018
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
2019 2020 2021 2022 2023 2024 2025 2026
     SSL_HIGH,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA,
2027
     TLS1_RFC_SRP_SHA_DSS_WITH_AES_256_CBC_SHA,
R
Rich Salz 已提交
2028 2029 2030 2031 2032 2033
     TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA,
     SSL_kSRP,
     SSL_aDSS,
     SSL_AES256,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
2034
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
2035 2036 2037 2038 2039
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
E
Emilia Kasper 已提交
2040
#endif                          /* OPENSSL_NO_SRP */
R
Rich Salz 已提交
2041 2042 2043 2044 2045 2046

#if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305)
# ifndef OPENSSL_NO_RSA
    {
     1,
     TLS1_TXT_DHE_RSA_WITH_CHACHA20_POLY1305,
2047
     TLS1_RFC_DHE_RSA_WITH_CHACHA20_POLY1305,
R
Rich Salz 已提交
2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059
     TLS1_CK_DHE_RSA_WITH_CHACHA20_POLY1305,
     SSL_kDHE,
     SSL_aRSA,
     SSL_CHACHA20POLY1305,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     256,
     256,
     },
E
Emilia Kasper 已提交
2060
# endif                         /* OPENSSL_NO_RSA */
R
Rich Salz 已提交
2061 2062 2063 2064 2065

# ifndef OPENSSL_NO_EC
    {
     1,
     TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305,
2066
     TLS1_RFC_ECDHE_RSA_WITH_CHACHA20_POLY1305,
R
Rich Salz 已提交
2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081
     TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305,
     SSL_kECDHE,
     SSL_aRSA,
     SSL_CHACHA20POLY1305,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
2082
     TLS1_RFC_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
R
Rich Salz 已提交
2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094
     TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
     SSL_kECDHE,
     SSL_aECDSA,
     SSL_CHACHA20POLY1305,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     256,
     256,
     },
E
Emilia Kasper 已提交
2095
# endif                         /* OPENSSL_NO_EC */
R
Rich Salz 已提交
2096 2097 2098 2099 2100

# ifndef OPENSSL_NO_PSK
    {
     1,
     TLS1_TXT_PSK_WITH_CHACHA20_POLY1305,
2101
     TLS1_RFC_PSK_WITH_CHACHA20_POLY1305,
R
Rich Salz 已提交
2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116
     TLS1_CK_PSK_WITH_CHACHA20_POLY1305,
     SSL_kPSK,
     SSL_aPSK,
     SSL_CHACHA20POLY1305,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_ECDHE_PSK_WITH_CHACHA20_POLY1305,
2117
     TLS1_RFC_ECDHE_PSK_WITH_CHACHA20_POLY1305,
R
Rich Salz 已提交
2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132
     TLS1_CK_ECDHE_PSK_WITH_CHACHA20_POLY1305,
     SSL_kECDHEPSK,
     SSL_aPSK,
     SSL_CHACHA20POLY1305,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_DHE_PSK_WITH_CHACHA20_POLY1305,
2133
     TLS1_RFC_DHE_PSK_WITH_CHACHA20_POLY1305,
R
Rich Salz 已提交
2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148
     TLS1_CK_DHE_PSK_WITH_CHACHA20_POLY1305,
     SSL_kDHEPSK,
     SSL_aPSK,
     SSL_CHACHA20POLY1305,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_RSA_PSK_WITH_CHACHA20_POLY1305,
2149
     TLS1_RFC_RSA_PSK_WITH_CHACHA20_POLY1305,
R
Rich Salz 已提交
2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161
     TLS1_CK_RSA_PSK_WITH_CHACHA20_POLY1305,
     SSL_kRSAPSK,
     SSL_aRSA,
     SSL_CHACHA20POLY1305,
     SSL_AEAD,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     256,
     256,
     },
E
Emilia Kasper 已提交
2162 2163 2164
# endif                         /* OPENSSL_NO_PSK */
#endif                          /* !defined(OPENSSL_NO_CHACHA) &&
                                 * !defined(OPENSSL_NO_POLY1305) */
R
Rich Salz 已提交
2165 2166 2167 2168 2169

#ifndef OPENSSL_NO_CAMELLIA
    {
     1,
     TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA256,
2170
     TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA256,
R
Rich Salz 已提交
2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185
     TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA256,
     SSL_kRSA,
     SSL_aRSA,
     SSL_CAMELLIA128,
     SSL_SHA256,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256,
2186
     TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256,
R
Rich Salz 已提交
2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201
     TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256,
     SSL_kEDH,
     SSL_aDSS,
     SSL_CAMELLIA128,
     SSL_SHA256,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256,
2202
     TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256,
R
Rich Salz 已提交
2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217
     TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256,
     SSL_kEDH,
     SSL_aRSA,
     SSL_CAMELLIA128,
     SSL_SHA256,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA256,
2218
     TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA256,
R
Rich Salz 已提交
2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233
     TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA256,
     SSL_kEDH,
     SSL_aNULL,
     SSL_CAMELLIA128,
     SSL_SHA256,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA256,
2234
     TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA256,
R
Rich Salz 已提交
2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249
     TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA256,
     SSL_kRSA,
     SSL_aRSA,
     SSL_CAMELLIA256,
     SSL_SHA256,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256,
2250
     TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256,
R
Rich Salz 已提交
2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265
     TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256,
     SSL_kEDH,
     SSL_aDSS,
     SSL_CAMELLIA256,
     SSL_SHA256,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256,
2266
     TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256,
R
Rich Salz 已提交
2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281
     TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256,
     SSL_kEDH,
     SSL_aRSA,
     SSL_CAMELLIA256,
     SSL_SHA256,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA256,
2282
     TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA256,
R
Rich Salz 已提交
2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297
     TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA256,
     SSL_kEDH,
     SSL_aNULL,
     SSL_CAMELLIA256,
     SSL_SHA256,
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA,
2298
     TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA,
R
Rich Salz 已提交
2299 2300 2301 2302 2303 2304
     TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA,
     SSL_kRSA,
     SSL_aRSA,
     SSL_CAMELLIA256,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
2305
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
2306 2307 2308 2309 2310 2311 2312 2313
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA,
2314
     TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA,
R
Rich Salz 已提交
2315 2316 2317 2318 2319 2320
     TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA,
     SSL_kDHE,
     SSL_aDSS,
     SSL_CAMELLIA256,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
2321
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
2322 2323 2324 2325 2326 2327 2328 2329
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
2330
     TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
R
Rich Salz 已提交
2331 2332 2333 2334 2335 2336
     TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
     SSL_kDHE,
     SSL_aRSA,
     SSL_CAMELLIA256,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
2337
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
2338 2339 2340 2341 2342 2343 2344 2345
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA,
2346
     TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA,
R
Rich Salz 已提交
2347 2348 2349 2350 2351 2352
     TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA,
     SSL_kDHE,
     SSL_aNULL,
     SSL_CAMELLIA256,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
2353
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
2354 2355 2356 2357 2358 2359 2360 2361
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     256,
     256,
     },
    {
     1,
     TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA,
2362
     TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA,
R
Rich Salz 已提交
2363 2364 2365 2366 2367 2368
     TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA,
     SSL_kRSA,
     SSL_aRSA,
     SSL_CAMELLIA128,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
2369
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
2370 2371 2372 2373 2374 2375 2376 2377
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA,
2378
     TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA,
R
Rich Salz 已提交
2379 2380 2381 2382 2383 2384
     TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA,
     SSL_kDHE,
     SSL_aDSS,
     SSL_CAMELLIA128,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
2385
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
2386 2387 2388 2389 2390 2391 2392 2393
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
2394
     TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
R
Rich Salz 已提交
2395 2396 2397 2398 2399 2400
     TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
     SSL_kDHE,
     SSL_aRSA,
     SSL_CAMELLIA128,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
2401
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
2402 2403 2404 2405 2406 2407 2408 2409
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
    {
     1,
     TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA,
2410
     TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA,
R
Rich Salz 已提交
2411 2412 2413 2414 2415 2416
     TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA,
     SSL_kDHE,
     SSL_aNULL,
     SSL_CAMELLIA128,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
2417
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
2418 2419 2420 2421 2422 2423 2424 2425
     SSL_NOT_DEFAULT | SSL_HIGH,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },

# ifndef OPENSSL_NO_EC
    {
2426 2427
     1,
     TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256,
2428
     TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256,
2429 2430 2431 2432 2433
     TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256,
     SSL_kECDHE,
     SSL_aECDSA,
     SSL_CAMELLIA128,
     SSL_SHA256,
2434 2435
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
2436
     SSL_NOT_DEFAULT | SSL_HIGH,
2437 2438
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
E
Emilia Kasper 已提交
2439 2440
     128,
     },
R
Rich Salz 已提交
2441
    {
2442 2443
     1,
     TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384,
2444
     TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384,
2445 2446 2447 2448 2449
     TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384,
     SSL_kECDHE,
     SSL_aECDSA,
     SSL_CAMELLIA256,
     SSL_SHA384,
2450 2451
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
2452
     SSL_NOT_DEFAULT | SSL_HIGH,
2453 2454
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
     256,
E
Emilia Kasper 已提交
2455 2456
     256,
     },
R
Rich Salz 已提交
2457
    {
2458 2459
     1,
     TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256,
2460
     TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256,
2461 2462 2463 2464 2465
     TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256,
     SSL_kECDHE,
     SSL_aRSA,
     SSL_CAMELLIA128,
     SSL_SHA256,
2466 2467
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
2468
     SSL_NOT_DEFAULT | SSL_HIGH,
2469 2470
     SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
     128,
E
Emilia Kasper 已提交
2471 2472
     128,
     },
R
Rich Salz 已提交
2473
    {
2474 2475
     1,
     TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384,
2476
     TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384,
2477 2478 2479 2480 2481
     TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384,
     SSL_kECDHE,
     SSL_aRSA,
     SSL_CAMELLIA256,
     SSL_SHA384,
2482 2483
     TLS1_2_VERSION, TLS1_2_VERSION,
     DTLS1_2_VERSION, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
2484
     SSL_NOT_DEFAULT | SSL_HIGH,
2485 2486
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
     256,
E
Emilia Kasper 已提交
2487 2488 2489
     256,
     },
# endif                         /* OPENSSL_NO_EC */
B
Ben Laurie 已提交
2490

R
Rich Salz 已提交
2491 2492
# ifndef OPENSSL_NO_PSK
    {
2493 2494
     1,
     TLS1_TXT_PSK_WITH_CAMELLIA_128_CBC_SHA256,
2495
     TLS1_RFC_PSK_WITH_CAMELLIA_128_CBC_SHA256,
2496 2497 2498 2499 2500
     TLS1_CK_PSK_WITH_CAMELLIA_128_CBC_SHA256,
     SSL_kPSK,
     SSL_aPSK,
     SSL_CAMELLIA128,
     SSL_SHA256,
2501
     TLS1_VERSION, TLS1_2_VERSION,
2502
     DTLS1_BAD_VER, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
2503
     SSL_NOT_DEFAULT | SSL_HIGH,
2504 2505
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
E
Emilia Kasper 已提交
2506 2507
     128,
     },
R
Rich Salz 已提交
2508
    {
2509 2510
     1,
     TLS1_TXT_PSK_WITH_CAMELLIA_256_CBC_SHA384,
2511
     TLS1_RFC_PSK_WITH_CAMELLIA_256_CBC_SHA384,
2512 2513 2514 2515 2516
     TLS1_CK_PSK_WITH_CAMELLIA_256_CBC_SHA384,
     SSL_kPSK,
     SSL_aPSK,
     SSL_CAMELLIA256,
     SSL_SHA384,
2517
     TLS1_VERSION, TLS1_2_VERSION,
2518
     DTLS1_BAD_VER, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
2519
     SSL_NOT_DEFAULT | SSL_HIGH,
2520 2521
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
     256,
E
Emilia Kasper 已提交
2522 2523
     256,
     },
R
Rich Salz 已提交
2524
    {
2525 2526
     1,
     TLS1_TXT_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256,
2527
     TLS1_RFC_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256,
2528 2529 2530 2531 2532
     TLS1_CK_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256,
     SSL_kDHEPSK,
     SSL_aPSK,
     SSL_CAMELLIA128,
     SSL_SHA256,
2533
     TLS1_VERSION, TLS1_2_VERSION,
2534
     DTLS1_BAD_VER, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
2535
     SSL_NOT_DEFAULT | SSL_HIGH,
2536 2537
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
E
Emilia Kasper 已提交
2538 2539
     128,
     },
R
Rich Salz 已提交
2540
    {
2541 2542
     1,
     TLS1_TXT_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384,
2543
     TLS1_RFC_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384,
2544 2545 2546 2547 2548
     TLS1_CK_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384,
     SSL_kDHEPSK,
     SSL_aPSK,
     SSL_CAMELLIA256,
     SSL_SHA384,
2549
     TLS1_VERSION, TLS1_2_VERSION,
2550
     DTLS1_BAD_VER, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
2551
     SSL_NOT_DEFAULT | SSL_HIGH,
2552 2553
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
     256,
E
Emilia Kasper 已提交
2554 2555
     256,
     },
R
Rich Salz 已提交
2556
    {
2557 2558
     1,
     TLS1_TXT_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256,
2559
     TLS1_RFC_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256,
2560 2561 2562 2563 2564
     TLS1_CK_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256,
     SSL_kRSAPSK,
     SSL_aRSA,
     SSL_CAMELLIA128,
     SSL_SHA256,
2565
     TLS1_VERSION, TLS1_2_VERSION,
2566
     DTLS1_BAD_VER, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
2567
     SSL_NOT_DEFAULT | SSL_HIGH,
2568 2569
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
E
Emilia Kasper 已提交
2570 2571
     128,
     },
R
Rich Salz 已提交
2572
    {
2573 2574
     1,
     TLS1_TXT_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384,
2575
     TLS1_RFC_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384,
2576 2577 2578 2579 2580
     TLS1_CK_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384,
     SSL_kRSAPSK,
     SSL_aRSA,
     SSL_CAMELLIA256,
     SSL_SHA384,
2581
     TLS1_VERSION, TLS1_2_VERSION,
2582
     DTLS1_BAD_VER, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
2583
     SSL_NOT_DEFAULT | SSL_HIGH,
2584 2585
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
     256,
E
Emilia Kasper 已提交
2586 2587
     256,
     },
2588 2589
    {
     1,
R
Rich Salz 已提交
2590
     TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256,
2591
     TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256,
R
Rich Salz 已提交
2592 2593
     TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256,
     SSL_kECDHEPSK,
2594
     SSL_aPSK,
R
Rich Salz 已提交
2595 2596 2597
     SSL_CAMELLIA128,
     SSL_SHA256,
     TLS1_VERSION, TLS1_2_VERSION,
2598
     DTLS1_BAD_VER, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
2599
     SSL_NOT_DEFAULT | SSL_HIGH,
R
Rich Salz 已提交
2600
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2601
     128,
E
Emilia Kasper 已提交
2602 2603
     128,
     },
2604 2605
    {
     1,
R
Rich Salz 已提交
2606
     TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384,
2607
     TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384,
R
Rich Salz 已提交
2608 2609
     TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384,
     SSL_kECDHEPSK,
2610
     SSL_aPSK,
R
Rich Salz 已提交
2611 2612 2613
     SSL_CAMELLIA256,
     SSL_SHA384,
     TLS1_VERSION, TLS1_2_VERSION,
2614
     DTLS1_BAD_VER, DTLS1_2_VERSION,
E
Emilia Kasper 已提交
2615
     SSL_NOT_DEFAULT | SSL_HIGH,
R
Rich Salz 已提交
2616
     SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
2617
     256,
E
Emilia Kasper 已提交
2618 2619 2620
     256,
     },
# endif                         /* OPENSSL_NO_PSK */
2621

E
Emilia Kasper 已提交
2622
#endif                          /* OPENSSL_NO_CAMELLIA */
2623

P
Pauli 已提交
2624
#ifndef OPENSSL_NO_GOST
2625 2626
    {
     1,
R
Rich Salz 已提交
2627
     "GOST2001-GOST89-GOST89",
2628
     "TLS_GOSTR341001_WITH_28147_CNT_IMIT",
R
Rich Salz 已提交
2629 2630 2631 2632 2633 2634
     0x3000081,
     SSL_kGOST,
     SSL_aGOST01,
     SSL_eGOST2814789CNT,
     SSL_GOST89MAC,
     TLS1_VERSION, TLS1_2_VERSION,
2635
     0, 0,
R
Rich Salz 已提交
2636 2637
     SSL_HIGH,
     SSL_HANDSHAKE_MAC_GOST94 | TLS1_PRF_GOST94 | TLS1_STREAM_MAC,
2638
     256,
E
Emilia Kasper 已提交
2639 2640
     256,
     },
R
Rich Salz 已提交
2641 2642 2643
    {
     1,
     "GOST2001-NULL-GOST94",
2644
     "TLS_GOSTR341001_WITH_NULL_GOSTR3411",
R
Rich Salz 已提交
2645 2646 2647 2648 2649 2650
     0x3000083,
     SSL_kGOST,
     SSL_aGOST01,
     SSL_eNULL,
     SSL_GOST94,
     TLS1_VERSION, TLS1_2_VERSION,
2651
     0, 0,
R
Rich Salz 已提交
2652 2653 2654
     SSL_STRONG_NONE,
     SSL_HANDSHAKE_MAC_GOST94 | TLS1_PRF_GOST94,
     0,
E
Emilia Kasper 已提交
2655 2656
     0,
     },
R
Rich Salz 已提交
2657 2658 2659
    {
     1,
     "GOST2012-GOST8912-GOST8912",
2660
     NULL,
R
Rich Salz 已提交
2661 2662 2663 2664 2665 2666
     0x0300ff85,
     SSL_kGOST,
     SSL_aGOST12 | SSL_aGOST01,
     SSL_eGOST2814789CNT12,
     SSL_GOST89MAC12,
     TLS1_VERSION, TLS1_2_VERSION,
2667
     0, 0,
R
Rich Salz 已提交
2668 2669
     SSL_HIGH,
     SSL_HANDSHAKE_MAC_GOST12_256 | TLS1_PRF_GOST12_256 | TLS1_STREAM_MAC,
2670
     256,
E
Emilia Kasper 已提交
2671 2672
     256,
     },
R
Rich Salz 已提交
2673 2674 2675
    {
     1,
     "GOST2012-NULL-GOST12",
2676
     NULL,
R
Rich Salz 已提交
2677 2678 2679 2680 2681 2682
     0x0300ff87,
     SSL_kGOST,
     SSL_aGOST12 | SSL_aGOST01,
     SSL_eNULL,
     SSL_GOST12_256,
     TLS1_VERSION, TLS1_2_VERSION,
2683
     0, 0,
R
Rich Salz 已提交
2684 2685 2686
     SSL_STRONG_NONE,
     SSL_HANDSHAKE_MAC_GOST12_256 | TLS1_PRF_GOST12_256 | TLS1_STREAM_MAC,
     0,
E
Emilia Kasper 已提交
2687 2688 2689
     0,
     },
#endif                          /* OPENSSL_NO_GOST */
2690

R
Rich Salz 已提交
2691
#ifndef OPENSSL_NO_IDEA
2692 2693
    {
     1,
R
Rich Salz 已提交
2694
     SSL3_TXT_RSA_IDEA_128_SHA,
2695
     SSL3_RFC_RSA_IDEA_128_SHA,
R
Rich Salz 已提交
2696 2697 2698 2699 2700 2701
     SSL3_CK_RSA_IDEA_128_SHA,
     SSL_kRSA,
     SSL_aRSA,
     SSL_IDEA,
     SSL_SHA1,
     SSL3_VERSION, TLS1_1_VERSION,
2702
     DTLS1_BAD_VER, DTLS1_VERSION,
R
Rich Salz 已提交
2703 2704
     SSL_NOT_DEFAULT | SSL_MEDIUM,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2705 2706 2707
     128,
     128,
     },
R
Rich Salz 已提交
2708
#endif
2709

R
Rich Salz 已提交
2710
#ifndef OPENSSL_NO_SEED
2711 2712
    {
     1,
R
Rich Salz 已提交
2713
     TLS1_TXT_RSA_WITH_SEED_SHA,
2714
     TLS1_RFC_RSA_WITH_SEED_SHA,
R
Rich Salz 已提交
2715 2716 2717 2718 2719 2720
     TLS1_CK_RSA_WITH_SEED_SHA,
     SSL_kRSA,
     SSL_aRSA,
     SSL_SEED,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
2721
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
2722 2723 2724 2725
     SSL_NOT_DEFAULT | SSL_MEDIUM,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
2726 2727 2728
     },
    {
     1,
R
Rich Salz 已提交
2729
     TLS1_TXT_DHE_DSS_WITH_SEED_SHA,
2730
     TLS1_RFC_DHE_DSS_WITH_SEED_SHA,
R
Rich Salz 已提交
2731 2732 2733 2734 2735 2736
     TLS1_CK_DHE_DSS_WITH_SEED_SHA,
     SSL_kDHE,
     SSL_aDSS,
     SSL_SEED,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
2737
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
2738 2739
     SSL_NOT_DEFAULT | SSL_MEDIUM,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2740 2741 2742 2743 2744
     128,
     128,
     },
    {
     1,
R
Rich Salz 已提交
2745
     TLS1_TXT_DHE_RSA_WITH_SEED_SHA,
2746
     TLS1_RFC_DHE_RSA_WITH_SEED_SHA,
R
Rich Salz 已提交
2747 2748 2749 2750 2751 2752
     TLS1_CK_DHE_RSA_WITH_SEED_SHA,
     SSL_kDHE,
     SSL_aRSA,
     SSL_SEED,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
2753
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
2754 2755 2756 2757
     SSL_NOT_DEFAULT | SSL_MEDIUM,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
2758 2759 2760
     },
    {
     1,
R
Rich Salz 已提交
2761
     TLS1_TXT_ADH_WITH_SEED_SHA,
2762
     TLS1_RFC_ADH_WITH_SEED_SHA,
R
Rich Salz 已提交
2763 2764 2765 2766 2767 2768
     TLS1_CK_ADH_WITH_SEED_SHA,
     SSL_kDHE,
     SSL_aNULL,
     SSL_SEED,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
2769
     DTLS1_BAD_VER, DTLS1_2_VERSION,
R
Rich Salz 已提交
2770 2771
     SSL_NOT_DEFAULT | SSL_MEDIUM,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2772 2773 2774
     128,
     128,
     },
E
Emilia Kasper 已提交
2775
#endif                          /* OPENSSL_NO_SEED */
2776

R
Rich Salz 已提交
2777 2778 2779 2780
#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
    {
     1,
     SSL3_TXT_RSA_RC4_128_MD5,
2781
     SSL3_RFC_RSA_RC4_128_MD5,
R
Rich Salz 已提交
2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793
     SSL3_CK_RSA_RC4_128_MD5,
     SSL_kRSA,
     SSL_aRSA,
     SSL_RC4,
     SSL_MD5,
     SSL3_VERSION, TLS1_2_VERSION,
     0, 0,
     SSL_NOT_DEFAULT | SSL_MEDIUM,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
     },
2794 2795
    {
     1,
R
Rich Salz 已提交
2796
     SSL3_TXT_RSA_RC4_128_SHA,
2797
     SSL3_RFC_RSA_RC4_128_SHA,
R
Rich Salz 已提交
2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808
     SSL3_CK_RSA_RC4_128_SHA,
     SSL_kRSA,
     SSL_aRSA,
     SSL_RC4,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
     0, 0,
     SSL_NOT_DEFAULT | SSL_MEDIUM,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
2809 2810 2811
     },
    {
     1,
R
Rich Salz 已提交
2812
     SSL3_TXT_ADH_RC4_128_MD5,
2813
     SSL3_RFC_ADH_RC4_128_MD5,
R
Rich Salz 已提交
2814 2815 2816 2817 2818 2819 2820 2821 2822
     SSL3_CK_ADH_RC4_128_MD5,
     SSL_kDHE,
     SSL_aNULL,
     SSL_RC4,
     SSL_MD5,
     SSL3_VERSION, TLS1_2_VERSION,
     0, 0,
     SSL_NOT_DEFAULT | SSL_MEDIUM,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2823 2824 2825 2826
     128,
     128,
     },

R
Rich Salz 已提交
2827
# ifndef OPENSSL_NO_EC
2828 2829
    {
     1,
R
Rich Salz 已提交
2830
     TLS1_TXT_ECDHE_PSK_WITH_RC4_128_SHA,
2831
     TLS1_RFC_ECDHE_PSK_WITH_RC4_128_SHA,
R
Rich Salz 已提交
2832 2833 2834 2835 2836
     TLS1_CK_ECDHE_PSK_WITH_RC4_128_SHA,
     SSL_kECDHEPSK,
     SSL_aPSK,
     SSL_RC4,
     SSL_SHA1,
T
Todd Short 已提交
2837
     TLS1_VERSION, TLS1_2_VERSION,
R
Rich Salz 已提交
2838 2839 2840 2841 2842
     0, 0,
     SSL_NOT_DEFAULT | SSL_MEDIUM,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
2843
     },
A
Andy Polyakov 已提交
2844 2845
    {
     1,
R
Rich Salz 已提交
2846
     TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA,
2847
     TLS1_RFC_ECDH_anon_WITH_RC4_128_SHA,
R
Rich Salz 已提交
2848
     TLS1_CK_ECDH_anon_WITH_RC4_128_SHA,
A
Andy Polyakov 已提交
2849
     SSL_kECDHE,
R
Rich Salz 已提交
2850 2851 2852
     SSL_aNULL,
     SSL_RC4,
     SSL_SHA1,
T
Todd Short 已提交
2853
     TLS1_VERSION, TLS1_2_VERSION,
R
Rich Salz 已提交
2854 2855 2856 2857 2858
     0, 0,
     SSL_NOT_DEFAULT | SSL_MEDIUM,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
A
Andy Polyakov 已提交
2859 2860 2861
     },
    {
     1,
R
Rich Salz 已提交
2862
     TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA,
2863
     TLS1_RFC_ECDHE_ECDSA_WITH_RC4_128_SHA,
R
Rich Salz 已提交
2864
     TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA,
A
Andy Polyakov 已提交
2865 2866
     SSL_kECDHE,
     SSL_aECDSA,
R
Rich Salz 已提交
2867 2868
     SSL_RC4,
     SSL_SHA1,
T
Todd Short 已提交
2869
     TLS1_VERSION, TLS1_2_VERSION,
R
Rich Salz 已提交
2870 2871 2872 2873 2874
     0, 0,
     SSL_NOT_DEFAULT | SSL_MEDIUM,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
A
Andy Polyakov 已提交
2875 2876 2877
     },
    {
     1,
R
Rich Salz 已提交
2878
     TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA,
2879
     TLS1_RFC_ECDHE_RSA_WITH_RC4_128_SHA,
R
Rich Salz 已提交
2880 2881
     TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA,
     SSL_kECDHE,
A
Andy Polyakov 已提交
2882
     SSL_aRSA,
R
Rich Salz 已提交
2883 2884
     SSL_RC4,
     SSL_SHA1,
T
Todd Short 已提交
2885
     TLS1_VERSION, TLS1_2_VERSION,
R
Rich Salz 已提交
2886 2887 2888 2889 2890
     0, 0,
     SSL_NOT_DEFAULT | SSL_MEDIUM,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
A
Andy Polyakov 已提交
2891
     },
E
Emilia Kasper 已提交
2892
# endif                         /* OPENSSL_NO_EC */
R
Rich Salz 已提交
2893

A
Andy Polyakov 已提交
2894 2895 2896
# ifndef OPENSSL_NO_PSK
    {
     1,
R
Rich Salz 已提交
2897
     TLS1_TXT_PSK_WITH_RC4_128_SHA,
2898
     TLS1_RFC_PSK_WITH_RC4_128_SHA,
R
Rich Salz 已提交
2899
     TLS1_CK_PSK_WITH_RC4_128_SHA,
A
Andy Polyakov 已提交
2900 2901
     SSL_kPSK,
     SSL_aPSK,
R
Rich Salz 已提交
2902 2903 2904 2905 2906 2907 2908 2909
     SSL_RC4,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
     0, 0,
     SSL_NOT_DEFAULT | SSL_MEDIUM,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
A
Andy Polyakov 已提交
2910 2911 2912
     },
    {
     1,
R
Rich Salz 已提交
2913
     TLS1_TXT_RSA_PSK_WITH_RC4_128_SHA,
2914
     TLS1_RFC_RSA_PSK_WITH_RC4_128_SHA,
R
Rich Salz 已提交
2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925
     TLS1_CK_RSA_PSK_WITH_RC4_128_SHA,
     SSL_kRSAPSK,
     SSL_aRSA,
     SSL_RC4,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
     0, 0,
     SSL_NOT_DEFAULT | SSL_MEDIUM,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
A
Andy Polyakov 已提交
2926 2927 2928
     },
    {
     1,
R
Rich Salz 已提交
2929
     TLS1_TXT_DHE_PSK_WITH_RC4_128_SHA,
2930
     TLS1_RFC_DHE_PSK_WITH_RC4_128_SHA,
R
Rich Salz 已提交
2931
     TLS1_CK_DHE_PSK_WITH_RC4_128_SHA,
A
Andy Polyakov 已提交
2932 2933
     SSL_kDHEPSK,
     SSL_aPSK,
R
Rich Salz 已提交
2934 2935 2936 2937 2938 2939 2940 2941
     SSL_RC4,
     SSL_SHA1,
     SSL3_VERSION, TLS1_2_VERSION,
     0, 0,
     SSL_NOT_DEFAULT | SSL_MEDIUM,
     SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
     128,
     128,
A
Andy Polyakov 已提交
2942
     },
E
Emilia Kasper 已提交
2943
# endif                         /* OPENSSL_NO_PSK */
R
Rich Salz 已提交
2944

E
Emilia Kasper 已提交
2945
#endif                          /* OPENSSL_NO_WEAK_SSL_CIPHERS */
2946

2947 2948
};

2949 2950 2951 2952 2953 2954 2955 2956 2957
/*
 * The list of known Signalling Cipher-Suite Value "ciphers", non-valid
 * values stuffed into the ciphers field of the wire protocol for signalling
 * purposes.
 */
static SSL_CIPHER ssl3_scsvs[] = {
    {
     0,
     "TLS_EMPTY_RENEGOTIATION_INFO_SCSV",
2958
     "TLS_EMPTY_RENEGOTIATION_INFO_SCSV",
2959 2960 2961 2962 2963 2964
     SSL3_CK_SCSV,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
     0,
     "TLS_FALLBACK_SCSV",
2965
     "TLS_FALLBACK_SCSV",
2966 2967 2968 2969 2970
     SSL3_CK_FALLBACK_SCSV,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
};

R
Rich Salz 已提交
2971 2972 2973 2974 2975
static int cipher_compare(const void *a, const void *b)
{
    const SSL_CIPHER *ap = (const SSL_CIPHER *)a;
    const SSL_CIPHER *bp = (const SSL_CIPHER *)b;

R
Richard Levitte 已提交
2976 2977 2978
    if (ap->id == bp->id)
        return 0;
    return ap->id < bp->id ? -1 : 1;
R
Rich Salz 已提交
2979 2980 2981 2982
}

void ssl_sort_cipher_list(void)
{
2983
    qsort(ssl3_ciphers, SSL3_NUM_CIPHERS, sizeof ssl3_ciphers[0],
R
Rich Salz 已提交
2984
          cipher_compare);
2985
    qsort(ssl3_scsvs, SSL3_NUM_SCSVS, sizeof ssl3_scsvs[0], cipher_compare);
R
Rich Salz 已提交
2986 2987
}

2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001
const SSL3_ENC_METHOD SSLv3_enc_data = {
    ssl3_enc,
    n_ssl3_mac,
    ssl3_setup_key_block,
    ssl3_generate_master_secret,
    ssl3_change_cipher_state,
    ssl3_final_finish_mac,
    SSL3_MD_CLIENT_FINISHED_CONST, 4,
    SSL3_MD_SERVER_FINISHED_CONST, 4,
    ssl3_alert_code,
    (int (*)(SSL *, unsigned char *, size_t, const char *,
             size_t, const unsigned char *, size_t,
             int use_context))ssl_undefined_function,
    0,
M
Matt Caswell 已提交
3002
    ssl3_set_handshake_header,
3003
    tls_close_construct_packet,
3004 3005
    ssl3_handshake_write
};
3006

3007
long ssl3_default_timeout(void)
3008 3009 3010 3011 3012 3013 3014
{
    /*
     * 2 hours, the 24 hours mentioned in the SSLv3 spec is way too long for
     * http, the cache would over fill
     */
    return (60 * 60 * 2);
}
3015

U
Ulf Möller 已提交
3016
int ssl3_num_ciphers(void)
3017 3018 3019
{
    return (SSL3_NUM_CIPHERS);
}
3020

3021
const SSL_CIPHER *ssl3_get_cipher(unsigned int u)
3022 3023 3024 3025 3026 3027
{
    if (u < SSL3_NUM_CIPHERS)
        return (&(ssl3_ciphers[SSL3_NUM_CIPHERS - 1 - u]));
    else
        return (NULL);
}
3028

M
Matt Caswell 已提交
3029
int ssl3_set_handshake_header(SSL *s, WPACKET *pkt, int htype)
3030
{
3031 3032 3033 3034
    /* No header in the event of a CCS */
    if (htype == SSL3_MT_CHANGE_CIPHER_SPEC)
        return 1;

3035
    /* Set the content type and 3 bytes for the message len */
3036
    if (!WPACKET_put_bytes_u8(pkt, htype)
M
Matt Caswell 已提交
3037
            || !WPACKET_start_sub_packet_u24(pkt))
3038 3039 3040 3041 3042
        return 0;

    return 1;
}

D
Dr. Stephen Henson 已提交
3043
int ssl3_handshake_write(SSL *s)
3044 3045 3046
{
    return ssl3_do_write(s, SSL3_RT_HANDSHAKE);
}
D
Dr. Stephen Henson 已提交
3047

U
Ulf Möller 已提交
3048
int ssl3_new(SSL *s)
3049 3050
{
    SSL3_STATE *s3;
3051

R
Rich Salz 已提交
3052
    if ((s3 = OPENSSL_zalloc(sizeof(*s3))) == NULL)
3053 3054
        goto err;
    s->s3 = s3;
B
Ben Laurie 已提交
3055

B
Ben Laurie 已提交
3056
#ifndef OPENSSL_NO_SRP
V
Viktor Dukhovni 已提交
3057
    if (!SSL_SRP_CTX_init(s))
E
Emilia Kasper 已提交
3058
        goto err;
B
Ben Laurie 已提交
3059
#endif
3060 3061 3062 3063

    if (!s->method->ssl_clear(s))
        return 0;

M
Matt Caswell 已提交
3064
    return 1;
3065
 err:
M
Matt Caswell 已提交
3066
    return 0;
3067
}
3068

U
Ulf Möller 已提交
3069
void ssl3_free(SSL *s)
3070
{
3071
    if (s == NULL || s->s3 == NULL)
3072
        return;
B
Ben Laurie 已提交
3073

3074
    ssl3_cleanup_key_block(s);
3075

D
Dr. Stephen Henson 已提交
3076
#if !defined(OPENSSL_NO_EC) || !defined(OPENSSL_NO_DH)
3077 3078
    EVP_PKEY_free(s->s3->peer_tmp);
    s->s3->peer_tmp = NULL;
D
Dr. Stephen Henson 已提交
3079 3080
    EVP_PKEY_free(s->s3->tmp.pkey);
    s->s3->tmp.pkey = NULL;
B
Bodo Möller 已提交
3081 3082
#endif

3083
    OPENSSL_free(s->s3->tmp.ctype);
3084
    sk_X509_NAME_pop_free(s->s3->tmp.peer_ca_names, X509_NAME_free);
D
Dr. Stephen Henson 已提交
3085 3086 3087
    OPENSSL_free(s->s3->tmp.ciphers_raw);
    OPENSSL_clear_free(s->s3->tmp.pms, s->s3->tmp.pmslen);
    OPENSSL_free(s->s3->tmp.peer_sigalgs);
3088
    ssl3_free_digest_list(s);
R
Rich Salz 已提交
3089
    OPENSSL_free(s->s3->alpn_selected);
T
Todd Short 已提交
3090
    OPENSSL_free(s->s3->alpn_proposed);
A
Adam Langley 已提交
3091

B
Ben Laurie 已提交
3092
#ifndef OPENSSL_NO_SRP
3093
    SSL_SRP_CTX_free(s);
B
Ben Laurie 已提交
3094
#endif
R
Rich Salz 已提交
3095
    OPENSSL_clear_free(s->s3, sizeof(*s->s3));
3096 3097
    s->s3 = NULL;
}
3098

3099
int ssl3_clear(SSL *s)
3100 3101
{
    ssl3_cleanup_key_block(s);
3102
    OPENSSL_free(s->s3->tmp.ctype);
3103
    sk_X509_NAME_pop_free(s->s3->tmp.peer_ca_names, X509_NAME_free);
D
Dr. Stephen Henson 已提交
3104 3105 3106
    OPENSSL_free(s->s3->tmp.ciphers_raw);
    OPENSSL_clear_free(s->s3->tmp.pms, s->s3->tmp.pmslen);
    OPENSSL_free(s->s3->tmp.peer_sigalgs);
3107

D
Dr. Stephen Henson 已提交
3108
#if !defined(OPENSSL_NO_EC) || !defined(OPENSSL_NO_DH)
D
Dr. Stephen Henson 已提交
3109
    EVP_PKEY_free(s->s3->tmp.pkey);
3110
    EVP_PKEY_free(s->s3->peer_tmp);
E
Emilia Kasper 已提交
3111
#endif                          /* !OPENSSL_NO_EC */
3112

3113
    ssl3_free_digest_list(s);
3114

T
Todd Short 已提交
3115 3116
    OPENSSL_free(s->s3->alpn_selected);
    OPENSSL_free(s->s3->alpn_proposed);
3117

T
Todd Short 已提交
3118
    /* NULL/zero-out everything in the s3 struct */
R
Rich Salz 已提交
3119
    memset(s->s3, 0, sizeof(*s->s3));
3120

3121 3122
    if (!ssl_free_wbio_buffer(s))
        return 0;
3123 3124

    s->version = SSL3_VERSION;
B
Ben Laurie 已提交
3125

3126
#if !defined(OPENSSL_NO_NEXTPROTONEG)
R
Rich Salz 已提交
3127 3128 3129
    OPENSSL_free(s->ext.npn);
    s->ext.npn = NULL;
    s->ext.npn_len = 0;
B
Ben Laurie 已提交
3130
#endif
3131 3132

    return 1;
3133
}
3134

B
Ben Laurie 已提交
3135
#ifndef OPENSSL_NO_SRP
3136 3137
static char *srp_password_from_info_cb(SSL *s, void *arg)
{
R
Rich Salz 已提交
3138
    return OPENSSL_strdup(s->srp_ctx.info);
3139
}
B
Ben Laurie 已提交
3140 3141
#endif

E
Emilia Kasper 已提交
3142
static int ssl3_set_req_cert_type(CERT *c, const unsigned char *p, size_t len);
3143

3144
long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
3145 3146
{
    int ret = 0;
3147

3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163
    switch (cmd) {
    case SSL_CTRL_GET_CLIENT_CERT_REQUEST:
        break;
    case SSL_CTRL_GET_NUM_RENEGOTIATIONS:
        ret = s->s3->num_renegotiations;
        break;
    case SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS:
        ret = s->s3->num_renegotiations;
        s->s3->num_renegotiations = 0;
        break;
    case SSL_CTRL_GET_TOTAL_RENEGOTIATIONS:
        ret = s->s3->total_renegotiations;
        break;
    case SSL_CTRL_GET_FLAGS:
        ret = (int)(s->s3->flags);
        break;
3164
#ifndef OPENSSL_NO_DH
3165 3166 3167
    case SSL_CTRL_SET_TMP_DH:
        {
            DH *dh = (DH *)parg;
3168
            EVP_PKEY *pkdh = NULL;
3169 3170 3171 3172
            if (dh == NULL) {
                SSLerr(SSL_F_SSL3_CTRL, ERR_R_PASSED_NULL_PARAMETER);
                return (ret);
            }
3173 3174 3175 3176 3177
            pkdh = ssl_dh_to_pkey(dh);
            if (pkdh == NULL) {
                SSLerr(SSL_F_SSL3_CTRL, ERR_R_MALLOC_FAILURE);
                return 0;
            }
3178
            if (!ssl_security(s, SSL_SECOP_TMP_DH,
3179
                              EVP_PKEY_security_bits(pkdh), 0, pkdh)) {
3180
                SSLerr(SSL_F_SSL3_CTRL, SSL_R_DH_KEY_TOO_SMALL);
3181 3182
                EVP_PKEY_free(pkdh);
                return ret;
3183
            }
3184 3185
            EVP_PKEY_free(s->cert->dh_tmp);
            s->cert->dh_tmp = pkdh;
3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196
            ret = 1;
        }
        break;
    case SSL_CTRL_SET_TMP_DH_CB:
        {
            SSLerr(SSL_F_SSL3_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
            return (ret);
        }
    case SSL_CTRL_SET_DH_AUTO:
        s->cert->dh_tmp_auto = larg;
        return 1;
3197
#endif
3198
#ifndef OPENSSL_NO_EC
3199 3200
    case SSL_CTRL_SET_TMP_ECDH:
        {
3201 3202
            const EC_GROUP *group = NULL;
            int nid;
3203 3204 3205

            if (parg == NULL) {
                SSLerr(SSL_F_SSL3_CTRL, ERR_R_PASSED_NULL_PARAMETER);
3206
                return 0;
3207
            }
3208 3209 3210 3211
            group = EC_KEY_get0_group((const EC_KEY *)parg);
            if (group == NULL) {
                SSLerr(SSL_F_SSL3_CTRL, EC_R_MISSING_PARAMETERS);
                return 0;
3212
            }
3213 3214 3215
            nid = EC_GROUP_get_curve_name(group);
            if (nid == NID_undef)
                return 0;
R
Rich Salz 已提交
3216 3217
            return tls1_set_groups(&s->ext.supportedgroups,
                                   &s->ext.supportedgroups_len,
3218
                                   &nid, 1);
3219 3220
        }
        break;
3221
#endif                          /* !OPENSSL_NO_EC */
3222 3223
    case SSL_CTRL_SET_TLSEXT_HOSTNAME:
        if (larg == TLSEXT_NAMETYPE_host_name) {
V
Viktor Dukhovni 已提交
3224 3225
            size_t len;

R
Rich Salz 已提交
3226 3227
            OPENSSL_free(s->ext.hostname);
            s->ext.hostname = NULL;
3228 3229 3230 3231

            ret = 1;
            if (parg == NULL)
                break;
V
Viktor Dukhovni 已提交
3232 3233
            len = strlen((char *)parg);
            if (len == 0 || len > TLSEXT_MAXLEN_host_name) {
3234 3235 3236
                SSLerr(SSL_F_SSL3_CTRL, SSL_R_SSL3_EXT_INVALID_SERVERNAME);
                return 0;
            }
R
Rich Salz 已提交
3237
            if ((s->ext.hostname = OPENSSL_strdup((char *)parg)) == NULL) {
3238 3239 3240 3241 3242 3243 3244 3245 3246
                SSLerr(SSL_F_SSL3_CTRL, ERR_R_INTERNAL_ERROR);
                return 0;
            }
        } else {
            SSLerr(SSL_F_SSL3_CTRL, SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE);
            return 0;
        }
        break;
    case SSL_CTRL_SET_TLSEXT_DEBUG_ARG:
R
Rich Salz 已提交
3247
        s->ext.debug_arg = parg;
3248 3249 3250
        ret = 1;
        break;

3251
    case SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE:
R
Rich Salz 已提交
3252
        ret = s->ext.status_type;
3253 3254
        break;

3255
    case SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE:
R
Rich Salz 已提交
3256
        s->ext.status_type = larg;
3257 3258 3259 3260
        ret = 1;
        break;

    case SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS:
R
Rich Salz 已提交
3261
        *(STACK_OF(X509_EXTENSION) **)parg = s->ext.ocsp.exts;
3262 3263 3264 3265
        ret = 1;
        break;

    case SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS:
R
Rich Salz 已提交
3266
        s->ext.ocsp.exts = parg;
3267 3268 3269 3270
        ret = 1;
        break;

    case SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS:
R
Rich Salz 已提交
3271
        *(STACK_OF(OCSP_RESPID) **)parg = s->ext.ocsp.ids;
3272 3273 3274 3275
        ret = 1;
        break;

    case SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS:
R
Rich Salz 已提交
3276
        s->ext.ocsp.ids = parg;
3277 3278 3279 3280
        ret = 1;
        break;

    case SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP:
R
Rich Salz 已提交
3281 3282 3283
        *(unsigned char **)parg = s->ext.ocsp.resp;
        if (s->ext.ocsp.resp_len == 0
                || s->ext.ocsp.resp_len > LONG_MAX)
M
Matt Caswell 已提交
3284
            return -1;
R
Rich Salz 已提交
3285
        return (long)s->ext.ocsp.resp_len;
3286 3287

    case SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP:
R
Rich Salz 已提交
3288 3289 3290
        OPENSSL_free(s->ext.ocsp.resp);
        s->ext.ocsp.resp = parg;
        s->ext.ocsp.resp_len = larg;
3291 3292 3293
        ret = 1;
        break;

3294 3295 3296 3297 3298 3299 3300
#ifndef OPENSSL_NO_HEARTBEATS
    case SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT:
    case SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING:
    case SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS:
        break;
#endif

3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325
    case SSL_CTRL_CHAIN:
        if (larg)
            return ssl_cert_set1_chain(s, NULL, (STACK_OF(X509) *)parg);
        else
            return ssl_cert_set0_chain(s, NULL, (STACK_OF(X509) *)parg);

    case SSL_CTRL_CHAIN_CERT:
        if (larg)
            return ssl_cert_add1_chain_cert(s, NULL, (X509 *)parg);
        else
            return ssl_cert_add0_chain_cert(s, NULL, (X509 *)parg);

    case SSL_CTRL_GET_CHAIN_CERTS:
        *(STACK_OF(X509) **)parg = s->cert->key->chain;
        break;

    case SSL_CTRL_SELECT_CURRENT_CERT:
        return ssl_cert_select_current(s->cert, (X509 *)parg);

    case SSL_CTRL_SET_CURRENT_CERT:
        if (larg == SSL_CERT_SET_SERVER) {
            const SSL_CIPHER *cipher;
            if (!s->server)
                return 0;
            cipher = s->s3->tmp.new_cipher;
D
Dr. Stephen Henson 已提交
3326
            if (cipher == NULL)
3327 3328 3329 3330 3331 3332 3333
                return 0;
            /*
             * No certificate for unauthenticated ciphersuites or using SRP
             * authentication
             */
            if (cipher->algorithm_auth & (SSL_aNULL | SSL_aSRP))
                return 2;
3334
            if (s->s3->tmp.cert == NULL)
3335
                return 0;
3336
            s->cert->key = s->s3->tmp.cert;
3337 3338 3339
            return 1;
        }
        return ssl_cert_set_current(s->cert, larg);
3340

3341
#ifndef OPENSSL_NO_EC
3342
    case SSL_CTRL_GET_GROUPS:
3343 3344 3345
        {
            unsigned char *clist;
            size_t clistlen;
R
Rich Salz 已提交
3346

3347 3348
            if (!s->session)
                return 0;
R
Rich Salz 已提交
3349 3350
            clist = s->session->ext.supportedgroups;
            clistlen = s->session->ext.supportedgroups_len / 2;
3351 3352 3353 3354 3355 3356
            if (parg) {
                size_t i;
                int *cptr = parg;
                unsigned int cid, nid;
                for (i = 0; i < clistlen; i++) {
                    n2s(clist, cid);
3357
                    /* TODO(TLS1.3): Handle DH groups here */
3358
                    nid = tls1_ec_curve_id2nid(cid, NULL);
3359 3360 3361 3362 3363 3364 3365 3366 3367
                    if (nid != 0)
                        cptr[i] = nid;
                    else
                        cptr[i] = TLSEXT_nid_unknown | cid;
                }
            }
            return (int)clistlen;
        }

3368
    case SSL_CTRL_SET_GROUPS:
R
Rich Salz 已提交
3369 3370
        return tls1_set_groups(&s->ext.supportedgroups,
                               &s->ext.supportedgroups_len, parg, larg);
3371

3372
    case SSL_CTRL_SET_GROUPS_LIST:
R
Rich Salz 已提交
3373 3374
        return tls1_set_groups_list(&s->ext.supportedgroups,
                                    &s->ext.supportedgroups_len, parg);
3375

3376 3377
    case SSL_CTRL_GET_SHARED_GROUP:
        return tls1_shared_group(s, larg);
3378

3379
#endif
3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397
    case SSL_CTRL_SET_SIGALGS:
        return tls1_set_sigalgs(s->cert, parg, larg, 0);

    case SSL_CTRL_SET_SIGALGS_LIST:
        return tls1_set_sigalgs_list(s->cert, parg, 0);

    case SSL_CTRL_SET_CLIENT_SIGALGS:
        return tls1_set_sigalgs(s->cert, parg, larg, 1);

    case SSL_CTRL_SET_CLIENT_SIGALGS_LIST:
        return tls1_set_sigalgs_list(s->cert, parg, 1);

    case SSL_CTRL_GET_CLIENT_CERT_TYPES:
        {
            const unsigned char **pctype = parg;
            if (s->server || !s->s3->tmp.cert_req)
                return 0;
            if (pctype)
3398 3399
                *pctype = s->s3->tmp.ctype;
            return s->s3->tmp.ctype_len;
3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416
        }

    case SSL_CTRL_SET_CLIENT_CERT_TYPES:
        if (!s->server)
            return 0;
        return ssl3_set_req_cert_type(s->cert, parg, larg);

    case SSL_CTRL_BUILD_CERT_CHAIN:
        return ssl_build_cert_chain(s, NULL, larg);

    case SSL_CTRL_SET_VERIFY_CERT_STORE:
        return ssl_cert_set_cert_store(s->cert, parg, 0, larg);

    case SSL_CTRL_SET_CHAIN_CERT_STORE:
        return ssl_cert_set_cert_store(s->cert, parg, 1, larg);

    case SSL_CTRL_GET_PEER_SIGNATURE_NID:
3417
        if (s->s3->tmp.peer_sigalg == NULL)
3418
            return 0;
3419 3420
        *(int *)parg = s->s3->tmp.peer_sigalg->hash;
        return 1;
3421 3422

    case SSL_CTRL_GET_SERVER_TMP_KEY:
D
Dr. Stephen Henson 已提交
3423 3424
#if !defined(OPENSSL_NO_DH) || !defined(OPENSSL_NO_EC)
        if (s->server || s->session == NULL || s->s3->peer_tmp == NULL) {
3425
            return 0;
D
Dr. Stephen Henson 已提交
3426 3427 3428 3429
        } else {
            EVP_PKEY_up_ref(s->s3->peer_tmp);
            *(EVP_PKEY **)parg = s->s3->peer_tmp;
            return 1;
3430
        }
D
Dr. Stephen Henson 已提交
3431 3432 3433
#else
        return 0;
#endif
3434
#ifndef OPENSSL_NO_EC
3435 3436 3437 3438
    case SSL_CTRL_GET_EC_POINT_FORMATS:
        {
            SSL_SESSION *sess = s->session;
            const unsigned char **pformat = parg;
R
Rich Salz 已提交
3439 3440

            if (sess == NULL || sess->ext.ecpointformats == NULL)
3441
                return 0;
R
Rich Salz 已提交
3442 3443
            *pformat = sess->ext.ecpointformats;
            return (int)sess->ext.ecpointformats_len;
3444
        }
3445
#endif
B
Bodo Moeller 已提交
3446

3447 3448 3449 3450 3451 3452 3453 3454 3455
    default:
        break;
    }
    return (ret);
}

long ssl3_callback_ctrl(SSL *s, int cmd, void (*fp) (void))
{
    int ret = 0;
3456

3457
    switch (cmd) {
3458
#ifndef OPENSSL_NO_DH
3459 3460 3461 3462 3463
    case SSL_CTRL_SET_TMP_DH_CB:
        {
            s->cert->dh_tmp_cb = (DH *(*)(SSL *, int, int))fp;
        }
        break;
3464
#endif
3465
    case SSL_CTRL_SET_TLSEXT_DEBUG_CB:
R
Rich Salz 已提交
3466
        s->ext.debug_cb = (void (*)(SSL *, int, int,
R
Rich Salz 已提交
3467
                                    const unsigned char *, int, void *))fp;
3468
        break;
3469

3470 3471 3472 3473 3474 3475 3476 3477 3478 3479
    case SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB:
        {
            s->not_resumable_session_cb = (int (*)(SSL *, int))fp;
        }
        break;
    default:
        break;
    }
    return (ret);
}
3480

3481
long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
3482 3483
{
    switch (cmd) {
3484
#ifndef OPENSSL_NO_DH
3485 3486
    case SSL_CTRL_SET_TMP_DH:
        {
3487 3488 3489 3490
            DH *dh = (DH *)parg;
            EVP_PKEY *pkdh = NULL;
            if (dh == NULL) {
                SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_PASSED_NULL_PARAMETER);
3491 3492
                return 0;
            }
3493 3494 3495
            pkdh = ssl_dh_to_pkey(dh);
            if (pkdh == NULL) {
                SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_MALLOC_FAILURE);
3496 3497
                return 0;
            }
3498 3499 3500 3501 3502
            if (!ssl_ctx_security(ctx, SSL_SECOP_TMP_DH,
                                  EVP_PKEY_security_bits(pkdh), 0, pkdh)) {
                SSLerr(SSL_F_SSL3_CTX_CTRL, SSL_R_DH_KEY_TOO_SMALL);
                EVP_PKEY_free(pkdh);
                return 1;
3503
            }
3504 3505
            EVP_PKEY_free(ctx->cert->dh_tmp);
            ctx->cert->dh_tmp = pkdh;
3506 3507 3508 3509 3510 3511 3512 3513 3514 3515
            return 1;
        }
    case SSL_CTRL_SET_TMP_DH_CB:
        {
            SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
            return (0);
        }
    case SSL_CTRL_SET_DH_AUTO:
        ctx->cert->dh_tmp_auto = larg;
        return 1;
3516
#endif
3517
#ifndef OPENSSL_NO_EC
3518 3519
    case SSL_CTRL_SET_TMP_ECDH:
        {
3520 3521
            const EC_GROUP *group = NULL;
            int nid;
3522 3523

            if (parg == NULL) {
3524
                SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_PASSED_NULL_PARAMETER);
3525 3526
                return 0;
            }
3527 3528 3529
            group = EC_KEY_get0_group((const EC_KEY *)parg);
            if (group == NULL) {
                SSLerr(SSL_F_SSL3_CTX_CTRL, EC_R_MISSING_PARAMETERS);
3530 3531
                return 0;
            }
3532 3533 3534
            nid = EC_GROUP_get_curve_name(group);
            if (nid == NID_undef)
                return 0;
R
Rich Salz 已提交
3535 3536
            return tls1_set_groups(&ctx->ext.supportedgroups,
                                   &ctx->ext.supportedgroups_len,
3537
                                   &nid, 1);
3538
        }
3539
#endif                          /* !OPENSSL_NO_EC */
3540
    case SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG:
R
Rich Salz 已提交
3541
        ctx->ext.servername_arg = parg;
3542 3543 3544 3545 3546
        break;
    case SSL_CTRL_SET_TLSEXT_TICKET_KEYS:
    case SSL_CTRL_GET_TLSEXT_TICKET_KEYS:
        {
            unsigned char *keys = parg;
R
Rich Salz 已提交
3547 3548 3549
            long tick_keylen = (sizeof(ctx->ext.tick_key_name) +
                                sizeof(ctx->ext.tick_hmac_key) +
                                sizeof(ctx->ext.tick_aes_key));
K
Kurt Roeckx 已提交
3550
            if (keys == NULL)
R
Rich Salz 已提交
3551 3552
                return tick_keylen;
            if (larg != tick_keylen) {
3553 3554 3555 3556
                SSLerr(SSL_F_SSL3_CTX_CTRL, SSL_R_INVALID_TICKET_KEYS_LENGTH);
                return 0;
            }
            if (cmd == SSL_CTRL_SET_TLSEXT_TICKET_KEYS) {
R
Rich Salz 已提交
3557 3558 3559 3560 3561 3562 3563 3564 3565
                memcpy(ctx->ext.tick_key_name, keys,
                       sizeof(ctx->ext.tick_key_name));
                memcpy(ctx->ext.tick_hmac_key,
                       keys + sizeof(ctx->ext.tick_key_name),
                       sizeof(ctx->ext.tick_hmac_key));
                memcpy(ctx->ext.tick_aes_key,
                       keys + sizeof(ctx->ext.tick_key_name) +
                       sizeof(ctx->ext.tick_hmac_key),
                       sizeof(ctx->ext.tick_aes_key));
3566
            } else {
R
Rich Salz 已提交
3567 3568 3569 3570 3571 3572 3573 3574 3575
                memcpy(keys, ctx->ext.tick_key_name,
                       sizeof(ctx->ext.tick_key_name));
                memcpy(keys + sizeof(ctx->ext.tick_key_name),
                       ctx->ext.tick_hmac_key,
                       sizeof(ctx->ext.tick_hmac_key));
                memcpy(keys + sizeof(ctx->ext.tick_key_name) +
                       sizeof(ctx->ext.tick_hmac_key),
                       ctx->ext.tick_aes_key,
                       sizeof(ctx->ext.tick_aes_key));
3576 3577 3578 3579
            }
            return 1;
        }

3580
    case SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE:
R
Rich Salz 已提交
3581
        return ctx->ext.status_type;
3582

3583
    case SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE:
R
Rich Salz 已提交
3584
        ctx->ext.status_type = larg;
3585 3586
        break;

3587
    case SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG:
R
Rich Salz 已提交
3588
        ctx->ext.status_arg = parg;
3589 3590
        return 1;

3591
    case SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG:
R
Rich Salz 已提交
3592
        *(void**)parg = ctx->ext.status_arg;
3593 3594 3595
        break;

    case SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB:
R
Rich Salz 已提交
3596
        *(int (**)(SSL*, void*))parg = ctx->ext.status_cb;
3597 3598
        break;

3599
#ifndef OPENSSL_NO_SRP
3600 3601
    case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME:
        ctx->srp_ctx.srp_Mask |= SSL_kSRP;
R
Rich Salz 已提交
3602
        OPENSSL_free(ctx->srp_ctx.login);
3603 3604 3605
        ctx->srp_ctx.login = NULL;
        if (parg == NULL)
            break;
E
Emilia Kasper 已提交
3606
        if (strlen((const char *)parg) > 255 || strlen((const char *)parg) < 1) {
3607 3608 3609
            SSLerr(SSL_F_SSL3_CTX_CTRL, SSL_R_INVALID_SRP_USERNAME);
            return 0;
        }
R
Rich Salz 已提交
3610
        if ((ctx->srp_ctx.login = OPENSSL_strdup((char *)parg)) == NULL) {
3611 3612 3613 3614 3615 3616 3617
            SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_INTERNAL_ERROR);
            return 0;
        }
        break;
    case SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD:
        ctx->srp_ctx.SRP_give_srp_client_pwd_callback =
            srp_password_from_info_cb;
3618 3619 3620 3621 3622 3623
        if (ctx->srp_ctx.info != NULL)
            OPENSSL_free(ctx->srp_ctx.info);
        if ((ctx->srp_ctx.info = BUF_strdup((char *)parg)) == NULL) {
            SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_INTERNAL_ERROR);
            return 0;
        }
3624 3625 3626 3627 3628 3629 3630 3631 3632
        break;
    case SSL_CTRL_SET_SRP_ARG:
        ctx->srp_ctx.srp_Mask |= SSL_kSRP;
        ctx->srp_ctx.SRP_cb_arg = parg;
        break;

    case SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH:
        ctx->srp_ctx.strength = larg;
        break;
3633
#endif
3634

3635
#ifndef OPENSSL_NO_EC
3636
    case SSL_CTRL_SET_GROUPS:
R
Rich Salz 已提交
3637 3638
        return tls1_set_groups(&ctx->ext.supportedgroups,
                               &ctx->ext.supportedgroups_len,
3639 3640
                               parg, larg);

3641
    case SSL_CTRL_SET_GROUPS_LIST:
R
Rich Salz 已提交
3642 3643
        return tls1_set_groups_list(&ctx->ext.supportedgroups,
                                    &ctx->ext.supportedgroups_len,
3644
                                    parg);
3645
#endif
3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672
    case SSL_CTRL_SET_SIGALGS:
        return tls1_set_sigalgs(ctx->cert, parg, larg, 0);

    case SSL_CTRL_SET_SIGALGS_LIST:
        return tls1_set_sigalgs_list(ctx->cert, parg, 0);

    case SSL_CTRL_SET_CLIENT_SIGALGS:
        return tls1_set_sigalgs(ctx->cert, parg, larg, 1);

    case SSL_CTRL_SET_CLIENT_SIGALGS_LIST:
        return tls1_set_sigalgs_list(ctx->cert, parg, 1);

    case SSL_CTRL_SET_CLIENT_CERT_TYPES:
        return ssl3_set_req_cert_type(ctx->cert, parg, larg);

    case SSL_CTRL_BUILD_CERT_CHAIN:
        return ssl_build_cert_chain(NULL, ctx, larg);

    case SSL_CTRL_SET_VERIFY_CERT_STORE:
        return ssl_cert_set_cert_store(ctx->cert, parg, 0, larg);

    case SSL_CTRL_SET_CHAIN_CERT_STORE:
        return ssl_cert_set_cert_store(ctx->cert, parg, 1, larg);

        /* A Thawte special :-) */
    case SSL_CTRL_EXTRA_CHAIN_CERT:
        if (ctx->extra_certs == NULL) {
3673 3674 3675 3676 3677 3678 3679 3680
            if ((ctx->extra_certs = sk_X509_new_null()) == NULL) {
                SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_MALLOC_FAILURE);
                return 0;
            }
        }
        if (!sk_X509_push(ctx->extra_certs, (X509 *)parg)) {
            SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_MALLOC_FAILURE);
            return 0;
3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691
        }
        break;

    case SSL_CTRL_GET_EXTRA_CHAIN_CERTS:
        if (ctx->extra_certs == NULL && larg == 0)
            *(STACK_OF(X509) **)parg = ctx->cert->key->chain;
        else
            *(STACK_OF(X509) **)parg = ctx->extra_certs;
        break;

    case SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS:
R
Rich Salz 已提交
3692 3693
        sk_X509_pop_free(ctx->extra_certs, X509_free);
        ctx->extra_certs = NULL;
3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726
        break;

    case SSL_CTRL_CHAIN:
        if (larg)
            return ssl_cert_set1_chain(NULL, ctx, (STACK_OF(X509) *)parg);
        else
            return ssl_cert_set0_chain(NULL, ctx, (STACK_OF(X509) *)parg);

    case SSL_CTRL_CHAIN_CERT:
        if (larg)
            return ssl_cert_add1_chain_cert(NULL, ctx, (X509 *)parg);
        else
            return ssl_cert_add0_chain_cert(NULL, ctx, (X509 *)parg);

    case SSL_CTRL_GET_CHAIN_CERTS:
        *(STACK_OF(X509) **)parg = ctx->cert->key->chain;
        break;

    case SSL_CTRL_SELECT_CURRENT_CERT:
        return ssl_cert_select_current(ctx->cert, (X509 *)parg);

    case SSL_CTRL_SET_CURRENT_CERT:
        return ssl_cert_set_current(ctx->cert, larg);

    default:
        return (0);
    }
    return (1);
}

long ssl3_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp) (void))
{
    switch (cmd) {
3727
#ifndef OPENSSL_NO_DH
3728 3729
    case SSL_CTRL_SET_TMP_DH_CB:
        {
M
Matt Caswell 已提交
3730
            ctx->cert->dh_tmp_cb = (DH *(*)(SSL *, int, int))fp;
3731 3732
        }
        break;
3733
#endif
3734
    case SSL_CTRL_SET_TLSEXT_SERVERNAME_CB:
R
Rich Salz 已提交
3735
        ctx->ext.servername_cb = (int (*)(SSL *, int *, void *))fp;
3736 3737 3738
        break;

    case SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB:
R
Rich Salz 已提交
3739
        ctx->ext.status_cb = (int (*)(SSL *, void *))fp;
3740 3741 3742
        break;

    case SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB:
R
Rich Salz 已提交
3743
        ctx->ext.ticket_key_cb = (int (*)(SSL *, unsigned char *,
3744 3745 3746 3747 3748
                                             unsigned char *,
                                             EVP_CIPHER_CTX *,
                                             HMAC_CTX *, int))fp;
        break;

3749
#ifndef OPENSSL_NO_SRP
3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763
    case SSL_CTRL_SET_SRP_VERIFY_PARAM_CB:
        ctx->srp_ctx.srp_Mask |= SSL_kSRP;
        ctx->srp_ctx.SRP_verify_param_callback = (int (*)(SSL *, void *))fp;
        break;
    case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB:
        ctx->srp_ctx.srp_Mask |= SSL_kSRP;
        ctx->srp_ctx.TLS_ext_srp_username_callback =
            (int (*)(SSL *, int *, void *))fp;
        break;
    case SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB:
        ctx->srp_ctx.srp_Mask |= SSL_kSRP;
        ctx->srp_ctx.SRP_give_srp_client_pwd_callback =
            (char *(*)(SSL *, void *))fp;
        break;
3764
#endif
3765 3766 3767 3768 3769 3770 3771 3772 3773 3774
    case SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB:
        {
            ctx->not_resumable_session_cb = (int (*)(SSL *, int))fp;
        }
        break;
    default:
        return (0);
    }
    return (1);
}
3775

3776 3777 3778
const SSL_CIPHER *ssl3_get_cipher_by_id(uint32_t id)
{
    SSL_CIPHER c;
3779
    const SSL_CIPHER *cp;
3780 3781

    c.id = id;
3782 3783 3784 3785
    cp = OBJ_bsearch_ssl_cipher_id(&c, ssl3_ciphers, SSL3_NUM_CIPHERS);
    if (cp != NULL)
        return cp;
    return OBJ_bsearch_ssl_cipher_id(&c, ssl3_scsvs, SSL3_NUM_SCSVS);
3786 3787
}

3788 3789 3790 3791 3792 3793
const SSL_CIPHER *ssl3_get_cipher_by_std_name(const char *stdname)
{
    SSL_CIPHER *c = NULL;
    SSL_CIPHER *tbl = ssl3_ciphers;
    size_t i;

3794
    /* this is not efficient, necessary to optimize this? */
3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814
    for (i = 0; i < SSL3_NUM_CIPHERS; i++, tbl++) {
        if (tbl->stdname == NULL)
            continue;
        if (strcmp(stdname, tbl->stdname) == 0) {
            c = tbl;
            break;
        }
    }
    if (c == NULL) {
        tbl = ssl3_scsvs;
        for (i = 0; i < SSL3_NUM_SCSVS; i++, tbl++) {
            if (strcmp(stdname, tbl->stdname) == 0) {
                c = tbl;
                break;
            }
        }
    }
    return c;
}

3815 3816 3817 3818
/*
 * This function needs to check if the ciphers required are actually
 * available
 */
3819
const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p)
3820
{
3821
    return ssl3_get_cipher_by_id(SSL3_CK_CIPHERSUITE_FLAG
3822 3823
                                 | ((uint32_t)p[0] << 8L)
                                 | (uint32_t)p[1]);
3824
}
3825

M
Matt Caswell 已提交
3826
int ssl3_put_cipher_by_char(const SSL_CIPHER *c, WPACKET *pkt, size_t *len)
3827
{
3828
    if ((c->id & 0xff000000) != SSL3_CK_CIPHERSUITE_FLAG) {
3829 3830 3831 3832
        *len = 0;
        return 1;
    }

3833
    if (!WPACKET_put_bytes_u16(pkt, c->id & 0xffff))
3834 3835 3836 3837 3838 3839
        return 0;

    *len = 2;
    return 1;
}

3840 3841 3842 3843 3844 3845 3846 3847
/*
 * ssl3_choose_cipher - choose a cipher from those offered by the client
 * @s: SSL connection
 * @clnt: ciphers offered by the client
 * @srvr: ciphers enabled on the server?
 *
 * Returns the selected cipher or NULL when no common ciphers.
 */
3848
const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
E
Emilia Kasper 已提交
3849
                                     STACK_OF(SSL_CIPHER) *srvr)
3850
{
3851
    const SSL_CIPHER *c, *ret = NULL;
3852 3853
    STACK_OF(SSL_CIPHER) *prio, *allow;
    int i, ii, ok;
3854
    unsigned long alg_k = 0, alg_a = 0, mask_k = 0, mask_a = 0;
3855

3856
    /* Let's see which ciphers we can support */
3857

3858 3859 3860 3861 3862 3863
    /*
     * Do not set the compare functions, because this may lead to a
     * reordering by "id". We want to keep the original ordering. We may pay
     * a price in performance during sk_SSL_CIPHER_find(), but would have to
     * pay with the price of sk_SSL_CIPHER_dup().
     */
3864

B
Ben Laurie 已提交
3865
#ifdef CIPHER_DEBUG
3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877
    fprintf(stderr, "Server has %d from %p:\n", sk_SSL_CIPHER_num(srvr),
            (void *)srvr);
    for (i = 0; i < sk_SSL_CIPHER_num(srvr); ++i) {
        c = sk_SSL_CIPHER_value(srvr, i);
        fprintf(stderr, "%p:%s\n", (void *)c, c->name);
    }
    fprintf(stderr, "Client sent %d from %p:\n", sk_SSL_CIPHER_num(clnt),
            (void *)clnt);
    for (i = 0; i < sk_SSL_CIPHER_num(clnt); ++i) {
        c = sk_SSL_CIPHER_value(clnt, i);
        fprintf(stderr, "%p:%s\n", (void *)c, c->name);
    }
B
Ben Laurie 已提交
3878 3879
#endif

3880 3881 3882 3883 3884 3885 3886 3887
    if (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE || tls1_suiteb(s)) {
        prio = srvr;
        allow = clnt;
    } else {
        prio = clnt;
        allow = srvr;
    }

3888 3889 3890 3891
    if (!SSL_IS_TLS13(s)) {
        tls1_set_cert_validity(s);
        ssl_set_masks(s);
    }
3892 3893 3894 3895

    for (i = 0; i < sk_SSL_CIPHER_num(prio); i++) {
        c = sk_SSL_CIPHER_value(prio, i);

3896 3897
        /* Skip ciphers not supported by the protocol version */
        if (!SSL_IS_DTLS(s) &&
E
Emilia Kasper 已提交
3898
            ((s->version < c->min_tls) || (s->version > c->max_tls)))
3899
            continue;
3900
        if (SSL_IS_DTLS(s) &&
E
Emilia Kasper 已提交
3901 3902
            (DTLS_VERSION_LT(s->version, c->min_dtls) ||
             DTLS_VERSION_GT(s->version, c->max_dtls)))
3903
            continue;
3904

3905 3906 3907 3908 3909
        /*
         * Since TLS 1.3 ciphersuites can be used with any auth or
         * key exchange scheme skip tests.
         */
        if (!SSL_IS_TLS13(s)) {
3910 3911
            mask_k = s->s3->tmp.mask_k;
            mask_a = s->s3->tmp.mask_a;
B
Ben Laurie 已提交
3912
#ifndef OPENSSL_NO_SRP
3913 3914 3915 3916
            if (s->srp_ctx.srp_Mask & SSL_kSRP) {
                mask_k |= SSL_kSRP;
                mask_a |= SSL_aSRP;
            }
B
Ben Laurie 已提交
3917
#endif
3918

3919 3920
            alg_k = c->algorithm_mkey;
            alg_a = c->algorithm_auth;
3921

3922
#ifndef OPENSSL_NO_PSK
3923 3924 3925
            /* with PSK there must be server callback set */
            if ((alg_k & SSL_PSK) && s->psk_server_callback == NULL)
                continue;
3926 3927
#endif                          /* OPENSSL_NO_PSK */

3928
            ok = (alg_k & mask_k) && (alg_a & mask_a);
3929
#ifdef CIPHER_DEBUG
3930 3931
            fprintf(stderr, "%d:[%08lX:%08lX:%08lX:%08lX]%p:%s\n", ok, alg_k,
                    alg_a, mask_k, mask_a, (void *)c, c->name);
3932 3933
#endif

E
Emilia Kasper 已提交
3934
#ifndef OPENSSL_NO_EC
3935 3936 3937 3938 3939 3940
            /*
             * if we are considering an ECC cipher suite that uses an ephemeral
             * EC key check it
             */
            if (alg_k & SSL_kECDHE)
                ok = ok && tls1_check_ec_tmp_key(s, c->id);
E
Emilia Kasper 已提交
3941
#endif                          /* OPENSSL_NO_EC */
3942

3943 3944 3945
            if (!ok)
                continue;
        }
3946 3947 3948 3949
        ii = sk_SSL_CIPHER_find(allow, c);
        if (ii >= 0) {
            /* Check security callback permits this cipher */
            if (!ssl_security(s, SSL_SECOP_CIPHER_SHARED,
3950
                              c->strength_bits, 0, (void *)c))
3951
                continue;
3952
#if !defined(OPENSSL_NO_EC)
3953 3954 3955 3956 3957 3958
            if ((alg_k & SSL_kECDHE) && (alg_a & SSL_aECDSA)
                && s->s3->is_probably_safari) {
                if (!ret)
                    ret = sk_SSL_CIPHER_value(allow, ii);
                continue;
            }
3959
#endif
3960 3961 3962 3963 3964 3965
            ret = sk_SSL_CIPHER_value(allow, ii);
            break;
        }
    }
    return (ret);
}
3966

3967
int ssl3_get_req_cert_type(SSL *s, WPACKET *pkt)
3968
{
3969
    uint32_t alg_k, alg_a = 0;
3970 3971

    /* If we have custom certificate types set, use them */
3972 3973
    if (s->cert->ctype)
        return WPACKET_memcpy(pkt, s->cert->ctype, s->cert->ctype_len);
3974 3975 3976 3977
    /* Get mask of algorithms disabled by signature list */
    ssl_set_sig_mask(&alg_a, s, SSL_SECOP_SIGALG_MASK);

    alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
3978

D
Dr. Stephen Henson 已提交
3979
#ifndef OPENSSL_NO_GOST
3980 3981 3982 3983
    if (s->version >= TLS1_VERSION && (alg_k & SSL_kGOST))
            return WPACKET_put_bytes_u8(pkt, TLS_CT_GOST01_SIGN)
                    && WPACKET_put_bytes_u8(pkt, TLS_CT_GOST12_SIGN)
                    && WPACKET_put_bytes_u8(pkt, TLS_CT_GOST12_512_SIGN);
D
Dr. Stephen Henson 已提交
3984 3985
#endif

D
Dr. Stephen Henson 已提交
3986
    if ((s->version == SSL3_VERSION) && (alg_k & SSL_kDHE)) {
3987
#ifndef OPENSSL_NO_DH
3988
# ifndef OPENSSL_NO_RSA
3989 3990
        if (!WPACKET_put_bytes_u8(pkt, SSL3_CT_RSA_EPHEMERAL_DH))
            return 0;
3991 3992
# endif
# ifndef OPENSSL_NO_DSA
3993 3994
        if (!WPACKET_put_bytes_u8(pkt, SSL3_CT_DSS_EPHEMERAL_DH))
            return 0;
3995 3996
# endif
#endif                          /* !OPENSSL_NO_DH */
B
Ben Laurie 已提交
3997
    }
3998
#ifndef OPENSSL_NO_RSA
3999 4000
    if (!(alg_a & SSL_aRSA) && !WPACKET_put_bytes_u8(pkt, SSL3_CT_RSA_SIGN))
        return 0;
4001
#endif
4002
#ifndef OPENSSL_NO_DSA
4003 4004
    if (!(alg_a & SSL_aDSS) && !WPACKET_put_bytes_u8(pkt, SSL3_CT_DSS_SIGN))
        return 0;
4005
#endif
4006
#ifndef OPENSSL_NO_EC
4007
    /*
D
Dr. Stephen Henson 已提交
4008
     * ECDSA certs can be used with RSA cipher suites too so we don't
4009 4010
     * need to check for SSL_kECDH or SSL_kECDHE
     */
4011 4012 4013 4014
    if (s->version >= TLS1_VERSION
            && !(alg_a & SSL_aECDSA)
            && !WPACKET_put_bytes_u8(pkt, TLS_CT_ECDSA_SIGN))
        return 0;
4015
#endif
4016
    return 1;
4017
}
4018

4019
static int ssl3_set_req_cert_type(CERT *c, const unsigned char *p, size_t len)
4020
{
4021 4022 4023 4024
    OPENSSL_free(c->ctype);
    c->ctype = NULL;
    c->ctype_len = 0;
    if (p == NULL || len == 0)
4025 4026 4027
        return 1;
    if (len > 0xff)
        return 0;
4028 4029
    c->ctype = OPENSSL_memdup(p, len);
    if (c->ctype == NULL)
4030
        return 0;
4031
    c->ctype_len = len;
4032 4033
    return 1;
}
4034

U
Ulf Möller 已提交
4035
int ssl3_shutdown(SSL *s)
4036 4037 4038 4039 4040 4041 4042
{
    int ret;

    /*
     * Don't do anything much if we have not done the handshake or we don't
     * want to send messages :-)
     */
M
Matt Caswell 已提交
4043
    if (s->quiet_shutdown || SSL_in_before(s)) {
4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062
        s->shutdown = (SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN);
        return (1);
    }

    if (!(s->shutdown & SSL_SENT_SHUTDOWN)) {
        s->shutdown |= SSL_SENT_SHUTDOWN;
        ssl3_send_alert(s, SSL3_AL_WARNING, SSL_AD_CLOSE_NOTIFY);
        /*
         * our shutdown alert has been sent now, and if it still needs to be
         * written, s->s3->alert_dispatch will be true
         */
        if (s->s3->alert_dispatch)
            return (-1);        /* return WANT_WRITE */
    } else if (s->s3->alert_dispatch) {
        /* resend it if not sent */
        ret = s->method->ssl_dispatch_alert(s);
        if (ret == -1) {
            /*
             * we only get to return -1 here the 2nd/Nth invocation, we must
F
FdaSilvaYY 已提交
4063
             * have already signalled return 0 upon a previous invocation,
4064 4065 4066 4067 4068
             * return WANT_WRITE
             */
            return (ret);
        }
    } else if (!(s->shutdown & SSL_RECEIVED_SHUTDOWN)) {
4069
        size_t readbytes;
4070 4071 4072
        /*
         * If we are waiting for a close from our peer, we are closed
         */
4073
        s->method->ssl_read_bytes(s, 0, NULL, NULL, 0, 0, &readbytes);
4074
        if (!(s->shutdown & SSL_RECEIVED_SHUTDOWN)) {
4075
            return -1;        /* return WANT_READ */
4076 4077 4078 4079 4080 4081 4082 4083 4084
        }
    }

    if ((s->shutdown == (SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN)) &&
        !s->s3->alert_dispatch)
        return (1);
    else
        return (0);
}
4085

M
Matt Caswell 已提交
4086
int ssl3_write(SSL *s, const void *buf, size_t len, size_t *written)
4087 4088 4089
{
    clear_sys_error();
    if (s->s3->renegotiate)
4090
        ssl3_renegotiate_check(s, 0);
4091

M
Matt Caswell 已提交
4092 4093
    return s->method->ssl_write_bytes(s, SSL3_RT_APPLICATION_DATA, buf, len,
                                      written);
4094
}
4095

4096
static int ssl3_read_internal(SSL *s, void *buf, size_t len, int peek,
4097
                              size_t *readbytes)
4098 4099 4100 4101 4102
{
    int ret;

    clear_sys_error();
    if (s->s3->renegotiate)
4103
        ssl3_renegotiate_check(s, 0);
4104 4105
    s->s3->in_read_app_data = 1;
    ret =
4106
        s->method->ssl_read_bytes(s, SSL3_RT_APPLICATION_DATA, NULL, buf, len,
4107
                                  peek, readbytes);
4108 4109 4110 4111 4112 4113 4114 4115
    if ((ret == -1) && (s->s3->in_read_app_data == 2)) {
        /*
         * ssl3_read_bytes decided to call s->handshake_func, which called
         * ssl3_read_bytes to read handshake data. However, ssl3_read_bytes
         * actually found application data and thinks that application data
         * makes sense here; so disable handshake processing and try to read
         * application data again.
         */
M
Matt Caswell 已提交
4116
        ossl_statem_set_in_handshake(s, 1);
4117
        ret =
4118
            s->method->ssl_read_bytes(s, SSL3_RT_APPLICATION_DATA, NULL, buf,
4119
                                      len, peek, readbytes);
M
Matt Caswell 已提交
4120
        ossl_statem_set_in_handshake(s, 0);
4121 4122 4123
    } else
        s->s3->in_read_app_data = 0;

4124
    return ret;
4125
}
4126

4127
int ssl3_read(SSL *s, void *buf, size_t len, size_t *readbytes)
4128
{
4129
    return ssl3_read_internal(s, buf, len, 0, readbytes);
4130
}
4131

4132
int ssl3_peek(SSL *s, void *buf, size_t len, size_t *readbytes)
4133
{
4134
    return ssl3_read_internal(s, buf, len, 1, readbytes);
4135
}
4136

U
Ulf Möller 已提交
4137
int ssl3_renegotiate(SSL *s)
4138 4139 4140
{
    if (s->handshake_func == NULL)
        return (1);
4141

4142 4143 4144
    s->s3->renegotiate = 1;
    return (1);
}
4145

4146 4147 4148 4149 4150 4151 4152 4153 4154
/*
 * Check if we are waiting to do a renegotiation and if so whether now is a
 * good time to do it. If |initok| is true then we are being called from inside
 * the state machine so ignore the result of SSL_in_init(s). Otherwise we
 * should not do a renegotiation if SSL_in_init(s) is true. Returns 1 if we
 * should do a renegotiation now and sets up the state machine for it. Otherwise
 * returns 0.
 */
int ssl3_renegotiate_check(SSL *s, int initok)
4155 4156 4157 4158
{
    int ret = 0;

    if (s->s3->renegotiate) {
4159 4160
        if (!RECORD_LAYER_read_pending(&s->rlayer)
            && !RECORD_LAYER_write_pending(&s->rlayer)
4161
            && (initok || !SSL_in_init(s))) {
4162 4163
            /*
             * if we are the server, and we have sent a 'RENEGOTIATE'
M
Matt Caswell 已提交
4164 4165
             * message, we need to set the state machine into the renegotiate
             * state.
4166
             */
M
Matt Caswell 已提交
4167
            ossl_statem_set_renegotiate(s);
4168 4169 4170 4171 4172 4173
            s->s3->renegotiate = 0;
            s->s3->num_renegotiations++;
            s->s3->total_renegotiations++;
            ret = 1;
        }
    }
4174
    return ret;
4175 4176
}

4177
/*
4178 4179
 * If we are using default SHA1+MD5 algorithms switch to new SHA256 PRF and
 * handshake macs if required.
D
Dr. Stephen Henson 已提交
4180 4181
 *
 * If PSK and using SHA384 for TLS < 1.2 switch to default.
4182 4183
 */
long ssl_get_algorithm2(SSL *s)
4184
{
4185 4186 4187 4188
    long alg2;
    if (s->s3 == NULL || s->s3->tmp.new_cipher == NULL)
        return -1;
    alg2 = s->s3->tmp.new_cipher->algorithm2;
D
Dr. Stephen Henson 已提交
4189 4190 4191 4192 4193 4194 4195
    if (s->method->ssl3_enc->enc_flags & SSL_ENC_FLAG_SHA256_PRF) {
        if (alg2 == (SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF))
            return SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256;
    } else if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_PSK) {
        if (alg2 == (SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384))
            return SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF;
    }
4196 4197
    return alg2;
}
4198 4199 4200 4201 4202

/*
 * Fill a ClientRandom or ServerRandom field of length len. Returns <= 0 on
 * failure, 1 on success.
 */
4203 4204
int ssl_fill_hello_random(SSL *s, int server, unsigned char *result, size_t len,
                          DOWNGRADE dgrd)
4205
{
4206
    int send_time = 0, ret;
4207 4208 4209 4210 4211 4212 4213 4214 4215 4216

    if (len < 4)
        return 0;
    if (server)
        send_time = (s->mode & SSL_MODE_SEND_SERVERHELLO_TIME) != 0;
    else
        send_time = (s->mode & SSL_MODE_SEND_CLIENTHELLO_TIME) != 0;
    if (send_time) {
        unsigned long Time = (unsigned long)time(NULL);
        unsigned char *p = result;
R
Rich Salz 已提交
4217

4218
        l2n(Time, p);
R
Rich Salz 已提交
4219
        ret = ssl_randbytes(s, p, len - 4);
4220
    } else {
R
Rich Salz 已提交
4221
        ret = ssl_randbytes(s, result, len);
4222 4223 4224
    }
#ifndef OPENSSL_NO_TLS13DOWNGRADE
    if (ret) {
4225 4226 4227
        if (!ossl_assert(sizeof(tls11downgrade) < len)
                || !ossl_assert(sizeof(tls12downgrade) < len))
             return 0;
4228 4229 4230 4231 4232 4233 4234 4235 4236
        if (dgrd == DOWNGRADE_TO_1_2)
            memcpy(result + len - sizeof(tls12downgrade), tls12downgrade,
                   sizeof(tls12downgrade));
        else if (dgrd == DOWNGRADE_TO_1_1)
            memcpy(result + len - sizeof(tls11downgrade), tls11downgrade,
                   sizeof(tls11downgrade));
    }
#endif
    return ret;
4237
}
4238 4239 4240 4241

int ssl_generate_master_secret(SSL *s, unsigned char *pms, size_t pmslen,
                               int free_pms)
{
4242
    unsigned long alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
4243 4244
    int ret = 0;

4245
    if (alg_k & SSL_PSK) {
4246
#ifndef OPENSSL_NO_PSK
4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258
        unsigned char *pskpms, *t;
        size_t psklen = s->s3->tmp.psklen;
        size_t pskpmslen;

        /* create PSK premaster_secret */

        /* For plain PSK "other_secret" is psklen zeroes */
        if (alg_k & SSL_kPSK)
            pmslen = psklen;

        pskpmslen = 4 + pmslen + psklen;
        pskpms = OPENSSL_malloc(pskpmslen);
4259
        if (pskpms == NULL)
4260
            goto err;
4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272
        t = pskpms;
        s2n(pmslen, t);
        if (alg_k & SSL_kPSK)
            memset(t, 0, pmslen);
        else
            memcpy(t, pms, pmslen);
        t += pmslen;
        s2n(psklen, t);
        memcpy(t, s->s3->tmp.psk, psklen);

        OPENSSL_clear_free(s->s3->tmp.psk, psklen);
        s->s3->tmp.psk = NULL;
4273 4274 4275 4276
        if (!s->method->ssl3_enc->generate_master_secret(s,
                    s->session->master_key,pskpms, pskpmslen,
                    &s->session->master_key_length))
            goto err;
4277
        OPENSSL_clear_free(pskpms, pskpmslen);
4278 4279 4280
#else
        /* Should never happen */
        goto err;
4281
#endif
4282
    } else {
4283 4284 4285 4286
        if (!s->method->ssl3_enc->generate_master_secret(s,
                s->session->master_key, pms, pmslen,
                &s->session->master_key_length))
            goto err;
4287 4288
    }

4289
    ret = 1;
4290
 err:
4291 4292 4293 4294 4295 4296
    if (pms) {
        if (free_pms)
            OPENSSL_clear_free(pms, pmslen);
        else
            OPENSSL_cleanse(pms, pmslen);
    }
4297 4298
    if (s->server == 0)
        s->s3->tmp.pms = NULL;
4299
    return ret;
4300
}
4301

D
Dr. Stephen Henson 已提交
4302 4303
/* Generate a private key from parameters */
EVP_PKEY *ssl_generate_pkey(EVP_PKEY *pm)
4304 4305 4306
{
    EVP_PKEY_CTX *pctx = NULL;
    EVP_PKEY *pkey = NULL;
D
Dr. Stephen Henson 已提交
4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336

    if (pm == NULL)
        return NULL;
    pctx = EVP_PKEY_CTX_new(pm, NULL);
    if (pctx == NULL)
        goto err;
    if (EVP_PKEY_keygen_init(pctx) <= 0)
        goto err;
    if (EVP_PKEY_keygen(pctx, &pkey) <= 0) {
        EVP_PKEY_free(pkey);
        pkey = NULL;
    }

    err:
    EVP_PKEY_CTX_free(pctx);
    return pkey;
}
#ifndef OPENSSL_NO_EC
/* Generate a private key a curve ID */
EVP_PKEY *ssl_generate_pkey_curve(int id)
{
    EVP_PKEY_CTX *pctx = NULL;
    EVP_PKEY *pkey = NULL;
    unsigned int curve_flags;
    int nid = tls1_ec_curve_id2nid(id, &curve_flags);

    if (nid == 0)
        goto err;
    if ((curve_flags & TLS_CURVE_TYPE) == TLS_CURVE_CUSTOM) {
        pctx = EVP_PKEY_CTX_new_id(nid, NULL);
4337
        nid = 0;
4338
    } else {
D
Dr. Stephen Henson 已提交
4339
        pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_EC, NULL);
4340 4341 4342 4343 4344
    }
    if (pctx == NULL)
        goto err;
    if (EVP_PKEY_keygen_init(pctx) <= 0)
        goto err;
4345
    if (nid != 0 && EVP_PKEY_CTX_set_ec_paramgen_curve_nid(pctx, nid) <= 0)
4346 4347 4348 4349 4350 4351
        goto err;
    if (EVP_PKEY_keygen(pctx, &pkey) <= 0) {
        EVP_PKEY_free(pkey);
        pkey = NULL;
    }

E
Emilia Kasper 已提交
4352
 err:
4353 4354 4355
    EVP_PKEY_CTX_free(pctx);
    return pkey;
}
D
Dr. Stephen Henson 已提交
4356
#endif
E
Emilia Kasper 已提交
4357

4358 4359
/* Derive secrets for ECDH/DH */
int ssl_derive(SSL *s, EVP_PKEY *privkey, EVP_PKEY *pubkey, int gensecret)
4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383
{
    int rv = 0;
    unsigned char *pms = NULL;
    size_t pmslen = 0;
    EVP_PKEY_CTX *pctx;

    if (privkey == NULL || pubkey == NULL)
        return 0;

    pctx = EVP_PKEY_CTX_new(privkey, NULL);

    if (EVP_PKEY_derive_init(pctx) <= 0
        || EVP_PKEY_derive_set_peer(pctx, pubkey) <= 0
        || EVP_PKEY_derive(pctx, NULL, &pmslen) <= 0) {
        goto err;
    }

    pms = OPENSSL_malloc(pmslen);
    if (pms == NULL)
        goto err;

    if (EVP_PKEY_derive(pctx, pms, &pmslen) <= 0)
        goto err;

4384 4385 4386
    if (gensecret) {
        if (SSL_IS_TLS13(s)) {
            /*
4387 4388
             * If we are resuming then we already generated the early secret
             * when we created the ClientHello, so don't recreate it.
4389
             */
4390 4391 4392 4393
            if (!s->hit)
                rv = tls13_generate_secret(s, ssl_handshake_md(s), NULL, NULL,
                                           0,
                                           (unsigned char *)&s->early_secret);
4394 4395 4396
            else
                rv = 1;

4397
            rv = rv && tls13_generate_handshake_secret(s, pms, pmslen);
4398
        } else {
4399
            rv = ssl_generate_master_secret(s, pms, pmslen, 0);
4400
        }
4401
    } else {
4402
        /* Save premaster secret */
4403 4404 4405 4406 4407 4408
        s->s3->tmp.pms = pms;
        s->s3->tmp.pmslen = pmslen;
        pms = NULL;
        rv = 1;
    }

E
Emilia Kasper 已提交
4409
 err:
4410 4411 4412 4413
    OPENSSL_clear_free(pms, pmslen);
    EVP_PKEY_CTX_free(pctx);
    return rv;
}
D
Dr. Stephen Henson 已提交
4414

B
Ben Laurie 已提交
4415
#ifndef OPENSSL_NO_DH
D
Dr. Stephen Henson 已提交
4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427
EVP_PKEY *ssl_dh_to_pkey(DH *dh)
{
    EVP_PKEY *ret;
    if (dh == NULL)
        return NULL;
    ret = EVP_PKEY_new();
    if (EVP_PKEY_set1_DH(ret, dh) <= 0) {
        EVP_PKEY_free(ret);
        return NULL;
    }
    return ret;
}
B
Ben Laurie 已提交
4428
#endif