]> git.ipfire.org Git - thirdparty/openssl.git/blame - ssl/s3_lib.c
update ordinals
[thirdparty/openssl.git] / ssl / s3_lib.c
CommitLineData
d02b48c6 1/* ssl/s3_lib.c */
58964a49 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
d02b48c6
RE
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
0f113f3e 8 *
d02b48c6
RE
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
0f113f3e 15 *
d02b48c6
RE
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
0f113f3e 22 *
d02b48c6
RE
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
0f113f3e 37 * 4. If you include any Windows specific code (or a derivative thereof) from
d02b48c6
RE
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
0f113f3e 40 *
d02b48c6
RE
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
0f113f3e 52 *
d02b48c6
RE
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
5a4fbc69 58/* ====================================================================
52b8dad8 59 * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
5a4fbc69
BM
60 *
61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions
63 * are met:
64 *
65 * 1. Redistributions of source code must retain the above copyright
0f113f3e 66 * notice, this list of conditions and the following disclaimer.
5a4fbc69
BM
67 *
68 * 2. Redistributions in binary form must reproduce the above copyright
69 * notice, this list of conditions and the following disclaimer in
70 * the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3. All advertising materials mentioning features or use of this
74 * software must display the following acknowledgment:
75 * "This product includes software developed by the OpenSSL Project
76 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77 *
78 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79 * endorse or promote products derived from this software without
80 * prior written permission. For written permission, please contact
81 * openssl-core@openssl.org.
82 *
83 * 5. Products derived from this software may not be called "OpenSSL"
84 * nor may "OpenSSL" appear in their names without prior written
85 * permission of the OpenSSL Project.
86 *
87 * 6. Redistributions of any form whatsoever must retain the following
88 * acknowledgment:
89 * "This product includes software developed by the OpenSSL Project
90 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91 *
92 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
96 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103 * OF THE POSSIBILITY OF SUCH DAMAGE.
104 * ====================================================================
105 *
106 * This product includes cryptographic software written by Eric Young
107 * (eay@cryptsoft.com). This product includes software written by Tim
108 * Hudson (tjh@cryptsoft.com).
109 *
110 */
ea262260
BM
111/* ====================================================================
112 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
113 *
0f113f3e 114 * Portions of the attached software ("Contribution") are developed by
ea262260
BM
115 * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
116 *
117 * The Contribution is licensed pursuant to the OpenSSL open source
118 * license provided above.
119 *
ea262260
BM
120 * ECC cipher suite support in OpenSSL originally written by
121 * Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories.
122 *
123 */
ddac1974
NL
124/* ====================================================================
125 * Copyright 2005 Nokia. All rights reserved.
126 *
127 * The portions of the attached software ("Contribution") is developed by
128 * Nokia Corporation and is licensed pursuant to the OpenSSL open source
129 * license.
130 *
131 * The Contribution, originally written by Mika Kousa and Pasi Eronen of
132 * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
133 * support (see RFC 4279) to OpenSSL.
134 *
135 * No patent licenses or other rights except those expressly stated in
136 * the OpenSSL open source license shall be deemed granted or received
137 * expressly, by implication, estoppel, or otherwise.
138 *
139 * No assurances are provided by Nokia that the Contribution does not
140 * infringe the patent or other intellectual property rights of any third
141 * party or that the license provides you with all the necessary rights
142 * to make use of the Contribution.
143 *
144 * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
145 * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
146 * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
147 * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
148 * OTHERWISE.
149 */
d02b48c6
RE
150
151#include <stdio.h>
ec577822 152#include <openssl/objects.h>
d02b48c6 153#include "ssl_locl.h"
2a96235b 154#include "kssl_lcl.h"
dbad1690 155#include <openssl/md5.h>
3eeaab4b 156#ifndef OPENSSL_NO_DH
0f113f3e 157# include <openssl/dh.h>
3eeaab4b 158#endif
d02b48c6 159
0f113f3e 160const char ssl3_version_str[] = "SSLv3" OPENSSL_VERSION_PTEXT;
d02b48c6 161
0f113f3e 162#define SSL3_NUM_CIPHERS (sizeof(ssl3_ciphers)/sizeof(SSL_CIPHER))
d02b48c6 163
6e119bb0 164/* list of available SSLv3 ciphers (sorted by id) */
0f113f3e 165OPENSSL_GLOBAL const SSL_CIPHER ssl3_ciphers[] = {
52b8dad8 166
d02b48c6
RE
167/* The RSA ciphers */
168/* Cipher 01 */
0f113f3e
MC
169 {
170 1,
171 SSL3_TXT_RSA_NULL_MD5,
172 SSL3_CK_RSA_NULL_MD5,
173 SSL_kRSA,
174 SSL_aRSA,
175 SSL_eNULL,
176 SSL_MD5,
177 SSL_SSLV3,
178 SSL_NOT_EXP | SSL_STRONG_NONE,
179 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
180 0,
181 0,
182 },
52b8dad8 183
d02b48c6 184/* Cipher 02 */
0f113f3e
MC
185 {
186 1,
187 SSL3_TXT_RSA_NULL_SHA,
188 SSL3_CK_RSA_NULL_SHA,
189 SSL_kRSA,
190 SSL_aRSA,
191 SSL_eNULL,
192 SSL_SHA1,
193 SSL_SSLV3,
194 SSL_NOT_EXP | SSL_STRONG_NONE | SSL_FIPS,
195 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
196 0,
197 0,
198 },
52b8dad8 199
d02b48c6 200/* Cipher 03 */
0f113f3e
MC
201 {
202 1,
203 SSL3_TXT_RSA_RC4_40_MD5,
204 SSL3_CK_RSA_RC4_40_MD5,
205 SSL_kRSA,
206 SSL_aRSA,
207 SSL_RC4,
208 SSL_MD5,
209 SSL_SSLV3,
210 SSL_EXPORT | SSL_EXP40,
211 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
212 40,
213 128,
214 },
52b8dad8 215
d02b48c6 216/* Cipher 04 */
0f113f3e
MC
217 {
218 1,
219 SSL3_TXT_RSA_RC4_128_MD5,
220 SSL3_CK_RSA_RC4_128_MD5,
221 SSL_kRSA,
222 SSL_aRSA,
223 SSL_RC4,
224 SSL_MD5,
225 SSL_SSLV3,
226 SSL_NOT_EXP | SSL_MEDIUM,
227 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
228 128,
229 128,
230 },
52b8dad8 231
d02b48c6 232/* Cipher 05 */
0f113f3e
MC
233 {
234 1,
235 SSL3_TXT_RSA_RC4_128_SHA,
236 SSL3_CK_RSA_RC4_128_SHA,
237 SSL_kRSA,
238 SSL_aRSA,
239 SSL_RC4,
240 SSL_SHA1,
241 SSL_SSLV3,
242 SSL_NOT_EXP | SSL_MEDIUM,
243 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
244 128,
245 128,
246 },
52b8dad8 247
d02b48c6 248/* Cipher 06 */
0f113f3e
MC
249 {
250 1,
251 SSL3_TXT_RSA_RC2_40_MD5,
252 SSL3_CK_RSA_RC2_40_MD5,
253 SSL_kRSA,
254 SSL_aRSA,
255 SSL_RC2,
256 SSL_MD5,
257 SSL_SSLV3,
258 SSL_EXPORT | SSL_EXP40,
259 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
260 40,
261 128,
262 },
52b8dad8 263
d02b48c6 264/* Cipher 07 */
5fdf0666 265#ifndef OPENSSL_NO_IDEA
0f113f3e
MC
266 {
267 1,
268 SSL3_TXT_RSA_IDEA_128_SHA,
269 SSL3_CK_RSA_IDEA_128_SHA,
270 SSL_kRSA,
271 SSL_aRSA,
272 SSL_IDEA,
273 SSL_SHA1,
274 SSL_SSLV3,
275 SSL_NOT_EXP | SSL_MEDIUM,
276 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
277 128,
278 128,
279 },
5fdf0666 280#endif
52b8dad8 281
d02b48c6 282/* Cipher 08 */
0f113f3e
MC
283 {
284 1,
285 SSL3_TXT_RSA_DES_40_CBC_SHA,
286 SSL3_CK_RSA_DES_40_CBC_SHA,
287 SSL_kRSA,
288 SSL_aRSA,
289 SSL_DES,
290 SSL_SHA1,
291 SSL_SSLV3,
292 SSL_EXPORT | SSL_EXP40,
293 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
294 40,
295 56,
296 },
52b8dad8 297
d02b48c6 298/* Cipher 09 */
0f113f3e
MC
299 {
300 1,
301 SSL3_TXT_RSA_DES_64_CBC_SHA,
302 SSL3_CK_RSA_DES_64_CBC_SHA,
303 SSL_kRSA,
304 SSL_aRSA,
305 SSL_DES,
306 SSL_SHA1,
307 SSL_SSLV3,
308 SSL_NOT_EXP | SSL_LOW,
309 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
310 56,
311 56,
312 },
52b8dad8 313
d02b48c6 314/* Cipher 0A */
0f113f3e
MC
315 {
316 1,
317 SSL3_TXT_RSA_DES_192_CBC3_SHA,
318 SSL3_CK_RSA_DES_192_CBC3_SHA,
319 SSL_kRSA,
320 SSL_aRSA,
321 SSL_3DES,
322 SSL_SHA1,
323 SSL_SSLV3,
324 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
325 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
326 112,
327 168,
328 },
52b8dad8 329
6e119bb0 330/* The DH ciphers */
d02b48c6 331/* Cipher 0B */
0f113f3e
MC
332 {
333 1,
334 SSL3_TXT_DH_DSS_DES_40_CBC_SHA,
335 SSL3_CK_DH_DSS_DES_40_CBC_SHA,
336 SSL_kDHd,
337 SSL_aDH,
338 SSL_DES,
339 SSL_SHA1,
340 SSL_SSLV3,
341 SSL_EXPORT | SSL_EXP40,
342 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
343 40,
344 56,
345 },
52b8dad8 346
d02b48c6 347/* Cipher 0C */
0f113f3e
MC
348 {
349 1,
350 SSL3_TXT_DH_DSS_DES_64_CBC_SHA,
351 SSL3_CK_DH_DSS_DES_64_CBC_SHA,
352 SSL_kDHd,
353 SSL_aDH,
354 SSL_DES,
355 SSL_SHA1,
356 SSL_SSLV3,
357 SSL_NOT_EXP | SSL_LOW,
358 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
359 56,
360 56,
361 },
52b8dad8 362
d02b48c6 363/* Cipher 0D */
0f113f3e
MC
364 {
365 1,
366 SSL3_TXT_DH_DSS_DES_192_CBC3_SHA,
367 SSL3_CK_DH_DSS_DES_192_CBC3_SHA,
368 SSL_kDHd,
369 SSL_aDH,
370 SSL_3DES,
371 SSL_SHA1,
372 SSL_SSLV3,
373 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
374 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
375 112,
376 168,
377 },
52b8dad8 378
d02b48c6 379/* Cipher 0E */
0f113f3e
MC
380 {
381 1,
382 SSL3_TXT_DH_RSA_DES_40_CBC_SHA,
383 SSL3_CK_DH_RSA_DES_40_CBC_SHA,
384 SSL_kDHr,
385 SSL_aDH,
386 SSL_DES,
387 SSL_SHA1,
388 SSL_SSLV3,
389 SSL_EXPORT | SSL_EXP40,
390 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
391 40,
392 56,
393 },
52b8dad8 394
d02b48c6 395/* Cipher 0F */
0f113f3e
MC
396 {
397 1,
398 SSL3_TXT_DH_RSA_DES_64_CBC_SHA,
399 SSL3_CK_DH_RSA_DES_64_CBC_SHA,
400 SSL_kDHr,
401 SSL_aDH,
402 SSL_DES,
403 SSL_SHA1,
404 SSL_SSLV3,
405 SSL_NOT_EXP | SSL_LOW,
406 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
407 56,
408 56,
409 },
52b8dad8 410
d02b48c6 411/* Cipher 10 */
0f113f3e
MC
412 {
413 1,
414 SSL3_TXT_DH_RSA_DES_192_CBC3_SHA,
415 SSL3_CK_DH_RSA_DES_192_CBC3_SHA,
416 SSL_kDHr,
417 SSL_aDH,
418 SSL_3DES,
419 SSL_SHA1,
420 SSL_SSLV3,
421 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
422 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
423 112,
424 168,
425 },
d02b48c6
RE
426
427/* The Ephemeral DH ciphers */
428/* Cipher 11 */
0f113f3e
MC
429 {
430 1,
431 SSL3_TXT_DHE_DSS_DES_40_CBC_SHA,
432 SSL3_CK_DHE_DSS_DES_40_CBC_SHA,
433 SSL_kDHE,
434 SSL_aDSS,
435 SSL_DES,
436 SSL_SHA1,
437 SSL_SSLV3,
438 SSL_EXPORT | SSL_EXP40,
439 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
440 40,
441 56,
442 },
52b8dad8 443
d02b48c6 444/* Cipher 12 */
0f113f3e
MC
445 {
446 1,
447 SSL3_TXT_DHE_DSS_DES_64_CBC_SHA,
448 SSL3_CK_DHE_DSS_DES_64_CBC_SHA,
449 SSL_kDHE,
450 SSL_aDSS,
451 SSL_DES,
452 SSL_SHA1,
453 SSL_SSLV3,
454 SSL_NOT_EXP | SSL_LOW,
455 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
456 56,
457 56,
458 },
52b8dad8 459
d02b48c6 460/* Cipher 13 */
0f113f3e
MC
461 {
462 1,
463 SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA,
464 SSL3_CK_DHE_DSS_DES_192_CBC3_SHA,
465 SSL_kDHE,
466 SSL_aDSS,
467 SSL_3DES,
468 SSL_SHA1,
469 SSL_SSLV3,
470 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
471 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
472 112,
473 168,
474 },
52b8dad8 475
d02b48c6 476/* Cipher 14 */
0f113f3e
MC
477 {
478 1,
479 SSL3_TXT_DHE_RSA_DES_40_CBC_SHA,
480 SSL3_CK_DHE_RSA_DES_40_CBC_SHA,
481 SSL_kDHE,
482 SSL_aRSA,
483 SSL_DES,
484 SSL_SHA1,
485 SSL_SSLV3,
486 SSL_EXPORT | SSL_EXP40,
487 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
488 40,
489 56,
490 },
52b8dad8 491
d02b48c6 492/* Cipher 15 */
0f113f3e
MC
493 {
494 1,
495 SSL3_TXT_DHE_RSA_DES_64_CBC_SHA,
496 SSL3_CK_DHE_RSA_DES_64_CBC_SHA,
497 SSL_kDHE,
498 SSL_aRSA,
499 SSL_DES,
500 SSL_SHA1,
501 SSL_SSLV3,
502 SSL_NOT_EXP | SSL_LOW,
503 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
504 56,
505 56,
506 },
52b8dad8 507
d02b48c6 508/* Cipher 16 */
0f113f3e
MC
509 {
510 1,
511 SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA,
512 SSL3_CK_DHE_RSA_DES_192_CBC3_SHA,
513 SSL_kDHE,
514 SSL_aRSA,
515 SSL_3DES,
516 SSL_SHA1,
517 SSL_SSLV3,
518 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
519 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
520 112,
521 168,
522 },
52b8dad8 523
6e119bb0 524/* Cipher 17 */
0f113f3e
MC
525 {
526 1,
527 SSL3_TXT_ADH_RC4_40_MD5,
528 SSL3_CK_ADH_RC4_40_MD5,
529 SSL_kDHE,
530 SSL_aNULL,
531 SSL_RC4,
532 SSL_MD5,
533 SSL_SSLV3,
534 SSL_EXPORT | SSL_EXP40,
535 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
536 40,
537 128,
538 },
52b8dad8 539
6e119bb0 540/* Cipher 18 */
0f113f3e
MC
541 {
542 1,
543 SSL3_TXT_ADH_RC4_128_MD5,
544 SSL3_CK_ADH_RC4_128_MD5,
545 SSL_kDHE,
546 SSL_aNULL,
547 SSL_RC4,
548 SSL_MD5,
549 SSL_SSLV3,
550 SSL_NOT_EXP | SSL_MEDIUM,
551 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
552 128,
553 128,
554 },
52b8dad8 555
6e119bb0 556/* Cipher 19 */
0f113f3e
MC
557 {
558 1,
559 SSL3_TXT_ADH_DES_40_CBC_SHA,
560 SSL3_CK_ADH_DES_40_CBC_SHA,
561 SSL_kDHE,
562 SSL_aNULL,
563 SSL_DES,
564 SSL_SHA1,
565 SSL_SSLV3,
566 SSL_EXPORT | SSL_EXP40,
567 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
568 40,
569 128,
570 },
52b8dad8 571
6e119bb0 572/* Cipher 1A */
0f113f3e
MC
573 {
574 1,
575 SSL3_TXT_ADH_DES_64_CBC_SHA,
576 SSL3_CK_ADH_DES_64_CBC_SHA,
577 SSL_kDHE,
578 SSL_aNULL,
579 SSL_DES,
580 SSL_SHA1,
581 SSL_SSLV3,
582 SSL_NOT_EXP | SSL_LOW,
583 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
584 56,
585 56,
586 },
52b8dad8 587
6e119bb0 588/* Cipher 1B */
0f113f3e
MC
589 {
590 1,
591 SSL3_TXT_ADH_DES_192_CBC_SHA,
592 SSL3_CK_ADH_DES_192_CBC_SHA,
593 SSL_kDHE,
594 SSL_aNULL,
595 SSL_3DES,
596 SSL_SHA1,
597 SSL_SSLV3,
598 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
599 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
600 112,
601 168,
602 },
d02b48c6 603
bc36ee62 604#ifndef OPENSSL_NO_KRB5
60cad2ca 605/* The Kerberos ciphers*/
89bbe14c 606/* Cipher 1E */
0f113f3e
MC
607 {
608 1,
609 SSL3_TXT_KRB5_DES_64_CBC_SHA,
610 SSL3_CK_KRB5_DES_64_CBC_SHA,
611 SSL_kKRB5,
612 SSL_aKRB5,
613 SSL_DES,
614 SSL_SHA1,
615 SSL_SSLV3,
616 SSL_NOT_EXP | SSL_LOW,
617 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
618 56,
619 56,
620 },
f9b3bff6 621
89bbe14c 622/* Cipher 1F */
0f113f3e
MC
623 {
624 1,
625 SSL3_TXT_KRB5_DES_192_CBC3_SHA,
626 SSL3_CK_KRB5_DES_192_CBC3_SHA,
627 SSL_kKRB5,
628 SSL_aKRB5,
629 SSL_3DES,
630 SSL_SHA1,
631 SSL_SSLV3,
632 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
633 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
634 112,
635 168,
636 },
f9b3bff6 637
89bbe14c 638/* Cipher 20 */
0f113f3e
MC
639 {
640 1,
641 SSL3_TXT_KRB5_RC4_128_SHA,
642 SSL3_CK_KRB5_RC4_128_SHA,
643 SSL_kKRB5,
644 SSL_aKRB5,
645 SSL_RC4,
646 SSL_SHA1,
647 SSL_SSLV3,
648 SSL_NOT_EXP | SSL_MEDIUM,
649 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
650 128,
651 128,
652 },
f9b3bff6 653
89bbe14c 654/* Cipher 21 */
0f113f3e
MC
655 {
656 1,
657 SSL3_TXT_KRB5_IDEA_128_CBC_SHA,
658 SSL3_CK_KRB5_IDEA_128_CBC_SHA,
659 SSL_kKRB5,
660 SSL_aKRB5,
661 SSL_IDEA,
662 SSL_SHA1,
663 SSL_SSLV3,
664 SSL_NOT_EXP | SSL_MEDIUM,
665 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
666 128,
667 128,
668 },
7ba3a4c3 669
89bbe14c 670/* Cipher 22 */
0f113f3e
MC
671 {
672 1,
673 SSL3_TXT_KRB5_DES_64_CBC_MD5,
674 SSL3_CK_KRB5_DES_64_CBC_MD5,
675 SSL_kKRB5,
676 SSL_aKRB5,
677 SSL_DES,
678 SSL_MD5,
679 SSL_SSLV3,
680 SSL_NOT_EXP | SSL_LOW,
681 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
682 56,
683 56,
684 },
f9b3bff6 685
89bbe14c 686/* Cipher 23 */
0f113f3e
MC
687 {
688 1,
689 SSL3_TXT_KRB5_DES_192_CBC3_MD5,
690 SSL3_CK_KRB5_DES_192_CBC3_MD5,
691 SSL_kKRB5,
692 SSL_aKRB5,
693 SSL_3DES,
694 SSL_MD5,
695 SSL_SSLV3,
696 SSL_NOT_EXP | SSL_HIGH,
697 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
698 112,
699 168,
700 },
f9b3bff6 701
89bbe14c 702/* Cipher 24 */
0f113f3e
MC
703 {
704 1,
705 SSL3_TXT_KRB5_RC4_128_MD5,
706 SSL3_CK_KRB5_RC4_128_MD5,
707 SSL_kKRB5,
708 SSL_aKRB5,
709 SSL_RC4,
710 SSL_MD5,
711 SSL_SSLV3,
712 SSL_NOT_EXP | SSL_MEDIUM,
713 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
714 128,
715 128,
716 },
7ba3a4c3 717
89bbe14c 718/* Cipher 25 */
0f113f3e
MC
719 {
720 1,
721 SSL3_TXT_KRB5_IDEA_128_CBC_MD5,
722 SSL3_CK_KRB5_IDEA_128_CBC_MD5,
723 SSL_kKRB5,
724 SSL_aKRB5,
725 SSL_IDEA,
726 SSL_MD5,
727 SSL_SSLV3,
728 SSL_NOT_EXP | SSL_MEDIUM,
729 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
730 128,
731 128,
732 },
7ba3a4c3 733
89bbe14c 734/* Cipher 26 */
0f113f3e
MC
735 {
736 1,
737 SSL3_TXT_KRB5_DES_40_CBC_SHA,
738 SSL3_CK_KRB5_DES_40_CBC_SHA,
739 SSL_kKRB5,
740 SSL_aKRB5,
741 SSL_DES,
742 SSL_SHA1,
743 SSL_SSLV3,
744 SSL_EXPORT | SSL_EXP40,
745 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
746 40,
747 56,
748 },
7ba3a4c3 749
89bbe14c 750/* Cipher 27 */
0f113f3e
MC
751 {
752 1,
753 SSL3_TXT_KRB5_RC2_40_CBC_SHA,
754 SSL3_CK_KRB5_RC2_40_CBC_SHA,
755 SSL_kKRB5,
756 SSL_aKRB5,
757 SSL_RC2,
758 SSL_SHA1,
759 SSL_SSLV3,
760 SSL_EXPORT | SSL_EXP40,
761 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
762 40,
763 128,
764 },
7ba3a4c3 765
89bbe14c 766/* Cipher 28 */
0f113f3e
MC
767 {
768 1,
769 SSL3_TXT_KRB5_RC4_40_SHA,
770 SSL3_CK_KRB5_RC4_40_SHA,
771 SSL_kKRB5,
772 SSL_aKRB5,
773 SSL_RC4,
774 SSL_SHA1,
775 SSL_SSLV3,
776 SSL_EXPORT | SSL_EXP40,
777 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
778 40,
779 128,
780 },
7ba3a4c3 781
89bbe14c 782/* Cipher 29 */
0f113f3e
MC
783 {
784 1,
785 SSL3_TXT_KRB5_DES_40_CBC_MD5,
786 SSL3_CK_KRB5_DES_40_CBC_MD5,
787 SSL_kKRB5,
788 SSL_aKRB5,
789 SSL_DES,
790 SSL_MD5,
791 SSL_SSLV3,
792 SSL_EXPORT | SSL_EXP40,
793 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
794 40,
795 56,
796 },
7ba3a4c3 797
89bbe14c 798/* Cipher 2A */
0f113f3e
MC
799 {
800 1,
801 SSL3_TXT_KRB5_RC2_40_CBC_MD5,
802 SSL3_CK_KRB5_RC2_40_CBC_MD5,
803 SSL_kKRB5,
804 SSL_aKRB5,
805 SSL_RC2,
806 SSL_MD5,
807 SSL_SSLV3,
808 SSL_EXPORT | SSL_EXP40,
809 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
810 40,
811 128,
812 },
7ba3a4c3 813
89bbe14c 814/* Cipher 2B */
0f113f3e
MC
815 {
816 1,
817 SSL3_TXT_KRB5_RC4_40_MD5,
818 SSL3_CK_KRB5_RC4_40_MD5,
819 SSL_kKRB5,
820 SSL_aKRB5,
821 SSL_RC4,
822 SSL_MD5,
823 SSL_SSLV3,
824 SSL_EXPORT | SSL_EXP40,
825 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
826 40,
827 128,
828 },
829#endif /* OPENSSL_NO_KRB5 */
deb2c1a1 830
89bbe14c 831/* New AES ciphersuites */
6e119bb0 832/* Cipher 2F */
0f113f3e
MC
833 {
834 1,
835 TLS1_TXT_RSA_WITH_AES_128_SHA,
836 TLS1_CK_RSA_WITH_AES_128_SHA,
837 SSL_kRSA,
838 SSL_aRSA,
839 SSL_AES128,
840 SSL_SHA1,
841 SSL_TLSV1,
842 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
843 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
844 128,
845 128,
846 },
6e119bb0 847/* Cipher 30 */
0f113f3e
MC
848 {
849 1,
850 TLS1_TXT_DH_DSS_WITH_AES_128_SHA,
851 TLS1_CK_DH_DSS_WITH_AES_128_SHA,
852 SSL_kDHd,
853 SSL_aDH,
854 SSL_AES128,
855 SSL_SHA1,
856 SSL_TLSV1,
857 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
858 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
859 128,
860 128,
861 },
6e119bb0 862/* Cipher 31 */
0f113f3e
MC
863 {
864 1,
865 TLS1_TXT_DH_RSA_WITH_AES_128_SHA,
866 TLS1_CK_DH_RSA_WITH_AES_128_SHA,
867 SSL_kDHr,
868 SSL_aDH,
869 SSL_AES128,
870 SSL_SHA1,
871 SSL_TLSV1,
872 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
873 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
874 128,
875 128,
876 },
6e119bb0 877/* Cipher 32 */
0f113f3e
MC
878 {
879 1,
880 TLS1_TXT_DHE_DSS_WITH_AES_128_SHA,
881 TLS1_CK_DHE_DSS_WITH_AES_128_SHA,
882 SSL_kDHE,
883 SSL_aDSS,
884 SSL_AES128,
885 SSL_SHA1,
886 SSL_TLSV1,
887 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
888 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
889 128,
890 128,
891 },
6e119bb0 892/* Cipher 33 */
0f113f3e
MC
893 {
894 1,
895 TLS1_TXT_DHE_RSA_WITH_AES_128_SHA,
896 TLS1_CK_DHE_RSA_WITH_AES_128_SHA,
897 SSL_kDHE,
898 SSL_aRSA,
899 SSL_AES128,
900 SSL_SHA1,
901 SSL_TLSV1,
902 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
903 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
904 128,
905 128,
906 },
6e119bb0 907/* Cipher 34 */
0f113f3e
MC
908 {
909 1,
910 TLS1_TXT_ADH_WITH_AES_128_SHA,
911 TLS1_CK_ADH_WITH_AES_128_SHA,
912 SSL_kDHE,
913 SSL_aNULL,
914 SSL_AES128,
915 SSL_SHA1,
916 SSL_TLSV1,
917 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
918 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
919 128,
920 128,
921 },
deb2c1a1 922
6e119bb0 923/* Cipher 35 */
0f113f3e
MC
924 {
925 1,
926 TLS1_TXT_RSA_WITH_AES_256_SHA,
927 TLS1_CK_RSA_WITH_AES_256_SHA,
928 SSL_kRSA,
929 SSL_aRSA,
930 SSL_AES256,
931 SSL_SHA1,
932 SSL_TLSV1,
933 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
934 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
935 256,
936 256,
937 },
6e119bb0 938/* Cipher 36 */
0f113f3e
MC
939 {
940 1,
941 TLS1_TXT_DH_DSS_WITH_AES_256_SHA,
942 TLS1_CK_DH_DSS_WITH_AES_256_SHA,
943 SSL_kDHd,
944 SSL_aDH,
945 SSL_AES256,
946 SSL_SHA1,
947 SSL_TLSV1,
948 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
949 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
950 256,
951 256,
952 },
52b8dad8 953
6e119bb0 954/* Cipher 37 */
0f113f3e
MC
955 {
956 1,
957 TLS1_TXT_DH_RSA_WITH_AES_256_SHA,
958 TLS1_CK_DH_RSA_WITH_AES_256_SHA,
959 SSL_kDHr,
960 SSL_aDH,
961 SSL_AES256,
962 SSL_SHA1,
963 SSL_TLSV1,
964 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
965 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
966 256,
967 256,
968 },
52b8dad8 969
6e119bb0 970/* Cipher 38 */
0f113f3e
MC
971 {
972 1,
973 TLS1_TXT_DHE_DSS_WITH_AES_256_SHA,
974 TLS1_CK_DHE_DSS_WITH_AES_256_SHA,
975 SSL_kDHE,
976 SSL_aDSS,
977 SSL_AES256,
978 SSL_SHA1,
979 SSL_TLSV1,
980 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
981 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
982 256,
983 256,
984 },
52b8dad8 985
6e119bb0 986/* Cipher 39 */
0f113f3e
MC
987 {
988 1,
989 TLS1_TXT_DHE_RSA_WITH_AES_256_SHA,
990 TLS1_CK_DHE_RSA_WITH_AES_256_SHA,
991 SSL_kDHE,
992 SSL_aRSA,
993 SSL_AES256,
994 SSL_SHA1,
995 SSL_TLSV1,
996 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
997 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
998 256,
999 256,
1000 },
1001
1002 /* Cipher 3A */
1003 {
1004 1,
1005 TLS1_TXT_ADH_WITH_AES_256_SHA,
1006 TLS1_CK_ADH_WITH_AES_256_SHA,
1007 SSL_kDHE,
1008 SSL_aNULL,
1009 SSL_AES256,
1010 SSL_SHA1,
1011 SSL_TLSV1,
1012 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1013 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1014 256,
1015 256,
1016 },
1017
1018 /* TLS v1.2 ciphersuites */
1019 /* Cipher 3B */
1020 {
1021 1,
1022 TLS1_TXT_RSA_WITH_NULL_SHA256,
1023 TLS1_CK_RSA_WITH_NULL_SHA256,
1024 SSL_kRSA,
1025 SSL_aRSA,
1026 SSL_eNULL,
1027 SSL_SHA256,
1028 SSL_TLSV1_2,
1029 SSL_NOT_EXP | SSL_STRONG_NONE | SSL_FIPS,
1030 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1031 0,
1032 0,
1033 },
1034
1035 /* Cipher 3C */
1036 {
1037 1,
1038 TLS1_TXT_RSA_WITH_AES_128_SHA256,
1039 TLS1_CK_RSA_WITH_AES_128_SHA256,
1040 SSL_kRSA,
1041 SSL_aRSA,
1042 SSL_AES128,
1043 SSL_SHA256,
1044 SSL_TLSV1_2,
1045 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1046 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1047 128,
1048 128,
1049 },
1050
1051 /* Cipher 3D */
1052 {
1053 1,
1054 TLS1_TXT_RSA_WITH_AES_256_SHA256,
1055 TLS1_CK_RSA_WITH_AES_256_SHA256,
1056 SSL_kRSA,
1057 SSL_aRSA,
1058 SSL_AES256,
1059 SSL_SHA256,
1060 SSL_TLSV1_2,
1061 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1062 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1063 256,
1064 256,
1065 },
1066
1067 /* Cipher 3E */
1068 {
1069 1,
1070 TLS1_TXT_DH_DSS_WITH_AES_128_SHA256,
1071 TLS1_CK_DH_DSS_WITH_AES_128_SHA256,
1072 SSL_kDHd,
1073 SSL_aDH,
1074 SSL_AES128,
1075 SSL_SHA256,
1076 SSL_TLSV1_2,
1077 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1078 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1079 128,
1080 128,
1081 },
1082
1083 /* Cipher 3F */
1084 {
1085 1,
1086 TLS1_TXT_DH_RSA_WITH_AES_128_SHA256,
1087 TLS1_CK_DH_RSA_WITH_AES_128_SHA256,
1088 SSL_kDHr,
1089 SSL_aDH,
1090 SSL_AES128,
1091 SSL_SHA256,
1092 SSL_TLSV1_2,
1093 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1094 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1095 128,
1096 128,
1097 },
1098
1099 /* Cipher 40 */
1100 {
1101 1,
1102 TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256,
1103 TLS1_CK_DHE_DSS_WITH_AES_128_SHA256,
1104 SSL_kDHE,
1105 SSL_aDSS,
1106 SSL_AES128,
1107 SSL_SHA256,
1108 SSL_TLSV1_2,
1109 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1110 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1111 128,
1112 128,
1113 },
7409d7ad 1114
f3dea9a5 1115#ifndef OPENSSL_NO_CAMELLIA
0f113f3e
MC
1116 /* Camellia ciphersuites from RFC4132 (128-bit portion) */
1117
1118 /* Cipher 41 */
1119 {
1120 1,
1121 TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA,
1122 TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA,
1123 SSL_kRSA,
1124 SSL_aRSA,
1125 SSL_CAMELLIA128,
1126 SSL_SHA1,
1127 SSL_TLSV1,
1128 SSL_NOT_EXP | SSL_HIGH,
1129 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1130 128,
1131 128,
1132 },
1133
1134 /* Cipher 42 */
1135 {
1136 1,
1137 TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA,
1138 TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA,
1139 SSL_kDHd,
1140 SSL_aDH,
1141 SSL_CAMELLIA128,
1142 SSL_SHA1,
1143 SSL_TLSV1,
1144 SSL_NOT_EXP | SSL_HIGH,
1145 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1146 128,
1147 128,
1148 },
1149
1150 /* Cipher 43 */
1151 {
1152 1,
1153 TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA,
1154 TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA,
1155 SSL_kDHr,
1156 SSL_aDH,
1157 SSL_CAMELLIA128,
1158 SSL_SHA1,
1159 SSL_TLSV1,
1160 SSL_NOT_EXP | SSL_HIGH,
1161 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1162 128,
1163 128,
1164 },
1165
1166 /* Cipher 44 */
1167 {
1168 1,
1169 TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA,
1170 TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA,
1171 SSL_kDHE,
1172 SSL_aDSS,
1173 SSL_CAMELLIA128,
1174 SSL_SHA1,
1175 SSL_TLSV1,
1176 SSL_NOT_EXP | SSL_HIGH,
1177 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1178 128,
1179 128,
1180 },
1181
1182 /* Cipher 45 */
1183 {
1184 1,
1185 TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
1186 TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
1187 SSL_kDHE,
1188 SSL_aRSA,
1189 SSL_CAMELLIA128,
1190 SSL_SHA1,
1191 SSL_TLSV1,
1192 SSL_NOT_EXP | SSL_HIGH,
1193 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1194 128,
1195 128,
1196 },
1197
1198 /* Cipher 46 */
1199 {
1200 1,
1201 TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA,
1202 TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA,
1203 SSL_kDHE,
1204 SSL_aNULL,
1205 SSL_CAMELLIA128,
1206 SSL_SHA1,
1207 SSL_TLSV1,
1208 SSL_NOT_EXP | SSL_HIGH,
1209 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1210 128,
1211 128,
1212 },
1213#endif /* OPENSSL_NO_CAMELLIA */
f3dea9a5 1214
0f113f3e
MC
1215 /* TLS v1.2 ciphersuites */
1216 /* Cipher 67 */
1217 {
1218 1,
1219 TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256,
1220 TLS1_CK_DHE_RSA_WITH_AES_128_SHA256,
1221 SSL_kDHE,
1222 SSL_aRSA,
1223 SSL_AES128,
1224 SSL_SHA256,
1225 SSL_TLSV1_2,
1226 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1227 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1228 128,
1229 128,
1230 },
1231
1232 /* Cipher 68 */
1233 {
1234 1,
1235 TLS1_TXT_DH_DSS_WITH_AES_256_SHA256,
1236 TLS1_CK_DH_DSS_WITH_AES_256_SHA256,
1237 SSL_kDHd,
1238 SSL_aDH,
1239 SSL_AES256,
1240 SSL_SHA256,
1241 SSL_TLSV1_2,
1242 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1243 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1244 256,
1245 256,
1246 },
1247
1248 /* Cipher 69 */
1249 {
1250 1,
1251 TLS1_TXT_DH_RSA_WITH_AES_256_SHA256,
1252 TLS1_CK_DH_RSA_WITH_AES_256_SHA256,
1253 SSL_kDHr,
1254 SSL_aDH,
1255 SSL_AES256,
1256 SSL_SHA256,
1257 SSL_TLSV1_2,
1258 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1259 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1260 256,
1261 256,
1262 },
1263
1264 /* Cipher 6A */
1265 {
1266 1,
1267 TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256,
1268 TLS1_CK_DHE_DSS_WITH_AES_256_SHA256,
1269 SSL_kDHE,
1270 SSL_aDSS,
1271 SSL_AES256,
1272 SSL_SHA256,
1273 SSL_TLSV1_2,
1274 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1275 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1276 256,
1277 256,
1278 },
1279
1280 /* Cipher 6B */
1281 {
1282 1,
1283 TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256,
1284 TLS1_CK_DHE_RSA_WITH_AES_256_SHA256,
1285 SSL_kDHE,
1286 SSL_aRSA,
1287 SSL_AES256,
1288 SSL_SHA256,
1289 SSL_TLSV1_2,
1290 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1291 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1292 256,
1293 256,
1294 },
1295
1296 /* Cipher 6C */
1297 {
1298 1,
1299 TLS1_TXT_ADH_WITH_AES_128_SHA256,
1300 TLS1_CK_ADH_WITH_AES_128_SHA256,
1301 SSL_kDHE,
1302 SSL_aNULL,
1303 SSL_AES128,
1304 SSL_SHA256,
1305 SSL_TLSV1_2,
1306 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1307 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1308 128,
1309 128,
1310 },
1311
1312 /* Cipher 6D */
1313 {
1314 1,
1315 TLS1_TXT_ADH_WITH_AES_256_SHA256,
1316 TLS1_CK_ADH_WITH_AES_256_SHA256,
1317 SSL_kDHE,
1318 SSL_aNULL,
1319 SSL_AES256,
1320 SSL_SHA256,
1321 SSL_TLSV1_2,
1322 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1323 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1324 256,
1325 256,
1326 },
1327
1328 /* GOST Ciphersuites */
1329
1330 {
1331 1,
1332 "GOST94-GOST89-GOST89",
1333 0x3000080,
1334 SSL_kGOST,
1335 SSL_aGOST94,
1336 SSL_eGOST2814789CNT,
1337 SSL_GOST89MAC,
1338 SSL_TLSV1,
1339 SSL_NOT_EXP | SSL_HIGH,
1340 SSL_HANDSHAKE_MAC_GOST94 | TLS1_PRF_GOST94 | TLS1_STREAM_MAC,
1341 256,
1342 256},
1343 {
1344 1,
1345 "GOST2001-GOST89-GOST89",
1346 0x3000081,
1347 SSL_kGOST,
1348 SSL_aGOST01,
1349 SSL_eGOST2814789CNT,
1350 SSL_GOST89MAC,
1351 SSL_TLSV1,
1352 SSL_NOT_EXP | SSL_HIGH,
1353 SSL_HANDSHAKE_MAC_GOST94 | TLS1_PRF_GOST94 | TLS1_STREAM_MAC,
1354 256,
1355 256},
1356 {
1357 1,
1358 "GOST94-NULL-GOST94",
1359 0x3000082,
1360 SSL_kGOST,
1361 SSL_aGOST94,
1362 SSL_eNULL,
1363 SSL_GOST94,
1364 SSL_TLSV1,
1365 SSL_NOT_EXP | SSL_STRONG_NONE,
1366 SSL_HANDSHAKE_MAC_GOST94 | TLS1_PRF_GOST94,
1367 0,
1368 0},
1369 {
1370 1,
1371 "GOST2001-NULL-GOST94",
1372 0x3000083,
1373 SSL_kGOST,
1374 SSL_aGOST01,
1375 SSL_eNULL,
1376 SSL_GOST94,
1377 SSL_TLSV1,
1378 SSL_NOT_EXP | SSL_STRONG_NONE,
1379 SSL_HANDSHAKE_MAC_GOST94 | TLS1_PRF_GOST94,
1380 0,
1381 0},
f3dea9a5
BM
1382
1383#ifndef OPENSSL_NO_CAMELLIA
0f113f3e
MC
1384 /* Camellia ciphersuites from RFC4132 (256-bit portion) */
1385
1386 /* Cipher 84 */
1387 {
1388 1,
1389 TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA,
1390 TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA,
1391 SSL_kRSA,
1392 SSL_aRSA,
1393 SSL_CAMELLIA256,
1394 SSL_SHA1,
1395 SSL_TLSV1,
1396 SSL_NOT_EXP | SSL_HIGH,
1397 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1398 256,
1399 256,
1400 },
1401 /* Cipher 85 */
1402 {
1403 1,
1404 TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA,
1405 TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA,
1406 SSL_kDHd,
1407 SSL_aDH,
1408 SSL_CAMELLIA256,
1409 SSL_SHA1,
1410 SSL_TLSV1,
1411 SSL_NOT_EXP | SSL_HIGH,
1412 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1413 256,
1414 256,
1415 },
1416
1417 /* Cipher 86 */
1418 {
1419 1,
1420 TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA,
1421 TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA,
1422 SSL_kDHr,
1423 SSL_aDH,
1424 SSL_CAMELLIA256,
1425 SSL_SHA1,
1426 SSL_TLSV1,
1427 SSL_NOT_EXP | SSL_HIGH,
1428 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1429 256,
1430 256,
1431 },
1432
1433 /* Cipher 87 */
1434 {
1435 1,
1436 TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA,
1437 TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA,
1438 SSL_kDHE,
1439 SSL_aDSS,
1440 SSL_CAMELLIA256,
1441 SSL_SHA1,
1442 SSL_TLSV1,
1443 SSL_NOT_EXP | SSL_HIGH,
1444 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1445 256,
1446 256,
1447 },
1448
1449 /* Cipher 88 */
1450 {
1451 1,
1452 TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
1453 TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
1454 SSL_kDHE,
1455 SSL_aRSA,
1456 SSL_CAMELLIA256,
1457 SSL_SHA1,
1458 SSL_TLSV1,
1459 SSL_NOT_EXP | SSL_HIGH,
1460 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1461 256,
1462 256,
1463 },
1464
1465 /* Cipher 89 */
1466 {
1467 1,
1468 TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA,
1469 TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA,
1470 SSL_kDHE,
1471 SSL_aNULL,
1472 SSL_CAMELLIA256,
1473 SSL_SHA1,
1474 SSL_TLSV1,
1475 SSL_NOT_EXP | SSL_HIGH,
1476 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1477 256,
1478 256,
1479 },
1480#endif /* OPENSSL_NO_CAMELLIA */
f3dea9a5 1481
ddac1974 1482#ifndef OPENSSL_NO_PSK
0f113f3e
MC
1483 /* Cipher 8A */
1484 {
1485 1,
1486 TLS1_TXT_PSK_WITH_RC4_128_SHA,
1487 TLS1_CK_PSK_WITH_RC4_128_SHA,
1488 SSL_kPSK,
1489 SSL_aPSK,
1490 SSL_RC4,
1491 SSL_SHA1,
1492 SSL_TLSV1,
1493 SSL_NOT_EXP | SSL_MEDIUM,
1494 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1495 128,
1496 128,
1497 },
1498
1499 /* Cipher 8B */
1500 {
1501 1,
1502 TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA,
1503 TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA,
1504 SSL_kPSK,
1505 SSL_aPSK,
1506 SSL_3DES,
1507 SSL_SHA1,
1508 SSL_TLSV1,
1509 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1510 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1511 112,
1512 168,
1513 },
1514
1515 /* Cipher 8C */
1516 {
1517 1,
1518 TLS1_TXT_PSK_WITH_AES_128_CBC_SHA,
1519 TLS1_CK_PSK_WITH_AES_128_CBC_SHA,
1520 SSL_kPSK,
1521 SSL_aPSK,
1522 SSL_AES128,
1523 SSL_SHA1,
1524 SSL_TLSV1,
1525 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1526 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1527 128,
1528 128,
1529 },
1530
1531 /* Cipher 8D */
1532 {
1533 1,
1534 TLS1_TXT_PSK_WITH_AES_256_CBC_SHA,
1535 TLS1_CK_PSK_WITH_AES_256_CBC_SHA,
1536 SSL_kPSK,
1537 SSL_aPSK,
1538 SSL_AES256,
1539 SSL_SHA1,
1540 SSL_TLSV1,
1541 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1542 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1543 256,
1544 256,
1545 },
1546#endif /* OPENSSL_NO_PSK */
89bbe14c 1547
96afc1cf 1548#ifndef OPENSSL_NO_SEED
0f113f3e
MC
1549 /* SEED ciphersuites from RFC4162 */
1550
1551 /* Cipher 96 */
1552 {
1553 1,
1554 TLS1_TXT_RSA_WITH_SEED_SHA,
1555 TLS1_CK_RSA_WITH_SEED_SHA,
1556 SSL_kRSA,
1557 SSL_aRSA,
1558 SSL_SEED,
1559 SSL_SHA1,
1560 SSL_TLSV1,
1561 SSL_NOT_EXP | SSL_MEDIUM,
1562 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1563 128,
1564 128,
1565 },
1566
1567 /* Cipher 97 */
1568 {
1569 1,
1570 TLS1_TXT_DH_DSS_WITH_SEED_SHA,
1571 TLS1_CK_DH_DSS_WITH_SEED_SHA,
1572 SSL_kDHd,
1573 SSL_aDH,
1574 SSL_SEED,
1575 SSL_SHA1,
1576 SSL_TLSV1,
1577 SSL_NOT_EXP | SSL_MEDIUM,
1578 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1579 128,
1580 128,
1581 },
1582
1583 /* Cipher 98 */
1584 {
1585 1,
1586 TLS1_TXT_DH_RSA_WITH_SEED_SHA,
1587 TLS1_CK_DH_RSA_WITH_SEED_SHA,
1588 SSL_kDHr,
1589 SSL_aDH,
1590 SSL_SEED,
1591 SSL_SHA1,
1592 SSL_TLSV1,
1593 SSL_NOT_EXP | SSL_MEDIUM,
1594 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1595 128,
1596 128,
1597 },
1598
1599 /* Cipher 99 */
1600 {
1601 1,
1602 TLS1_TXT_DHE_DSS_WITH_SEED_SHA,
1603 TLS1_CK_DHE_DSS_WITH_SEED_SHA,
1604 SSL_kDHE,
1605 SSL_aDSS,
1606 SSL_SEED,
1607 SSL_SHA1,
1608 SSL_TLSV1,
1609 SSL_NOT_EXP | SSL_MEDIUM,
1610 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1611 128,
1612 128,
1613 },
1614
1615 /* Cipher 9A */
1616 {
1617 1,
1618 TLS1_TXT_DHE_RSA_WITH_SEED_SHA,
1619 TLS1_CK_DHE_RSA_WITH_SEED_SHA,
1620 SSL_kDHE,
1621 SSL_aRSA,
1622 SSL_SEED,
1623 SSL_SHA1,
1624 SSL_TLSV1,
1625 SSL_NOT_EXP | SSL_MEDIUM,
1626 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1627 128,
1628 128,
1629 },
1630
1631 /* Cipher 9B */
1632 {
1633 1,
1634 TLS1_TXT_ADH_WITH_SEED_SHA,
1635 TLS1_CK_ADH_WITH_SEED_SHA,
1636 SSL_kDHE,
1637 SSL_aNULL,
1638 SSL_SEED,
1639 SSL_SHA1,
1640 SSL_TLSV1,
1641 SSL_NOT_EXP | SSL_MEDIUM,
1642 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
1643 128,
1644 128,
1645 },
1646
1647#endif /* OPENSSL_NO_SEED */
1648
1649 /* GCM ciphersuites from RFC5288 */
1650
1651 /* Cipher 9C */
1652 {
1653 1,
1654 TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256,
1655 TLS1_CK_RSA_WITH_AES_128_GCM_SHA256,
1656 SSL_kRSA,
1657 SSL_aRSA,
1658 SSL_AES128GCM,
1659 SSL_AEAD,
1660 SSL_TLSV1_2,
1661 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1662 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1663 128,
1664 128,
1665 },
1666
1667 /* Cipher 9D */
1668 {
1669 1,
1670 TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384,
1671 TLS1_CK_RSA_WITH_AES_256_GCM_SHA384,
1672 SSL_kRSA,
1673 SSL_aRSA,
1674 SSL_AES256GCM,
1675 SSL_AEAD,
1676 SSL_TLSV1_2,
1677 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1678 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
1679 256,
1680 256,
1681 },
1682
1683 /* Cipher 9E */
1684 {
1685 1,
1686 TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256,
1687 TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256,
1688 SSL_kDHE,
1689 SSL_aRSA,
1690 SSL_AES128GCM,
1691 SSL_AEAD,
1692 SSL_TLSV1_2,
1693 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1694 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1695 128,
1696 128,
1697 },
1698
1699 /* Cipher 9F */
1700 {
1701 1,
1702 TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384,
1703 TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384,
1704 SSL_kDHE,
1705 SSL_aRSA,
1706 SSL_AES256GCM,
1707 SSL_AEAD,
1708 SSL_TLSV1_2,
1709 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1710 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
1711 256,
1712 256,
1713 },
1714
1715 /* Cipher A0 */
1716 {
1717 1,
1718 TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256,
1719 TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256,
1720 SSL_kDHr,
1721 SSL_aDH,
1722 SSL_AES128GCM,
1723 SSL_AEAD,
1724 SSL_TLSV1_2,
1725 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1726 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1727 128,
1728 128,
1729 },
1730
1731 /* Cipher A1 */
1732 {
1733 1,
1734 TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384,
1735 TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384,
1736 SSL_kDHr,
1737 SSL_aDH,
1738 SSL_AES256GCM,
1739 SSL_AEAD,
1740 SSL_TLSV1_2,
1741 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1742 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
1743 256,
1744 256,
1745 },
1746
1747 /* Cipher A2 */
1748 {
1749 1,
1750 TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256,
1751 TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256,
1752 SSL_kDHE,
1753 SSL_aDSS,
1754 SSL_AES128GCM,
1755 SSL_AEAD,
1756 SSL_TLSV1_2,
1757 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1758 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1759 128,
1760 128,
1761 },
1762
1763 /* Cipher A3 */
1764 {
1765 1,
1766 TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384,
1767 TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384,
1768 SSL_kDHE,
1769 SSL_aDSS,
1770 SSL_AES256GCM,
1771 SSL_AEAD,
1772 SSL_TLSV1_2,
1773 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1774 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
1775 256,
1776 256,
1777 },
1778
1779 /* Cipher A4 */
1780 {
1781 1,
1782 TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256,
1783 TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256,
1784 SSL_kDHd,
1785 SSL_aDH,
1786 SSL_AES128GCM,
1787 SSL_AEAD,
1788 SSL_TLSV1_2,
1789 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1790 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1791 128,
1792 128,
1793 },
1794
1795 /* Cipher A5 */
1796 {
1797 1,
1798 TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384,
1799 TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384,
1800 SSL_kDHd,
1801 SSL_aDH,
1802 SSL_AES256GCM,
1803 SSL_AEAD,
1804 SSL_TLSV1_2,
1805 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1806 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
1807 256,
1808 256,
1809 },
1810
1811 /* Cipher A6 */
1812 {
1813 1,
1814 TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256,
1815 TLS1_CK_ADH_WITH_AES_128_GCM_SHA256,
1816 SSL_kDHE,
1817 SSL_aNULL,
1818 SSL_AES128GCM,
1819 SSL_AEAD,
1820 SSL_TLSV1_2,
1821 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1822 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1823 128,
1824 128,
1825 },
1826
1827 /* Cipher A7 */
1828 {
1829 1,
1830 TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384,
1831 TLS1_CK_ADH_WITH_AES_256_GCM_SHA384,
1832 SSL_kDHE,
1833 SSL_aNULL,
1834 SSL_AES256GCM,
1835 SSL_AEAD,
1836 SSL_TLSV1_2,
1837 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
1838 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
1839 256,
1840 256,
1841 },
323fa645 1842#ifdef OPENSSL_SSL_DEBUG_BROKEN_PROTOCOL
0f113f3e
MC
1843 {
1844 1,
1845 "SCSV",
1846 SSL3_CK_SCSV,
1847 0,
1848 0,
1849 0,
1850 0,
1851 0,
1852 0,
1853 0,
1854 0,
1855 0},
323fa645 1856#endif
28dd49fa 1857
e6332489 1858#ifndef OPENSSL_NO_CAMELLIA
0f113f3e
MC
1859 /* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */
1860
1861 /* Cipher BA */
1862 {
1863 1,
1864 TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA256,
1865 TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA256,
1866 SSL_kRSA,
1867 SSL_aRSA,
1868 SSL_CAMELLIA128,
1869 SSL_SHA256,
1870 SSL_TLSV1_2,
1871 SSL_NOT_EXP | SSL_HIGH,
1872 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1873 128,
1874 128,
1875 },
1876
1877 /* Cipher BB */
1878 {
1879 1,
1880 TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256,
1881 TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256,
1882 SSL_kDHd,
1883 SSL_aDH,
1884 SSL_CAMELLIA128,
1885 SSL_SHA256,
1886 SSL_TLSV1_2,
1887 SSL_NOT_EXP | SSL_HIGH,
1888 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1889 128,
1890 128,
1891 },
1892
1893 /* Cipher BC */
1894 {
1895 1,
1896 TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256,
1897 TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256,
1898 SSL_kDHr,
1899 SSL_aDH,
1900 SSL_CAMELLIA128,
1901 SSL_SHA256,
1902 SSL_TLSV1_2,
1903 SSL_NOT_EXP | SSL_HIGH,
1904 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1905 128,
1906 128,
1907 },
1908
1909 /* Cipher BD */
1910 {
1911 1,
1912 TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256,
1913 TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256,
1914 SSL_kEDH,
1915 SSL_aDSS,
1916 SSL_CAMELLIA128,
1917 SSL_SHA256,
1918 SSL_TLSV1_2,
1919 SSL_NOT_EXP | SSL_HIGH,
1920 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1921 128,
1922 128,
1923 },
1924
1925 /* Cipher BE */
1926 {
1927 1,
1928 TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256,
1929 TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256,
1930 SSL_kEDH,
1931 SSL_aRSA,
1932 SSL_CAMELLIA128,
1933 SSL_SHA256,
1934 SSL_TLSV1_2,
1935 SSL_NOT_EXP | SSL_HIGH,
1936 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1937 128,
1938 128,
1939 },
1940
1941 /* Cipher BF */
1942 {
1943 1,
1944 TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA256,
1945 TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA256,
1946 SSL_kEDH,
1947 SSL_aNULL,
1948 SSL_CAMELLIA128,
1949 SSL_SHA256,
1950 SSL_TLSV1_2,
1951 SSL_NOT_EXP | SSL_HIGH,
1952 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1953 128,
1954 128,
1955 },
1956
1957 /* Cipher C0 */
1958 {
1959 1,
1960 TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA256,
1961 TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA256,
1962 SSL_kRSA,
1963 SSL_aRSA,
1964 SSL_CAMELLIA256,
1965 SSL_SHA256,
1966 SSL_TLSV1_2,
1967 SSL_NOT_EXP | SSL_HIGH,
1968 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1969 256,
1970 256,
1971 },
1972
1973 /* Cipher C1 */
1974 {
1975 1,
1976 TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256,
1977 TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256,
1978 SSL_kDHd,
1979 SSL_aDH,
1980 SSL_CAMELLIA256,
1981 SSL_SHA256,
1982 SSL_TLSV1_2,
1983 SSL_NOT_EXP | SSL_HIGH,
1984 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
1985 256,
1986 256,
1987 },
1988
1989 /* Cipher C2 */
1990 {
1991 1,
1992 TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256,
1993 TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256,
1994 SSL_kDHr,
1995 SSL_aDH,
1996 SSL_CAMELLIA256,
1997 SSL_SHA256,
1998 SSL_TLSV1_2,
1999 SSL_NOT_EXP | SSL_HIGH,
2000 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2001 256,
2002 256,
2003 },
2004
2005 /* Cipher C3 */
2006 {
2007 1,
2008 TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256,
2009 TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256,
2010 SSL_kEDH,
2011 SSL_aDSS,
2012 SSL_CAMELLIA256,
2013 SSL_SHA256,
2014 SSL_TLSV1_2,
2015 SSL_NOT_EXP | SSL_HIGH,
2016 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2017 256,
2018 256,
2019 },
2020
2021 /* Cipher C4 */
2022 {
2023 1,
2024 TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256,
2025 TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256,
2026 SSL_kEDH,
2027 SSL_aRSA,
2028 SSL_CAMELLIA256,
2029 SSL_SHA256,
2030 SSL_TLSV1_2,
2031 SSL_NOT_EXP | SSL_HIGH,
2032 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2033 256,
2034 256,
2035 },
2036
2037 /* Cipher C5 */
2038 {
2039 1,
2040 TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA256,
2041 TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA256,
2042 SSL_kEDH,
2043 SSL_aNULL,
2044 SSL_CAMELLIA256,
2045 SSL_SHA256,
2046 SSL_TLSV1_2,
2047 SSL_NOT_EXP | SSL_HIGH,
2048 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2049 256,
2050 256,
2051 },
e6332489
P
2052#endif
2053
10bf4fc2 2054#ifndef OPENSSL_NO_EC
0f113f3e
MC
2055 /* Cipher C001 */
2056 {
2057 1,
2058 TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA,
2059 TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA,
2060 SSL_kECDHe,
2061 SSL_aECDH,
2062 SSL_eNULL,
2063 SSL_SHA1,
2064 SSL_TLSV1,
2065 SSL_NOT_EXP | SSL_STRONG_NONE | SSL_FIPS,
2066 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2067 0,
2068 0,
2069 },
2070
2071 /* Cipher C002 */
2072 {
2073 1,
2074 TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA,
2075 TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA,
2076 SSL_kECDHe,
2077 SSL_aECDH,
2078 SSL_RC4,
2079 SSL_SHA1,
2080 SSL_TLSV1,
2081 SSL_NOT_EXP | SSL_MEDIUM,
2082 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2083 128,
2084 128,
2085 },
2086
2087 /* Cipher C003 */
2088 {
2089 1,
2090 TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA,
2091 TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA,
2092 SSL_kECDHe,
2093 SSL_aECDH,
2094 SSL_3DES,
2095 SSL_SHA1,
2096 SSL_TLSV1,
2097 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2098 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2099 112,
2100 168,
2101 },
2102
2103 /* Cipher C004 */
2104 {
2105 1,
2106 TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
2107 TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
2108 SSL_kECDHe,
2109 SSL_aECDH,
2110 SSL_AES128,
2111 SSL_SHA1,
2112 SSL_TLSV1,
2113 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2114 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2115 128,
2116 128,
2117 },
2118
2119 /* Cipher C005 */
2120 {
2121 1,
2122 TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
2123 TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
2124 SSL_kECDHe,
2125 SSL_aECDH,
2126 SSL_AES256,
2127 SSL_SHA1,
2128 SSL_TLSV1,
2129 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2130 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2131 256,
2132 256,
2133 },
2134
2135 /* Cipher C006 */
2136 {
2137 1,
2138 TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA,
2139 TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA,
2140 SSL_kECDHE,
2141 SSL_aECDSA,
2142 SSL_eNULL,
2143 SSL_SHA1,
2144 SSL_TLSV1,
2145 SSL_NOT_EXP | SSL_STRONG_NONE | SSL_FIPS,
2146 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2147 0,
2148 0,
2149 },
2150
2151 /* Cipher C007 */
2152 {
2153 1,
2154 TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA,
2155 TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA,
2156 SSL_kECDHE,
2157 SSL_aECDSA,
2158 SSL_RC4,
2159 SSL_SHA1,
2160 SSL_TLSV1,
2161 SSL_NOT_EXP | SSL_MEDIUM,
2162 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2163 128,
2164 128,
2165 },
2166
2167 /* Cipher C008 */
2168 {
2169 1,
2170 TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA,
2171 TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA,
2172 SSL_kECDHE,
2173 SSL_aECDSA,
2174 SSL_3DES,
2175 SSL_SHA1,
2176 SSL_TLSV1,
2177 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2178 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2179 112,
2180 168,
2181 },
2182
2183 /* Cipher C009 */
2184 {
2185 1,
2186 TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
2187 TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
2188 SSL_kECDHE,
2189 SSL_aECDSA,
2190 SSL_AES128,
2191 SSL_SHA1,
2192 SSL_TLSV1,
2193 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2194 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2195 128,
2196 128,
2197 },
2198
2199 /* Cipher C00A */
2200 {
2201 1,
2202 TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
2203 TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
2204 SSL_kECDHE,
2205 SSL_aECDSA,
2206 SSL_AES256,
2207 SSL_SHA1,
2208 SSL_TLSV1,
2209 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2210 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2211 256,
2212 256,
2213 },
2214
2215 /* Cipher C00B */
2216 {
2217 1,
2218 TLS1_TXT_ECDH_RSA_WITH_NULL_SHA,
2219 TLS1_CK_ECDH_RSA_WITH_NULL_SHA,
2220 SSL_kECDHr,
2221 SSL_aECDH,
2222 SSL_eNULL,
2223 SSL_SHA1,
2224 SSL_TLSV1,
2225 SSL_NOT_EXP | SSL_STRONG_NONE | SSL_FIPS,
2226 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2227 0,
2228 0,
2229 },
2230
2231 /* Cipher C00C */
2232 {
2233 1,
2234 TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA,
2235 TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA,
2236 SSL_kECDHr,
2237 SSL_aECDH,
2238 SSL_RC4,
2239 SSL_SHA1,
2240 SSL_TLSV1,
2241 SSL_NOT_EXP | SSL_MEDIUM,
2242 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2243 128,
2244 128,
2245 },
2246
2247 /* Cipher C00D */
2248 {
2249 1,
2250 TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA,
2251 TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA,
2252 SSL_kECDHr,
2253 SSL_aECDH,
2254 SSL_3DES,
2255 SSL_SHA1,
2256 SSL_TLSV1,
2257 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2258 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2259 112,
2260 168,
2261 },
2262
2263 /* Cipher C00E */
2264 {
2265 1,
2266 TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA,
2267 TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA,
2268 SSL_kECDHr,
2269 SSL_aECDH,
2270 SSL_AES128,
2271 SSL_SHA1,
2272 SSL_TLSV1,
2273 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2274 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2275 128,
2276 128,
2277 },
2278
2279 /* Cipher C00F */
2280 {
2281 1,
2282 TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA,
2283 TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA,
2284 SSL_kECDHr,
2285 SSL_aECDH,
2286 SSL_AES256,
2287 SSL_SHA1,
2288 SSL_TLSV1,
2289 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2290 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2291 256,
2292 256,
2293 },
2294
2295 /* Cipher C010 */
2296 {
2297 1,
2298 TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA,
2299 TLS1_CK_ECDHE_RSA_WITH_NULL_SHA,
2300 SSL_kECDHE,
2301 SSL_aRSA,
2302 SSL_eNULL,
2303 SSL_SHA1,
2304 SSL_TLSV1,
2305 SSL_NOT_EXP | SSL_STRONG_NONE | SSL_FIPS,
2306 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2307 0,
2308 0,
2309 },
2310
2311 /* Cipher C011 */
2312 {
2313 1,
2314 TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA,
2315 TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA,
2316 SSL_kECDHE,
2317 SSL_aRSA,
2318 SSL_RC4,
2319 SSL_SHA1,
2320 SSL_TLSV1,
2321 SSL_NOT_EXP | SSL_MEDIUM,
2322 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2323 128,
2324 128,
2325 },
2326
2327 /* Cipher C012 */
2328 {
2329 1,
2330 TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA,
2331 TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA,
2332 SSL_kECDHE,
2333 SSL_aRSA,
2334 SSL_3DES,
2335 SSL_SHA1,
2336 SSL_TLSV1,
2337 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2338 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2339 112,
2340 168,
2341 },
2342
2343 /* Cipher C013 */
2344 {
2345 1,
2346 TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA,
2347 TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA,
2348 SSL_kECDHE,
2349 SSL_aRSA,
2350 SSL_AES128,
2351 SSL_SHA1,
2352 SSL_TLSV1,
2353 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2354 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2355 128,
2356 128,
2357 },
2358
2359 /* Cipher C014 */
2360 {
2361 1,
2362 TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA,
2363 TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA,
2364 SSL_kECDHE,
2365 SSL_aRSA,
2366 SSL_AES256,
2367 SSL_SHA1,
2368 SSL_TLSV1,
2369 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2370 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2371 256,
2372 256,
2373 },
2374
2375 /* Cipher C015 */
2376 {
2377 1,
2378 TLS1_TXT_ECDH_anon_WITH_NULL_SHA,
2379 TLS1_CK_ECDH_anon_WITH_NULL_SHA,
2380 SSL_kECDHE,
2381 SSL_aNULL,
2382 SSL_eNULL,
2383 SSL_SHA1,
2384 SSL_TLSV1,
2385 SSL_NOT_EXP | SSL_STRONG_NONE | SSL_FIPS,
2386 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2387 0,
2388 0,
2389 },
2390
2391 /* Cipher C016 */
2392 {
2393 1,
2394 TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA,
2395 TLS1_CK_ECDH_anon_WITH_RC4_128_SHA,
2396 SSL_kECDHE,
2397 SSL_aNULL,
2398 SSL_RC4,
2399 SSL_SHA1,
2400 SSL_TLSV1,
2401 SSL_NOT_EXP | SSL_MEDIUM,
2402 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2403 128,
2404 128,
2405 },
2406
2407 /* Cipher C017 */
2408 {
2409 1,
2410 TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA,
2411 TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA,
2412 SSL_kECDHE,
2413 SSL_aNULL,
2414 SSL_3DES,
2415 SSL_SHA1,
2416 SSL_TLSV1,
2417 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2418 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2419 112,
2420 168,
2421 },
2422
2423 /* Cipher C018 */
2424 {
2425 1,
2426 TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA,
2427 TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA,
2428 SSL_kECDHE,
2429 SSL_aNULL,
2430 SSL_AES128,
2431 SSL_SHA1,
2432 SSL_TLSV1,
2433 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2434 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2435 128,
2436 128,
2437 },
2438
2439 /* Cipher C019 */
2440 {
2441 1,
2442 TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA,
2443 TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA,
2444 SSL_kECDHE,
2445 SSL_aNULL,
2446 SSL_AES256,
2447 SSL_SHA1,
2448 SSL_TLSV1,
2449 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2450 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2451 256,
2452 256,
2453 },
10bf4fc2 2454#endif /* OPENSSL_NO_EC */
6e119bb0 2455
edc032b5 2456#ifndef OPENSSL_NO_SRP
0f113f3e
MC
2457 /* Cipher C01A */
2458 {
2459 1,
2460 TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA,
2461 TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA,
2462 SSL_kSRP,
2463 SSL_aSRP,
2464 SSL_3DES,
2465 SSL_SHA1,
2466 SSL_TLSV1,
2467 SSL_NOT_EXP | SSL_HIGH,
2468 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2469 112,
2470 168,
2471 },
2472
2473 /* Cipher C01B */
2474 {
2475 1,
2476 TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA,
2477 TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA,
2478 SSL_kSRP,
2479 SSL_aRSA,
2480 SSL_3DES,
2481 SSL_SHA1,
2482 SSL_TLSV1,
2483 SSL_NOT_EXP | SSL_HIGH,
2484 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2485 112,
2486 168,
2487 },
2488
2489 /* Cipher C01C */
2490 {
2491 1,
2492 TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA,
2493 TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA,
2494 SSL_kSRP,
2495 SSL_aDSS,
2496 SSL_3DES,
2497 SSL_SHA1,
2498 SSL_TLSV1,
2499 SSL_NOT_EXP | SSL_HIGH,
2500 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2501 112,
2502 168,
2503 },
2504
2505 /* Cipher C01D */
2506 {
2507 1,
2508 TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA,
2509 TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA,
2510 SSL_kSRP,
2511 SSL_aSRP,
2512 SSL_AES128,
2513 SSL_SHA1,
2514 SSL_TLSV1,
2515 SSL_NOT_EXP | SSL_HIGH,
2516 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2517 128,
2518 128,
2519 },
2520
2521 /* Cipher C01E */
2522 {
2523 1,
2524 TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA,
2525 TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA,
2526 SSL_kSRP,
2527 SSL_aRSA,
2528 SSL_AES128,
2529 SSL_SHA1,
2530 SSL_TLSV1,
2531 SSL_NOT_EXP | SSL_HIGH,
2532 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2533 128,
2534 128,
2535 },
2536
2537 /* Cipher C01F */
2538 {
2539 1,
2540 TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA,
2541 TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA,
2542 SSL_kSRP,
2543 SSL_aDSS,
2544 SSL_AES128,
2545 SSL_SHA1,
2546 SSL_TLSV1,
2547 SSL_NOT_EXP | SSL_HIGH,
2548 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2549 128,
2550 128,
2551 },
2552
2553 /* Cipher C020 */
2554 {
2555 1,
2556 TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA,
2557 TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA,
2558 SSL_kSRP,
2559 SSL_aSRP,
2560 SSL_AES256,
2561 SSL_SHA1,
2562 SSL_TLSV1,
2563 SSL_NOT_EXP | SSL_HIGH,
2564 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2565 256,
2566 256,
2567 },
2568
2569 /* Cipher C021 */
2570 {
2571 1,
2572 TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA,
2573 TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA,
2574 SSL_kSRP,
2575 SSL_aRSA,
2576 SSL_AES256,
2577 SSL_SHA1,
2578 SSL_TLSV1,
2579 SSL_NOT_EXP | SSL_HIGH,
2580 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2581 256,
2582 256,
2583 },
2584
2585 /* Cipher C022 */
2586 {
2587 1,
2588 TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA,
2589 TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA,
2590 SSL_kSRP,
2591 SSL_aDSS,
2592 SSL_AES256,
2593 SSL_SHA1,
2594 SSL_TLSV1,
2595 SSL_NOT_EXP | SSL_HIGH,
2596 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2597 256,
2598 256,
2599 },
2600#endif /* OPENSSL_NO_SRP */
10bf4fc2 2601#ifndef OPENSSL_NO_EC
d09677ac 2602
0f113f3e
MC
2603 /* HMAC based TLS v1.2 ciphersuites from RFC5289 */
2604
2605 /* Cipher C023 */
2606 {
2607 1,
2608 TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256,
2609 TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256,
2610 SSL_kECDHE,
2611 SSL_aECDSA,
2612 SSL_AES128,
2613 SSL_SHA256,
2614 SSL_TLSV1_2,
2615 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2616 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2617 128,
2618 128,
2619 },
2620
2621 /* Cipher C024 */
2622 {
2623 1,
2624 TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384,
2625 TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384,
2626 SSL_kECDHE,
2627 SSL_aECDSA,
2628 SSL_AES256,
2629 SSL_SHA384,
2630 SSL_TLSV1_2,
2631 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2632 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
2633 256,
2634 256,
2635 },
2636
2637 /* Cipher C025 */
2638 {
2639 1,
2640 TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256,
2641 TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256,
2642 SSL_kECDHe,
2643 SSL_aECDH,
2644 SSL_AES128,
2645 SSL_SHA256,
2646 SSL_TLSV1_2,
2647 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2648 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2649 128,
2650 128,
2651 },
2652
2653 /* Cipher C026 */
2654 {
2655 1,
2656 TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384,
2657 TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384,
2658 SSL_kECDHe,
2659 SSL_aECDH,
2660 SSL_AES256,
2661 SSL_SHA384,
2662 SSL_TLSV1_2,
2663 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2664 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
2665 256,
2666 256,
2667 },
2668
2669 /* Cipher C027 */
2670 {
2671 1,
2672 TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256,
2673 TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256,
2674 SSL_kECDHE,
2675 SSL_aRSA,
2676 SSL_AES128,
2677 SSL_SHA256,
2678 SSL_TLSV1_2,
2679 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2680 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2681 128,
2682 128,
2683 },
2684
2685 /* Cipher C028 */
2686 {
2687 1,
2688 TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384,
2689 TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384,
2690 SSL_kECDHE,
2691 SSL_aRSA,
2692 SSL_AES256,
2693 SSL_SHA384,
2694 SSL_TLSV1_2,
2695 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2696 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
2697 256,
2698 256,
2699 },
2700
2701 /* Cipher C029 */
2702 {
2703 1,
2704 TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256,
2705 TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256,
2706 SSL_kECDHr,
2707 SSL_aECDH,
2708 SSL_AES128,
2709 SSL_SHA256,
2710 SSL_TLSV1_2,
2711 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2712 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2713 128,
2714 128,
2715 },
2716
2717 /* Cipher C02A */
2718 {
2719 1,
2720 TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384,
2721 TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384,
2722 SSL_kECDHr,
2723 SSL_aECDH,
2724 SSL_AES256,
2725 SSL_SHA384,
2726 SSL_TLSV1_2,
2727 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2728 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
2729 256,
2730 256,
2731 },
2732
2733 /* GCM based TLS v1.2 ciphersuites from RFC5289 */
2734
2735 /* Cipher C02B */
2736 {
2737 1,
2738 TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
2739 TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
2740 SSL_kECDHE,
2741 SSL_aECDSA,
2742 SSL_AES128GCM,
2743 SSL_AEAD,
2744 SSL_TLSV1_2,
2745 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2746 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2747 128,
2748 128,
2749 },
2750
2751 /* Cipher C02C */
2752 {
2753 1,
2754 TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
2755 TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
2756 SSL_kECDHE,
2757 SSL_aECDSA,
2758 SSL_AES256GCM,
2759 SSL_AEAD,
2760 SSL_TLSV1_2,
2761 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2762 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
2763 256,
2764 256,
2765 },
2766
2767 /* Cipher C02D */
2768 {
2769 1,
2770 TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256,
2771 TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256,
2772 SSL_kECDHe,
2773 SSL_aECDH,
2774 SSL_AES128GCM,
2775 SSL_AEAD,
2776 SSL_TLSV1_2,
2777 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2778 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2779 128,
2780 128,
2781 },
2782
2783 /* Cipher C02E */
2784 {
2785 1,
2786 TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384,
2787 TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384,
2788 SSL_kECDHe,
2789 SSL_aECDH,
2790 SSL_AES256GCM,
2791 SSL_AEAD,
2792 SSL_TLSV1_2,
2793 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2794 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
2795 256,
2796 256,
2797 },
2798
2799 /* Cipher C02F */
2800 {
2801 1,
2802 TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
2803 TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
2804 SSL_kECDHE,
2805 SSL_aRSA,
2806 SSL_AES128GCM,
2807 SSL_AEAD,
2808 SSL_TLSV1_2,
2809 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2810 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2811 128,
2812 128,
2813 },
2814
2815 /* Cipher C030 */
2816 {
2817 1,
2818 TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
2819 TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
2820 SSL_kECDHE,
2821 SSL_aRSA,
2822 SSL_AES256GCM,
2823 SSL_AEAD,
2824 SSL_TLSV1_2,
2825 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2826 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
2827 256,
2828 256,
2829 },
2830
2831 /* Cipher C031 */
2832 {
2833 1,
2834 TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256,
2835 TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256,
2836 SSL_kECDHr,
2837 SSL_aECDH,
2838 SSL_AES128GCM,
2839 SSL_AEAD,
2840 SSL_TLSV1_2,
2841 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2842 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2843 128,
2844 128,
2845 },
2846
2847 /* Cipher C032 */
2848 {
2849 1,
2850 TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384,
2851 TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384,
2852 SSL_kECDHr,
2853 SSL_aECDH,
2854 SSL_AES256GCM,
2855 SSL_AEAD,
2856 SSL_TLSV1_2,
2857 SSL_NOT_EXP | SSL_HIGH | SSL_FIPS,
2858 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
2859 256,
2860 256,
2861 },
2862
2863# ifndef OPENSSL_NO_CAMELLIA
2864 { /* Cipher C072 */
2865 1,
2866 TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256,
2867 TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256,
2868 SSL_kECDHE,
2869 SSL_aECDSA,
2870 SSL_CAMELLIA128,
2871 SSL_SHA256,
2872 SSL_TLSV1_2,
2873 SSL_NOT_EXP | SSL_HIGH,
2874 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2875 128,
2876 128},
2877
2878 { /* Cipher C073 */
2879 1,
2880 TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384,
2881 TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384,
2882 SSL_kECDHE,
2883 SSL_aECDSA,
2884 SSL_CAMELLIA256,
2885 SSL_SHA384,
2886 SSL_TLSV1_2,
2887 SSL_NOT_EXP | SSL_HIGH,
2888 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
2889 256,
2890 256},
2891
2892 { /* Cipher C074 */
2893 1,
2894 TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256,
2895 TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256,
2896 SSL_kECDHe,
2897 SSL_aECDH,
2898 SSL_CAMELLIA128,
2899 SSL_SHA256,
2900 SSL_TLSV1_2,
2901 SSL_NOT_EXP | SSL_HIGH,
2902 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2903 128,
2904 128},
2905
2906 { /* Cipher C075 */
2907 1,
2908 TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384,
2909 TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384,
2910 SSL_kECDHe,
2911 SSL_aECDH,
2912 SSL_CAMELLIA256,
2913 SSL_SHA384,
2914 SSL_TLSV1_2,
2915 SSL_NOT_EXP | SSL_HIGH,
2916 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
2917 256,
2918 256},
2919
2920 { /* Cipher C076 */
2921 1,
2922 TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256,
2923 TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256,
2924 SSL_kECDHE,
2925 SSL_aRSA,
2926 SSL_CAMELLIA128,
2927 SSL_SHA256,
2928 SSL_TLSV1_2,
2929 SSL_NOT_EXP | SSL_HIGH,
2930 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2931 128,
2932 128},
2933
2934 { /* Cipher C077 */
2935 1,
2936 TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384,
2937 TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384,
2938 SSL_kECDHE,
2939 SSL_aRSA,
2940 SSL_CAMELLIA256,
2941 SSL_SHA384,
2942 SSL_TLSV1_2,
2943 SSL_NOT_EXP | SSL_HIGH,
2944 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
2945 256,
2946 256},
2947
2948 { /* Cipher C078 */
2949 1,
2950 TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256,
2951 TLS1_CK_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256,
2952 SSL_kECDHr,
2953 SSL_aECDH,
2954 SSL_CAMELLIA128,
2955 SSL_SHA256,
2956 SSL_TLSV1_2,
2957 SSL_NOT_EXP | SSL_HIGH,
2958 SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256,
2959 128,
2960 128},
2961
2962 { /* Cipher C079 */
2963 1,
2964 TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384,
2965 TLS1_CK_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384,
2966 SSL_kECDHr,
2967 SSL_aECDH,
2968 SSL_CAMELLIA256,
2969 SSL_SHA384,
2970 SSL_TLSV1_2,
2971 SSL_NOT_EXP | SSL_HIGH,
2972 SSL_HANDSHAKE_MAC_SHA384 | TLS1_PRF_SHA384,
2973 256,
2974 256},
2975# endif /* OPENSSL_NO_CAMELLIA */
10bf4fc2 2976#endif /* OPENSSL_NO_EC */
edc032b5 2977
9981a51e
DSH
2978#ifdef TEMP_GOST_TLS
2979/* Cipher FF00 */
0f113f3e
MC
2980 {
2981 1,
2982 "GOST-MD5",
2983 0x0300ff00,
2984 SSL_kRSA,
2985 SSL_aRSA,
2986 SSL_eGOST2814789CNT,
2987 SSL_MD5,
2988 SSL_TLSV1,
2989 SSL_NOT_EXP | SSL_HIGH,
2990 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
2991 256,
2992 256,
2993 },
2994 {
2995 1,
2996 "GOST-GOST94",
2997 0x0300ff01,
2998 SSL_kRSA,
2999 SSL_aRSA,
3000 SSL_eGOST2814789CNT,
3001 SSL_GOST94,
3002 SSL_TLSV1,
3003 SSL_NOT_EXP | SSL_HIGH,
3004 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
3005 256,
3006 256},
3007 {
3008 1,
3009 "GOST-GOST89MAC",
3010 0x0300ff02,
3011 SSL_kRSA,
3012 SSL_aRSA,
3013 SSL_eGOST2814789CNT,
3014 SSL_GOST89MAC,
3015 SSL_TLSV1,
3016 SSL_NOT_EXP | SSL_HIGH,
3017 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
3018 256,
3019 256},
3020 {
3021 1,
3022 "GOST-GOST89STREAM",
3023 0x0300ff03,
3024 SSL_kRSA,
3025 SSL_aRSA,
3026 SSL_eGOST2814789CNT,
3027 SSL_GOST89MAC,
3028 SSL_TLSV1,
3029 SSL_NOT_EXP | SSL_HIGH,
3030 SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF | TLS1_STREAM_MAC,
3031 256,
3032 256},
9981a51e
DSH
3033#endif
3034
d02b48c6 3035/* end of list */
0f113f3e
MC
3036};
3037
3038const SSL3_ENC_METHOD SSLv3_enc_data = {
3039 ssl3_enc,
3040 n_ssl3_mac,
3041 ssl3_setup_key_block,
3042 ssl3_generate_master_secret,
3043 ssl3_change_cipher_state,
3044 ssl3_final_finish_mac,
3045 MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH,
3046 ssl3_cert_verify_mac,
3047 SSL3_MD_CLIENT_FINISHED_CONST, 4,
3048 SSL3_MD_SERVER_FINISHED_CONST, 4,
3049 ssl3_alert_code,
3050 (int (*)(SSL *, unsigned char *, size_t, const char *,
3051 size_t, const unsigned char *, size_t,
3052 int use_context))ssl_undefined_function,
3053 0,
3054 SSL3_HM_HEADER_LENGTH,
3055 ssl3_set_handshake_header,
3056 ssl3_handshake_write
3057};
58964a49 3058
f3b656b2 3059long ssl3_default_timeout(void)
0f113f3e
MC
3060{
3061 /*
3062 * 2 hours, the 24 hours mentioned in the SSLv3 spec is way too long for
3063 * http, the cache would over fill
3064 */
3065 return (60 * 60 * 2);
3066}
d02b48c6 3067
6b691a5c 3068int ssl3_num_ciphers(void)
0f113f3e
MC
3069{
3070 return (SSL3_NUM_CIPHERS);
3071}
d02b48c6 3072
babb3798 3073const SSL_CIPHER *ssl3_get_cipher(unsigned int u)
0f113f3e
MC
3074{
3075 if (u < SSL3_NUM_CIPHERS)
3076 return (&(ssl3_ciphers[SSL3_NUM_CIPHERS - 1 - u]));
3077 else
3078 return (NULL);
3079}
d02b48c6 3080
0821bcd4 3081int ssl3_pending(const SSL *s)
0f113f3e
MC
3082{
3083 if (s->rstate == SSL_ST_READ_BODY)
3084 return 0;
3085
3086 return (s->s3->rrec.type ==
3087 SSL3_RT_APPLICATION_DATA) ? s->s3->rrec.length : 0;
3088}
d02b48c6 3089
77d514c5 3090int ssl3_set_handshake_header(SSL *s, int htype, unsigned long len)
0f113f3e
MC
3091{
3092 unsigned char *p = (unsigned char *)s->init_buf->data;
3093 *(p++) = htype;
3094 l2n3(len, p);
3095 s->init_num = (int)len + SSL3_HM_HEADER_LENGTH;
3096 s->init_off = 0;
77d514c5
MC
3097
3098 return 1;
0f113f3e 3099}
173e72e6
DSH
3100
3101int ssl3_handshake_write(SSL *s)
0f113f3e
MC
3102{
3103 return ssl3_do_write(s, SSL3_RT_HANDSHAKE);
3104}
173e72e6 3105
6b691a5c 3106int ssl3_new(SSL *s)
0f113f3e
MC
3107{
3108 SSL3_STATE *s3;
d02b48c6 3109
0f113f3e
MC
3110 if ((s3 = OPENSSL_malloc(sizeof *s3)) == NULL)
3111 goto err;
3112 memset(s3, 0, sizeof *s3);
3113 memset(s3->rrec.seq_num, 0, sizeof(s3->rrec.seq_num));
3114 memset(s3->wrec.seq_num, 0, sizeof(s3->wrec.seq_num));
d02b48c6 3115
0f113f3e 3116 s->s3 = s3;
d02b48c6 3117
edc032b5 3118#ifndef OPENSSL_NO_SRP
69f68237
MC
3119 if(!SSL_SRP_CTX_init(s))
3120 goto err;
edc032b5 3121#endif
0f113f3e
MC
3122 s->method->ssl_clear(s);
3123 return (1);
3124 err:
3125 return (0);
3126}
d02b48c6 3127
6b691a5c 3128void ssl3_free(SSL *s)
0f113f3e
MC
3129{
3130 if (s == NULL)
3131 return;
e03ddfae 3132
0f113f3e
MC
3133 ssl3_cleanup_key_block(s);
3134 if (s->s3->rbuf.buf != NULL)
3135 ssl3_release_read_buffer(s);
3136 if (s->s3->wbuf.buf != NULL)
3137 ssl3_release_write_buffer(s);
3138 if (s->s3->rrec.comp != NULL)
3139 OPENSSL_free(s->s3->rrec.comp);
bc36ee62 3140#ifndef OPENSSL_NO_DH
0f113f3e
MC
3141 if (s->s3->tmp.dh != NULL)
3142 DH_free(s->s3->tmp.dh);
d02b48c6 3143#endif
10bf4fc2 3144#ifndef OPENSSL_NO_EC
0f113f3e
MC
3145 if (s->s3->tmp.ecdh != NULL)
3146 EC_KEY_free(s->s3->tmp.ecdh);
ea262260
BM
3147#endif
3148
0f113f3e
MC
3149 if (s->s3->tmp.ca_names != NULL)
3150 sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free);
3151 if (s->s3->handshake_buffer) {
3152 BIO_free(s->s3->handshake_buffer);
3153 }
3154 if (s->s3->handshake_dgst)
3155 ssl3_free_digest_list(s);
6f017a8f 3156#ifndef OPENSSL_NO_TLSEXT
0f113f3e
MC
3157 if (s->s3->alpn_selected)
3158 OPENSSL_free(s->s3->alpn_selected);
6f017a8f
AL
3159#endif
3160
edc032b5 3161#ifndef OPENSSL_NO_SRP
0f113f3e 3162 SSL_SRP_CTX_free(s);
edc032b5 3163#endif
0f113f3e
MC
3164 OPENSSL_cleanse(s->s3, sizeof *s->s3);
3165 OPENSSL_free(s->s3);
3166 s->s3 = NULL;
3167}
d02b48c6 3168
6b691a5c 3169void ssl3_clear(SSL *s)
0f113f3e
MC
3170{
3171 unsigned char *rp, *wp;
3172 size_t rlen, wlen;
3173 int init_extra;
d02b48c6 3174
0f113f3e
MC
3175 ssl3_cleanup_key_block(s);
3176 if (s->s3->tmp.ca_names != NULL)
3177 sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free);
d02b48c6 3178
0f113f3e
MC
3179 if (s->s3->rrec.comp != NULL) {
3180 OPENSSL_free(s->s3->rrec.comp);
3181 s->s3->rrec.comp = NULL;
3182 }
bc36ee62 3183#ifndef OPENSSL_NO_DH
0f113f3e
MC
3184 if (s->s3->tmp.dh != NULL) {
3185 DH_free(s->s3->tmp.dh);
3186 s->s3->tmp.dh = NULL;
3187 }
a2a01589 3188#endif
10bf4fc2 3189#ifndef OPENSSL_NO_EC
0f113f3e
MC
3190 if (s->s3->tmp.ecdh != NULL) {
3191 EC_KEY_free(s->s3->tmp.ecdh);
3192 s->s3->tmp.ecdh = NULL;
3193 }
ea262260 3194#endif
195b9eee 3195#ifndef OPENSSL_NO_TLSEXT
0f113f3e
MC
3196# ifndef OPENSSL_NO_EC
3197 s->s3->is_probably_safari = 0;
3198# endif /* !OPENSSL_NO_EC */
3199#endif /* !OPENSSL_NO_TLSEXT */
3200
3201 rp = s->s3->rbuf.buf;
3202 wp = s->s3->wbuf.buf;
3203 rlen = s->s3->rbuf.len;
3204 wlen = s->s3->wbuf.len;
3205 init_extra = s->s3->init_extra;
3206 if (s->s3->handshake_buffer) {
3207 BIO_free(s->s3->handshake_buffer);
3208 s->s3->handshake_buffer = NULL;
3209 }
3210 if (s->s3->handshake_dgst) {
3211 ssl3_free_digest_list(s);
3212 }
6f017a8f 3213#if !defined(OPENSSL_NO_TLSEXT)
0f113f3e
MC
3214 if (s->s3->alpn_selected) {
3215 free(s->s3->alpn_selected);
3216 s->s3->alpn_selected = NULL;
3217 }
6f017a8f 3218#endif
0f113f3e
MC
3219 memset(s->s3, 0, sizeof *s->s3);
3220 s->s3->rbuf.buf = rp;
3221 s->s3->wbuf.buf = wp;
3222 s->s3->rbuf.len = rlen;
3223 s->s3->wbuf.len = wlen;
3224 s->s3->init_extra = init_extra;
3225
3226 ssl_free_wbio_buffer(s);
3227
3228 s->packet_length = 0;
3229 s->s3->renegotiate = 0;
3230 s->s3->total_renegotiations = 0;
3231 s->s3->num_renegotiations = 0;
3232 s->s3->in_read_app_data = 0;
3233 s->version = SSL3_VERSION;
ee2ffc27 3234
bf48836c 3235#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
0f113f3e
MC
3236 if (s->next_proto_negotiated) {
3237 OPENSSL_free(s->next_proto_negotiated);
3238 s->next_proto_negotiated = NULL;
3239 s->next_proto_negotiated_len = 0;
3240 }
ee2ffc27 3241#endif
0f113f3e 3242}
d02b48c6 3243
edc032b5 3244#ifndef OPENSSL_NO_SRP
0f113f3e
MC
3245static char *srp_password_from_info_cb(SSL *s, void *arg)
3246{
3247 return BUF_strdup(s->srp_ctx.info);
3248}
edc032b5
BL
3249#endif
3250
0f113f3e
MC
3251static int ssl3_set_req_cert_type(CERT *c, const unsigned char *p,
3252 size_t len);
9f27b1ee 3253
a661b653 3254long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
0f113f3e
MC
3255{
3256 int ret = 0;
58964a49 3257
0f113f3e
MC
3258 switch (cmd) {
3259 case SSL_CTRL_GET_SESSION_REUSED:
3260 ret = s->hit;
3261 break;
3262 case SSL_CTRL_GET_CLIENT_CERT_REQUEST:
3263 break;
3264 case SSL_CTRL_GET_NUM_RENEGOTIATIONS:
3265 ret = s->s3->num_renegotiations;
3266 break;
3267 case SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS:
3268 ret = s->s3->num_renegotiations;
3269 s->s3->num_renegotiations = 0;
3270 break;
3271 case SSL_CTRL_GET_TOTAL_RENEGOTIATIONS:
3272 ret = s->s3->total_renegotiations;
3273 break;
3274 case SSL_CTRL_GET_FLAGS:
3275 ret = (int)(s->s3->flags);
3276 break;
bc36ee62 3277#ifndef OPENSSL_NO_RSA
0f113f3e
MC
3278 case SSL_CTRL_NEED_TMP_RSA:
3279 if ((s->cert != NULL) && (s->cert->rsa_tmp == NULL) &&
3280 ((s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey == NULL) ||
3281 (EVP_PKEY_size(s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey) >
3282 (512 / 8))))
3283 ret = 1;
3284 break;
3285 case SSL_CTRL_SET_TMP_RSA:
3286 {
3287 RSA *rsa = (RSA *)parg;
3288 if (rsa == NULL) {
3289 SSLerr(SSL_F_SSL3_CTRL, ERR_R_PASSED_NULL_PARAMETER);
3290 return (ret);
3291 }
3292 if ((rsa = RSAPrivateKey_dup(rsa)) == NULL) {
3293 SSLerr(SSL_F_SSL3_CTRL, ERR_R_RSA_LIB);
3294 return (ret);
3295 }
3296 if (s->cert->rsa_tmp != NULL)
3297 RSA_free(s->cert->rsa_tmp);
3298 s->cert->rsa_tmp = rsa;
3299 ret = 1;
3300 }
3301 break;
3302 case SSL_CTRL_SET_TMP_RSA_CB:
3303 {
3304 SSLerr(SSL_F_SSL3_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
3305 return (ret);
3306 }
15d21c2d 3307#endif
bc36ee62 3308#ifndef OPENSSL_NO_DH
0f113f3e
MC
3309 case SSL_CTRL_SET_TMP_DH:
3310 {
3311 DH *dh = (DH *)parg;
3312 if (dh == NULL) {
3313 SSLerr(SSL_F_SSL3_CTRL, ERR_R_PASSED_NULL_PARAMETER);
3314 return (ret);
3315 }
3316 if (!ssl_security(s, SSL_SECOP_TMP_DH,
3317 DH_security_bits(dh), 0, dh)) {
3318 SSLerr(SSL_F_SSL3_CTRL, SSL_R_DH_KEY_TOO_SMALL);
3319 return (ret);
3320 }
3321 if ((dh = DHparams_dup(dh)) == NULL) {
3322 SSLerr(SSL_F_SSL3_CTRL, ERR_R_DH_LIB);
3323 return (ret);
3324 }
3325 if (!(s->options & SSL_OP_SINGLE_DH_USE)) {
3326 if (!DH_generate_key(dh)) {
3327 DH_free(dh);
3328 SSLerr(SSL_F_SSL3_CTRL, ERR_R_DH_LIB);
3329 return (ret);
3330 }
3331 }
3332 if (s->cert->dh_tmp != NULL)
3333 DH_free(s->cert->dh_tmp);
3334 s->cert->dh_tmp = dh;
3335 ret = 1;
3336 }
3337 break;
3338 case SSL_CTRL_SET_TMP_DH_CB:
3339 {
3340 SSLerr(SSL_F_SSL3_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
3341 return (ret);
3342 }
0f113f3e
MC
3343 case SSL_CTRL_SET_DH_AUTO:
3344 s->cert->dh_tmp_auto = larg;
3345 return 1;
d3442bc7 3346#endif
10bf4fc2 3347#ifndef OPENSSL_NO_EC
0f113f3e
MC
3348 case SSL_CTRL_SET_TMP_ECDH:
3349 {
3350 EC_KEY *ecdh = NULL;
3351
3352 if (parg == NULL) {
3353 SSLerr(SSL_F_SSL3_CTRL, ERR_R_PASSED_NULL_PARAMETER);
3354 return (ret);
3355 }
3356 if (!EC_KEY_up_ref((EC_KEY *)parg)) {
3357 SSLerr(SSL_F_SSL3_CTRL, ERR_R_ECDH_LIB);
3358 return (ret);
3359 }
3360 ecdh = (EC_KEY *)parg;
3361 if (!(s->options & SSL_OP_SINGLE_ECDH_USE)) {
3362 if (!EC_KEY_generate_key(ecdh)) {
3363 EC_KEY_free(ecdh);
3364 SSLerr(SSL_F_SSL3_CTRL, ERR_R_ECDH_LIB);
3365 return (ret);
3366 }
3367 }
3368 if (s->cert->ecdh_tmp != NULL)
3369 EC_KEY_free(s->cert->ecdh_tmp);
3370 s->cert->ecdh_tmp = ecdh;
3371 ret = 1;
3372 }
3373 break;
3374 case SSL_CTRL_SET_TMP_ECDH_CB:
3375 {
3376 SSLerr(SSL_F_SSL3_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
3377 return (ret);
3378 }
10bf4fc2 3379#endif /* !OPENSSL_NO_EC */
ed3883d2 3380#ifndef OPENSSL_NO_TLSEXT
0f113f3e
MC
3381 case SSL_CTRL_SET_TLSEXT_HOSTNAME:
3382 if (larg == TLSEXT_NAMETYPE_host_name) {
3383 if (s->tlsext_hostname != NULL)
3384 OPENSSL_free(s->tlsext_hostname);
3385 s->tlsext_hostname = NULL;
3386
3387 ret = 1;
3388 if (parg == NULL)
3389 break;
3390 if (strlen((char *)parg) > TLSEXT_MAXLEN_host_name) {
3391 SSLerr(SSL_F_SSL3_CTRL, SSL_R_SSL3_EXT_INVALID_SERVERNAME);
3392 return 0;
3393 }
3394 if ((s->tlsext_hostname = BUF_strdup((char *)parg)) == NULL) {
3395 SSLerr(SSL_F_SSL3_CTRL, ERR_R_INTERNAL_ERROR);
3396 return 0;
3397 }
3398 } else {
3399 SSLerr(SSL_F_SSL3_CTRL, SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE);
3400 return 0;
3401 }
3402 break;
3403 case SSL_CTRL_SET_TLSEXT_DEBUG_ARG:
3404 s->tlsext_debug_arg = parg;
3405 ret = 1;
3406 break;
3407
0f113f3e
MC
3408 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE:
3409 s->tlsext_status_type = larg;
3410 ret = 1;
3411 break;
3412
3413 case SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS:
3414 *(STACK_OF(X509_EXTENSION) **)parg = s->tlsext_ocsp_exts;
3415 ret = 1;
3416 break;
3417
3418 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS:
3419 s->tlsext_ocsp_exts = parg;
3420 ret = 1;
3421 break;
3422
3423 case SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS:
3424 *(STACK_OF(OCSP_RESPID) **)parg = s->tlsext_ocsp_ids;
3425 ret = 1;
3426 break;
3427
3428 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS:
3429 s->tlsext_ocsp_ids = parg;
3430 ret = 1;
3431 break;
3432
3433 case SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP:
3434 *(unsigned char **)parg = s->tlsext_ocsp_resp;
3435 return s->tlsext_ocsp_resplen;
3436
3437 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP:
3438 if (s->tlsext_ocsp_resp)
3439 OPENSSL_free(s->tlsext_ocsp_resp);
3440 s->tlsext_ocsp_resp = parg;
3441 s->tlsext_ocsp_resplen = larg;
3442 ret = 1;
3443 break;
3444
3445# ifndef OPENSSL_NO_HEARTBEATS
3446 case SSL_CTRL_TLS_EXT_SEND_HEARTBEAT:
3447 if (SSL_IS_DTLS(s))
3448 ret = dtls1_heartbeat(s);
3449 else
3450 ret = tls1_heartbeat(s);
3451 break;
3452
3453 case SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING:
3454 ret = s->tlsext_hb_pending;
3455 break;
3456
3457 case SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS:
3458 if (larg)
3459 s->tlsext_heartbeat |= SSL_TLSEXT_HB_DONT_RECV_REQUESTS;
3460 else
3461 s->tlsext_heartbeat &= ~SSL_TLSEXT_HB_DONT_RECV_REQUESTS;
3462 ret = 1;
3463 break;
3464# endif
3465
3466#endif /* !OPENSSL_NO_TLSEXT */
3467
3468 case SSL_CTRL_CHAIN:
3469 if (larg)
3470 return ssl_cert_set1_chain(s, NULL, (STACK_OF(X509) *)parg);
3471 else
3472 return ssl_cert_set0_chain(s, NULL, (STACK_OF(X509) *)parg);
3473
3474 case SSL_CTRL_CHAIN_CERT:
3475 if (larg)
3476 return ssl_cert_add1_chain_cert(s, NULL, (X509 *)parg);
3477 else
3478 return ssl_cert_add0_chain_cert(s, NULL, (X509 *)parg);
3479
3480 case SSL_CTRL_GET_CHAIN_CERTS:
3481 *(STACK_OF(X509) **)parg = s->cert->key->chain;
3482 break;
3483
3484 case SSL_CTRL_SELECT_CURRENT_CERT:
3485 return ssl_cert_select_current(s->cert, (X509 *)parg);
3486
3487 case SSL_CTRL_SET_CURRENT_CERT:
3488 if (larg == SSL_CERT_SET_SERVER) {
3489 CERT_PKEY *cpk;
3490 const SSL_CIPHER *cipher;
3491 if (!s->server)
3492 return 0;
3493 cipher = s->s3->tmp.new_cipher;
3494 if (!cipher)
3495 return 0;
3496 /*
3497 * No certificate for unauthenticated ciphersuites or using SRP
3498 * authentication
3499 */
3500 if (cipher->algorithm_auth & (SSL_aNULL | SSL_aSRP))
3501 return 2;
3502 cpk = ssl_get_server_send_pkey(s);
3503 if (!cpk)
3504 return 0;
3505 s->cert->key = cpk;
3506 return 1;
3507 }
3508 return ssl_cert_set_current(s->cert, larg);
0f78819c 3509
14536c8c 3510#ifndef OPENSSL_NO_EC
0f113f3e
MC
3511 case SSL_CTRL_GET_CURVES:
3512 {
3513 unsigned char *clist;
3514 size_t clistlen;
3515 if (!s->session)
3516 return 0;
3517 clist = s->session->tlsext_ellipticcurvelist;
3518 clistlen = s->session->tlsext_ellipticcurvelist_length / 2;
3519 if (parg) {
3520 size_t i;
3521 int *cptr = parg;
3522 unsigned int cid, nid;
3523 for (i = 0; i < clistlen; i++) {
3524 n2s(clist, cid);
3525 nid = tls1_ec_curve_id2nid(cid);
3526 if (nid != 0)
3527 cptr[i] = nid;
3528 else
3529 cptr[i] = TLSEXT_nid_unknown | cid;
3530 }
3531 }
3532 return (int)clistlen;
3533 }
3534
3535 case SSL_CTRL_SET_CURVES:
3536 return tls1_set_curves(&s->tlsext_ellipticcurvelist,
3537 &s->tlsext_ellipticcurvelist_length,
3538 parg, larg);
3539
3540 case SSL_CTRL_SET_CURVES_LIST:
3541 return tls1_set_curves_list(&s->tlsext_ellipticcurvelist,
3542 &s->tlsext_ellipticcurvelist_length,
3543 parg);
3544
3545 case SSL_CTRL_GET_SHARED_CURVE:
3546 return tls1_shared_curve(s, larg);
3547
10bf4fc2 3548# ifndef OPENSSL_NO_EC
0f113f3e
MC
3549 case SSL_CTRL_SET_ECDH_AUTO:
3550 s->cert->ecdh_tmp_auto = larg;
3551 return 1;
3552# endif
14536c8c 3553#endif
0f113f3e
MC
3554 case SSL_CTRL_SET_SIGALGS:
3555 return tls1_set_sigalgs(s->cert, parg, larg, 0);
3556
3557 case SSL_CTRL_SET_SIGALGS_LIST:
3558 return tls1_set_sigalgs_list(s->cert, parg, 0);
3559
3560 case SSL_CTRL_SET_CLIENT_SIGALGS:
3561 return tls1_set_sigalgs(s->cert, parg, larg, 1);
3562
3563 case SSL_CTRL_SET_CLIENT_SIGALGS_LIST:
3564 return tls1_set_sigalgs_list(s->cert, parg, 1);
3565
3566 case SSL_CTRL_GET_CLIENT_CERT_TYPES:
3567 {
3568 const unsigned char **pctype = parg;
3569 if (s->server || !s->s3->tmp.cert_req)
3570 return 0;
3571 if (s->cert->ctypes) {
3572 if (pctype)
3573 *pctype = s->cert->ctypes;
3574 return (int)s->cert->ctype_num;
3575 }
3576 if (pctype)
3577 *pctype = (unsigned char *)s->s3->tmp.ctype;
3578 return s->s3->tmp.ctype_num;
3579 }
3580
3581 case SSL_CTRL_SET_CLIENT_CERT_TYPES:
3582 if (!s->server)
3583 return 0;
3584 return ssl3_set_req_cert_type(s->cert, parg, larg);
3585
3586 case SSL_CTRL_BUILD_CERT_CHAIN:
3587 return ssl_build_cert_chain(s, NULL, larg);
3588
3589 case SSL_CTRL_SET_VERIFY_CERT_STORE:
3590 return ssl_cert_set_cert_store(s->cert, parg, 0, larg);
3591
3592 case SSL_CTRL_SET_CHAIN_CERT_STORE:
3593 return ssl_cert_set_cert_store(s->cert, parg, 1, larg);
3594
3595 case SSL_CTRL_GET_PEER_SIGNATURE_NID:
3596 if (SSL_USE_SIGALGS(s)) {
3597 if (s->session && s->session->sess_cert) {
3598 const EVP_MD *sig;
3599 sig = s->session->sess_cert->peer_key->digest;
3600 if (sig) {
3601 *(int *)parg = EVP_MD_type(sig);
3602 return 1;
3603 }
3604 }
3605 return 0;
3606 }
3607 /* Might want to do something here for other versions */
3608 else
3609 return 0;
3610
3611 case SSL_CTRL_GET_SERVER_TMP_KEY:
3612 if (s->server || !s->session || !s->session->sess_cert)
3613 return 0;
3614 else {
3615 SESS_CERT *sc;
3616 EVP_PKEY *ptmp;
3617 int rv = 0;
3618 sc = s->session->sess_cert;
10bf4fc2 3619#if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DH) && !defined(OPENSSL_NO_EC)
0f113f3e
MC
3620 if (!sc->peer_rsa_tmp && !sc->peer_dh_tmp && !sc->peer_ecdh_tmp)
3621 return 0;
14536c8c 3622#endif
0f113f3e
MC
3623 ptmp = EVP_PKEY_new();
3624 if (!ptmp)
3625 return 0;
3626 if (0) ;
33a8de69 3627#ifndef OPENSSL_NO_RSA
0f113f3e
MC
3628 else if (sc->peer_rsa_tmp)
3629 rv = EVP_PKEY_set1_RSA(ptmp, sc->peer_rsa_tmp);
33a8de69
DSH
3630#endif
3631#ifndef OPENSSL_NO_DH
0f113f3e
MC
3632 else if (sc->peer_dh_tmp)
3633 rv = EVP_PKEY_set1_DH(ptmp, sc->peer_dh_tmp);
33a8de69 3634#endif
10bf4fc2 3635#ifndef OPENSSL_NO_EC
0f113f3e
MC
3636 else if (sc->peer_ecdh_tmp)
3637 rv = EVP_PKEY_set1_EC_KEY(ptmp, sc->peer_ecdh_tmp);
33a8de69 3638#endif
0f113f3e
MC
3639 if (rv) {
3640 *(EVP_PKEY **)parg = ptmp;
3641 return 1;
3642 }
3643 EVP_PKEY_free(ptmp);
3644 return 0;
3645 }
14536c8c 3646#ifndef OPENSSL_NO_EC
0f113f3e
MC
3647 case SSL_CTRL_GET_EC_POINT_FORMATS:
3648 {
3649 SSL_SESSION *sess = s->session;
3650 const unsigned char **pformat = parg;
3651 if (!sess || !sess->tlsext_ecpointformatlist)
3652 return 0;
3653 *pformat = sess->tlsext_ecpointformatlist;
3654 return (int)sess->tlsext_ecpointformatlist_length;
3655 }
14536c8c 3656#endif
cf6da053 3657
0f113f3e
MC
3658 case SSL_CTRL_CHECK_PROTO_VERSION:
3659 /*
3660 * For library-internal use; checks that the current protocol is the
3661 * highest enabled version (according to s->ctx->method, as version
3662 * negotiation may have changed s->method).
3663 */
3664 if (s->version == s->ctx->method->version)
3665 return 1;
3666 /*
3667 * Apparently we're using a version-flexible SSL_METHOD (not at its
3668 * highest protocol version).
3669 */
3670 if (s->ctx->method->version == SSLv23_method()->version) {
cf6da053 3671#if TLS_MAX_VERSION != TLS1_2_VERSION
0f113f3e 3672# error Code needs update for SSLv23_method() support beyond TLS1_2_VERSION.
cf6da053 3673#endif
0f113f3e
MC
3674 if (!(s->options & SSL_OP_NO_TLSv1_2))
3675 return s->version == TLS1_2_VERSION;
3676 if (!(s->options & SSL_OP_NO_TLSv1_1))
3677 return s->version == TLS1_1_VERSION;
3678 if (!(s->options & SSL_OP_NO_TLSv1))
3679 return s->version == TLS1_VERSION;
3680 if (!(s->options & SSL_OP_NO_SSLv3))
3681 return s->version == SSL3_VERSION;
3682 }
3683 return 0; /* Unexpected state; fail closed. */
3684
3685 default:
3686 break;
3687 }
3688 return (ret);
3689}
3690
3691long ssl3_callback_ctrl(SSL *s, int cmd, void (*fp) (void))
3692{
3693 int ret = 0;
d3442bc7 3694
0f113f3e 3695 switch (cmd) {
bc36ee62 3696#ifndef OPENSSL_NO_RSA
0f113f3e
MC
3697 case SSL_CTRL_SET_TMP_RSA_CB:
3698 {
3699 s->cert->rsa_tmp_cb = (RSA *(*)(SSL *, int, int))fp;
3700 }
3701 break;
d3442bc7 3702#endif
bc36ee62 3703#ifndef OPENSSL_NO_DH
0f113f3e
MC
3704 case SSL_CTRL_SET_TMP_DH_CB:
3705 {
3706 s->cert->dh_tmp_cb = (DH *(*)(SSL *, int, int))fp;
3707 }
3708 break;
ea262260 3709#endif
10bf4fc2 3710#ifndef OPENSSL_NO_EC
0f113f3e
MC
3711 case SSL_CTRL_SET_TMP_ECDH_CB:
3712 {
3713 s->cert->ecdh_tmp_cb = (EC_KEY *(*)(SSL *, int, int))fp;
3714 }
3715 break;
6434abbf
DSH
3716#endif
3717#ifndef OPENSSL_NO_TLSEXT
0f113f3e
MC
3718 case SSL_CTRL_SET_TLSEXT_DEBUG_CB:
3719 s->tlsext_debug_cb = (void (*)(SSL *, int, int,
3720 unsigned char *, int, void *))fp;
3721 break;
15d21c2d 3722#endif
0f113f3e
MC
3723 case SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB:
3724 {
3725 s->not_resumable_session_cb = (int (*)(SSL *, int))fp;
3726 }
3727 break;
3728 default:
3729 break;
3730 }
3731 return (ret);
3732}
d02b48c6 3733
a661b653 3734long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
0f113f3e
MC
3735{
3736 CERT *cert;
d02b48c6 3737
0f113f3e 3738 cert = ctx->cert;
d02b48c6 3739
0f113f3e 3740 switch (cmd) {
bc36ee62 3741#ifndef OPENSSL_NO_RSA
0f113f3e
MC
3742 case SSL_CTRL_NEED_TMP_RSA:
3743 if ((cert->rsa_tmp == NULL) &&
3744 ((cert->pkeys[SSL_PKEY_RSA_ENC].privatekey == NULL) ||
3745 (EVP_PKEY_size(cert->pkeys[SSL_PKEY_RSA_ENC].privatekey) >
3746 (512 / 8)))
3747 )
3748 return (1);
3749 else
3750 return (0);
3751 /* break; */
3752 case SSL_CTRL_SET_TMP_RSA:
3753 {
3754 RSA *rsa;
3755 int i;
3756
3757 rsa = (RSA *)parg;
3758 i = 1;
3759 if (rsa == NULL)
3760 i = 0;
3761 else {
3762 if ((rsa = RSAPrivateKey_dup(rsa)) == NULL)
3763 i = 0;
3764 }
3765 if (!i) {
3766 SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_RSA_LIB);
3767 return (0);
3768 } else {
3769 if (cert->rsa_tmp != NULL)
3770 RSA_free(cert->rsa_tmp);
3771 cert->rsa_tmp = rsa;
3772 return (1);
3773 }
3774 }
3775 /* break; */
3776 case SSL_CTRL_SET_TMP_RSA_CB:
3777 {
3778 SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
3779 return (0);
3780 }
d02b48c6 3781#endif
bc36ee62 3782#ifndef OPENSSL_NO_DH
0f113f3e
MC
3783 case SSL_CTRL_SET_TMP_DH:
3784 {
3785 DH *new = NULL, *dh;
3786
3787 dh = (DH *)parg;
3788 if (!ssl_ctx_security(ctx, SSL_SECOP_TMP_DH,
3789 DH_security_bits(dh), 0, dh)) {
3790 SSLerr(SSL_F_SSL3_CTX_CTRL, SSL_R_DH_KEY_TOO_SMALL);
3791 return 0;
3792 }
3793 if ((new = DHparams_dup(dh)) == NULL) {
3794 SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_DH_LIB);
3795 return 0;
3796 }
3797 if (!(ctx->options & SSL_OP_SINGLE_DH_USE)) {
3798 if (!DH_generate_key(new)) {
3799 SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_DH_LIB);
3800 DH_free(new);
3801 return 0;
3802 }
3803 }
3804 if (cert->dh_tmp != NULL)
3805 DH_free(cert->dh_tmp);
3806 cert->dh_tmp = new;
3807 return 1;
3808 }
3809 /*
3810 * break;
3811 */
3812 case SSL_CTRL_SET_TMP_DH_CB:
3813 {
3814 SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
3815 return (0);
3816 }
0f113f3e
MC
3817 case SSL_CTRL_SET_DH_AUTO:
3818 ctx->cert->dh_tmp_auto = larg;
3819 return 1;
d02b48c6 3820#endif
10bf4fc2 3821#ifndef OPENSSL_NO_EC
0f113f3e
MC
3822 case SSL_CTRL_SET_TMP_ECDH:
3823 {
3824 EC_KEY *ecdh = NULL;
3825
3826 if (parg == NULL) {
3827 SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_ECDH_LIB);
3828 return 0;
3829 }
3830 ecdh = EC_KEY_dup((EC_KEY *)parg);
3831 if (ecdh == NULL) {
3832 SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_EC_LIB);
3833 return 0;
3834 }
3835 if (!(ctx->options & SSL_OP_SINGLE_ECDH_USE)) {
3836 if (!EC_KEY_generate_key(ecdh)) {
3837 EC_KEY_free(ecdh);
3838 SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_ECDH_LIB);
3839 return 0;
3840 }
3841 }
3842
3843 if (cert->ecdh_tmp != NULL) {
3844 EC_KEY_free(cert->ecdh_tmp);
3845 }
3846 cert->ecdh_tmp = ecdh;
3847 return 1;
3848 }
3849 /* break; */
3850 case SSL_CTRL_SET_TMP_ECDH_CB:
3851 {
3852 SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
3853 return (0);
3854 }
10bf4fc2 3855#endif /* !OPENSSL_NO_EC */
ed3883d2 3856#ifndef OPENSSL_NO_TLSEXT
0f113f3e
MC
3857 case SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG:
3858 ctx->tlsext_servername_arg = parg;
3859 break;
3860 case SSL_CTRL_SET_TLSEXT_TICKET_KEYS:
3861 case SSL_CTRL_GET_TLSEXT_TICKET_KEYS:
3862 {
3863 unsigned char *keys = parg;
3864 if (!keys)
3865 return 48;
3866 if (larg != 48) {
3867 SSLerr(SSL_F_SSL3_CTX_CTRL, SSL_R_INVALID_TICKET_KEYS_LENGTH);
3868 return 0;
3869 }
3870 if (cmd == SSL_CTRL_SET_TLSEXT_TICKET_KEYS) {
3871 memcpy(ctx->tlsext_tick_key_name, keys, 16);
3872 memcpy(ctx->tlsext_tick_hmac_key, keys + 16, 16);
3873 memcpy(ctx->tlsext_tick_aes_key, keys + 32, 16);
3874 } else {
3875 memcpy(keys, ctx->tlsext_tick_key_name, 16);
3876 memcpy(keys + 16, ctx->tlsext_tick_hmac_key, 16);
3877 memcpy(keys + 32, ctx->tlsext_tick_aes_key, 16);
3878 }
3879 return 1;
3880 }
3881
0f113f3e
MC
3882 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG:
3883 ctx->tlsext_status_arg = parg;
3884 return 1;
0f113f3e
MC
3885
3886# ifndef OPENSSL_NO_SRP
3887 case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME:
3888 ctx->srp_ctx.srp_Mask |= SSL_kSRP;
3889 if (ctx->srp_ctx.login != NULL)
3890 OPENSSL_free(ctx->srp_ctx.login);
3891 ctx->srp_ctx.login = NULL;
3892 if (parg == NULL)
3893 break;
3894 if (strlen((const char *)parg) > 255
3895 || strlen((const char *)parg) < 1) {
3896 SSLerr(SSL_F_SSL3_CTX_CTRL, SSL_R_INVALID_SRP_USERNAME);
3897 return 0;
3898 }
3899 if ((ctx->srp_ctx.login = BUF_strdup((char *)parg)) == NULL) {
3900 SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_INTERNAL_ERROR);
3901 return 0;
3902 }
3903 break;
3904 case SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD:
3905 ctx->srp_ctx.SRP_give_srp_client_pwd_callback =
3906 srp_password_from_info_cb;
3907 ctx->srp_ctx.info = parg;
3908 break;
3909 case SSL_CTRL_SET_SRP_ARG:
3910 ctx->srp_ctx.srp_Mask |= SSL_kSRP;
3911 ctx->srp_ctx.SRP_cb_arg = parg;
3912 break;
3913
3914 case SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH:
3915 ctx->srp_ctx.strength = larg;
3916 break;
3917# endif
3918
3919# ifndef OPENSSL_NO_EC
3920 case SSL_CTRL_SET_CURVES:
3921 return tls1_set_curves(&ctx->tlsext_ellipticcurvelist,
3922 &ctx->tlsext_ellipticcurvelist_length,
3923 parg, larg);
3924
3925 case SSL_CTRL_SET_CURVES_LIST:
3926 return tls1_set_curves_list(&ctx->tlsext_ellipticcurvelist,
3927 &ctx->tlsext_ellipticcurvelist_length,
3928 parg);
10bf4fc2 3929# ifndef OPENSSL_NO_EC
0f113f3e
MC
3930 case SSL_CTRL_SET_ECDH_AUTO:
3931 ctx->cert->ecdh_tmp_auto = larg;
3932 return 1;
3933# endif
3934# endif
3935 case SSL_CTRL_SET_SIGALGS:
3936 return tls1_set_sigalgs(ctx->cert, parg, larg, 0);
3937
3938 case SSL_CTRL_SET_SIGALGS_LIST:
3939 return tls1_set_sigalgs_list(ctx->cert, parg, 0);
3940
3941 case SSL_CTRL_SET_CLIENT_SIGALGS:
3942 return tls1_set_sigalgs(ctx->cert, parg, larg, 1);
3943
3944 case SSL_CTRL_SET_CLIENT_SIGALGS_LIST:
3945 return tls1_set_sigalgs_list(ctx->cert, parg, 1);
3946
3947 case SSL_CTRL_SET_CLIENT_CERT_TYPES:
3948 return ssl3_set_req_cert_type(ctx->cert, parg, larg);
3949
3950 case SSL_CTRL_BUILD_CERT_CHAIN:
3951 return ssl_build_cert_chain(NULL, ctx, larg);
3952
3953 case SSL_CTRL_SET_VERIFY_CERT_STORE:
3954 return ssl_cert_set_cert_store(ctx->cert, parg, 0, larg);
3955
3956 case SSL_CTRL_SET_CHAIN_CERT_STORE:
3957 return ssl_cert_set_cert_store(ctx->cert, parg, 1, larg);
3958
3959#endif /* !OPENSSL_NO_TLSEXT */
3960
3961 /* A Thawte special :-) */
3962 case SSL_CTRL_EXTRA_CHAIN_CERT:
3963 if (ctx->extra_certs == NULL) {
3964 if ((ctx->extra_certs = sk_X509_new_null()) == NULL)
3965 return (0);
3966 }
3967 sk_X509_push(ctx->extra_certs, (X509 *)parg);
3968 break;
3969
3970 case SSL_CTRL_GET_EXTRA_CHAIN_CERTS:
3971 if (ctx->extra_certs == NULL && larg == 0)
3972 *(STACK_OF(X509) **)parg = ctx->cert->key->chain;
3973 else
3974 *(STACK_OF(X509) **)parg = ctx->extra_certs;
3975 break;
3976
3977 case SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS:
3978 if (ctx->extra_certs) {
3979 sk_X509_pop_free(ctx->extra_certs, X509_free);
3980 ctx->extra_certs = NULL;
3981 }
3982 break;
3983
3984 case SSL_CTRL_CHAIN:
3985 if (larg)
3986 return ssl_cert_set1_chain(NULL, ctx, (STACK_OF(X509) *)parg);
3987 else
3988 return ssl_cert_set0_chain(NULL, ctx, (STACK_OF(X509) *)parg);
3989
3990 case SSL_CTRL_CHAIN_CERT:
3991 if (larg)
3992 return ssl_cert_add1_chain_cert(NULL, ctx, (X509 *)parg);
3993 else
3994 return ssl_cert_add0_chain_cert(NULL, ctx, (X509 *)parg);
3995
3996 case SSL_CTRL_GET_CHAIN_CERTS:
3997 *(STACK_OF(X509) **)parg = ctx->cert->key->chain;
3998 break;
3999
4000 case SSL_CTRL_SELECT_CURRENT_CERT:
4001 return ssl_cert_select_current(ctx->cert, (X509 *)parg);
4002
4003 case SSL_CTRL_SET_CURRENT_CERT:
4004 return ssl_cert_set_current(ctx->cert, larg);
4005
4006 default:
4007 return (0);
4008 }
4009 return (1);
4010}
4011
4012long ssl3_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp) (void))
4013{
4014 CERT *cert;
4015
4016 cert = ctx->cert;
4017
4018 switch (cmd) {
bc36ee62 4019#ifndef OPENSSL_NO_RSA
0f113f3e
MC
4020 case SSL_CTRL_SET_TMP_RSA_CB:
4021 {
4022 cert->rsa_tmp_cb = (RSA *(*)(SSL *, int, int))fp;
4023 }
4024 break;
d3442bc7 4025#endif
bc36ee62 4026#ifndef OPENSSL_NO_DH
0f113f3e
MC
4027 case SSL_CTRL_SET_TMP_DH_CB:
4028 {
4029 cert->dh_tmp_cb = (DH *(*)(SSL *, int, int))fp;
4030 }
4031 break;
ea262260 4032#endif
10bf4fc2 4033#ifndef OPENSSL_NO_EC
0f113f3e
MC
4034 case SSL_CTRL_SET_TMP_ECDH_CB:
4035 {
4036 cert->ecdh_tmp_cb = (EC_KEY *(*)(SSL *, int, int))fp;
4037 }
4038 break;
ed3883d2
BM
4039#endif
4040#ifndef OPENSSL_NO_TLSEXT
0f113f3e
MC
4041 case SSL_CTRL_SET_TLSEXT_SERVERNAME_CB:
4042 ctx->tlsext_servername_callback = (int (*)(SSL *, int *, void *))fp;
4043 break;
4044
0f113f3e
MC
4045 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB:
4046 ctx->tlsext_status_cb = (int (*)(SSL *, void *))fp;
4047 break;
4048
4049 case SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB:
4050 ctx->tlsext_ticket_key_cb = (int (*)(SSL *, unsigned char *,
4051 unsigned char *,
4052 EVP_CIPHER_CTX *,
4053 HMAC_CTX *, int))fp;
4054 break;
4055
4056# ifndef OPENSSL_NO_SRP
4057 case SSL_CTRL_SET_SRP_VERIFY_PARAM_CB:
4058 ctx->srp_ctx.srp_Mask |= SSL_kSRP;
4059 ctx->srp_ctx.SRP_verify_param_callback = (int (*)(SSL *, void *))fp;
4060 break;
4061 case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB:
4062 ctx->srp_ctx.srp_Mask |= SSL_kSRP;
4063 ctx->srp_ctx.TLS_ext_srp_username_callback =
4064 (int (*)(SSL *, int *, void *))fp;
4065 break;
4066 case SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB:
4067 ctx->srp_ctx.srp_Mask |= SSL_kSRP;
4068 ctx->srp_ctx.SRP_give_srp_client_pwd_callback =
4069 (char *(*)(SSL *, void *))fp;
4070 break;
4071# endif
761772d7 4072#endif
0f113f3e
MC
4073 case SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB:
4074 {
4075 ctx->not_resumable_session_cb = (int (*)(SSL *, int))fp;
4076 }
4077 break;
4078 default:
4079 return (0);
4080 }
4081 return (1);
4082}
761772d7 4083
0f113f3e
MC
4084/*
4085 * This function needs to check if the ciphers required are actually
4086 * available
4087 */
babb3798 4088const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p)
0f113f3e
MC
4089{
4090 SSL_CIPHER c;
4091 const SSL_CIPHER *cp;
4092 unsigned long id;
4093
4094 id = 0x03000000L | ((unsigned long)p[0] << 8L) | (unsigned long)p[1];
4095 c.id = id;
4096 cp = OBJ_bsearch_ssl_cipher_id(&c, ssl3_ciphers, SSL3_NUM_CIPHERS);
7409d7ad 4097#ifdef DEBUG_PRINT_UNKNOWN_CIPHERSUITES
0f113f3e
MC
4098 if (cp == NULL)
4099 fprintf(stderr, "Unknown cipher ID %x\n", (p[0] << 8) | p[1]);
7409d7ad 4100#endif
0f113f3e
MC
4101 return cp;
4102}
d02b48c6 4103
6b691a5c 4104int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p)
0f113f3e
MC
4105{
4106 long l;
4107
4108 if (p != NULL) {
4109 l = c->id;
4110 if ((l & 0xff000000) != 0x03000000)
4111 return (0);
4112 p[0] = ((unsigned char)(l >> 8L)) & 0xFF;
4113 p[1] = ((unsigned char)(l)) & 0xFF;
4114 }
4115 return (2);
4116}
d02b48c6 4117
836f9960 4118SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
0f113f3e
MC
4119 STACK_OF(SSL_CIPHER) *srvr)
4120{
4121 SSL_CIPHER *c, *ret = NULL;
4122 STACK_OF(SSL_CIPHER) *prio, *allow;
4123 int i, ii, ok;
4124 CERT *cert;
4125 unsigned long alg_k, alg_a, mask_k, mask_a, emask_k, emask_a;
d02b48c6 4126
0f113f3e
MC
4127 /* Let's see which ciphers we can support */
4128 cert = s->cert;
d02b48c6 4129
836f9960 4130#if 0
0f113f3e
MC
4131 /*
4132 * Do not set the compare functions, because this may lead to a
4133 * reordering by "id". We want to keep the original ordering. We may pay
4134 * a price in performance during sk_SSL_CIPHER_find(), but would have to
4135 * pay with the price of sk_SSL_CIPHER_dup().
4136 */
4137 sk_SSL_CIPHER_set_cmp_func(srvr, ssl_cipher_ptr_id_cmp);
4138 sk_SSL_CIPHER_set_cmp_func(clnt, ssl_cipher_ptr_id_cmp);
836f9960 4139#endif
d02b48c6 4140
f415fa32 4141#ifdef CIPHER_DEBUG
0f113f3e
MC
4142 fprintf(stderr, "Server has %d from %p:\n", sk_SSL_CIPHER_num(srvr),
4143 (void *)srvr);
4144 for (i = 0; i < sk_SSL_CIPHER_num(srvr); ++i) {
4145 c = sk_SSL_CIPHER_value(srvr, i);
4146 fprintf(stderr, "%p:%s\n", (void *)c, c->name);
4147 }
4148 fprintf(stderr, "Client sent %d from %p:\n", sk_SSL_CIPHER_num(clnt),
4149 (void *)clnt);
4150 for (i = 0; i < sk_SSL_CIPHER_num(clnt); ++i) {
4151 c = sk_SSL_CIPHER_value(clnt, i);
4152 fprintf(stderr, "%p:%s\n", (void *)c, c->name);
4153 }
f415fa32
BL
4154#endif
4155
0f113f3e
MC
4156 if (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE || tls1_suiteb(s)) {
4157 prio = srvr;
4158 allow = clnt;
4159 } else {
4160 prio = clnt;
4161 allow = srvr;
4162 }
4163
4164 tls1_set_cert_validity(s);
4165
4166 for (i = 0; i < sk_SSL_CIPHER_num(prio); i++) {
4167 c = sk_SSL_CIPHER_value(prio, i);
4168
4169 /* Skip TLS v1.2 only ciphersuites if not supported */
4170 if ((c->algorithm_ssl & SSL_TLSV1_2) && !SSL_USE_TLS1_2_CIPHERS(s))
4171 continue;
4172
4173 ssl_set_cert_masks(cert, c);
4174 mask_k = cert->mask_k;
4175 mask_a = cert->mask_a;
4176 emask_k = cert->export_mask_k;
4177 emask_a = cert->export_mask_a;
edc032b5 4178#ifndef OPENSSL_NO_SRP
0f113f3e
MC
4179 if (s->srp_ctx.srp_Mask & SSL_kSRP) {
4180 mask_k |= SSL_kSRP;
4181 emask_k |= SSL_kSRP;
4182 mask_a |= SSL_aSRP;
4183 emask_a |= SSL_aSRP;
4184 }
edc032b5 4185#endif
0f113f3e 4186
f9b3bff6 4187#ifdef KSSL_DEBUG
0f113f3e
MC
4188 /*
4189 * fprintf(stderr,"ssl3_choose_cipher %d alg= %lx\n",
4190 * i,c->algorithms);
4191 */
4192#endif /* KSSL_DEBUG */
f9b3bff6 4193
0f113f3e
MC
4194 alg_k = c->algorithm_mkey;
4195 alg_a = c->algorithm_auth;
52b8dad8 4196
a5224c34 4197#ifndef OPENSSL_NO_KRB5
0f113f3e
MC
4198 if (alg_k & SSL_kKRB5) {
4199 if (!kssl_keytab_is_available(s->kssl_ctx))
4200 continue;
4201 }
4202#endif /* OPENSSL_NO_KRB5 */
ddac1974 4203#ifndef OPENSSL_NO_PSK
0f113f3e
MC
4204 /* with PSK there must be server callback set */
4205 if ((alg_k & SSL_kPSK) && s->psk_server_callback == NULL)
4206 continue;
4207#endif /* OPENSSL_NO_PSK */
4208
4209 if (SSL_C_IS_EXPORT(c)) {
4210 ok = (alg_k & emask_k) && (alg_a & emask_a);
d02b48c6 4211#ifdef CIPHER_DEBUG
0f113f3e
MC
4212 fprintf(stderr, "%d:[%08lX:%08lX:%08lX:%08lX]%p:%s (export)\n",
4213 ok, alg_k, alg_a, emask_k, emask_a, (void *)c, c->name);
d02b48c6 4214#endif
0f113f3e
MC
4215 } else {
4216 ok = (alg_k & mask_k) && (alg_a & mask_a);
d02b48c6 4217#ifdef CIPHER_DEBUG
0f113f3e
MC
4218 fprintf(stderr, "%d:[%08lX:%08lX:%08lX:%08lX]%p:%s\n", ok, alg_k,
4219 alg_a, mask_k, mask_a, (void *)c, c->name);
d02b48c6 4220#endif
0f113f3e 4221 }
d02b48c6 4222
f393b744 4223#ifndef OPENSSL_NO_TLSEXT
0f113f3e 4224# ifndef OPENSSL_NO_EC
0f113f3e
MC
4225 /*
4226 * if we are considering an ECC cipher suite that uses an ephemeral
4227 * EC key check it
4228 */
4229 if (alg_k & SSL_kECDHE)
4230 ok = ok && tls1_check_ec_tmp_key(s, c->id);
0f113f3e
MC
4231# endif /* OPENSSL_NO_EC */
4232#endif /* OPENSSL_NO_TLSEXT */
4233
4234 if (!ok)
4235 continue;
4236 ii = sk_SSL_CIPHER_find(allow, c);
4237 if (ii >= 0) {
4238 /* Check security callback permits this cipher */
4239 if (!ssl_security(s, SSL_SECOP_CIPHER_SHARED,
4240 c->strength_bits, 0, c))
4241 continue;
d89cd382 4242#if !defined(OPENSSL_NO_EC) && !defined(OPENSSL_NO_TLSEXT)
0f113f3e
MC
4243 if ((alg_k & SSL_kECDHE) && (alg_a & SSL_aECDSA)
4244 && s->s3->is_probably_safari) {
4245 if (!ret)
4246 ret = sk_SSL_CIPHER_value(allow, ii);
4247 continue;
4248 }
d89cd382 4249#endif
0f113f3e
MC
4250 ret = sk_SSL_CIPHER_value(allow, ii);
4251 break;
4252 }
4253 }
4254 return (ret);
4255}
d02b48c6 4256
6b691a5c 4257int ssl3_get_req_cert_type(SSL *s, unsigned char *p)
0f113f3e
MC
4258{
4259 int ret = 0;
4260 int nostrict = 1;
4261 unsigned long alg_k, alg_a = 0;
4262
4263 /* If we have custom certificate types set, use them */
4264 if (s->cert->ctypes) {
4265 memcpy(p, s->cert->ctypes, s->cert->ctype_num);
4266 return (int)s->cert->ctype_num;
4267 }
4268 /* Get mask of algorithms disabled by signature list */
4269 ssl_set_sig_mask(&alg_a, s, SSL_SECOP_SIGALG_MASK);
4270 if (s->cert->cert_flags & SSL_CERT_FLAGS_CHECK_TLS_STRICT)
4271 nostrict = 0;
4272
4273 alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
d02b48c6 4274
caa97ef1 4275#ifndef OPENSSL_NO_GOST
0f113f3e
MC
4276 if (s->version >= TLS1_VERSION) {
4277 if (alg_k & SSL_kGOST) {
4278 p[ret++] = TLS_CT_GOST94_SIGN;
4279 p[ret++] = TLS_CT_GOST01_SIGN;
4280 return (ret);
4281 }
4282 }
caa97ef1
DSH
4283#endif
4284
bc36ee62 4285#ifndef OPENSSL_NO_DH
0f113f3e
MC
4286 if (alg_k & (SSL_kDHr | SSL_kDHE)) {
4287# ifndef OPENSSL_NO_RSA
4288 /*
4289 * Since this refers to a certificate signed with an RSA algorithm,
4290 * only check for rsa signing in strict mode.
4291 */
4292 if (nostrict || !(alg_a & SSL_aRSA))
4293 p[ret++] = SSL3_CT_RSA_FIXED_DH;
4294# endif
4295# ifndef OPENSSL_NO_DSA
4296 if (nostrict || !(alg_a & SSL_aDSS))
4297 p[ret++] = SSL3_CT_DSS_FIXED_DH;
4298# endif
4299 }
4300 if ((s->version == SSL3_VERSION) &&
4301 (alg_k & (SSL_kDHE | SSL_kDHd | SSL_kDHr))) {
4302# ifndef OPENSSL_NO_RSA
4303 p[ret++] = SSL3_CT_RSA_EPHEMERAL_DH;
4304# endif
4305# ifndef OPENSSL_NO_DSA
4306 p[ret++] = SSL3_CT_DSS_EPHEMERAL_DH;
4307# endif
4308 }
4309#endif /* !OPENSSL_NO_DH */
bc36ee62 4310#ifndef OPENSSL_NO_RSA
0f113f3e
MC
4311 if (!(alg_a & SSL_aRSA))
4312 p[ret++] = SSL3_CT_RSA_SIGN;
d02b48c6 4313#endif
bc36ee62 4314#ifndef OPENSSL_NO_DSA
0f113f3e
MC
4315 if (!(alg_a & SSL_aDSS))
4316 p[ret++] = SSL3_CT_DSS_SIGN;
dfeab068 4317#endif
10bf4fc2 4318#ifndef OPENSSL_NO_EC
0f113f3e
MC
4319 if ((alg_k & (SSL_kECDHr | SSL_kECDHe)) && (s->version >= TLS1_VERSION)) {
4320 if (nostrict || !(alg_a & SSL_aRSA))
4321 p[ret++] = TLS_CT_RSA_FIXED_ECDH;
4322 if (nostrict || !(alg_a & SSL_aECDSA))
4323 p[ret++] = TLS_CT_ECDSA_FIXED_ECDH;
4324 }
0f113f3e
MC
4325 /*
4326 * ECDSA certs can be used with RSA cipher suites as well so we don't
4327 * need to check for SSL_kECDH or SSL_kECDHE
4328 */
4329 if (s->version >= TLS1_VERSION) {
4330 if (!(alg_a & SSL_aECDSA))
4331 p[ret++] = TLS_CT_ECDSA_SIGN;
4332 }
4333#endif
4334 return (ret);
4335}
d02b48c6 4336
9f27b1ee 4337static int ssl3_set_req_cert_type(CERT *c, const unsigned char *p, size_t len)
0f113f3e
MC
4338{
4339 if (c->ctypes) {
4340 OPENSSL_free(c->ctypes);
4341 c->ctypes = NULL;
4342 }
4343 if (!p || !len)
4344 return 1;
4345 if (len > 0xff)
4346 return 0;
4347 c->ctypes = OPENSSL_malloc(len);
4348 if (!c->ctypes)
4349 return 0;
4350 memcpy(c->ctypes, p, len);
4351 c->ctype_num = len;
4352 return 1;
4353}
9f27b1ee 4354
6b691a5c 4355int ssl3_shutdown(SSL *s)
0f113f3e
MC
4356{
4357 int ret;
4358
4359 /*
4360 * Don't do anything much if we have not done the handshake or we don't
4361 * want to send messages :-)
4362 */
4363 if ((s->quiet_shutdown) || (s->state == SSL_ST_BEFORE)) {
4364 s->shutdown = (SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN);
4365 return (1);
4366 }
4367
4368 if (!(s->shutdown & SSL_SENT_SHUTDOWN)) {
4369 s->shutdown |= SSL_SENT_SHUTDOWN;
0f113f3e 4370 ssl3_send_alert(s, SSL3_AL_WARNING, SSL_AD_CLOSE_NOTIFY);
0f113f3e
MC
4371 /*
4372 * our shutdown alert has been sent now, and if it still needs to be
4373 * written, s->s3->alert_dispatch will be true
4374 */
4375 if (s->s3->alert_dispatch)
4376 return (-1); /* return WANT_WRITE */
4377 } else if (s->s3->alert_dispatch) {
4378 /* resend it if not sent */
0f113f3e
MC
4379 ret = s->method->ssl_dispatch_alert(s);
4380 if (ret == -1) {
4381 /*
4382 * we only get to return -1 here the 2nd/Nth invocation, we must
4383 * have already signalled return 0 upon a previous invoation,
4384 * return WANT_WRITE
4385 */
4386 return (ret);
4387 }
0f113f3e
MC
4388 } else if (!(s->shutdown & SSL_RECEIVED_SHUTDOWN)) {
4389 /*
4390 * If we are waiting for a close from our peer, we are closed
4391 */
4392 s->method->ssl_read_bytes(s, 0, NULL, 0, 0);
4393 if (!(s->shutdown & SSL_RECEIVED_SHUTDOWN)) {
4394 return (-1); /* return WANT_READ */
4395 }
4396 }
4397
4398 if ((s->shutdown == (SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN)) &&
4399 !s->s3->alert_dispatch)
4400 return (1);
4401 else
4402 return (0);
4403}
d02b48c6 4404
61f5b6f3 4405int ssl3_write(SSL *s, const void *buf, int len)
0f113f3e
MC
4406{
4407 int ret, n;
d02b48c6
RE
4408
4409#if 0
0f113f3e
MC
4410 if (s->shutdown & SSL_SEND_SHUTDOWN) {
4411 s->rwstate = SSL_NOTHING;
4412 return (0);
4413 }
d02b48c6 4414#endif
0f113f3e
MC
4415 clear_sys_error();
4416 if (s->s3->renegotiate)
4417 ssl3_renegotiate_check(s);
4418
4419 /*
4420 * This is an experimental flag that sends the last handshake message in
4421 * the same packet as the first use data - used to see if it helps the
4422 * TCP protocol during session-id reuse
4423 */
4424 /* The second test is because the buffer may have been removed */
4425 if ((s->s3->flags & SSL3_FLAGS_POP_BUFFER) && (s->wbio == s->bbio)) {
4426 /* First time through, we write into the buffer */
4427 if (s->s3->delay_buf_pop_ret == 0) {
4428 ret = ssl3_write_bytes(s, SSL3_RT_APPLICATION_DATA, buf, len);
4429 if (ret <= 0)
4430 return (ret);
4431
4432 s->s3->delay_buf_pop_ret = ret;
4433 }
4434
4435 s->rwstate = SSL_WRITING;
4436 n = BIO_flush(s->wbio);
4437 if (n <= 0)
4438 return (n);
4439 s->rwstate = SSL_NOTHING;
4440
4441 /* We have flushed the buffer, so remove it */
4442 ssl_free_wbio_buffer(s);
4443 s->s3->flags &= ~SSL3_FLAGS_POP_BUFFER;
4444
4445 ret = s->s3->delay_buf_pop_ret;
4446 s->s3->delay_buf_pop_ret = 0;
4447 } else {
4448 ret = s->method->ssl_write_bytes(s, SSL3_RT_APPLICATION_DATA,
4449 buf, len);
4450 if (ret <= 0)
4451 return (ret);
4452 }
4453
4454 return (ret);
4455}
d02b48c6 4456
5a4fbc69 4457static int ssl3_read_internal(SSL *s, void *buf, int len, int peek)
0f113f3e
MC
4458{
4459 int ret;
4460
4461 clear_sys_error();
4462 if (s->s3->renegotiate)
4463 ssl3_renegotiate_check(s);
4464 s->s3->in_read_app_data = 1;
4465 ret =
4466 s->method->ssl_read_bytes(s, SSL3_RT_APPLICATION_DATA, buf, len,
4467 peek);
4468 if ((ret == -1) && (s->s3->in_read_app_data == 2)) {
4469 /*
4470 * ssl3_read_bytes decided to call s->handshake_func, which called
4471 * ssl3_read_bytes to read handshake data. However, ssl3_read_bytes
4472 * actually found application data and thinks that application data
4473 * makes sense here; so disable handshake processing and try to read
4474 * application data again.
4475 */
4476 s->in_handshake++;
4477 ret =
4478 s->method->ssl_read_bytes(s, SSL3_RT_APPLICATION_DATA, buf, len,
4479 peek);
4480 s->in_handshake--;
4481 } else
4482 s->s3->in_read_app_data = 0;
4483
4484 return (ret);
4485}
d02b48c6 4486
5a4fbc69 4487int ssl3_read(SSL *s, void *buf, int len)
0f113f3e
MC
4488{
4489 return ssl3_read_internal(s, buf, len, 0);
4490}
d02b48c6 4491
e34cfcf7 4492int ssl3_peek(SSL *s, void *buf, int len)
0f113f3e
MC
4493{
4494 return ssl3_read_internal(s, buf, len, 1);
4495}
d02b48c6 4496
6b691a5c 4497int ssl3_renegotiate(SSL *s)
0f113f3e
MC
4498{
4499 if (s->handshake_func == NULL)
4500 return (1);
d02b48c6 4501
0f113f3e
MC
4502 if (s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)
4503 return (0);
d02b48c6 4504
0f113f3e
MC
4505 s->s3->renegotiate = 1;
4506 return (1);
4507}
d02b48c6 4508
6b691a5c 4509int ssl3_renegotiate_check(SSL *s)
0f113f3e
MC
4510{
4511 int ret = 0;
4512
4513 if (s->s3->renegotiate) {
4514 if ((s->s3->rbuf.left == 0) &&
4515 (s->s3->wbuf.left == 0) && !SSL_in_init(s)) {
4516 /*
4517 * if we are the server, and we have sent a 'RENEGOTIATE'
4518 * message, we need to go to SSL_ST_ACCEPT.
4519 */
4520 /* SSL_ST_ACCEPT */
4521 s->state = SSL_ST_RENEGOTIATE;
4522 s->s3->renegotiate = 0;
4523 s->s3->num_renegotiations++;
4524 s->s3->total_renegotiations++;
4525 ret = 1;
4526 }
4527 }
4528 return (ret);
4529}
4530
58964a49 4531/*
0f113f3e
MC
4532 * If we are using default SHA1+MD5 algorithms switch to new SHA256 PRF and
4533 * handshake macs if required.
7409d7ad
DSH
4534 */
4535long ssl_get_algorithm2(SSL *s)
0f113f3e
MC
4536{
4537 long alg2 = s->s3->tmp.new_cipher->algorithm2;
4538 if (s->method->ssl3_enc->enc_flags & SSL_ENC_FLAG_SHA256_PRF
4539 && alg2 == (SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF))
4540 return SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256;
4541 return alg2;
4542}