2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
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.
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).
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.
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
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 :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
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
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.]
58 /* ====================================================================
59 * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions
65 * 1. Redistributions of source code must retain the above copyright
66 * notice, this list of conditions and the following disclaimer.
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
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/)"
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.
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.
87 * 6. Redistributions of any form whatsoever must retain the following
89 * "This product includes software developed by the OpenSSL Project
90 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
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 * ====================================================================
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).
111 /* ====================================================================
112 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
114 * Portions of the attached software ("Contribution") are developed by
115 * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
117 * The Contribution is licensed pursuant to the OpenSSL open source
118 * license provided above.
120 * ECC cipher suite support in OpenSSL originally written by
121 * Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories.
124 /* ====================================================================
125 * Copyright 2005 Nokia. All rights reserved.
127 * The portions of the attached software ("Contribution") is developed by
128 * Nokia Corporation and is licensed pursuant to the OpenSSL open source
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.
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.
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.
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
152 #include <openssl/objects.h>
153 #include "ssl_locl.h"
154 #include "kssl_lcl.h"
155 #ifndef OPENSSL_NO_TLSEXT
156 #ifndef OPENSSL_NO_EC
157 #include "../crypto/ec/ec_lcl.h"
158 #endif /* OPENSSL_NO_EC */
159 #endif /* OPENSSL_NO_TLSEXT */
160 #include <openssl/md5.h>
161 #ifndef OPENSSL_NO_DH
162 #include <openssl/dh.h>
165 const char ssl3_version_str
[]="SSLv3" OPENSSL_VERSION_PTEXT
;
167 #define SSL3_NUM_CIPHERS (sizeof(ssl3_ciphers)/sizeof(SSL_CIPHER))
169 /* list of available SSLv3 ciphers (sorted by id) */
170 OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers
[]={
172 /* The RSA ciphers */
176 SSL3_TXT_RSA_NULL_MD5
,
177 SSL3_CK_RSA_NULL_MD5
,
183 SSL_NOT_EXP
|SSL_STRONG_NONE
,
184 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
192 SSL3_TXT_RSA_NULL_SHA
,
193 SSL3_CK_RSA_NULL_SHA
,
199 SSL_NOT_EXP
|SSL_STRONG_NONE
|SSL_FIPS
,
200 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
208 SSL3_TXT_RSA_RC4_40_MD5
,
209 SSL3_CK_RSA_RC4_40_MD5
,
215 SSL_EXPORT
|SSL_EXP40
,
216 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
224 SSL3_TXT_RSA_RC4_128_MD5
,
225 SSL3_CK_RSA_RC4_128_MD5
,
231 SSL_NOT_EXP
|SSL_MEDIUM
,
232 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
240 SSL3_TXT_RSA_RC4_128_SHA
,
241 SSL3_CK_RSA_RC4_128_SHA
,
247 SSL_NOT_EXP
|SSL_MEDIUM
,
248 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
256 SSL3_TXT_RSA_RC2_40_MD5
,
257 SSL3_CK_RSA_RC2_40_MD5
,
263 SSL_EXPORT
|SSL_EXP40
,
264 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
270 #ifndef OPENSSL_NO_IDEA
273 SSL3_TXT_RSA_IDEA_128_SHA
,
274 SSL3_CK_RSA_IDEA_128_SHA
,
280 SSL_NOT_EXP
|SSL_MEDIUM
,
281 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
290 SSL3_TXT_RSA_DES_40_CBC_SHA
,
291 SSL3_CK_RSA_DES_40_CBC_SHA
,
297 SSL_EXPORT
|SSL_EXP40
,
298 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
306 SSL3_TXT_RSA_DES_64_CBC_SHA
,
307 SSL3_CK_RSA_DES_64_CBC_SHA
,
314 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
322 SSL3_TXT_RSA_DES_192_CBC3_SHA
,
323 SSL3_CK_RSA_DES_192_CBC3_SHA
,
329 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
330 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
339 SSL3_TXT_DH_DSS_DES_40_CBC_SHA
,
340 SSL3_CK_DH_DSS_DES_40_CBC_SHA
,
346 SSL_EXPORT
|SSL_EXP40
,
347 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
354 0, /* not implemented (non-ephemeral DH) */
355 SSL3_TXT_DH_DSS_DES_64_CBC_SHA
,
356 SSL3_CK_DH_DSS_DES_64_CBC_SHA
,
363 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
370 0, /* not implemented (non-ephemeral DH) */
371 SSL3_TXT_DH_DSS_DES_192_CBC3_SHA
,
372 SSL3_CK_DH_DSS_DES_192_CBC3_SHA
,
378 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
379 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
386 0, /* not implemented (non-ephemeral DH) */
387 SSL3_TXT_DH_RSA_DES_40_CBC_SHA
,
388 SSL3_CK_DH_RSA_DES_40_CBC_SHA
,
394 SSL_EXPORT
|SSL_EXP40
,
395 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
402 0, /* not implemented (non-ephemeral DH) */
403 SSL3_TXT_DH_RSA_DES_64_CBC_SHA
,
404 SSL3_CK_DH_RSA_DES_64_CBC_SHA
,
411 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
418 0, /* not implemented (non-ephemeral DH) */
419 SSL3_TXT_DH_RSA_DES_192_CBC3_SHA
,
420 SSL3_CK_DH_RSA_DES_192_CBC3_SHA
,
426 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
427 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
432 /* The Ephemeral DH ciphers */
436 SSL3_TXT_EDH_DSS_DES_40_CBC_SHA
,
437 SSL3_CK_EDH_DSS_DES_40_CBC_SHA
,
443 SSL_EXPORT
|SSL_EXP40
,
444 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
452 SSL3_TXT_EDH_DSS_DES_64_CBC_SHA
,
453 SSL3_CK_EDH_DSS_DES_64_CBC_SHA
,
460 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
468 SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA
,
469 SSL3_CK_EDH_DSS_DES_192_CBC3_SHA
,
475 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
476 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
484 SSL3_TXT_EDH_RSA_DES_40_CBC_SHA
,
485 SSL3_CK_EDH_RSA_DES_40_CBC_SHA
,
491 SSL_EXPORT
|SSL_EXP40
,
492 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
500 SSL3_TXT_EDH_RSA_DES_64_CBC_SHA
,
501 SSL3_CK_EDH_RSA_DES_64_CBC_SHA
,
508 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
516 SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA
,
517 SSL3_CK_EDH_RSA_DES_192_CBC3_SHA
,
523 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
524 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
532 SSL3_TXT_ADH_RC4_40_MD5
,
533 SSL3_CK_ADH_RC4_40_MD5
,
539 SSL_EXPORT
|SSL_EXP40
,
540 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
548 SSL3_TXT_ADH_RC4_128_MD5
,
549 SSL3_CK_ADH_RC4_128_MD5
,
555 SSL_NOT_EXP
|SSL_MEDIUM
,
556 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
564 SSL3_TXT_ADH_DES_40_CBC_SHA
,
565 SSL3_CK_ADH_DES_40_CBC_SHA
,
571 SSL_EXPORT
|SSL_EXP40
,
572 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
580 SSL3_TXT_ADH_DES_64_CBC_SHA
,
581 SSL3_CK_ADH_DES_64_CBC_SHA
,
588 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
596 SSL3_TXT_ADH_DES_192_CBC_SHA
,
597 SSL3_CK_ADH_DES_192_CBC_SHA
,
603 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
604 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
609 /* Fortezza ciphersuite from SSL 3.0 spec */
614 SSL3_TXT_FZA_DMS_NULL_SHA
,
615 SSL3_CK_FZA_DMS_NULL_SHA
,
621 SSL_NOT_EXP
|SSL_STRONG_NONE
,
622 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
630 SSL3_TXT_FZA_DMS_FZA_SHA
,
631 SSL3_CK_FZA_DMS_FZA_SHA
,
637 SSL_NOT_EXP
|SSL_STRONG_NONE
,
638 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
646 SSL3_TXT_FZA_DMS_RC4_SHA
,
647 SSL3_CK_FZA_DMS_RC4_SHA
,
653 SSL_NOT_EXP
|SSL_MEDIUM
,
654 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
660 #ifndef OPENSSL_NO_KRB5
661 /* The Kerberos ciphers*/
665 SSL3_TXT_KRB5_DES_64_CBC_SHA
,
666 SSL3_CK_KRB5_DES_64_CBC_SHA
,
673 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
681 SSL3_TXT_KRB5_DES_192_CBC3_SHA
,
682 SSL3_CK_KRB5_DES_192_CBC3_SHA
,
688 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
689 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
697 SSL3_TXT_KRB5_RC4_128_SHA
,
698 SSL3_CK_KRB5_RC4_128_SHA
,
704 SSL_NOT_EXP
|SSL_MEDIUM
,
705 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
713 SSL3_TXT_KRB5_IDEA_128_CBC_SHA
,
714 SSL3_CK_KRB5_IDEA_128_CBC_SHA
,
720 SSL_NOT_EXP
|SSL_MEDIUM
,
721 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
729 SSL3_TXT_KRB5_DES_64_CBC_MD5
,
730 SSL3_CK_KRB5_DES_64_CBC_MD5
,
737 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
745 SSL3_TXT_KRB5_DES_192_CBC3_MD5
,
746 SSL3_CK_KRB5_DES_192_CBC3_MD5
,
752 SSL_NOT_EXP
|SSL_HIGH
,
753 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
761 SSL3_TXT_KRB5_RC4_128_MD5
,
762 SSL3_CK_KRB5_RC4_128_MD5
,
768 SSL_NOT_EXP
|SSL_MEDIUM
,
769 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
777 SSL3_TXT_KRB5_IDEA_128_CBC_MD5
,
778 SSL3_CK_KRB5_IDEA_128_CBC_MD5
,
784 SSL_NOT_EXP
|SSL_MEDIUM
,
785 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
793 SSL3_TXT_KRB5_DES_40_CBC_SHA
,
794 SSL3_CK_KRB5_DES_40_CBC_SHA
,
800 SSL_EXPORT
|SSL_EXP40
,
801 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
809 SSL3_TXT_KRB5_RC2_40_CBC_SHA
,
810 SSL3_CK_KRB5_RC2_40_CBC_SHA
,
816 SSL_EXPORT
|SSL_EXP40
,
817 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
825 SSL3_TXT_KRB5_RC4_40_SHA
,
826 SSL3_CK_KRB5_RC4_40_SHA
,
832 SSL_EXPORT
|SSL_EXP40
,
833 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
841 SSL3_TXT_KRB5_DES_40_CBC_MD5
,
842 SSL3_CK_KRB5_DES_40_CBC_MD5
,
848 SSL_EXPORT
|SSL_EXP40
,
849 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
857 SSL3_TXT_KRB5_RC2_40_CBC_MD5
,
858 SSL3_CK_KRB5_RC2_40_CBC_MD5
,
864 SSL_EXPORT
|SSL_EXP40
,
865 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
873 SSL3_TXT_KRB5_RC4_40_MD5
,
874 SSL3_CK_KRB5_RC4_40_MD5
,
880 SSL_EXPORT
|SSL_EXP40
,
881 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
885 #endif /* OPENSSL_NO_KRB5 */
887 /* New AES ciphersuites */
891 TLS1_TXT_RSA_WITH_AES_128_SHA
,
892 TLS1_CK_RSA_WITH_AES_128_SHA
,
898 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
899 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
906 TLS1_TXT_DH_DSS_WITH_AES_128_SHA
,
907 TLS1_CK_DH_DSS_WITH_AES_128_SHA
,
913 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
914 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
921 TLS1_TXT_DH_RSA_WITH_AES_128_SHA
,
922 TLS1_CK_DH_RSA_WITH_AES_128_SHA
,
928 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
929 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
936 TLS1_TXT_DHE_DSS_WITH_AES_128_SHA
,
937 TLS1_CK_DHE_DSS_WITH_AES_128_SHA
,
943 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
944 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
951 TLS1_TXT_DHE_RSA_WITH_AES_128_SHA
,
952 TLS1_CK_DHE_RSA_WITH_AES_128_SHA
,
958 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
959 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
966 TLS1_TXT_ADH_WITH_AES_128_SHA
,
967 TLS1_CK_ADH_WITH_AES_128_SHA
,
973 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
974 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
982 TLS1_TXT_RSA_WITH_AES_256_SHA
,
983 TLS1_CK_RSA_WITH_AES_256_SHA
,
989 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
990 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
997 TLS1_TXT_DH_DSS_WITH_AES_256_SHA
,
998 TLS1_CK_DH_DSS_WITH_AES_256_SHA
,
1004 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1005 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1012 0, /* not implemented (non-ephemeral DH) */
1013 TLS1_TXT_DH_RSA_WITH_AES_256_SHA
,
1014 TLS1_CK_DH_RSA_WITH_AES_256_SHA
,
1020 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1021 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1029 TLS1_TXT_DHE_DSS_WITH_AES_256_SHA
,
1030 TLS1_CK_DHE_DSS_WITH_AES_256_SHA
,
1036 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1037 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1045 TLS1_TXT_DHE_RSA_WITH_AES_256_SHA
,
1046 TLS1_CK_DHE_RSA_WITH_AES_256_SHA
,
1052 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1053 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1061 TLS1_TXT_ADH_WITH_AES_256_SHA
,
1062 TLS1_CK_ADH_WITH_AES_256_SHA
,
1068 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1069 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1074 /* TLS v1.2 ciphersuites */
1078 TLS1_TXT_RSA_WITH_NULL_SHA256
,
1079 TLS1_CK_RSA_WITH_NULL_SHA256
,
1085 SSL_NOT_EXP
|SSL_STRONG_NONE
|SSL_FIPS
,
1086 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1094 TLS1_TXT_RSA_WITH_AES_128_SHA256
,
1095 TLS1_CK_RSA_WITH_AES_128_SHA256
,
1101 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1102 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1110 TLS1_TXT_RSA_WITH_AES_256_SHA256
,
1111 TLS1_CK_RSA_WITH_AES_256_SHA256
,
1117 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1118 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1125 0, /* not implemented (non-ephemeral DH) */
1126 TLS1_TXT_DH_DSS_WITH_AES_128_SHA256
,
1127 TLS1_CK_DH_DSS_WITH_AES_128_SHA256
,
1133 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1134 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1141 0, /* not implemented (non-ephemeral DH) */
1142 TLS1_TXT_DH_RSA_WITH_AES_128_SHA256
,
1143 TLS1_CK_DH_RSA_WITH_AES_128_SHA256
,
1149 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1150 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1158 TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256
,
1159 TLS1_CK_DHE_DSS_WITH_AES_128_SHA256
,
1165 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1166 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1171 #ifndef OPENSSL_NO_CAMELLIA
1172 /* Camellia ciphersuites from RFC4132 (128-bit portion) */
1177 TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA
,
1178 TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA
,
1184 SSL_NOT_EXP
|SSL_HIGH
,
1185 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1192 0, /* not implemented (non-ephemeral DH) */
1193 TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA
,
1194 TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA
,
1200 SSL_NOT_EXP
|SSL_HIGH
,
1201 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1208 0, /* not implemented (non-ephemeral DH) */
1209 TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA
,
1210 TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA
,
1216 SSL_NOT_EXP
|SSL_HIGH
,
1217 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1225 TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA
,
1226 TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA
,
1232 SSL_NOT_EXP
|SSL_HIGH
,
1233 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1241 TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
,
1242 TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
,
1248 SSL_NOT_EXP
|SSL_HIGH
,
1249 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1257 TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA
,
1258 TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA
,
1264 SSL_NOT_EXP
|SSL_HIGH
,
1265 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1269 #endif /* OPENSSL_NO_CAMELLIA */
1271 #if TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES
1272 /* New TLS Export CipherSuites from expired ID */
1277 TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5
,
1278 TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5
,
1284 SSL_EXPORT
|SSL_EXP56
,
1285 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1293 TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5
,
1294 TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5
,
1300 SSL_EXPORT
|SSL_EXP56
,
1301 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1310 TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA
,
1311 TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA
,
1317 SSL_EXPORT
|SSL_EXP56
,
1318 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1326 TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA
,
1327 TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA
,
1333 SSL_EXPORT
|SSL_EXP56
,
1334 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1342 TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA
,
1343 TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA
,
1349 SSL_EXPORT
|SSL_EXP56
,
1350 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1358 TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA
,
1359 TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA
,
1365 SSL_EXPORT
|SSL_EXP56
,
1366 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1374 TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA
,
1375 TLS1_CK_DHE_DSS_WITH_RC4_128_SHA
,
1381 SSL_NOT_EXP
|SSL_MEDIUM
,
1382 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1388 /* TLS v1.2 ciphersuites */
1392 TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256
,
1393 TLS1_CK_DHE_RSA_WITH_AES_128_SHA256
,
1399 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1400 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1407 0, /* not implemented (non-ephemeral DH) */
1408 TLS1_TXT_DH_DSS_WITH_AES_256_SHA256
,
1409 TLS1_CK_DH_DSS_WITH_AES_256_SHA256
,
1415 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1416 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1423 0, /* not implemented (non-ephemeral DH) */
1424 TLS1_TXT_DH_RSA_WITH_AES_256_SHA256
,
1425 TLS1_CK_DH_RSA_WITH_AES_256_SHA256
,
1431 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1432 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1440 TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256
,
1441 TLS1_CK_DHE_DSS_WITH_AES_256_SHA256
,
1447 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1448 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1456 TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256
,
1457 TLS1_CK_DHE_RSA_WITH_AES_256_SHA256
,
1463 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1464 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1472 TLS1_TXT_ADH_WITH_AES_128_SHA256
,
1473 TLS1_CK_ADH_WITH_AES_128_SHA256
,
1479 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1480 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1488 TLS1_TXT_ADH_WITH_AES_256_SHA256
,
1489 TLS1_CK_ADH_WITH_AES_256_SHA256
,
1495 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1496 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1501 /* GOST Ciphersuites */
1505 "GOST94-GOST89-GOST89",
1509 SSL_eGOST2814789CNT
,
1512 SSL_NOT_EXP
|SSL_HIGH
,
1513 SSL_HANDSHAKE_MAC_GOST94
|TLS1_PRF_GOST94
|TLS1_STREAM_MAC
,
1519 "GOST2001-GOST89-GOST89",
1523 SSL_eGOST2814789CNT
,
1526 SSL_NOT_EXP
|SSL_HIGH
,
1527 SSL_HANDSHAKE_MAC_GOST94
|TLS1_PRF_GOST94
|TLS1_STREAM_MAC
,
1533 "GOST94-NULL-GOST94",
1540 SSL_NOT_EXP
|SSL_STRONG_NONE
,
1541 SSL_HANDSHAKE_MAC_GOST94
|TLS1_PRF_GOST94
,
1547 "GOST2001-NULL-GOST94",
1554 SSL_NOT_EXP
|SSL_STRONG_NONE
,
1555 SSL_HANDSHAKE_MAC_GOST94
|TLS1_PRF_GOST94
,
1560 #ifndef OPENSSL_NO_CAMELLIA
1561 /* Camellia ciphersuites from RFC4132 (256-bit portion) */
1566 TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA
,
1567 TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA
,
1573 SSL_NOT_EXP
|SSL_HIGH
,
1574 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1580 0, /* not implemented (non-ephemeral DH) */
1581 TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA
,
1582 TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA
,
1588 SSL_NOT_EXP
|SSL_HIGH
,
1589 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1596 0, /* not implemented (non-ephemeral DH) */
1597 TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA
,
1598 TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA
,
1604 SSL_NOT_EXP
|SSL_HIGH
,
1605 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1613 TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA
,
1614 TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA
,
1620 SSL_NOT_EXP
|SSL_HIGH
,
1621 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1629 TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
,
1630 TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
,
1636 SSL_NOT_EXP
|SSL_HIGH
,
1637 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1645 TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA
,
1646 TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA
,
1652 SSL_NOT_EXP
|SSL_HIGH
,
1653 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1657 #endif /* OPENSSL_NO_CAMELLIA */
1659 #ifndef OPENSSL_NO_PSK
1663 TLS1_TXT_PSK_WITH_RC4_128_SHA
,
1664 TLS1_CK_PSK_WITH_RC4_128_SHA
,
1670 SSL_NOT_EXP
|SSL_MEDIUM
,
1671 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1679 TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA
,
1680 TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA
,
1686 SSL_NOT_EXP
|SSL_HIGH
,
1687 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1695 TLS1_TXT_PSK_WITH_AES_128_CBC_SHA
,
1696 TLS1_CK_PSK_WITH_AES_128_CBC_SHA
,
1702 SSL_NOT_EXP
|SSL_HIGH
,
1703 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1711 TLS1_TXT_PSK_WITH_AES_256_CBC_SHA
,
1712 TLS1_CK_PSK_WITH_AES_256_CBC_SHA
,
1718 SSL_NOT_EXP
|SSL_HIGH
,
1719 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1723 #endif /* OPENSSL_NO_PSK */
1725 #ifndef OPENSSL_NO_SEED
1726 /* SEED ciphersuites from RFC4162 */
1731 TLS1_TXT_RSA_WITH_SEED_SHA
,
1732 TLS1_CK_RSA_WITH_SEED_SHA
,
1738 SSL_NOT_EXP
|SSL_MEDIUM
,
1739 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1746 0, /* not implemented (non-ephemeral DH) */
1747 TLS1_TXT_DH_DSS_WITH_SEED_SHA
,
1748 TLS1_CK_DH_DSS_WITH_SEED_SHA
,
1754 SSL_NOT_EXP
|SSL_MEDIUM
,
1755 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1762 0, /* not implemented (non-ephemeral DH) */
1763 TLS1_TXT_DH_RSA_WITH_SEED_SHA
,
1764 TLS1_CK_DH_RSA_WITH_SEED_SHA
,
1770 SSL_NOT_EXP
|SSL_MEDIUM
,
1771 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1779 TLS1_TXT_DHE_DSS_WITH_SEED_SHA
,
1780 TLS1_CK_DHE_DSS_WITH_SEED_SHA
,
1786 SSL_NOT_EXP
|SSL_MEDIUM
,
1787 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1795 TLS1_TXT_DHE_RSA_WITH_SEED_SHA
,
1796 TLS1_CK_DHE_RSA_WITH_SEED_SHA
,
1802 SSL_NOT_EXP
|SSL_MEDIUM
,
1803 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1811 TLS1_TXT_ADH_WITH_SEED_SHA
,
1812 TLS1_CK_ADH_WITH_SEED_SHA
,
1818 SSL_NOT_EXP
|SSL_MEDIUM
,
1819 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
1824 #endif /* OPENSSL_NO_SEED */
1826 /* GCM ciphersuites from RFC5288 */
1831 TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256
,
1832 TLS1_CK_RSA_WITH_AES_128_GCM_SHA256
,
1838 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1839 SSL_HANDSHAKE_MAC_SHA256
|TLS1_PRF_SHA256
,
1847 TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384
,
1848 TLS1_CK_RSA_WITH_AES_256_GCM_SHA384
,
1854 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1855 SSL_HANDSHAKE_MAC_SHA384
|TLS1_PRF_SHA384
,
1863 TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256
,
1864 TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256
,
1870 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1871 SSL_HANDSHAKE_MAC_SHA256
|TLS1_PRF_SHA256
,
1879 TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384
,
1880 TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384
,
1886 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1887 SSL_HANDSHAKE_MAC_SHA384
|TLS1_PRF_SHA384
,
1895 TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256
,
1896 TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256
,
1902 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1903 SSL_HANDSHAKE_MAC_SHA256
|TLS1_PRF_SHA256
,
1911 TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384
,
1912 TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384
,
1918 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1919 SSL_HANDSHAKE_MAC_SHA384
|TLS1_PRF_SHA384
,
1927 TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256
,
1928 TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256
,
1934 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1935 SSL_HANDSHAKE_MAC_SHA256
|TLS1_PRF_SHA256
,
1943 TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384
,
1944 TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384
,
1950 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1951 SSL_HANDSHAKE_MAC_SHA384
|TLS1_PRF_SHA384
,
1959 TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256
,
1960 TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256
,
1966 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1967 SSL_HANDSHAKE_MAC_SHA256
|TLS1_PRF_SHA256
,
1975 TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384
,
1976 TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384
,
1982 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1983 SSL_HANDSHAKE_MAC_SHA384
|TLS1_PRF_SHA384
,
1991 TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256
,
1992 TLS1_CK_ADH_WITH_AES_128_GCM_SHA256
,
1998 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
1999 SSL_HANDSHAKE_MAC_SHA256
|TLS1_PRF_SHA256
,
2007 TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384
,
2008 TLS1_CK_ADH_WITH_AES_256_GCM_SHA384
,
2014 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2015 SSL_HANDSHAKE_MAC_SHA384
|TLS1_PRF_SHA384
,
2020 #ifndef OPENSSL_NO_ECDH
2024 TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA
,
2025 TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA
,
2031 SSL_NOT_EXP
|SSL_STRONG_NONE
|SSL_FIPS
,
2032 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2040 TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA
,
2041 TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA
,
2047 SSL_NOT_EXP
|SSL_MEDIUM
,
2048 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2056 TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA
,
2057 TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA
,
2063 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2064 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2072 TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA
,
2073 TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA
,
2079 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2080 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2088 TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA
,
2089 TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA
,
2095 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2096 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2104 TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA
,
2105 TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA
,
2111 SSL_NOT_EXP
|SSL_STRONG_NONE
|SSL_FIPS
,
2112 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2120 TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA
,
2121 TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA
,
2127 SSL_NOT_EXP
|SSL_MEDIUM
,
2128 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2136 TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA
,
2137 TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA
,
2143 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2144 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2152 TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
,
2153 TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
,
2159 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2160 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2168 TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
,
2169 TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
,
2175 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2176 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2184 TLS1_TXT_ECDH_RSA_WITH_NULL_SHA
,
2185 TLS1_CK_ECDH_RSA_WITH_NULL_SHA
,
2191 SSL_NOT_EXP
|SSL_STRONG_NONE
|SSL_FIPS
,
2192 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2200 TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA
,
2201 TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA
,
2207 SSL_NOT_EXP
|SSL_MEDIUM
,
2208 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2216 TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA
,
2217 TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA
,
2223 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2224 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2232 TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA
,
2233 TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA
,
2239 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2240 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2248 TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA
,
2249 TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA
,
2255 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2256 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2264 TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA
,
2265 TLS1_CK_ECDHE_RSA_WITH_NULL_SHA
,
2271 SSL_NOT_EXP
|SSL_STRONG_NONE
|SSL_FIPS
,
2272 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2280 TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA
,
2281 TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA
,
2287 SSL_NOT_EXP
|SSL_MEDIUM
,
2288 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2296 TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA
,
2297 TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA
,
2303 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2304 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2312 TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA
,
2313 TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA
,
2319 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2320 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2328 TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA
,
2329 TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA
,
2335 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2336 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2344 TLS1_TXT_ECDH_anon_WITH_NULL_SHA
,
2345 TLS1_CK_ECDH_anon_WITH_NULL_SHA
,
2351 SSL_NOT_EXP
|SSL_STRONG_NONE
|SSL_FIPS
,
2352 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2360 TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA
,
2361 TLS1_CK_ECDH_anon_WITH_RC4_128_SHA
,
2367 SSL_NOT_EXP
|SSL_MEDIUM
,
2368 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2376 TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA
,
2377 TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA
,
2383 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2384 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2392 TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA
,
2393 TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA
,
2399 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2400 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2408 TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA
,
2409 TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA
,
2415 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2416 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2420 #endif /* OPENSSL_NO_ECDH */
2422 #ifndef OPENSSL_NO_SRP
2426 TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA
,
2427 TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA
,
2433 SSL_NOT_EXP
|SSL_HIGH
,
2434 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2442 TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA
,
2443 TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA
,
2449 SSL_NOT_EXP
|SSL_HIGH
,
2450 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2458 TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA
,
2459 TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA
,
2465 SSL_NOT_EXP
|SSL_HIGH
,
2466 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2474 TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA
,
2475 TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA
,
2481 SSL_NOT_EXP
|SSL_HIGH
,
2482 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2490 TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA
,
2491 TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA
,
2497 SSL_NOT_EXP
|SSL_HIGH
,
2498 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2506 TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA
,
2507 TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA
,
2513 SSL_NOT_EXP
|SSL_HIGH
,
2514 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2522 TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA
,
2523 TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA
,
2529 SSL_NOT_EXP
|SSL_HIGH
,
2530 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2538 TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA
,
2539 TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA
,
2545 SSL_NOT_EXP
|SSL_HIGH
,
2546 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2554 TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA
,
2555 TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA
,
2561 SSL_NOT_EXP
|SSL_HIGH
,
2562 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2566 #endif /* OPENSSL_NO_SRP */
2567 #ifndef OPENSSL_NO_ECDH
2569 /* HMAC based TLS v1.2 ciphersuites from RFC5289 */
2574 TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256
,
2575 TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256
,
2581 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2582 SSL_HANDSHAKE_MAC_SHA256
|TLS1_PRF_SHA256
,
2590 TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384
,
2591 TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384
,
2597 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2598 SSL_HANDSHAKE_MAC_SHA384
|TLS1_PRF_SHA384
,
2606 TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256
,
2607 TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256
,
2613 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2614 SSL_HANDSHAKE_MAC_SHA256
|TLS1_PRF_SHA256
,
2622 TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384
,
2623 TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384
,
2629 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2630 SSL_HANDSHAKE_MAC_SHA384
|TLS1_PRF_SHA384
,
2638 TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256
,
2639 TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256
,
2645 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2646 SSL_HANDSHAKE_MAC_SHA256
|TLS1_PRF_SHA256
,
2654 TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384
,
2655 TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384
,
2661 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2662 SSL_HANDSHAKE_MAC_SHA384
|TLS1_PRF_SHA384
,
2670 TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256
,
2671 TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256
,
2677 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2678 SSL_HANDSHAKE_MAC_SHA256
|TLS1_PRF_SHA256
,
2686 TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384
,
2687 TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384
,
2693 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2694 SSL_HANDSHAKE_MAC_SHA384
|TLS1_PRF_SHA384
,
2699 /* GCM based TLS v1.2 ciphersuites from RFC5289 */
2704 TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
,
2705 TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
,
2711 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2712 SSL_HANDSHAKE_MAC_SHA256
|TLS1_PRF_SHA256
,
2720 TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
,
2721 TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
,
2727 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2728 SSL_HANDSHAKE_MAC_SHA384
|TLS1_PRF_SHA384
,
2736 TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
,
2737 TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
,
2743 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2744 SSL_HANDSHAKE_MAC_SHA256
|TLS1_PRF_SHA256
,
2752 TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
,
2753 TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
,
2759 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2760 SSL_HANDSHAKE_MAC_SHA384
|TLS1_PRF_SHA384
,
2768 TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256
,
2769 TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256
,
2775 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2776 SSL_HANDSHAKE_MAC_SHA256
|TLS1_PRF_SHA256
,
2784 TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384
,
2785 TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384
,
2791 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2792 SSL_HANDSHAKE_MAC_SHA384
|TLS1_PRF_SHA384
,
2800 TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256
,
2801 TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256
,
2807 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2808 SSL_HANDSHAKE_MAC_SHA256
|TLS1_PRF_SHA256
,
2816 TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384
,
2817 TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384
,
2823 SSL_NOT_EXP
|SSL_HIGH
|SSL_FIPS
,
2824 SSL_HANDSHAKE_MAC_SHA384
|TLS1_PRF_SHA384
,
2829 #endif /* OPENSSL_NO_ECDH */
2832 #ifdef TEMP_GOST_TLS
2840 SSL_eGOST2814789CNT
,
2843 SSL_NOT_EXP
|SSL_HIGH
,
2844 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2854 SSL_eGOST2814789CNT
,
2857 SSL_NOT_EXP
|SSL_HIGH
,
2858 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2868 SSL_eGOST2814789CNT
,
2871 SSL_NOT_EXP
|SSL_HIGH
,
2872 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
,
2878 "GOST-GOST89STREAM",
2882 SSL_eGOST2814789CNT
,
2885 SSL_NOT_EXP
|SSL_HIGH
,
2886 SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
|TLS1_STREAM_MAC
,
2895 SSL3_ENC_METHOD SSLv3_enc_data
={
2898 ssl3_setup_key_block
,
2899 ssl3_generate_master_secret
,
2900 ssl3_change_cipher_state
,
2901 ssl3_final_finish_mac
,
2902 MD5_DIGEST_LENGTH
+SHA_DIGEST_LENGTH
,
2903 ssl3_cert_verify_mac
,
2904 SSL3_MD_CLIENT_FINISHED_CONST
,4,
2905 SSL3_MD_SERVER_FINISHED_CONST
,4,
2907 (int (*)(SSL
*, unsigned char *, size_t, const char *,
2908 size_t, const unsigned char *, size_t,
2909 int use_context
))ssl_undefined_function
,
2912 long ssl3_default_timeout(void)
2914 /* 2 hours, the 24 hours mentioned in the SSLv3 spec
2915 * is way too long for http, the cache would over fill */
2919 int ssl3_num_ciphers(void)
2921 return(SSL3_NUM_CIPHERS
);
2924 const SSL_CIPHER
*ssl3_get_cipher(unsigned int u
)
2926 if (u
< SSL3_NUM_CIPHERS
)
2927 return(&(ssl3_ciphers
[SSL3_NUM_CIPHERS
-1-u
]));
2932 int ssl3_pending(const SSL
*s
)
2934 if (s
->rstate
== SSL_ST_READ_BODY
)
2937 return (s
->s3
->rrec
.type
== SSL3_RT_APPLICATION_DATA
) ? s
->s3
->rrec
.length
: 0;
2940 int ssl3_new(SSL
*s
)
2944 if ((s3
=OPENSSL_malloc(sizeof *s3
)) == NULL
) goto err
;
2945 memset(s3
,0,sizeof *s3
);
2946 memset(s3
->rrec
.seq_num
,0,sizeof(s3
->rrec
.seq_num
));
2947 memset(s3
->wrec
.seq_num
,0,sizeof(s3
->wrec
.seq_num
));
2951 #ifndef OPENSSL_NO_SRP
2952 SSL_SRP_CTX_init(s
);
2954 s
->method
->ssl_clear(s
);
2960 void ssl3_free(SSL
*s
)
2965 #ifdef TLSEXT_TYPE_opaque_prf_input
2966 if (s
->s3
->client_opaque_prf_input
!= NULL
)
2967 OPENSSL_free(s
->s3
->client_opaque_prf_input
);
2968 if (s
->s3
->server_opaque_prf_input
!= NULL
)
2969 OPENSSL_free(s
->s3
->server_opaque_prf_input
);
2972 ssl3_cleanup_key_block(s
);
2973 if (s
->s3
->rbuf
.buf
!= NULL
)
2974 ssl3_release_read_buffer(s
);
2975 if (s
->s3
->wbuf
.buf
!= NULL
)
2976 ssl3_release_write_buffer(s
);
2977 if (s
->s3
->rrec
.comp
!= NULL
)
2978 OPENSSL_free(s
->s3
->rrec
.comp
);
2979 #ifndef OPENSSL_NO_DH
2980 if (s
->s3
->tmp
.dh
!= NULL
)
2981 DH_free(s
->s3
->tmp
.dh
);
2983 #ifndef OPENSSL_NO_ECDH
2984 if (s
->s3
->tmp
.ecdh
!= NULL
)
2985 EC_KEY_free(s
->s3
->tmp
.ecdh
);
2988 if (s
->s3
->tmp
.ca_names
!= NULL
)
2989 sk_X509_NAME_pop_free(s
->s3
->tmp
.ca_names
,X509_NAME_free
);
2990 if (s
->s3
->handshake_buffer
) {
2991 BIO_free(s
->s3
->handshake_buffer
);
2993 if (s
->s3
->handshake_dgst
) ssl3_free_digest_list(s
);
2994 #ifndef OPENSSL_NO_SRP
2995 SSL_SRP_CTX_free(s
);
2997 OPENSSL_cleanse(s
->s3
,sizeof *s
->s3
);
2998 OPENSSL_free(s
->s3
);
3002 void ssl3_clear(SSL
*s
)
3004 unsigned char *rp
,*wp
;
3008 #ifdef TLSEXT_TYPE_opaque_prf_input
3009 if (s
->s3
->client_opaque_prf_input
!= NULL
)
3010 OPENSSL_free(s
->s3
->client_opaque_prf_input
);
3011 s
->s3
->client_opaque_prf_input
= NULL
;
3012 if (s
->s3
->server_opaque_prf_input
!= NULL
)
3013 OPENSSL_free(s
->s3
->server_opaque_prf_input
);
3014 s
->s3
->server_opaque_prf_input
= NULL
;
3017 ssl3_cleanup_key_block(s
);
3018 if (s
->s3
->tmp
.ca_names
!= NULL
)
3019 sk_X509_NAME_pop_free(s
->s3
->tmp
.ca_names
,X509_NAME_free
);
3021 if (s
->s3
->rrec
.comp
!= NULL
)
3023 OPENSSL_free(s
->s3
->rrec
.comp
);
3024 s
->s3
->rrec
.comp
=NULL
;
3026 #ifndef OPENSSL_NO_DH
3027 if (s
->s3
->tmp
.dh
!= NULL
)
3029 DH_free(s
->s3
->tmp
.dh
);
3030 s
->s3
->tmp
.dh
= NULL
;
3033 #ifndef OPENSSL_NO_ECDH
3034 if (s
->s3
->tmp
.ecdh
!= NULL
)
3036 EC_KEY_free(s
->s3
->tmp
.ecdh
);
3037 s
->s3
->tmp
.ecdh
= NULL
;
3041 rp
= s
->s3
->rbuf
.buf
;
3042 wp
= s
->s3
->wbuf
.buf
;
3043 rlen
= s
->s3
->rbuf
.len
;
3044 wlen
= s
->s3
->wbuf
.len
;
3045 init_extra
= s
->s3
->init_extra
;
3046 if (s
->s3
->handshake_buffer
) {
3047 BIO_free(s
->s3
->handshake_buffer
);
3048 s
->s3
->handshake_buffer
= NULL
;
3050 if (s
->s3
->handshake_dgst
) {
3051 ssl3_free_digest_list(s
);
3053 memset(s
->s3
,0,sizeof *s
->s3
);
3054 s
->s3
->rbuf
.buf
= rp
;
3055 s
->s3
->wbuf
.buf
= wp
;
3056 s
->s3
->rbuf
.len
= rlen
;
3057 s
->s3
->wbuf
.len
= wlen
;
3058 s
->s3
->init_extra
= init_extra
;
3060 ssl_free_wbio_buffer(s
);
3063 s
->s3
->renegotiate
=0;
3064 s
->s3
->total_renegotiations
=0;
3065 s
->s3
->num_renegotiations
=0;
3066 s
->s3
->in_read_app_data
=0;
3067 s
->version
=SSL3_VERSION
;
3069 #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
3070 if (s
->next_proto_negotiated
)
3072 OPENSSL_free(s
->next_proto_negotiated
);
3073 s
->next_proto_negotiated
= NULL
;
3074 s
->next_proto_negotiated_len
= 0;
3079 #ifndef OPENSSL_NO_SRP
3080 static char * MS_CALLBACK
srp_password_from_info_cb(SSL
*s
, void *arg
)
3082 return BUF_strdup(s
->srp_ctx
.info
) ;
3086 long ssl3_ctrl(SSL
*s
, int cmd
, long larg
, void *parg
)
3090 #if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_RSA)
3092 #ifndef OPENSSL_NO_RSA
3093 cmd
== SSL_CTRL_SET_TMP_RSA
||
3094 cmd
== SSL_CTRL_SET_TMP_RSA_CB
||
3096 #ifndef OPENSSL_NO_DSA
3097 cmd
== SSL_CTRL_SET_TMP_DH
||
3098 cmd
== SSL_CTRL_SET_TMP_DH_CB
||
3102 if (!ssl_cert_inst(&s
->cert
))
3104 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_MALLOC_FAILURE
);
3112 case SSL_CTRL_GET_SESSION_REUSED
:
3115 case SSL_CTRL_GET_CLIENT_CERT_REQUEST
:
3117 case SSL_CTRL_GET_NUM_RENEGOTIATIONS
:
3118 ret
=s
->s3
->num_renegotiations
;
3120 case SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS
:
3121 ret
=s
->s3
->num_renegotiations
;
3122 s
->s3
->num_renegotiations
=0;
3124 case SSL_CTRL_GET_TOTAL_RENEGOTIATIONS
:
3125 ret
=s
->s3
->total_renegotiations
;
3127 case SSL_CTRL_GET_FLAGS
:
3128 ret
=(int)(s
->s3
->flags
);
3130 #ifndef OPENSSL_NO_RSA
3131 case SSL_CTRL_NEED_TMP_RSA
:
3132 if ((s
->cert
!= NULL
) && (s
->cert
->rsa_tmp
== NULL
) &&
3133 ((s
->cert
->pkeys
[SSL_PKEY_RSA_ENC
].privatekey
== NULL
) ||
3134 (EVP_PKEY_size(s
->cert
->pkeys
[SSL_PKEY_RSA_ENC
].privatekey
) > (512/8))))
3137 case SSL_CTRL_SET_TMP_RSA
:
3139 RSA
*rsa
= (RSA
*)parg
;
3142 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_PASSED_NULL_PARAMETER
);
3145 if ((rsa
= RSAPrivateKey_dup(rsa
)) == NULL
)
3147 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_RSA_LIB
);
3150 if (s
->cert
->rsa_tmp
!= NULL
)
3151 RSA_free(s
->cert
->rsa_tmp
);
3152 s
->cert
->rsa_tmp
= rsa
;
3156 case SSL_CTRL_SET_TMP_RSA_CB
:
3158 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
);
3163 #ifndef OPENSSL_NO_DH
3164 case SSL_CTRL_SET_TMP_DH
:
3166 DH
*dh
= (DH
*)parg
;
3169 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_PASSED_NULL_PARAMETER
);
3172 if ((dh
= DHparams_dup(dh
)) == NULL
)
3174 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_DH_LIB
);
3177 if (!(s
->options
& SSL_OP_SINGLE_DH_USE
))
3179 if (!DH_generate_key(dh
))
3182 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_DH_LIB
);
3186 if (s
->cert
->dh_tmp
!= NULL
)
3187 DH_free(s
->cert
->dh_tmp
);
3188 s
->cert
->dh_tmp
= dh
;
3192 case SSL_CTRL_SET_TMP_DH_CB
:
3194 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
);
3199 #ifndef OPENSSL_NO_ECDH
3200 case SSL_CTRL_SET_TMP_ECDH
:
3202 EC_KEY
*ecdh
= NULL
;
3206 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_PASSED_NULL_PARAMETER
);
3209 if (!EC_KEY_up_ref((EC_KEY
*)parg
))
3211 SSLerr(SSL_F_SSL3_CTRL
,ERR_R_ECDH_LIB
);
3214 ecdh
= (EC_KEY
*)parg
;
3215 if (!(s
->options
& SSL_OP_SINGLE_ECDH_USE
))
3217 if (!EC_KEY_generate_key(ecdh
))
3220 SSLerr(SSL_F_SSL3_CTRL
,ERR_R_ECDH_LIB
);
3224 if (s
->cert
->ecdh_tmp
!= NULL
)
3225 EC_KEY_free(s
->cert
->ecdh_tmp
);
3226 s
->cert
->ecdh_tmp
= ecdh
;
3230 case SSL_CTRL_SET_TMP_ECDH_CB
:
3232 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
);
3236 #endif /* !OPENSSL_NO_ECDH */
3237 #ifndef OPENSSL_NO_TLSEXT
3238 case SSL_CTRL_SET_TLSEXT_HOSTNAME
:
3239 if (larg
== TLSEXT_NAMETYPE_host_name
)
3241 if (s
->tlsext_hostname
!= NULL
)
3242 OPENSSL_free(s
->tlsext_hostname
);
3243 s
->tlsext_hostname
= NULL
;
3248 if (strlen((char *)parg
) > TLSEXT_MAXLEN_host_name
)
3250 SSLerr(SSL_F_SSL3_CTRL
, SSL_R_SSL3_EXT_INVALID_SERVERNAME
);
3253 if ((s
->tlsext_hostname
= BUF_strdup((char *)parg
)) == NULL
)
3255 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_INTERNAL_ERROR
);
3261 SSLerr(SSL_F_SSL3_CTRL
, SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE
);
3265 case SSL_CTRL_SET_TLSEXT_DEBUG_ARG
:
3266 s
->tlsext_debug_arg
=parg
;
3270 #ifdef TLSEXT_TYPE_opaque_prf_input
3271 case SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT
:
3272 if (larg
> 12288) /* actual internal limit is 2^16 for the complete hello message
3273 * (including the cert chain and everything) */
3275 SSLerr(SSL_F_SSL3_CTRL
, SSL_R_OPAQUE_PRF_INPUT_TOO_LONG
);
3278 if (s
->tlsext_opaque_prf_input
!= NULL
)
3279 OPENSSL_free(s
->tlsext_opaque_prf_input
);
3280 if ((size_t)larg
== 0)
3281 s
->tlsext_opaque_prf_input
= OPENSSL_malloc(1); /* dummy byte just to get non-NULL */
3283 s
->tlsext_opaque_prf_input
= BUF_memdup(parg
, (size_t)larg
);
3284 if (s
->tlsext_opaque_prf_input
!= NULL
)
3286 s
->tlsext_opaque_prf_input_len
= (size_t)larg
;
3290 s
->tlsext_opaque_prf_input_len
= 0;
3294 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE
:
3295 s
->tlsext_status_type
=larg
;
3299 case SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS
:
3300 *(STACK_OF(X509_EXTENSION
) **)parg
= s
->tlsext_ocsp_exts
;
3304 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS
:
3305 s
->tlsext_ocsp_exts
= parg
;
3309 case SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS
:
3310 *(STACK_OF(OCSP_RESPID
) **)parg
= s
->tlsext_ocsp_ids
;
3314 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS
:
3315 s
->tlsext_ocsp_ids
= parg
;
3319 case SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP
:
3320 *(unsigned char **)parg
= s
->tlsext_ocsp_resp
;
3321 return s
->tlsext_ocsp_resplen
;
3323 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP
:
3324 if (s
->tlsext_ocsp_resp
)
3325 OPENSSL_free(s
->tlsext_ocsp_resp
);
3326 s
->tlsext_ocsp_resp
= parg
;
3327 s
->tlsext_ocsp_resplen
= larg
;
3331 #ifndef OPENSSL_NO_HEARTBEATS
3332 case SSL_CTRL_TLS_EXT_SEND_HEARTBEAT
:
3333 if (SSL_version(s
) == DTLS1_VERSION
|| SSL_version(s
) == DTLS1_BAD_VER
)
3334 ret
= dtls1_heartbeat(s
);
3336 ret
= tls1_heartbeat(s
);
3339 case SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING
:
3340 ret
= s
->tlsext_hb_pending
;
3343 case SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS
:
3345 s
->tlsext_heartbeat
|= SSL_TLSEXT_HB_DONT_RECV_REQUESTS
;
3347 s
->tlsext_heartbeat
&= ~SSL_TLSEXT_HB_DONT_RECV_REQUESTS
;
3352 #endif /* !OPENSSL_NO_TLSEXT */
3359 long ssl3_callback_ctrl(SSL
*s
, int cmd
, void (*fp
)(void))
3363 #if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_RSA)
3365 #ifndef OPENSSL_NO_RSA
3366 cmd
== SSL_CTRL_SET_TMP_RSA_CB
||
3368 #ifndef OPENSSL_NO_DSA
3369 cmd
== SSL_CTRL_SET_TMP_DH_CB
||
3373 if (!ssl_cert_inst(&s
->cert
))
3375 SSLerr(SSL_F_SSL3_CALLBACK_CTRL
, ERR_R_MALLOC_FAILURE
);
3383 #ifndef OPENSSL_NO_RSA
3384 case SSL_CTRL_SET_TMP_RSA_CB
:
3386 s
->cert
->rsa_tmp_cb
= (RSA
*(*)(SSL
*, int, int))fp
;
3390 #ifndef OPENSSL_NO_DH
3391 case SSL_CTRL_SET_TMP_DH_CB
:
3393 s
->cert
->dh_tmp_cb
= (DH
*(*)(SSL
*, int, int))fp
;
3397 #ifndef OPENSSL_NO_ECDH
3398 case SSL_CTRL_SET_TMP_ECDH_CB
:
3400 s
->cert
->ecdh_tmp_cb
= (EC_KEY
*(*)(SSL
*, int, int))fp
;
3404 #ifndef OPENSSL_NO_TLSEXT
3405 case SSL_CTRL_SET_TLSEXT_DEBUG_CB
:
3406 s
->tlsext_debug_cb
=(void (*)(SSL
*,int ,int,
3407 unsigned char *, int, void *))fp
;
3416 long ssl3_ctx_ctrl(SSL_CTX
*ctx
, int cmd
, long larg
, void *parg
)
3424 #ifndef OPENSSL_NO_RSA
3425 case SSL_CTRL_NEED_TMP_RSA
:
3426 if ( (cert
->rsa_tmp
== NULL
) &&
3427 ((cert
->pkeys
[SSL_PKEY_RSA_ENC
].privatekey
== NULL
) ||
3428 (EVP_PKEY_size(cert
->pkeys
[SSL_PKEY_RSA_ENC
].privatekey
) > (512/8)))
3434 case SSL_CTRL_SET_TMP_RSA
:
3445 if ((rsa
=RSAPrivateKey_dup(rsa
)) == NULL
)
3450 SSLerr(SSL_F_SSL3_CTX_CTRL
,ERR_R_RSA_LIB
);
3455 if (cert
->rsa_tmp
!= NULL
)
3456 RSA_free(cert
->rsa_tmp
);
3462 case SSL_CTRL_SET_TMP_RSA_CB
:
3464 SSLerr(SSL_F_SSL3_CTX_CTRL
, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
);
3469 #ifndef OPENSSL_NO_DH
3470 case SSL_CTRL_SET_TMP_DH
:
3475 if ((new=DHparams_dup(dh
)) == NULL
)
3477 SSLerr(SSL_F_SSL3_CTX_CTRL
,ERR_R_DH_LIB
);
3480 if (!(ctx
->options
& SSL_OP_SINGLE_DH_USE
))
3482 if (!DH_generate_key(new))
3484 SSLerr(SSL_F_SSL3_CTX_CTRL
,ERR_R_DH_LIB
);
3489 if (cert
->dh_tmp
!= NULL
)
3490 DH_free(cert
->dh_tmp
);
3495 case SSL_CTRL_SET_TMP_DH_CB
:
3497 SSLerr(SSL_F_SSL3_CTX_CTRL
, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
);
3502 #ifndef OPENSSL_NO_ECDH
3503 case SSL_CTRL_SET_TMP_ECDH
:
3505 EC_KEY
*ecdh
= NULL
;
3509 SSLerr(SSL_F_SSL3_CTX_CTRL
,ERR_R_ECDH_LIB
);
3512 ecdh
= EC_KEY_dup((EC_KEY
*)parg
);
3515 SSLerr(SSL_F_SSL3_CTX_CTRL
,ERR_R_EC_LIB
);
3518 if (!(ctx
->options
& SSL_OP_SINGLE_ECDH_USE
))
3520 if (!EC_KEY_generate_key(ecdh
))
3523 SSLerr(SSL_F_SSL3_CTX_CTRL
,ERR_R_ECDH_LIB
);
3528 if (cert
->ecdh_tmp
!= NULL
)
3530 EC_KEY_free(cert
->ecdh_tmp
);
3532 cert
->ecdh_tmp
= ecdh
;
3536 case SSL_CTRL_SET_TMP_ECDH_CB
:
3538 SSLerr(SSL_F_SSL3_CTX_CTRL
, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
);
3542 #endif /* !OPENSSL_NO_ECDH */
3543 #ifndef OPENSSL_NO_TLSEXT
3544 case SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG
:
3545 ctx
->tlsext_servername_arg
=parg
;
3547 case SSL_CTRL_SET_TLSEXT_TICKET_KEYS
:
3548 case SSL_CTRL_GET_TLSEXT_TICKET_KEYS
:
3550 unsigned char *keys
= parg
;
3555 SSLerr(SSL_F_SSL3_CTX_CTRL
, SSL_R_INVALID_TICKET_KEYS_LENGTH
);
3558 if (cmd
== SSL_CTRL_SET_TLSEXT_TICKET_KEYS
)
3560 memcpy(ctx
->tlsext_tick_key_name
, keys
, 16);
3561 memcpy(ctx
->tlsext_tick_hmac_key
, keys
+ 16, 16);
3562 memcpy(ctx
->tlsext_tick_aes_key
, keys
+ 32, 16);
3566 memcpy(keys
, ctx
->tlsext_tick_key_name
, 16);
3567 memcpy(keys
+ 16, ctx
->tlsext_tick_hmac_key
, 16);
3568 memcpy(keys
+ 32, ctx
->tlsext_tick_aes_key
, 16);
3573 #ifdef TLSEXT_TYPE_opaque_prf_input
3574 case SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG
:
3575 ctx
->tlsext_opaque_prf_input_callback_arg
= parg
;
3579 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG
:
3580 ctx
->tlsext_status_arg
=parg
;
3584 #ifndef OPENSSL_NO_SRP
3585 case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME
:
3586 ctx
->srp_ctx
.srp_Mask
|=SSL_kSRP
;
3587 if (ctx
->srp_ctx
.login
!= NULL
)
3588 OPENSSL_free(ctx
->srp_ctx
.login
);
3589 ctx
->srp_ctx
.login
= NULL
;
3592 if (strlen((const char *)parg
) > 255 || strlen((const char *)parg
) < 1)
3594 SSLerr(SSL_F_SSL3_CTX_CTRL
, SSL_R_INVALID_SRP_USERNAME
);
3597 if ((ctx
->srp_ctx
.login
= BUF_strdup((char *)parg
)) == NULL
)
3599 SSLerr(SSL_F_SSL3_CTX_CTRL
, ERR_R_INTERNAL_ERROR
);
3603 case SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD
:
3604 ctx
->srp_ctx
.SRP_give_srp_client_pwd_callback
=srp_password_from_info_cb
;
3605 ctx
->srp_ctx
.info
=parg
;
3607 case SSL_CTRL_SET_SRP_ARG
:
3608 ctx
->srp_ctx
.srp_Mask
|=SSL_kSRP
;
3609 ctx
->srp_ctx
.SRP_cb_arg
=parg
;
3612 case SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH
:
3613 ctx
->srp_ctx
.strength
=larg
;
3616 #endif /* !OPENSSL_NO_TLSEXT */
3618 /* A Thawte special :-) */
3619 case SSL_CTRL_EXTRA_CHAIN_CERT
:
3620 if (ctx
->extra_certs
== NULL
)
3622 if ((ctx
->extra_certs
=sk_X509_new_null()) == NULL
)
3625 sk_X509_push(ctx
->extra_certs
,(X509
*)parg
);
3628 case SSL_CTRL_GET_EXTRA_CHAIN_CERTS
:
3629 *(STACK_OF(X509
) **)parg
= ctx
->extra_certs
;
3632 case SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS
:
3633 if (ctx
->extra_certs
)
3635 sk_X509_pop_free(ctx
->extra_certs
, X509_free
);
3636 ctx
->extra_certs
= NULL
;
3646 long ssl3_ctx_callback_ctrl(SSL_CTX
*ctx
, int cmd
, void (*fp
)(void))
3654 #ifndef OPENSSL_NO_RSA
3655 case SSL_CTRL_SET_TMP_RSA_CB
:
3657 cert
->rsa_tmp_cb
= (RSA
*(*)(SSL
*, int, int))fp
;
3661 #ifndef OPENSSL_NO_DH
3662 case SSL_CTRL_SET_TMP_DH_CB
:
3664 cert
->dh_tmp_cb
= (DH
*(*)(SSL
*, int, int))fp
;
3668 #ifndef OPENSSL_NO_ECDH
3669 case SSL_CTRL_SET_TMP_ECDH_CB
:
3671 cert
->ecdh_tmp_cb
= (EC_KEY
*(*)(SSL
*, int, int))fp
;
3675 #ifndef OPENSSL_NO_TLSEXT
3676 case SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
:
3677 ctx
->tlsext_servername_callback
=(int (*)(SSL
*,int *,void *))fp
;
3680 #ifdef TLSEXT_TYPE_opaque_prf_input
3681 case SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB
:
3682 ctx
->tlsext_opaque_prf_input_callback
= (int (*)(SSL
*,void *, size_t, void *))fp
;
3686 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB
:
3687 ctx
->tlsext_status_cb
=(int (*)(SSL
*,void *))fp
;
3690 case SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB
:
3691 ctx
->tlsext_ticket_key_cb
=(int (*)(SSL
*,unsigned char *,
3694 HMAC_CTX
*, int))fp
;
3697 #ifndef OPENSSL_NO_SRP
3698 case SSL_CTRL_SET_SRP_VERIFY_PARAM_CB
:
3699 ctx
->srp_ctx
.srp_Mask
|=SSL_kSRP
;
3700 ctx
->srp_ctx
.SRP_verify_param_callback
=(int (*)(SSL
*,void *))fp
;
3702 case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB
:
3703 ctx
->srp_ctx
.srp_Mask
|=SSL_kSRP
;
3704 ctx
->srp_ctx
.TLS_ext_srp_username_callback
=(int (*)(SSL
*,int *,void *))fp
;
3706 case SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB
:
3707 ctx
->srp_ctx
.srp_Mask
|=SSL_kSRP
;
3708 ctx
->srp_ctx
.SRP_give_srp_client_pwd_callback
=(char *(*)(SSL
*,void *))fp
;
3718 /* This function needs to check if the ciphers required are actually
3720 const SSL_CIPHER
*ssl3_get_cipher_by_char(const unsigned char *p
)
3723 const SSL_CIPHER
*cp
;
3726 id
=0x03000000L
|((unsigned long)p
[0]<<8L)|(unsigned long)p
[1];
3728 cp
= OBJ_bsearch_ssl_cipher_id(&c
, ssl3_ciphers
, SSL3_NUM_CIPHERS
);
3729 #ifdef DEBUG_PRINT_UNKNOWN_CIPHERSUITES
3730 if (cp
== NULL
) fprintf(stderr
, "Unknown cipher ID %x\n", (p
[0] << 8) | p
[1]);
3732 if (cp
== NULL
|| cp
->valid
== 0)
3738 int ssl3_put_cipher_by_char(const SSL_CIPHER
*c
, unsigned char *p
)
3745 if ((l
& 0xff000000) != 0x03000000) return(0);
3746 p
[0]=((unsigned char)(l
>> 8L))&0xFF;
3747 p
[1]=((unsigned char)(l
))&0xFF;
3752 SSL_CIPHER
*ssl3_choose_cipher(SSL
*s
, STACK_OF(SSL_CIPHER
) *clnt
,
3753 STACK_OF(SSL_CIPHER
) *srvr
)
3755 SSL_CIPHER
*c
,*ret
=NULL
;
3756 STACK_OF(SSL_CIPHER
) *prio
, *allow
;
3758 #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_EC)
3761 unsigned char ec_search1
= 0, ec_search2
= 0;
3764 unsigned long alg_k
,alg_a
,mask_k
,mask_a
,emask_k
,emask_a
;
3766 /* Let's see which ciphers we can support */
3770 /* Do not set the compare functions, because this may lead to a
3771 * reordering by "id". We want to keep the original ordering.
3772 * We may pay a price in performance during sk_SSL_CIPHER_find(),
3773 * but would have to pay with the price of sk_SSL_CIPHER_dup().
3775 sk_SSL_CIPHER_set_cmp_func(srvr
, ssl_cipher_ptr_id_cmp
);
3776 sk_SSL_CIPHER_set_cmp_func(clnt
, ssl_cipher_ptr_id_cmp
);
3780 printf("Server has %d from %p:\n", sk_SSL_CIPHER_num(srvr
), (void *)srvr
);
3781 for(i
=0 ; i
< sk_SSL_CIPHER_num(srvr
) ; ++i
)
3783 c
=sk_SSL_CIPHER_value(srvr
,i
);
3784 printf("%p:%s\n",(void *)c
,c
->name
);
3786 printf("Client sent %d from %p:\n", sk_SSL_CIPHER_num(clnt
), (void *)clnt
);
3787 for(i
=0 ; i
< sk_SSL_CIPHER_num(clnt
) ; ++i
)
3789 c
=sk_SSL_CIPHER_value(clnt
,i
);
3790 printf("%p:%s\n",(void *)c
,c
->name
);
3794 if (s
->options
& SSL_OP_CIPHER_SERVER_PREFERENCE
)
3805 for (i
=0; i
<sk_SSL_CIPHER_num(prio
); i
++)
3807 c
=sk_SSL_CIPHER_value(prio
,i
);
3809 /* Skip TLS v1.2 only ciphersuites if lower than v1.2 */
3810 if ((c
->algorithm_ssl
& SSL_TLSV1_2
) &&
3811 (TLS1_get_version(s
) < TLS1_2_VERSION
))
3814 ssl_set_cert_masks(cert
,c
);
3815 mask_k
= cert
->mask_k
;
3816 mask_a
= cert
->mask_a
;
3817 emask_k
= cert
->export_mask_k
;
3818 emask_a
= cert
->export_mask_a
;
3819 #ifndef OPENSSL_NO_SRP
3820 mask_k
=cert
->mask_k
| s
->srp_ctx
.srp_Mask
;
3821 emask_k
=cert
->export_mask_k
| s
->srp_ctx
.srp_Mask
;
3825 /* printf("ssl3_choose_cipher %d alg= %lx\n", i,c->algorithms);*/
3826 #endif /* KSSL_DEBUG */
3828 alg_k
=c
->algorithm_mkey
;
3829 alg_a
=c
->algorithm_auth
;
3831 #ifndef OPENSSL_NO_KRB5
3832 if (alg_k
& SSL_kKRB5
)
3834 if ( !kssl_keytab_is_available(s
->kssl_ctx
) )
3837 #endif /* OPENSSL_NO_KRB5 */
3838 #ifndef OPENSSL_NO_PSK
3839 /* with PSK there must be server callback set */
3840 if ((alg_k
& SSL_kPSK
) && s
->psk_server_callback
== NULL
)
3842 #endif /* OPENSSL_NO_PSK */
3844 if (SSL_C_IS_EXPORT(c
))
3846 ok
= (alg_k
& emask_k
) && (alg_a
& emask_a
);
3848 printf("%d:[%08lX:%08lX:%08lX:%08lX]%p:%s (export)\n",ok
,alg_k
,alg_a
,emask_k
,emask_a
,
3854 ok
= (alg_k
& mask_k
) && (alg_a
& mask_a
);
3856 printf("%d:[%08lX:%08lX:%08lX:%08lX]%p:%s\n",ok
,alg_k
,alg_a
,mask_k
,mask_a
,(void *)c
,
3861 #ifndef OPENSSL_NO_TLSEXT
3862 #ifndef OPENSSL_NO_EC
3864 /* if we are considering an ECC cipher suite that uses our certificate */
3865 (alg_a
& SSL_aECDSA
|| alg_a
& SSL_aECDH
)
3866 /* and we have an ECC certificate */
3867 && (s
->cert
->pkeys
[SSL_PKEY_ECC
].x509
!= NULL
)
3868 /* and the client specified a Supported Point Formats extension */
3869 && ((s
->session
->tlsext_ecpointformatlist_length
> 0) && (s
->session
->tlsext_ecpointformatlist
!= NULL
))
3870 /* and our certificate's point is compressed */
3872 (s
->cert
->pkeys
[SSL_PKEY_ECC
].x509
->cert_info
!= NULL
)
3873 && (s
->cert
->pkeys
[SSL_PKEY_ECC
].x509
->cert_info
->key
!= NULL
)
3874 && (s
->cert
->pkeys
[SSL_PKEY_ECC
].x509
->cert_info
->key
->public_key
!= NULL
)
3875 && (s
->cert
->pkeys
[SSL_PKEY_ECC
].x509
->cert_info
->key
->public_key
->data
!= NULL
)
3877 (*(s
->cert
->pkeys
[SSL_PKEY_ECC
].x509
->cert_info
->key
->public_key
->data
) == POINT_CONVERSION_COMPRESSED
)
3878 || (*(s
->cert
->pkeys
[SSL_PKEY_ECC
].x509
->cert_info
->key
->public_key
->data
) == POINT_CONVERSION_COMPRESSED
+ 1)
3884 /* if our certificate's curve is over a field type that the client does not support
3885 * then do not allow this cipher suite to be negotiated */
3887 (s
->cert
->pkeys
[SSL_PKEY_ECC
].privatekey
->pkey
.ec
!= NULL
)
3888 && (s
->cert
->pkeys
[SSL_PKEY_ECC
].privatekey
->pkey
.ec
->group
!= NULL
)
3889 && (s
->cert
->pkeys
[SSL_PKEY_ECC
].privatekey
->pkey
.ec
->group
->meth
!= NULL
)
3890 && (EC_METHOD_get_field_type(s
->cert
->pkeys
[SSL_PKEY_ECC
].privatekey
->pkey
.ec
->group
->meth
) == NID_X9_62_prime_field
)
3893 for (j
= 0; j
< s
->session
->tlsext_ecpointformatlist_length
; j
++)
3895 if (s
->session
->tlsext_ecpointformatlist
[j
] == TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime
)
3902 else if (EC_METHOD_get_field_type(s
->cert
->pkeys
[SSL_PKEY_ECC
].privatekey
->pkey
.ec
->group
->meth
) == NID_X9_62_characteristic_two_field
)
3904 for (j
= 0; j
< s
->session
->tlsext_ecpointformatlist_length
; j
++)
3906 if (s
->session
->tlsext_ecpointformatlist
[j
] == TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2
)
3916 /* if we are considering an ECC cipher suite that uses our certificate */
3917 (alg_a
& SSL_aECDSA
|| alg_a
& SSL_aECDH
)
3918 /* and we have an ECC certificate */
3919 && (s
->cert
->pkeys
[SSL_PKEY_ECC
].x509
!= NULL
)
3920 /* and the client specified an EllipticCurves extension */
3921 && ((s
->session
->tlsext_ellipticcurvelist_length
> 0) && (s
->session
->tlsext_ellipticcurvelist
!= NULL
))
3926 (s
->cert
->pkeys
[SSL_PKEY_ECC
].privatekey
->pkey
.ec
!= NULL
)
3927 && (s
->cert
->pkeys
[SSL_PKEY_ECC
].privatekey
->pkey
.ec
->group
!= NULL
)
3930 ec_nid
= EC_GROUP_get_curve_name(s
->cert
->pkeys
[SSL_PKEY_ECC
].privatekey
->pkey
.ec
->group
);
3932 && (s
->cert
->pkeys
[SSL_PKEY_ECC
].privatekey
->pkey
.ec
->group
->meth
!= NULL
)
3935 if (EC_METHOD_get_field_type(s
->cert
->pkeys
[SSL_PKEY_ECC
].privatekey
->pkey
.ec
->group
->meth
) == NID_X9_62_prime_field
)
3940 else if (EC_METHOD_get_field_type(s
->cert
->pkeys
[SSL_PKEY_ECC
].privatekey
->pkey
.ec
->group
->meth
) == NID_X9_62_characteristic_two_field
)
3949 ec_search2
= tls1_ec_nid2curve_id(ec_nid
);
3951 if ((ec_search1
!= 0) || (ec_search2
!= 0))
3953 for (j
= 0; j
< s
->session
->tlsext_ellipticcurvelist_length
/ 2; j
++)
3955 if ((s
->session
->tlsext_ellipticcurvelist
[2*j
] == ec_search1
) && (s
->session
->tlsext_ellipticcurvelist
[2*j
+1] == ec_search2
))
3966 /* if we are considering an ECC cipher suite that uses an ephemeral EC key */
3967 (alg_k
& SSL_kEECDH
)
3968 /* and we have an ephemeral EC key */
3969 && (s
->cert
->ecdh_tmp
!= NULL
)
3970 /* and the client specified an EllipticCurves extension */
3971 && ((s
->session
->tlsext_ellipticcurvelist_length
> 0) && (s
->session
->tlsext_ellipticcurvelist
!= NULL
))
3975 if (s
->cert
->ecdh_tmp
->group
!= NULL
)
3977 ec_nid
= EC_GROUP_get_curve_name(s
->cert
->ecdh_tmp
->group
);
3979 && (s
->cert
->ecdh_tmp
->group
->meth
!= NULL
)
3982 if (EC_METHOD_get_field_type(s
->cert
->ecdh_tmp
->group
->meth
) == NID_X9_62_prime_field
)
3987 else if (EC_METHOD_get_field_type(s
->cert
->ecdh_tmp
->group
->meth
) == NID_X9_62_characteristic_two_field
)
3996 ec_search2
= tls1_ec_nid2curve_id(ec_nid
);
3998 if ((ec_search1
!= 0) || (ec_search2
!= 0))
4000 for (j
= 0; j
< s
->session
->tlsext_ellipticcurvelist_length
/ 2; j
++)
4002 if ((s
->session
->tlsext_ellipticcurvelist
[2*j
] == ec_search1
) && (s
->session
->tlsext_ellipticcurvelist
[2*j
+1] == ec_search2
))
4012 #endif /* OPENSSL_NO_EC */
4013 #endif /* OPENSSL_NO_TLSEXT */
4016 ii
=sk_SSL_CIPHER_find(allow
,c
);
4019 ret
=sk_SSL_CIPHER_value(allow
,ii
);
4026 int ssl3_get_req_cert_type(SSL
*s
, unsigned char *p
)
4029 unsigned long alg_k
;
4031 alg_k
= s
->s3
->tmp
.new_cipher
->algorithm_mkey
;
4033 #ifndef OPENSSL_NO_GOST
4034 if (s
->version
>= TLS1_VERSION
)
4036 if (alg_k
& SSL_kGOST
)
4038 p
[ret
++]=TLS_CT_GOST94_SIGN
;
4039 p
[ret
++]=TLS_CT_GOST01_SIGN
;
4045 #ifndef OPENSSL_NO_DH
4046 if (alg_k
& (SSL_kDHr
|SSL_kEDH
))
4048 # ifndef OPENSSL_NO_RSA
4049 p
[ret
++]=SSL3_CT_RSA_FIXED_DH
;
4051 # ifndef OPENSSL_NO_DSA
4052 p
[ret
++]=SSL3_CT_DSS_FIXED_DH
;
4055 if ((s
->version
== SSL3_VERSION
) &&
4056 (alg_k
& (SSL_kEDH
|SSL_kDHd
|SSL_kDHr
)))
4058 # ifndef OPENSSL_NO_RSA
4059 p
[ret
++]=SSL3_CT_RSA_EPHEMERAL_DH
;
4061 # ifndef OPENSSL_NO_DSA
4062 p
[ret
++]=SSL3_CT_DSS_EPHEMERAL_DH
;
4065 #endif /* !OPENSSL_NO_DH */
4066 #ifndef OPENSSL_NO_RSA
4067 p
[ret
++]=SSL3_CT_RSA_SIGN
;
4069 #ifndef OPENSSL_NO_DSA
4070 p
[ret
++]=SSL3_CT_DSS_SIGN
;
4072 #ifndef OPENSSL_NO_ECDH
4073 if ((alg_k
& (SSL_kECDHr
|SSL_kECDHe
)) && (s
->version
>= TLS1_VERSION
))
4075 p
[ret
++]=TLS_CT_RSA_FIXED_ECDH
;
4076 p
[ret
++]=TLS_CT_ECDSA_FIXED_ECDH
;
4080 #ifndef OPENSSL_NO_ECDSA
4081 /* ECDSA certs can be used with RSA cipher suites as well
4082 * so we don't need to check for SSL_kECDH or SSL_kEECDH
4084 if (s
->version
>= TLS1_VERSION
)
4086 p
[ret
++]=TLS_CT_ECDSA_SIGN
;
4092 int ssl3_shutdown(SSL
*s
)
4096 /* Don't do anything much if we have not done the handshake or
4097 * we don't want to send messages :-) */
4098 if ((s
->quiet_shutdown
) || (s
->state
== SSL_ST_BEFORE
))
4100 s
->shutdown
=(SSL_SENT_SHUTDOWN
|SSL_RECEIVED_SHUTDOWN
);
4104 if (!(s
->shutdown
& SSL_SENT_SHUTDOWN
))
4106 s
->shutdown
|=SSL_SENT_SHUTDOWN
;
4108 ssl3_send_alert(s
,SSL3_AL_WARNING
,SSL_AD_CLOSE_NOTIFY
);
4110 /* our shutdown alert has been sent now, and if it still needs
4111 * to be written, s->s3->alert_dispatch will be true */
4112 if (s
->s3
->alert_dispatch
)
4113 return(-1); /* return WANT_WRITE */
4115 else if (s
->s3
->alert_dispatch
)
4117 /* resend it if not sent */
4119 ret
=s
->method
->ssl_dispatch_alert(s
);
4122 /* we only get to return -1 here the 2nd/Nth
4123 * invocation, we must have already signalled
4124 * return 0 upon a previous invoation,
4125 * return WANT_WRITE */
4130 else if (!(s
->shutdown
& SSL_RECEIVED_SHUTDOWN
))
4132 /* If we are waiting for a close from our peer, we are closed */
4133 s
->method
->ssl_read_bytes(s
,0,NULL
,0,0);
4134 if(!(s
->shutdown
& SSL_RECEIVED_SHUTDOWN
))
4136 return(-1); /* return WANT_READ */
4140 if ((s
->shutdown
== (SSL_SENT_SHUTDOWN
|SSL_RECEIVED_SHUTDOWN
)) &&
4141 !s
->s3
->alert_dispatch
)
4147 int ssl3_write(SSL
*s
, const void *buf
, int len
)
4152 if (s
->shutdown
& SSL_SEND_SHUTDOWN
)
4154 s
->rwstate
=SSL_NOTHING
;
4159 if (s
->s3
->renegotiate
) ssl3_renegotiate_check(s
);
4161 /* This is an experimental flag that sends the
4162 * last handshake message in the same packet as the first
4163 * use data - used to see if it helps the TCP protocol during
4164 * session-id reuse */
4165 /* The second test is because the buffer may have been removed */
4166 if ((s
->s3
->flags
& SSL3_FLAGS_POP_BUFFER
) && (s
->wbio
== s
->bbio
))
4168 /* First time through, we write into the buffer */
4169 if (s
->s3
->delay_buf_pop_ret
== 0)
4171 ret
=ssl3_write_bytes(s
,SSL3_RT_APPLICATION_DATA
,
4173 if (ret
<= 0) return(ret
);
4175 s
->s3
->delay_buf_pop_ret
=ret
;
4178 s
->rwstate
=SSL_WRITING
;
4179 n
=BIO_flush(s
->wbio
);
4180 if (n
<= 0) return(n
);
4181 s
->rwstate
=SSL_NOTHING
;
4183 /* We have flushed the buffer, so remove it */
4184 ssl_free_wbio_buffer(s
);
4185 s
->s3
->flags
&= ~SSL3_FLAGS_POP_BUFFER
;
4187 ret
=s
->s3
->delay_buf_pop_ret
;
4188 s
->s3
->delay_buf_pop_ret
=0;
4192 ret
=s
->method
->ssl_write_bytes(s
,SSL3_RT_APPLICATION_DATA
,
4194 if (ret
<= 0) return(ret
);
4200 static int ssl3_read_internal(SSL
*s
, void *buf
, int len
, int peek
)
4205 if (s
->s3
->renegotiate
) ssl3_renegotiate_check(s
);
4206 s
->s3
->in_read_app_data
=1;
4207 ret
=s
->method
->ssl_read_bytes(s
,SSL3_RT_APPLICATION_DATA
,buf
,len
,peek
);
4208 if ((ret
== -1) && (s
->s3
->in_read_app_data
== 2))
4210 /* ssl3_read_bytes decided to call s->handshake_func, which
4211 * called ssl3_read_bytes to read handshake data.
4212 * However, ssl3_read_bytes actually found application data
4213 * and thinks that application data makes sense here; so disable
4214 * handshake processing and try to read application data again. */
4216 ret
=s
->method
->ssl_read_bytes(s
,SSL3_RT_APPLICATION_DATA
,buf
,len
,peek
);
4220 s
->s3
->in_read_app_data
=0;
4225 int ssl3_read(SSL
*s
, void *buf
, int len
)
4227 return ssl3_read_internal(s
, buf
, len
, 0);
4230 int ssl3_peek(SSL
*s
, void *buf
, int len
)
4232 return ssl3_read_internal(s
, buf
, len
, 1);
4235 int ssl3_renegotiate(SSL
*s
)
4237 if (s
->handshake_func
== NULL
)
4240 if (s
->s3
->flags
& SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS
)
4243 s
->s3
->renegotiate
=1;
4247 int ssl3_renegotiate_check(SSL
*s
)
4251 if (s
->s3
->renegotiate
)
4253 if ( (s
->s3
->rbuf
.left
== 0) &&
4254 (s
->s3
->wbuf
.left
== 0) &&
4258 if we are the server, and we have sent a 'RENEGOTIATE' message, we
4259 need to go to SSL_ST_ACCEPT.
4262 s
->state
=SSL_ST_RENEGOTIATE
;
4263 s
->s3
->renegotiate
=0;
4264 s
->s3
->num_renegotiations
++;
4265 s
->s3
->total_renegotiations
++;
4271 /* If we are using TLS v1.2 or later and default SHA1+MD5 algorithms switch
4272 * to new SHA256 PRF and handshake macs
4274 long ssl_get_algorithm2(SSL
*s
)
4276 long alg2
= s
->s3
->tmp
.new_cipher
->algorithm2
;
4277 if (TLS1_get_version(s
) >= TLS1_2_VERSION
&&
4278 alg2
== (SSL_HANDSHAKE_MAC_DEFAULT
|TLS1_PRF
))
4279 return SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
;