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 #include <openssl/md5.h>
156 #ifndef OPENSSL_NO_DH
157 # include <openssl/dh.h>
160 const char ssl3_version_str
[] = "SSLv3" OPENSSL_VERSION_PTEXT
;
162 #define SSL3_NUM_CIPHERS (sizeof(ssl3_ciphers)/sizeof(SSL_CIPHER))
164 /* list of available SSLv3 ciphers (sorted by id) */
165 OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers
[] = {
167 /* The RSA ciphers */
171 SSL3_TXT_RSA_NULL_MD5
,
172 SSL3_CK_RSA_NULL_MD5
,
178 SSL_NOT_EXP
| SSL_STRONG_NONE
,
179 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
187 SSL3_TXT_RSA_NULL_SHA
,
188 SSL3_CK_RSA_NULL_SHA
,
194 SSL_NOT_EXP
| SSL_STRONG_NONE
| SSL_FIPS
,
195 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
203 SSL3_TXT_RSA_RC4_40_MD5
,
204 SSL3_CK_RSA_RC4_40_MD5
,
210 SSL_EXPORT
| SSL_EXP40
,
211 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
219 SSL3_TXT_RSA_RC4_128_MD5
,
220 SSL3_CK_RSA_RC4_128_MD5
,
226 SSL_NOT_EXP
| SSL_MEDIUM
,
227 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
235 SSL3_TXT_RSA_RC4_128_SHA
,
236 SSL3_CK_RSA_RC4_128_SHA
,
242 SSL_NOT_EXP
| SSL_MEDIUM
,
243 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
251 SSL3_TXT_RSA_RC2_40_MD5
,
252 SSL3_CK_RSA_RC2_40_MD5
,
258 SSL_EXPORT
| SSL_EXP40
,
259 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
265 #ifndef OPENSSL_NO_IDEA
268 SSL3_TXT_RSA_IDEA_128_SHA
,
269 SSL3_CK_RSA_IDEA_128_SHA
,
275 SSL_NOT_EXP
| SSL_MEDIUM
,
276 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
285 SSL3_TXT_RSA_DES_40_CBC_SHA
,
286 SSL3_CK_RSA_DES_40_CBC_SHA
,
292 SSL_EXPORT
| SSL_EXP40
,
293 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
301 SSL3_TXT_RSA_DES_64_CBC_SHA
,
302 SSL3_CK_RSA_DES_64_CBC_SHA
,
308 SSL_NOT_EXP
| SSL_LOW
,
309 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
317 SSL3_TXT_RSA_DES_192_CBC3_SHA
,
318 SSL3_CK_RSA_DES_192_CBC3_SHA
,
324 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
325 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
334 SSL3_TXT_DH_DSS_DES_40_CBC_SHA
,
335 SSL3_CK_DH_DSS_DES_40_CBC_SHA
,
341 SSL_EXPORT
| SSL_EXP40
,
342 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
350 SSL3_TXT_DH_DSS_DES_64_CBC_SHA
,
351 SSL3_CK_DH_DSS_DES_64_CBC_SHA
,
357 SSL_NOT_EXP
| SSL_LOW
,
358 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
366 SSL3_TXT_DH_DSS_DES_192_CBC3_SHA
,
367 SSL3_CK_DH_DSS_DES_192_CBC3_SHA
,
373 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
374 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
382 SSL3_TXT_DH_RSA_DES_40_CBC_SHA
,
383 SSL3_CK_DH_RSA_DES_40_CBC_SHA
,
389 SSL_EXPORT
| SSL_EXP40
,
390 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
398 SSL3_TXT_DH_RSA_DES_64_CBC_SHA
,
399 SSL3_CK_DH_RSA_DES_64_CBC_SHA
,
405 SSL_NOT_EXP
| SSL_LOW
,
406 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
414 SSL3_TXT_DH_RSA_DES_192_CBC3_SHA
,
415 SSL3_CK_DH_RSA_DES_192_CBC3_SHA
,
421 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
422 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
427 /* The Ephemeral DH ciphers */
431 SSL3_TXT_EDH_DSS_DES_40_CBC_SHA
,
432 SSL3_CK_EDH_DSS_DES_40_CBC_SHA
,
438 SSL_EXPORT
| SSL_EXP40
,
439 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
447 SSL3_TXT_EDH_DSS_DES_64_CBC_SHA
,
448 SSL3_CK_EDH_DSS_DES_64_CBC_SHA
,
454 SSL_NOT_EXP
| SSL_LOW
,
455 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
463 SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA
,
464 SSL3_CK_EDH_DSS_DES_192_CBC3_SHA
,
470 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
471 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
479 SSL3_TXT_EDH_RSA_DES_40_CBC_SHA
,
480 SSL3_CK_EDH_RSA_DES_40_CBC_SHA
,
486 SSL_EXPORT
| SSL_EXP40
,
487 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
495 SSL3_TXT_EDH_RSA_DES_64_CBC_SHA
,
496 SSL3_CK_EDH_RSA_DES_64_CBC_SHA
,
502 SSL_NOT_EXP
| SSL_LOW
,
503 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
511 SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA
,
512 SSL3_CK_EDH_RSA_DES_192_CBC3_SHA
,
518 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
519 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
527 SSL3_TXT_ADH_RC4_40_MD5
,
528 SSL3_CK_ADH_RC4_40_MD5
,
534 SSL_EXPORT
| SSL_EXP40
,
535 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
543 SSL3_TXT_ADH_RC4_128_MD5
,
544 SSL3_CK_ADH_RC4_128_MD5
,
550 SSL_NOT_EXP
| SSL_MEDIUM
,
551 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
559 SSL3_TXT_ADH_DES_40_CBC_SHA
,
560 SSL3_CK_ADH_DES_40_CBC_SHA
,
566 SSL_EXPORT
| SSL_EXP40
,
567 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
575 SSL3_TXT_ADH_DES_64_CBC_SHA
,
576 SSL3_CK_ADH_DES_64_CBC_SHA
,
582 SSL_NOT_EXP
| SSL_LOW
,
583 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
591 SSL3_TXT_ADH_DES_192_CBC_SHA
,
592 SSL3_CK_ADH_DES_192_CBC_SHA
,
598 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
599 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
604 /* Fortezza ciphersuite from SSL 3.0 spec */
609 SSL3_TXT_FZA_DMS_NULL_SHA
,
610 SSL3_CK_FZA_DMS_NULL_SHA
,
616 SSL_NOT_EXP
| SSL_STRONG_NONE
,
617 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
625 SSL3_TXT_FZA_DMS_FZA_SHA
,
626 SSL3_CK_FZA_DMS_FZA_SHA
,
632 SSL_NOT_EXP
| SSL_STRONG_NONE
,
633 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
641 SSL3_TXT_FZA_DMS_RC4_SHA
,
642 SSL3_CK_FZA_DMS_RC4_SHA
,
648 SSL_NOT_EXP
| SSL_MEDIUM
,
649 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
655 #ifndef OPENSSL_NO_KRB5
656 /* The Kerberos ciphers*/
660 SSL3_TXT_KRB5_DES_64_CBC_SHA
,
661 SSL3_CK_KRB5_DES_64_CBC_SHA
,
667 SSL_NOT_EXP
| SSL_LOW
,
668 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
676 SSL3_TXT_KRB5_DES_192_CBC3_SHA
,
677 SSL3_CK_KRB5_DES_192_CBC3_SHA
,
683 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
684 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
692 SSL3_TXT_KRB5_RC4_128_SHA
,
693 SSL3_CK_KRB5_RC4_128_SHA
,
699 SSL_NOT_EXP
| SSL_MEDIUM
,
700 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
708 SSL3_TXT_KRB5_IDEA_128_CBC_SHA
,
709 SSL3_CK_KRB5_IDEA_128_CBC_SHA
,
715 SSL_NOT_EXP
| SSL_MEDIUM
,
716 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
724 SSL3_TXT_KRB5_DES_64_CBC_MD5
,
725 SSL3_CK_KRB5_DES_64_CBC_MD5
,
731 SSL_NOT_EXP
| SSL_LOW
,
732 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
740 SSL3_TXT_KRB5_DES_192_CBC3_MD5
,
741 SSL3_CK_KRB5_DES_192_CBC3_MD5
,
747 SSL_NOT_EXP
| SSL_HIGH
,
748 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
756 SSL3_TXT_KRB5_RC4_128_MD5
,
757 SSL3_CK_KRB5_RC4_128_MD5
,
763 SSL_NOT_EXP
| SSL_MEDIUM
,
764 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
772 SSL3_TXT_KRB5_IDEA_128_CBC_MD5
,
773 SSL3_CK_KRB5_IDEA_128_CBC_MD5
,
779 SSL_NOT_EXP
| SSL_MEDIUM
,
780 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
788 SSL3_TXT_KRB5_DES_40_CBC_SHA
,
789 SSL3_CK_KRB5_DES_40_CBC_SHA
,
795 SSL_EXPORT
| SSL_EXP40
,
796 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
804 SSL3_TXT_KRB5_RC2_40_CBC_SHA
,
805 SSL3_CK_KRB5_RC2_40_CBC_SHA
,
811 SSL_EXPORT
| SSL_EXP40
,
812 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
820 SSL3_TXT_KRB5_RC4_40_SHA
,
821 SSL3_CK_KRB5_RC4_40_SHA
,
827 SSL_EXPORT
| SSL_EXP40
,
828 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
836 SSL3_TXT_KRB5_DES_40_CBC_MD5
,
837 SSL3_CK_KRB5_DES_40_CBC_MD5
,
843 SSL_EXPORT
| SSL_EXP40
,
844 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
852 SSL3_TXT_KRB5_RC2_40_CBC_MD5
,
853 SSL3_CK_KRB5_RC2_40_CBC_MD5
,
859 SSL_EXPORT
| SSL_EXP40
,
860 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
868 SSL3_TXT_KRB5_RC4_40_MD5
,
869 SSL3_CK_KRB5_RC4_40_MD5
,
875 SSL_EXPORT
| SSL_EXP40
,
876 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
880 #endif /* OPENSSL_NO_KRB5 */
882 /* New AES ciphersuites */
886 TLS1_TXT_RSA_WITH_AES_128_SHA
,
887 TLS1_CK_RSA_WITH_AES_128_SHA
,
893 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
894 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
901 TLS1_TXT_DH_DSS_WITH_AES_128_SHA
,
902 TLS1_CK_DH_DSS_WITH_AES_128_SHA
,
908 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
909 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
916 TLS1_TXT_DH_RSA_WITH_AES_128_SHA
,
917 TLS1_CK_DH_RSA_WITH_AES_128_SHA
,
923 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
924 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
931 TLS1_TXT_DHE_DSS_WITH_AES_128_SHA
,
932 TLS1_CK_DHE_DSS_WITH_AES_128_SHA
,
938 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
939 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
946 TLS1_TXT_DHE_RSA_WITH_AES_128_SHA
,
947 TLS1_CK_DHE_RSA_WITH_AES_128_SHA
,
953 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
954 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
961 TLS1_TXT_ADH_WITH_AES_128_SHA
,
962 TLS1_CK_ADH_WITH_AES_128_SHA
,
968 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
969 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
977 TLS1_TXT_RSA_WITH_AES_256_SHA
,
978 TLS1_CK_RSA_WITH_AES_256_SHA
,
984 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
985 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
992 TLS1_TXT_DH_DSS_WITH_AES_256_SHA
,
993 TLS1_CK_DH_DSS_WITH_AES_256_SHA
,
999 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1000 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1008 TLS1_TXT_DH_RSA_WITH_AES_256_SHA
,
1009 TLS1_CK_DH_RSA_WITH_AES_256_SHA
,
1015 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1016 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1024 TLS1_TXT_DHE_DSS_WITH_AES_256_SHA
,
1025 TLS1_CK_DHE_DSS_WITH_AES_256_SHA
,
1031 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1032 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1040 TLS1_TXT_DHE_RSA_WITH_AES_256_SHA
,
1041 TLS1_CK_DHE_RSA_WITH_AES_256_SHA
,
1047 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1048 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1056 TLS1_TXT_ADH_WITH_AES_256_SHA
,
1057 TLS1_CK_ADH_WITH_AES_256_SHA
,
1063 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1064 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1069 /* TLS v1.2 ciphersuites */
1073 TLS1_TXT_RSA_WITH_NULL_SHA256
,
1074 TLS1_CK_RSA_WITH_NULL_SHA256
,
1080 SSL_NOT_EXP
| SSL_STRONG_NONE
| SSL_FIPS
,
1081 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1089 TLS1_TXT_RSA_WITH_AES_128_SHA256
,
1090 TLS1_CK_RSA_WITH_AES_128_SHA256
,
1096 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1097 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1105 TLS1_TXT_RSA_WITH_AES_256_SHA256
,
1106 TLS1_CK_RSA_WITH_AES_256_SHA256
,
1112 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1113 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1121 TLS1_TXT_DH_DSS_WITH_AES_128_SHA256
,
1122 TLS1_CK_DH_DSS_WITH_AES_128_SHA256
,
1128 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1129 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1137 TLS1_TXT_DH_RSA_WITH_AES_128_SHA256
,
1138 TLS1_CK_DH_RSA_WITH_AES_128_SHA256
,
1144 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1145 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1153 TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256
,
1154 TLS1_CK_DHE_DSS_WITH_AES_128_SHA256
,
1160 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1161 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1166 #ifndef OPENSSL_NO_CAMELLIA
1167 /* Camellia ciphersuites from RFC4132 (128-bit portion) */
1172 TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA
,
1173 TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA
,
1179 SSL_NOT_EXP
| SSL_HIGH
,
1180 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1188 TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA
,
1189 TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA
,
1195 SSL_NOT_EXP
| SSL_HIGH
,
1196 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1204 TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA
,
1205 TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA
,
1211 SSL_NOT_EXP
| SSL_HIGH
,
1212 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1220 TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA
,
1221 TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA
,
1227 SSL_NOT_EXP
| SSL_HIGH
,
1228 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1236 TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
,
1237 TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
,
1243 SSL_NOT_EXP
| SSL_HIGH
,
1244 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1252 TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA
,
1253 TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA
,
1259 SSL_NOT_EXP
| SSL_HIGH
,
1260 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1264 #endif /* OPENSSL_NO_CAMELLIA */
1266 #if TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES
1267 /* New TLS Export CipherSuites from expired ID */
1272 TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5
,
1273 TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5
,
1279 SSL_EXPORT
| SSL_EXP56
,
1280 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1288 TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5
,
1289 TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5
,
1295 SSL_EXPORT
| SSL_EXP56
,
1296 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1305 TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA
,
1306 TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA
,
1312 SSL_EXPORT
| SSL_EXP56
,
1313 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1321 TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA
,
1322 TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA
,
1328 SSL_EXPORT
| SSL_EXP56
,
1329 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1337 TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA
,
1338 TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA
,
1344 SSL_EXPORT
| SSL_EXP56
,
1345 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1353 TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA
,
1354 TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA
,
1360 SSL_EXPORT
| SSL_EXP56
,
1361 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1369 TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA
,
1370 TLS1_CK_DHE_DSS_WITH_RC4_128_SHA
,
1376 SSL_NOT_EXP
| SSL_MEDIUM
,
1377 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1383 /* TLS v1.2 ciphersuites */
1387 TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256
,
1388 TLS1_CK_DHE_RSA_WITH_AES_128_SHA256
,
1394 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1395 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1403 TLS1_TXT_DH_DSS_WITH_AES_256_SHA256
,
1404 TLS1_CK_DH_DSS_WITH_AES_256_SHA256
,
1410 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1411 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1419 TLS1_TXT_DH_RSA_WITH_AES_256_SHA256
,
1420 TLS1_CK_DH_RSA_WITH_AES_256_SHA256
,
1426 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1427 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1435 TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256
,
1436 TLS1_CK_DHE_DSS_WITH_AES_256_SHA256
,
1442 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1443 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1451 TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256
,
1452 TLS1_CK_DHE_RSA_WITH_AES_256_SHA256
,
1458 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1459 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1467 TLS1_TXT_ADH_WITH_AES_128_SHA256
,
1468 TLS1_CK_ADH_WITH_AES_128_SHA256
,
1474 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1475 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1483 TLS1_TXT_ADH_WITH_AES_256_SHA256
,
1484 TLS1_CK_ADH_WITH_AES_256_SHA256
,
1490 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1491 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1496 /* GOST Ciphersuites */
1500 "GOST94-GOST89-GOST89",
1504 SSL_eGOST2814789CNT
,
1507 SSL_NOT_EXP
| SSL_HIGH
,
1508 SSL_HANDSHAKE_MAC_GOST94
| TLS1_PRF_GOST94
| TLS1_STREAM_MAC
,
1513 "GOST2001-GOST89-GOST89",
1517 SSL_eGOST2814789CNT
,
1520 SSL_NOT_EXP
| SSL_HIGH
,
1521 SSL_HANDSHAKE_MAC_GOST94
| TLS1_PRF_GOST94
| TLS1_STREAM_MAC
,
1526 "GOST94-NULL-GOST94",
1533 SSL_NOT_EXP
| SSL_STRONG_NONE
,
1534 SSL_HANDSHAKE_MAC_GOST94
| TLS1_PRF_GOST94
,
1539 "GOST2001-NULL-GOST94",
1546 SSL_NOT_EXP
| SSL_STRONG_NONE
,
1547 SSL_HANDSHAKE_MAC_GOST94
| TLS1_PRF_GOST94
,
1551 #ifndef OPENSSL_NO_CAMELLIA
1552 /* Camellia ciphersuites from RFC4132 (256-bit portion) */
1557 TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA
,
1558 TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA
,
1564 SSL_NOT_EXP
| SSL_HIGH
,
1565 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1572 TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA
,
1573 TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA
,
1579 SSL_NOT_EXP
| SSL_HIGH
,
1580 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1588 TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA
,
1589 TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA
,
1595 SSL_NOT_EXP
| SSL_HIGH
,
1596 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1604 TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA
,
1605 TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA
,
1611 SSL_NOT_EXP
| SSL_HIGH
,
1612 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1620 TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
,
1621 TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
,
1627 SSL_NOT_EXP
| SSL_HIGH
,
1628 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1636 TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA
,
1637 TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA
,
1643 SSL_NOT_EXP
| SSL_HIGH
,
1644 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1648 #endif /* OPENSSL_NO_CAMELLIA */
1650 #ifndef OPENSSL_NO_PSK
1654 TLS1_TXT_PSK_WITH_RC4_128_SHA
,
1655 TLS1_CK_PSK_WITH_RC4_128_SHA
,
1661 SSL_NOT_EXP
| SSL_MEDIUM
,
1662 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1670 TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA
,
1671 TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA
,
1677 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1678 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1686 TLS1_TXT_PSK_WITH_AES_128_CBC_SHA
,
1687 TLS1_CK_PSK_WITH_AES_128_CBC_SHA
,
1693 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1694 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1702 TLS1_TXT_PSK_WITH_AES_256_CBC_SHA
,
1703 TLS1_CK_PSK_WITH_AES_256_CBC_SHA
,
1709 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1710 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1714 #endif /* OPENSSL_NO_PSK */
1716 #ifndef OPENSSL_NO_SEED
1717 /* SEED ciphersuites from RFC4162 */
1722 TLS1_TXT_RSA_WITH_SEED_SHA
,
1723 TLS1_CK_RSA_WITH_SEED_SHA
,
1729 SSL_NOT_EXP
| SSL_MEDIUM
,
1730 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1738 TLS1_TXT_DH_DSS_WITH_SEED_SHA
,
1739 TLS1_CK_DH_DSS_WITH_SEED_SHA
,
1745 SSL_NOT_EXP
| SSL_MEDIUM
,
1746 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1754 TLS1_TXT_DH_RSA_WITH_SEED_SHA
,
1755 TLS1_CK_DH_RSA_WITH_SEED_SHA
,
1761 SSL_NOT_EXP
| SSL_MEDIUM
,
1762 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1770 TLS1_TXT_DHE_DSS_WITH_SEED_SHA
,
1771 TLS1_CK_DHE_DSS_WITH_SEED_SHA
,
1777 SSL_NOT_EXP
| SSL_MEDIUM
,
1778 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1786 TLS1_TXT_DHE_RSA_WITH_SEED_SHA
,
1787 TLS1_CK_DHE_RSA_WITH_SEED_SHA
,
1793 SSL_NOT_EXP
| SSL_MEDIUM
,
1794 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1802 TLS1_TXT_ADH_WITH_SEED_SHA
,
1803 TLS1_CK_ADH_WITH_SEED_SHA
,
1809 SSL_NOT_EXP
| SSL_MEDIUM
,
1810 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
1815 #endif /* OPENSSL_NO_SEED */
1817 /* GCM ciphersuites from RFC5288 */
1822 TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256
,
1823 TLS1_CK_RSA_WITH_AES_128_GCM_SHA256
,
1829 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1830 SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
,
1838 TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384
,
1839 TLS1_CK_RSA_WITH_AES_256_GCM_SHA384
,
1845 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1846 SSL_HANDSHAKE_MAC_SHA384
| TLS1_PRF_SHA384
,
1854 TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256
,
1855 TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256
,
1861 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1862 SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
,
1870 TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384
,
1871 TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384
,
1877 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1878 SSL_HANDSHAKE_MAC_SHA384
| TLS1_PRF_SHA384
,
1886 TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256
,
1887 TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256
,
1893 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1894 SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
,
1902 TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384
,
1903 TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384
,
1909 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1910 SSL_HANDSHAKE_MAC_SHA384
| TLS1_PRF_SHA384
,
1918 TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256
,
1919 TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256
,
1925 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1926 SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
,
1934 TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384
,
1935 TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384
,
1941 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1942 SSL_HANDSHAKE_MAC_SHA384
| TLS1_PRF_SHA384
,
1950 TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256
,
1951 TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256
,
1957 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1958 SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
,
1966 TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384
,
1967 TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384
,
1973 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1974 SSL_HANDSHAKE_MAC_SHA384
| TLS1_PRF_SHA384
,
1982 TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256
,
1983 TLS1_CK_ADH_WITH_AES_128_GCM_SHA256
,
1989 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
1990 SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
,
1998 TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384
,
1999 TLS1_CK_ADH_WITH_AES_256_GCM_SHA384
,
2005 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2006 SSL_HANDSHAKE_MAC_SHA384
| TLS1_PRF_SHA384
,
2010 #ifdef OPENSSL_SSL_DEBUG_BROKEN_PROTOCOL
2026 #ifndef OPENSSL_NO_ECDH
2030 TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA
,
2031 TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA
,
2037 SSL_NOT_EXP
| SSL_STRONG_NONE
| SSL_FIPS
,
2038 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2046 TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA
,
2047 TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA
,
2053 SSL_NOT_EXP
| SSL_MEDIUM
,
2054 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2062 TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA
,
2063 TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA
,
2069 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2070 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2078 TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA
,
2079 TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA
,
2085 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2086 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2094 TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA
,
2095 TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA
,
2101 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2102 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2110 TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA
,
2111 TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA
,
2117 SSL_NOT_EXP
| SSL_STRONG_NONE
| SSL_FIPS
,
2118 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2126 TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA
,
2127 TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA
,
2133 SSL_NOT_EXP
| SSL_MEDIUM
,
2134 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2142 TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA
,
2143 TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA
,
2149 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2150 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2158 TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
,
2159 TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
,
2165 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2166 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2174 TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
,
2175 TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
,
2181 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2182 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2190 TLS1_TXT_ECDH_RSA_WITH_NULL_SHA
,
2191 TLS1_CK_ECDH_RSA_WITH_NULL_SHA
,
2197 SSL_NOT_EXP
| SSL_STRONG_NONE
| SSL_FIPS
,
2198 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2206 TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA
,
2207 TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA
,
2213 SSL_NOT_EXP
| SSL_MEDIUM
,
2214 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2222 TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA
,
2223 TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA
,
2229 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2230 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2238 TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA
,
2239 TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA
,
2245 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2246 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2254 TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA
,
2255 TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA
,
2261 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2262 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2270 TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA
,
2271 TLS1_CK_ECDHE_RSA_WITH_NULL_SHA
,
2277 SSL_NOT_EXP
| SSL_STRONG_NONE
| SSL_FIPS
,
2278 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2286 TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA
,
2287 TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA
,
2293 SSL_NOT_EXP
| SSL_MEDIUM
,
2294 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2302 TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA
,
2303 TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA
,
2309 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2310 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2318 TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA
,
2319 TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA
,
2325 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2326 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2334 TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA
,
2335 TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA
,
2341 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2342 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2350 TLS1_TXT_ECDH_anon_WITH_NULL_SHA
,
2351 TLS1_CK_ECDH_anon_WITH_NULL_SHA
,
2357 SSL_NOT_EXP
| SSL_STRONG_NONE
| SSL_FIPS
,
2358 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2366 TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA
,
2367 TLS1_CK_ECDH_anon_WITH_RC4_128_SHA
,
2373 SSL_NOT_EXP
| SSL_MEDIUM
,
2374 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2382 TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA
,
2383 TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA
,
2389 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2390 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2398 TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA
,
2399 TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA
,
2405 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2406 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2414 TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA
,
2415 TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA
,
2421 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2422 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2426 #endif /* OPENSSL_NO_ECDH */
2428 #ifndef OPENSSL_NO_SRP
2432 TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA
,
2433 TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA
,
2439 SSL_NOT_EXP
| SSL_HIGH
,
2440 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2448 TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA
,
2449 TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA
,
2455 SSL_NOT_EXP
| SSL_HIGH
,
2456 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2464 TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA
,
2465 TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA
,
2471 SSL_NOT_EXP
| SSL_HIGH
,
2472 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2480 TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA
,
2481 TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA
,
2487 SSL_NOT_EXP
| SSL_HIGH
,
2488 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2496 TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA
,
2497 TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA
,
2503 SSL_NOT_EXP
| SSL_HIGH
,
2504 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2512 TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA
,
2513 TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA
,
2519 SSL_NOT_EXP
| SSL_HIGH
,
2520 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2528 TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA
,
2529 TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA
,
2535 SSL_NOT_EXP
| SSL_HIGH
,
2536 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2544 TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA
,
2545 TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA
,
2551 SSL_NOT_EXP
| SSL_HIGH
,
2552 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2560 TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA
,
2561 TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA
,
2567 SSL_NOT_EXP
| SSL_HIGH
,
2568 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2572 #endif /* OPENSSL_NO_SRP */
2573 #ifndef OPENSSL_NO_ECDH
2575 /* HMAC based TLS v1.2 ciphersuites from RFC5289 */
2580 TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256
,
2581 TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256
,
2587 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2588 SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
,
2596 TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384
,
2597 TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384
,
2603 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2604 SSL_HANDSHAKE_MAC_SHA384
| TLS1_PRF_SHA384
,
2612 TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256
,
2613 TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256
,
2619 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2620 SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
,
2628 TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384
,
2629 TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384
,
2635 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2636 SSL_HANDSHAKE_MAC_SHA384
| TLS1_PRF_SHA384
,
2644 TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256
,
2645 TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256
,
2651 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2652 SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
,
2660 TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384
,
2661 TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384
,
2667 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2668 SSL_HANDSHAKE_MAC_SHA384
| TLS1_PRF_SHA384
,
2676 TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256
,
2677 TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256
,
2683 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2684 SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
,
2692 TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384
,
2693 TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384
,
2699 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2700 SSL_HANDSHAKE_MAC_SHA384
| TLS1_PRF_SHA384
,
2705 /* GCM based TLS v1.2 ciphersuites from RFC5289 */
2710 TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
,
2711 TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
,
2717 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2718 SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
,
2726 TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
,
2727 TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
,
2733 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2734 SSL_HANDSHAKE_MAC_SHA384
| TLS1_PRF_SHA384
,
2742 TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
,
2743 TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
,
2749 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2750 SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
,
2758 TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
,
2759 TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
,
2765 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2766 SSL_HANDSHAKE_MAC_SHA384
| TLS1_PRF_SHA384
,
2774 TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256
,
2775 TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256
,
2781 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2782 SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
,
2790 TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384
,
2791 TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384
,
2797 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2798 SSL_HANDSHAKE_MAC_SHA384
| TLS1_PRF_SHA384
,
2806 TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256
,
2807 TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256
,
2813 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2814 SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
,
2822 TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384
,
2823 TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384
,
2829 SSL_NOT_EXP
| SSL_HIGH
| SSL_FIPS
,
2830 SSL_HANDSHAKE_MAC_SHA384
| TLS1_PRF_SHA384
,
2835 #endif /* OPENSSL_NO_ECDH */
2837 #ifdef TEMP_GOST_TLS
2845 SSL_eGOST2814789CNT
,
2848 SSL_NOT_EXP
| SSL_HIGH
,
2849 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2859 SSL_eGOST2814789CNT
,
2862 SSL_NOT_EXP
| SSL_HIGH
,
2863 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2872 SSL_eGOST2814789CNT
,
2875 SSL_NOT_EXP
| SSL_HIGH
,
2876 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
,
2881 "GOST-GOST89STREAM",
2885 SSL_eGOST2814789CNT
,
2888 SSL_NOT_EXP
| SSL_HIGH
,
2889 SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
| TLS1_STREAM_MAC
,
2897 SSL3_ENC_METHOD SSLv3_enc_data
= {
2900 ssl3_setup_key_block
,
2901 ssl3_generate_master_secret
,
2902 ssl3_change_cipher_state
,
2903 ssl3_final_finish_mac
,
2904 MD5_DIGEST_LENGTH
+ SHA_DIGEST_LENGTH
,
2905 ssl3_cert_verify_mac
,
2906 SSL3_MD_CLIENT_FINISHED_CONST
, 4,
2907 SSL3_MD_SERVER_FINISHED_CONST
, 4,
2909 (int (*)(SSL
*, unsigned char *, size_t, const char *,
2910 size_t, const unsigned char *, size_t,
2911 int use_context
))ssl_undefined_function
,
2913 SSL3_HM_HEADER_LENGTH
,
2914 ssl3_set_handshake_header
,
2915 ssl3_handshake_write
2918 long ssl3_default_timeout(void)
2921 * 2 hours, the 24 hours mentioned in the SSLv3 spec is way too long for
2922 * http, the cache would over fill
2924 return (60 * 60 * 2);
2927 int ssl3_num_ciphers(void)
2929 return (SSL3_NUM_CIPHERS
);
2932 const SSL_CIPHER
*ssl3_get_cipher(unsigned int u
)
2934 if (u
< SSL3_NUM_CIPHERS
)
2935 return (&(ssl3_ciphers
[SSL3_NUM_CIPHERS
- 1 - u
]));
2940 int ssl3_pending(const SSL
*s
)
2942 if (s
->rstate
== SSL_ST_READ_BODY
)
2945 return (s
->s3
->rrec
.type
==
2946 SSL3_RT_APPLICATION_DATA
) ? s
->s3
->rrec
.length
: 0;
2949 void ssl3_set_handshake_header(SSL
*s
, int htype
, unsigned long len
)
2951 unsigned char *p
= (unsigned char *)s
->init_buf
->data
;
2954 s
->init_num
= (int)len
+ SSL3_HM_HEADER_LENGTH
;
2958 int ssl3_handshake_write(SSL
*s
)
2960 return ssl3_do_write(s
, SSL3_RT_HANDSHAKE
);
2963 int ssl3_new(SSL
*s
)
2967 if ((s3
= OPENSSL_malloc(sizeof *s3
)) == NULL
)
2969 memset(s3
, 0, sizeof *s3
);
2970 memset(s3
->rrec
.seq_num
, 0, sizeof(s3
->rrec
.seq_num
));
2971 memset(s3
->wrec
.seq_num
, 0, sizeof(s3
->wrec
.seq_num
));
2975 #ifndef OPENSSL_NO_SRP
2976 SSL_SRP_CTX_init(s
);
2978 s
->method
->ssl_clear(s
);
2984 void ssl3_free(SSL
*s
)
2989 #ifdef TLSEXT_TYPE_opaque_prf_input
2990 if (s
->s3
->client_opaque_prf_input
!= NULL
)
2991 OPENSSL_free(s
->s3
->client_opaque_prf_input
);
2992 if (s
->s3
->server_opaque_prf_input
!= NULL
)
2993 OPENSSL_free(s
->s3
->server_opaque_prf_input
);
2996 ssl3_cleanup_key_block(s
);
2997 if (s
->s3
->rbuf
.buf
!= NULL
)
2998 ssl3_release_read_buffer(s
);
2999 if (s
->s3
->wbuf
.buf
!= NULL
)
3000 ssl3_release_write_buffer(s
);
3001 if (s
->s3
->rrec
.comp
!= NULL
)
3002 OPENSSL_free(s
->s3
->rrec
.comp
);
3003 #ifndef OPENSSL_NO_DH
3004 if (s
->s3
->tmp
.dh
!= NULL
)
3005 DH_free(s
->s3
->tmp
.dh
);
3007 #ifndef OPENSSL_NO_ECDH
3008 if (s
->s3
->tmp
.ecdh
!= NULL
)
3009 EC_KEY_free(s
->s3
->tmp
.ecdh
);
3012 if (s
->s3
->tmp
.ca_names
!= NULL
)
3013 sk_X509_NAME_pop_free(s
->s3
->tmp
.ca_names
, X509_NAME_free
);
3014 if (s
->s3
->handshake_buffer
) {
3015 BIO_free(s
->s3
->handshake_buffer
);
3017 if (s
->s3
->handshake_dgst
)
3018 ssl3_free_digest_list(s
);
3019 #ifndef OPENSSL_NO_TLSEXT
3020 if (s
->s3
->alpn_selected
)
3021 OPENSSL_free(s
->s3
->alpn_selected
);
3024 #ifndef OPENSSL_NO_SRP
3025 SSL_SRP_CTX_free(s
);
3027 OPENSSL_cleanse(s
->s3
, sizeof *s
->s3
);
3028 OPENSSL_free(s
->s3
);
3032 void ssl3_clear(SSL
*s
)
3034 unsigned char *rp
, *wp
;
3038 #ifdef TLSEXT_TYPE_opaque_prf_input
3039 if (s
->s3
->client_opaque_prf_input
!= NULL
)
3040 OPENSSL_free(s
->s3
->client_opaque_prf_input
);
3041 s
->s3
->client_opaque_prf_input
= NULL
;
3042 if (s
->s3
->server_opaque_prf_input
!= NULL
)
3043 OPENSSL_free(s
->s3
->server_opaque_prf_input
);
3044 s
->s3
->server_opaque_prf_input
= NULL
;
3047 ssl3_cleanup_key_block(s
);
3048 if (s
->s3
->tmp
.ca_names
!= NULL
)
3049 sk_X509_NAME_pop_free(s
->s3
->tmp
.ca_names
, X509_NAME_free
);
3051 if (s
->s3
->rrec
.comp
!= NULL
) {
3052 OPENSSL_free(s
->s3
->rrec
.comp
);
3053 s
->s3
->rrec
.comp
= NULL
;
3055 #ifndef OPENSSL_NO_DH
3056 if (s
->s3
->tmp
.dh
!= NULL
) {
3057 DH_free(s
->s3
->tmp
.dh
);
3058 s
->s3
->tmp
.dh
= NULL
;
3061 #ifndef OPENSSL_NO_ECDH
3062 if (s
->s3
->tmp
.ecdh
!= NULL
) {
3063 EC_KEY_free(s
->s3
->tmp
.ecdh
);
3064 s
->s3
->tmp
.ecdh
= NULL
;
3067 #ifndef OPENSSL_NO_TLSEXT
3068 # ifndef OPENSSL_NO_EC
3069 s
->s3
->is_probably_safari
= 0;
3070 # endif /* !OPENSSL_NO_EC */
3071 #endif /* !OPENSSL_NO_TLSEXT */
3073 rp
= s
->s3
->rbuf
.buf
;
3074 wp
= s
->s3
->wbuf
.buf
;
3075 rlen
= s
->s3
->rbuf
.len
;
3076 wlen
= s
->s3
->wbuf
.len
;
3077 init_extra
= s
->s3
->init_extra
;
3078 if (s
->s3
->handshake_buffer
) {
3079 BIO_free(s
->s3
->handshake_buffer
);
3080 s
->s3
->handshake_buffer
= NULL
;
3082 if (s
->s3
->handshake_dgst
) {
3083 ssl3_free_digest_list(s
);
3085 #if !defined(OPENSSL_NO_TLSEXT)
3086 if (s
->s3
->alpn_selected
) {
3087 free(s
->s3
->alpn_selected
);
3088 s
->s3
->alpn_selected
= NULL
;
3091 memset(s
->s3
, 0, sizeof *s
->s3
);
3092 s
->s3
->rbuf
.buf
= rp
;
3093 s
->s3
->wbuf
.buf
= wp
;
3094 s
->s3
->rbuf
.len
= rlen
;
3095 s
->s3
->wbuf
.len
= wlen
;
3096 s
->s3
->init_extra
= init_extra
;
3098 ssl_free_wbio_buffer(s
);
3100 s
->packet_length
= 0;
3101 s
->s3
->renegotiate
= 0;
3102 s
->s3
->total_renegotiations
= 0;
3103 s
->s3
->num_renegotiations
= 0;
3104 s
->s3
->in_read_app_data
= 0;
3105 s
->version
= SSL3_VERSION
;
3107 #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
3108 if (s
->next_proto_negotiated
) {
3109 OPENSSL_free(s
->next_proto_negotiated
);
3110 s
->next_proto_negotiated
= NULL
;
3111 s
->next_proto_negotiated_len
= 0;
3116 #ifndef OPENSSL_NO_SRP
3117 static char *MS_CALLBACK
srp_password_from_info_cb(SSL
*s
, void *arg
)
3119 return BUF_strdup(s
->srp_ctx
.info
);
3123 static int ssl3_set_req_cert_type(CERT
*c
, const unsigned char *p
,
3126 long ssl3_ctrl(SSL
*s
, int cmd
, long larg
, void *parg
)
3130 #if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_RSA)
3132 # ifndef OPENSSL_NO_RSA
3133 cmd
== SSL_CTRL_SET_TMP_RSA
|| cmd
== SSL_CTRL_SET_TMP_RSA_CB
||
3135 # ifndef OPENSSL_NO_DSA
3136 cmd
== SSL_CTRL_SET_TMP_DH
|| cmd
== SSL_CTRL_SET_TMP_DH_CB
||
3139 if (!ssl_cert_inst(&s
->cert
)) {
3140 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_MALLOC_FAILURE
);
3147 case SSL_CTRL_GET_SESSION_REUSED
:
3150 case SSL_CTRL_GET_CLIENT_CERT_REQUEST
:
3152 case SSL_CTRL_GET_NUM_RENEGOTIATIONS
:
3153 ret
= s
->s3
->num_renegotiations
;
3155 case SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS
:
3156 ret
= s
->s3
->num_renegotiations
;
3157 s
->s3
->num_renegotiations
= 0;
3159 case SSL_CTRL_GET_TOTAL_RENEGOTIATIONS
:
3160 ret
= s
->s3
->total_renegotiations
;
3162 case SSL_CTRL_GET_FLAGS
:
3163 ret
= (int)(s
->s3
->flags
);
3165 #ifndef OPENSSL_NO_RSA
3166 case SSL_CTRL_NEED_TMP_RSA
:
3167 if ((s
->cert
!= NULL
) && (s
->cert
->rsa_tmp
== NULL
) &&
3168 ((s
->cert
->pkeys
[SSL_PKEY_RSA_ENC
].privatekey
== NULL
) ||
3169 (EVP_PKEY_size(s
->cert
->pkeys
[SSL_PKEY_RSA_ENC
].privatekey
) >
3173 case SSL_CTRL_SET_TMP_RSA
:
3175 RSA
*rsa
= (RSA
*)parg
;
3177 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_PASSED_NULL_PARAMETER
);
3180 if ((rsa
= RSAPrivateKey_dup(rsa
)) == NULL
) {
3181 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_RSA_LIB
);
3184 if (s
->cert
->rsa_tmp
!= NULL
)
3185 RSA_free(s
->cert
->rsa_tmp
);
3186 s
->cert
->rsa_tmp
= rsa
;
3190 case SSL_CTRL_SET_TMP_RSA_CB
:
3192 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
);
3197 #ifndef OPENSSL_NO_DH
3198 case SSL_CTRL_SET_TMP_DH
:
3200 DH
*dh
= (DH
*)parg
;
3202 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_PASSED_NULL_PARAMETER
);
3205 if ((dh
= DHparams_dup(dh
)) == NULL
) {
3206 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_DH_LIB
);
3209 if (!(s
->options
& SSL_OP_SINGLE_DH_USE
)) {
3210 if (!DH_generate_key(dh
)) {
3212 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_DH_LIB
);
3216 if (s
->cert
->dh_tmp
!= NULL
)
3217 DH_free(s
->cert
->dh_tmp
);
3218 s
->cert
->dh_tmp
= dh
;
3222 case SSL_CTRL_SET_TMP_DH_CB
:
3224 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
);
3229 #ifndef OPENSSL_NO_ECDH
3230 case SSL_CTRL_SET_TMP_ECDH
:
3232 EC_KEY
*ecdh
= NULL
;
3235 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_PASSED_NULL_PARAMETER
);
3238 if (!EC_KEY_up_ref((EC_KEY
*)parg
)) {
3239 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_ECDH_LIB
);
3242 ecdh
= (EC_KEY
*)parg
;
3243 if (!(s
->options
& SSL_OP_SINGLE_ECDH_USE
)) {
3244 if (!EC_KEY_generate_key(ecdh
)) {
3246 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_ECDH_LIB
);
3250 if (s
->cert
->ecdh_tmp
!= NULL
)
3251 EC_KEY_free(s
->cert
->ecdh_tmp
);
3252 s
->cert
->ecdh_tmp
= ecdh
;
3256 case SSL_CTRL_SET_TMP_ECDH_CB
:
3258 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
);
3262 #endif /* !OPENSSL_NO_ECDH */
3263 #ifndef OPENSSL_NO_TLSEXT
3264 case SSL_CTRL_SET_TLSEXT_HOSTNAME
:
3265 if (larg
== TLSEXT_NAMETYPE_host_name
) {
3266 if (s
->tlsext_hostname
!= NULL
)
3267 OPENSSL_free(s
->tlsext_hostname
);
3268 s
->tlsext_hostname
= NULL
;
3273 if (strlen((char *)parg
) > TLSEXT_MAXLEN_host_name
) {
3274 SSLerr(SSL_F_SSL3_CTRL
, SSL_R_SSL3_EXT_INVALID_SERVERNAME
);
3277 if ((s
->tlsext_hostname
= BUF_strdup((char *)parg
)) == NULL
) {
3278 SSLerr(SSL_F_SSL3_CTRL
, ERR_R_INTERNAL_ERROR
);
3282 SSLerr(SSL_F_SSL3_CTRL
, SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE
);
3286 case SSL_CTRL_SET_TLSEXT_DEBUG_ARG
:
3287 s
->tlsext_debug_arg
= parg
;
3291 # ifdef TLSEXT_TYPE_opaque_prf_input
3292 case SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT
:
3293 if (larg
> 12288) { /* actual internal limit is 2^16 for the
3294 * complete hello message * (including the
3295 * cert chain and everything) */
3296 SSLerr(SSL_F_SSL3_CTRL
, SSL_R_OPAQUE_PRF_INPUT_TOO_LONG
);
3299 if (s
->tlsext_opaque_prf_input
!= NULL
)
3300 OPENSSL_free(s
->tlsext_opaque_prf_input
);
3301 if ((size_t)larg
== 0)
3302 s
->tlsext_opaque_prf_input
= OPENSSL_malloc(1); /* dummy byte
3306 s
->tlsext_opaque_prf_input
= BUF_memdup(parg
, (size_t)larg
);
3307 if (s
->tlsext_opaque_prf_input
!= NULL
) {
3308 s
->tlsext_opaque_prf_input_len
= (size_t)larg
;
3311 s
->tlsext_opaque_prf_input_len
= 0;
3315 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE
:
3316 s
->tlsext_status_type
= larg
;
3320 case SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS
:
3321 *(STACK_OF(X509_EXTENSION
) **)parg
= s
->tlsext_ocsp_exts
;
3325 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS
:
3326 s
->tlsext_ocsp_exts
= parg
;
3330 case SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS
:
3331 *(STACK_OF(OCSP_RESPID
) **)parg
= s
->tlsext_ocsp_ids
;
3335 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS
:
3336 s
->tlsext_ocsp_ids
= parg
;
3340 case SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP
:
3341 *(unsigned char **)parg
= s
->tlsext_ocsp_resp
;
3342 return s
->tlsext_ocsp_resplen
;
3344 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP
:
3345 if (s
->tlsext_ocsp_resp
)
3346 OPENSSL_free(s
->tlsext_ocsp_resp
);
3347 s
->tlsext_ocsp_resp
= parg
;
3348 s
->tlsext_ocsp_resplen
= larg
;
3352 # ifndef OPENSSL_NO_HEARTBEATS
3353 case SSL_CTRL_TLS_EXT_SEND_HEARTBEAT
:
3355 ret
= dtls1_heartbeat(s
);
3357 ret
= tls1_heartbeat(s
);
3360 case SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING
:
3361 ret
= s
->tlsext_hb_pending
;
3364 case SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS
:
3366 s
->tlsext_heartbeat
|= SSL_TLSEXT_HB_DONT_RECV_REQUESTS
;
3368 s
->tlsext_heartbeat
&= ~SSL_TLSEXT_HB_DONT_RECV_REQUESTS
;
3373 #endif /* !OPENSSL_NO_TLSEXT */
3375 case SSL_CTRL_CHAIN
:
3377 return ssl_cert_set1_chain(s
->cert
, (STACK_OF(X509
) *)parg
);
3379 return ssl_cert_set0_chain(s
->cert
, (STACK_OF(X509
) *)parg
);
3381 case SSL_CTRL_CHAIN_CERT
:
3383 return ssl_cert_add1_chain_cert(s
->cert
, (X509
*)parg
);
3385 return ssl_cert_add0_chain_cert(s
->cert
, (X509
*)parg
);
3387 case SSL_CTRL_GET_CHAIN_CERTS
:
3388 *(STACK_OF(X509
) **)parg
= s
->cert
->key
->chain
;
3391 case SSL_CTRL_SELECT_CURRENT_CERT
:
3392 return ssl_cert_select_current(s
->cert
, (X509
*)parg
);
3394 case SSL_CTRL_SET_CURRENT_CERT
:
3395 if (larg
== SSL_CERT_SET_SERVER
) {
3397 const SSL_CIPHER
*cipher
;
3400 cipher
= s
->s3
->tmp
.new_cipher
;
3404 * No certificate for unauthenticated ciphersuites or using SRP
3407 if (cipher
->algorithm_auth
& (SSL_aNULL
| SSL_aSRP
))
3409 cpk
= ssl_get_server_send_pkey(s
);
3415 return ssl_cert_set_current(s
->cert
, larg
);
3417 #ifndef OPENSSL_NO_EC
3418 case SSL_CTRL_GET_CURVES
:
3420 unsigned char *clist
;
3424 clist
= s
->session
->tlsext_ellipticcurvelist
;
3425 clistlen
= s
->session
->tlsext_ellipticcurvelist_length
/ 2;
3429 unsigned int cid
, nid
;
3430 for (i
= 0; i
< clistlen
; i
++) {
3432 nid
= tls1_ec_curve_id2nid(cid
);
3436 cptr
[i
] = TLSEXT_nid_unknown
| cid
;
3439 return (int)clistlen
;
3442 case SSL_CTRL_SET_CURVES
:
3443 return tls1_set_curves(&s
->tlsext_ellipticcurvelist
,
3444 &s
->tlsext_ellipticcurvelist_length
,
3447 case SSL_CTRL_SET_CURVES_LIST
:
3448 return tls1_set_curves_list(&s
->tlsext_ellipticcurvelist
,
3449 &s
->tlsext_ellipticcurvelist_length
,
3452 case SSL_CTRL_GET_SHARED_CURVE
:
3453 return tls1_shared_curve(s
, larg
);
3455 # ifndef OPENSSL_NO_ECDH
3456 case SSL_CTRL_SET_ECDH_AUTO
:
3457 s
->cert
->ecdh_tmp_auto
= larg
;
3461 case SSL_CTRL_SET_SIGALGS
:
3462 return tls1_set_sigalgs(s
->cert
, parg
, larg
, 0);
3464 case SSL_CTRL_SET_SIGALGS_LIST
:
3465 return tls1_set_sigalgs_list(s
->cert
, parg
, 0);
3467 case SSL_CTRL_SET_CLIENT_SIGALGS
:
3468 return tls1_set_sigalgs(s
->cert
, parg
, larg
, 1);
3470 case SSL_CTRL_SET_CLIENT_SIGALGS_LIST
:
3471 return tls1_set_sigalgs_list(s
->cert
, parg
, 1);
3473 case SSL_CTRL_GET_CLIENT_CERT_TYPES
:
3475 const unsigned char **pctype
= parg
;
3476 if (s
->server
|| !s
->s3
->tmp
.cert_req
)
3478 if (s
->cert
->ctypes
) {
3480 *pctype
= s
->cert
->ctypes
;
3481 return (int)s
->cert
->ctype_num
;
3484 *pctype
= (unsigned char *)s
->s3
->tmp
.ctype
;
3485 return s
->s3
->tmp
.ctype_num
;
3488 case SSL_CTRL_SET_CLIENT_CERT_TYPES
:
3491 return ssl3_set_req_cert_type(s
->cert
, parg
, larg
);
3493 case SSL_CTRL_BUILD_CERT_CHAIN
:
3494 return ssl_build_cert_chain(s
->cert
, s
->ctx
->cert_store
, larg
);
3496 case SSL_CTRL_SET_VERIFY_CERT_STORE
:
3497 return ssl_cert_set_cert_store(s
->cert
, parg
, 0, larg
);
3499 case SSL_CTRL_SET_CHAIN_CERT_STORE
:
3500 return ssl_cert_set_cert_store(s
->cert
, parg
, 1, larg
);
3502 case SSL_CTRL_GET_PEER_SIGNATURE_NID
:
3503 if (SSL_USE_SIGALGS(s
)) {
3504 if (s
->session
&& s
->session
->sess_cert
) {
3506 sig
= s
->session
->sess_cert
->peer_key
->digest
;
3508 *(int *)parg
= EVP_MD_type(sig
);
3514 /* Might want to do something here for other versions */
3518 case SSL_CTRL_GET_SERVER_TMP_KEY
:
3519 if (s
->server
|| !s
->session
|| !s
->session
->sess_cert
)
3525 sc
= s
->session
->sess_cert
;
3526 #if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DH) && !defined(OPENSSL_NO_EC) && !defined(OPENSSL_NO_ECDH)
3527 if (!sc
->peer_rsa_tmp
&& !sc
->peer_dh_tmp
&& !sc
->peer_ecdh_tmp
)
3530 ptmp
= EVP_PKEY_new();
3534 #ifndef OPENSSL_NO_RSA
3535 else if (sc
->peer_rsa_tmp
)
3536 rv
= EVP_PKEY_set1_RSA(ptmp
, sc
->peer_rsa_tmp
);
3538 #ifndef OPENSSL_NO_DH
3539 else if (sc
->peer_dh_tmp
)
3540 rv
= EVP_PKEY_set1_DH(ptmp
, sc
->peer_dh_tmp
);
3542 #ifndef OPENSSL_NO_ECDH
3543 else if (sc
->peer_ecdh_tmp
)
3544 rv
= EVP_PKEY_set1_EC_KEY(ptmp
, sc
->peer_ecdh_tmp
);
3547 *(EVP_PKEY
**)parg
= ptmp
;
3550 EVP_PKEY_free(ptmp
);
3553 #ifndef OPENSSL_NO_EC
3554 case SSL_CTRL_GET_EC_POINT_FORMATS
:
3556 SSL_SESSION
*sess
= s
->session
;
3557 const unsigned char **pformat
= parg
;
3558 if (!sess
|| !sess
->tlsext_ecpointformatlist
)
3560 *pformat
= sess
->tlsext_ecpointformatlist
;
3561 return (int)sess
->tlsext_ecpointformatlist_length
;
3565 case SSL_CTRL_CHECK_PROTO_VERSION
:
3567 * For library-internal use; checks that the current protocol is the
3568 * highest enabled version (according to s->ctx->method, as version
3569 * negotiation may have changed s->method).
3571 if (s
->version
== s
->ctx
->method
->version
)
3574 * Apparently we're using a version-flexible SSL_METHOD (not at its
3575 * highest protocol version).
3577 if (s
->ctx
->method
->version
== SSLv23_method()->version
) {
3578 #if TLS_MAX_VERSION != TLS1_2_VERSION
3579 # error Code needs update for SSLv23_method() support beyond TLS1_2_VERSION.
3581 if (!(s
->options
& SSL_OP_NO_TLSv1_2
))
3582 return s
->version
== TLS1_2_VERSION
;
3583 if (!(s
->options
& SSL_OP_NO_TLSv1_1
))
3584 return s
->version
== TLS1_1_VERSION
;
3585 if (!(s
->options
& SSL_OP_NO_TLSv1
))
3586 return s
->version
== TLS1_VERSION
;
3587 if (!(s
->options
& SSL_OP_NO_SSLv3
))
3588 return s
->version
== SSL3_VERSION
;
3589 if (!(s
->options
& SSL_OP_NO_SSLv2
))
3590 return s
->version
== SSL2_VERSION
;
3592 return 0; /* Unexpected state; fail closed. */
3600 long ssl3_callback_ctrl(SSL
*s
, int cmd
, void (*fp
) (void))
3604 #if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_RSA)
3606 # ifndef OPENSSL_NO_RSA
3607 cmd
== SSL_CTRL_SET_TMP_RSA_CB
||
3609 # ifndef OPENSSL_NO_DSA
3610 cmd
== SSL_CTRL_SET_TMP_DH_CB
||
3613 if (!ssl_cert_inst(&s
->cert
)) {
3614 SSLerr(SSL_F_SSL3_CALLBACK_CTRL
, ERR_R_MALLOC_FAILURE
);
3621 #ifndef OPENSSL_NO_RSA
3622 case SSL_CTRL_SET_TMP_RSA_CB
:
3624 s
->cert
->rsa_tmp_cb
= (RSA
*(*)(SSL
*, int, int))fp
;
3628 #ifndef OPENSSL_NO_DH
3629 case SSL_CTRL_SET_TMP_DH_CB
:
3631 s
->cert
->dh_tmp_cb
= (DH
*(*)(SSL
*, int, int))fp
;
3635 #ifndef OPENSSL_NO_ECDH
3636 case SSL_CTRL_SET_TMP_ECDH_CB
:
3638 s
->cert
->ecdh_tmp_cb
= (EC_KEY
*(*)(SSL
*, int, int))fp
;
3642 #ifndef OPENSSL_NO_TLSEXT
3643 case SSL_CTRL_SET_TLSEXT_DEBUG_CB
:
3644 s
->tlsext_debug_cb
= (void (*)(SSL
*, int, int,
3645 unsigned char *, int, void *))fp
;
3654 long ssl3_ctx_ctrl(SSL_CTX
*ctx
, int cmd
, long larg
, void *parg
)
3661 #ifndef OPENSSL_NO_RSA
3662 case SSL_CTRL_NEED_TMP_RSA
:
3663 if ((cert
->rsa_tmp
== NULL
) &&
3664 ((cert
->pkeys
[SSL_PKEY_RSA_ENC
].privatekey
== NULL
) ||
3665 (EVP_PKEY_size(cert
->pkeys
[SSL_PKEY_RSA_ENC
].privatekey
) >
3672 case SSL_CTRL_SET_TMP_RSA
:
3682 if ((rsa
= RSAPrivateKey_dup(rsa
)) == NULL
)
3686 SSLerr(SSL_F_SSL3_CTX_CTRL
, ERR_R_RSA_LIB
);
3689 if (cert
->rsa_tmp
!= NULL
)
3690 RSA_free(cert
->rsa_tmp
);
3691 cert
->rsa_tmp
= rsa
;
3696 case SSL_CTRL_SET_TMP_RSA_CB
:
3698 SSLerr(SSL_F_SSL3_CTX_CTRL
, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
);
3703 #ifndef OPENSSL_NO_DH
3704 case SSL_CTRL_SET_TMP_DH
:
3706 DH
*new = NULL
, *dh
;
3709 if ((new = DHparams_dup(dh
)) == NULL
) {
3710 SSLerr(SSL_F_SSL3_CTX_CTRL
, ERR_R_DH_LIB
);
3713 if (!(ctx
->options
& SSL_OP_SINGLE_DH_USE
)) {
3714 if (!DH_generate_key(new)) {
3715 SSLerr(SSL_F_SSL3_CTX_CTRL
, ERR_R_DH_LIB
);
3720 if (cert
->dh_tmp
!= NULL
)
3721 DH_free(cert
->dh_tmp
);
3728 case SSL_CTRL_SET_TMP_DH_CB
:
3730 SSLerr(SSL_F_SSL3_CTX_CTRL
, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
);
3735 #ifndef OPENSSL_NO_ECDH
3736 case SSL_CTRL_SET_TMP_ECDH
:
3738 EC_KEY
*ecdh
= NULL
;
3741 SSLerr(SSL_F_SSL3_CTX_CTRL
, ERR_R_ECDH_LIB
);
3744 ecdh
= EC_KEY_dup((EC_KEY
*)parg
);
3746 SSLerr(SSL_F_SSL3_CTX_CTRL
, ERR_R_EC_LIB
);
3749 if (!(ctx
->options
& SSL_OP_SINGLE_ECDH_USE
)) {
3750 if (!EC_KEY_generate_key(ecdh
)) {
3752 SSLerr(SSL_F_SSL3_CTX_CTRL
, ERR_R_ECDH_LIB
);
3757 if (cert
->ecdh_tmp
!= NULL
) {
3758 EC_KEY_free(cert
->ecdh_tmp
);
3760 cert
->ecdh_tmp
= ecdh
;
3764 case SSL_CTRL_SET_TMP_ECDH_CB
:
3766 SSLerr(SSL_F_SSL3_CTX_CTRL
, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED
);
3770 #endif /* !OPENSSL_NO_ECDH */
3771 #ifndef OPENSSL_NO_TLSEXT
3772 case SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG
:
3773 ctx
->tlsext_servername_arg
= parg
;
3775 case SSL_CTRL_SET_TLSEXT_TICKET_KEYS
:
3776 case SSL_CTRL_GET_TLSEXT_TICKET_KEYS
:
3778 unsigned char *keys
= parg
;
3782 SSLerr(SSL_F_SSL3_CTX_CTRL
, SSL_R_INVALID_TICKET_KEYS_LENGTH
);
3785 if (cmd
== SSL_CTRL_SET_TLSEXT_TICKET_KEYS
) {
3786 memcpy(ctx
->tlsext_tick_key_name
, keys
, 16);
3787 memcpy(ctx
->tlsext_tick_hmac_key
, keys
+ 16, 16);
3788 memcpy(ctx
->tlsext_tick_aes_key
, keys
+ 32, 16);
3790 memcpy(keys
, ctx
->tlsext_tick_key_name
, 16);
3791 memcpy(keys
+ 16, ctx
->tlsext_tick_hmac_key
, 16);
3792 memcpy(keys
+ 32, ctx
->tlsext_tick_aes_key
, 16);
3797 # ifdef TLSEXT_TYPE_opaque_prf_input
3798 case SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG
:
3799 ctx
->tlsext_opaque_prf_input_callback_arg
= parg
;
3803 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG
:
3804 ctx
->tlsext_status_arg
= parg
;
3808 # ifndef OPENSSL_NO_SRP
3809 case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME
:
3810 ctx
->srp_ctx
.srp_Mask
|= SSL_kSRP
;
3811 if (ctx
->srp_ctx
.login
!= NULL
)
3812 OPENSSL_free(ctx
->srp_ctx
.login
);
3813 ctx
->srp_ctx
.login
= NULL
;
3816 if (strlen((const char *)parg
) > 255
3817 || strlen((const char *)parg
) < 1) {
3818 SSLerr(SSL_F_SSL3_CTX_CTRL
, SSL_R_INVALID_SRP_USERNAME
);
3821 if ((ctx
->srp_ctx
.login
= BUF_strdup((char *)parg
)) == NULL
) {
3822 SSLerr(SSL_F_SSL3_CTX_CTRL
, ERR_R_INTERNAL_ERROR
);
3826 case SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD
:
3827 ctx
->srp_ctx
.SRP_give_srp_client_pwd_callback
=
3828 srp_password_from_info_cb
;
3829 ctx
->srp_ctx
.info
= parg
;
3831 case SSL_CTRL_SET_SRP_ARG
:
3832 ctx
->srp_ctx
.srp_Mask
|= SSL_kSRP
;
3833 ctx
->srp_ctx
.SRP_cb_arg
= parg
;
3836 case SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH
:
3837 ctx
->srp_ctx
.strength
= larg
;
3841 # ifndef OPENSSL_NO_EC
3842 case SSL_CTRL_SET_CURVES
:
3843 return tls1_set_curves(&ctx
->tlsext_ellipticcurvelist
,
3844 &ctx
->tlsext_ellipticcurvelist_length
,
3847 case SSL_CTRL_SET_CURVES_LIST
:
3848 return tls1_set_curves_list(&ctx
->tlsext_ellipticcurvelist
,
3849 &ctx
->tlsext_ellipticcurvelist_length
,
3851 # ifndef OPENSSL_NO_ECDH
3852 case SSL_CTRL_SET_ECDH_AUTO
:
3853 ctx
->cert
->ecdh_tmp_auto
= larg
;
3857 case SSL_CTRL_SET_SIGALGS
:
3858 return tls1_set_sigalgs(ctx
->cert
, parg
, larg
, 0);
3860 case SSL_CTRL_SET_SIGALGS_LIST
:
3861 return tls1_set_sigalgs_list(ctx
->cert
, parg
, 0);
3863 case SSL_CTRL_SET_CLIENT_SIGALGS
:
3864 return tls1_set_sigalgs(ctx
->cert
, parg
, larg
, 1);
3866 case SSL_CTRL_SET_CLIENT_SIGALGS_LIST
:
3867 return tls1_set_sigalgs_list(ctx
->cert
, parg
, 1);
3869 case SSL_CTRL_SET_CLIENT_CERT_TYPES
:
3870 return ssl3_set_req_cert_type(ctx
->cert
, parg
, larg
);
3872 case SSL_CTRL_BUILD_CERT_CHAIN
:
3873 return ssl_build_cert_chain(ctx
->cert
, ctx
->cert_store
, larg
);
3875 case SSL_CTRL_SET_VERIFY_CERT_STORE
:
3876 return ssl_cert_set_cert_store(ctx
->cert
, parg
, 0, larg
);
3878 case SSL_CTRL_SET_CHAIN_CERT_STORE
:
3879 return ssl_cert_set_cert_store(ctx
->cert
, parg
, 1, larg
);
3881 #endif /* !OPENSSL_NO_TLSEXT */
3883 /* A Thawte special :-) */
3884 case SSL_CTRL_EXTRA_CHAIN_CERT
:
3885 if (ctx
->extra_certs
== NULL
) {
3886 if ((ctx
->extra_certs
= sk_X509_new_null()) == NULL
)
3889 sk_X509_push(ctx
->extra_certs
, (X509
*)parg
);
3892 case SSL_CTRL_GET_EXTRA_CHAIN_CERTS
:
3893 if (ctx
->extra_certs
== NULL
&& larg
== 0)
3894 *(STACK_OF(X509
) **)parg
= ctx
->cert
->key
->chain
;
3896 *(STACK_OF(X509
) **)parg
= ctx
->extra_certs
;
3899 case SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS
:
3900 if (ctx
->extra_certs
) {
3901 sk_X509_pop_free(ctx
->extra_certs
, X509_free
);
3902 ctx
->extra_certs
= NULL
;
3906 case SSL_CTRL_CHAIN
:
3908 return ssl_cert_set1_chain(ctx
->cert
, (STACK_OF(X509
) *)parg
);
3910 return ssl_cert_set0_chain(ctx
->cert
, (STACK_OF(X509
) *)parg
);
3912 case SSL_CTRL_CHAIN_CERT
:
3914 return ssl_cert_add1_chain_cert(ctx
->cert
, (X509
*)parg
);
3916 return ssl_cert_add0_chain_cert(ctx
->cert
, (X509
*)parg
);
3918 case SSL_CTRL_GET_CHAIN_CERTS
:
3919 *(STACK_OF(X509
) **)parg
= ctx
->cert
->key
->chain
;
3922 case SSL_CTRL_SELECT_CURRENT_CERT
:
3923 return ssl_cert_select_current(ctx
->cert
, (X509
*)parg
);
3925 case SSL_CTRL_SET_CURRENT_CERT
:
3926 return ssl_cert_set_current(ctx
->cert
, larg
);
3934 long ssl3_ctx_callback_ctrl(SSL_CTX
*ctx
, int cmd
, void (*fp
) (void))
3941 #ifndef OPENSSL_NO_RSA
3942 case SSL_CTRL_SET_TMP_RSA_CB
:
3944 cert
->rsa_tmp_cb
= (RSA
*(*)(SSL
*, int, int))fp
;
3948 #ifndef OPENSSL_NO_DH
3949 case SSL_CTRL_SET_TMP_DH_CB
:
3951 cert
->dh_tmp_cb
= (DH
*(*)(SSL
*, int, int))fp
;
3955 #ifndef OPENSSL_NO_ECDH
3956 case SSL_CTRL_SET_TMP_ECDH_CB
:
3958 cert
->ecdh_tmp_cb
= (EC_KEY
*(*)(SSL
*, int, int))fp
;
3962 #ifndef OPENSSL_NO_TLSEXT
3963 case SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
:
3964 ctx
->tlsext_servername_callback
= (int (*)(SSL
*, int *, void *))fp
;
3967 # ifdef TLSEXT_TYPE_opaque_prf_input
3968 case SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB
:
3969 ctx
->tlsext_opaque_prf_input_callback
=
3970 (int (*)(SSL
*, void *, size_t, void *))fp
;
3974 case SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB
:
3975 ctx
->tlsext_status_cb
= (int (*)(SSL
*, void *))fp
;
3978 case SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB
:
3979 ctx
->tlsext_ticket_key_cb
= (int (*)(SSL
*, unsigned char *,
3982 HMAC_CTX
*, int))fp
;
3985 # ifndef OPENSSL_NO_SRP
3986 case SSL_CTRL_SET_SRP_VERIFY_PARAM_CB
:
3987 ctx
->srp_ctx
.srp_Mask
|= SSL_kSRP
;
3988 ctx
->srp_ctx
.SRP_verify_param_callback
= (int (*)(SSL
*, void *))fp
;
3990 case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB
:
3991 ctx
->srp_ctx
.srp_Mask
|= SSL_kSRP
;
3992 ctx
->srp_ctx
.TLS_ext_srp_username_callback
=
3993 (int (*)(SSL
*, int *, void *))fp
;
3995 case SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB
:
3996 ctx
->srp_ctx
.srp_Mask
|= SSL_kSRP
;
3997 ctx
->srp_ctx
.SRP_give_srp_client_pwd_callback
=
3998 (char *(*)(SSL
*, void *))fp
;
4009 * This function needs to check if the ciphers required are actually
4012 const SSL_CIPHER
*ssl3_get_cipher_by_char(const unsigned char *p
)
4015 const SSL_CIPHER
*cp
;
4018 id
= 0x03000000L
| ((unsigned long)p
[0] << 8L) | (unsigned long)p
[1];
4020 cp
= OBJ_bsearch_ssl_cipher_id(&c
, ssl3_ciphers
, SSL3_NUM_CIPHERS
);
4021 #ifdef DEBUG_PRINT_UNKNOWN_CIPHERSUITES
4023 fprintf(stderr
, "Unknown cipher ID %x\n", (p
[0] << 8) | p
[1]);
4028 int ssl3_put_cipher_by_char(const SSL_CIPHER
*c
, unsigned char *p
)
4034 if ((l
& 0xff000000) != 0x03000000)
4036 p
[0] = ((unsigned char)(l
>> 8L)) & 0xFF;
4037 p
[1] = ((unsigned char)(l
)) & 0xFF;
4042 SSL_CIPHER
*ssl3_choose_cipher(SSL
*s
, STACK_OF(SSL_CIPHER
) *clnt
,
4043 STACK_OF(SSL_CIPHER
) *srvr
)
4045 SSL_CIPHER
*c
, *ret
= NULL
;
4046 STACK_OF(SSL_CIPHER
) *prio
, *allow
;
4049 unsigned long alg_k
, alg_a
, mask_k
, mask_a
, emask_k
, emask_a
;
4051 /* Let's see which ciphers we can support */
4056 * Do not set the compare functions, because this may lead to a
4057 * reordering by "id". We want to keep the original ordering. We may pay
4058 * a price in performance during sk_SSL_CIPHER_find(), but would have to
4059 * pay with the price of sk_SSL_CIPHER_dup().
4061 sk_SSL_CIPHER_set_cmp_func(srvr
, ssl_cipher_ptr_id_cmp
);
4062 sk_SSL_CIPHER_set_cmp_func(clnt
, ssl_cipher_ptr_id_cmp
);
4066 fprintf(stderr
, "Server has %d from %p:\n", sk_SSL_CIPHER_num(srvr
),
4068 for (i
= 0; i
< sk_SSL_CIPHER_num(srvr
); ++i
) {
4069 c
= sk_SSL_CIPHER_value(srvr
, i
);
4070 fprintf(stderr
, "%p:%s\n", (void *)c
, c
->name
);
4072 fprintf(stderr
, "Client sent %d from %p:\n", sk_SSL_CIPHER_num(clnt
),
4074 for (i
= 0; i
< sk_SSL_CIPHER_num(clnt
); ++i
) {
4075 c
= sk_SSL_CIPHER_value(clnt
, i
);
4076 fprintf(stderr
, "%p:%s\n", (void *)c
, c
->name
);
4080 if (s
->options
& SSL_OP_CIPHER_SERVER_PREFERENCE
|| tls1_suiteb(s
)) {
4088 tls1_set_cert_validity(s
);
4090 for (i
= 0; i
< sk_SSL_CIPHER_num(prio
); i
++) {
4091 c
= sk_SSL_CIPHER_value(prio
, i
);
4093 /* Skip TLS v1.2 only ciphersuites if not supported */
4094 if ((c
->algorithm_ssl
& SSL_TLSV1_2
) && !SSL_USE_TLS1_2_CIPHERS(s
))
4097 ssl_set_cert_masks(cert
, c
);
4098 mask_k
= cert
->mask_k
;
4099 mask_a
= cert
->mask_a
;
4100 emask_k
= cert
->export_mask_k
;
4101 emask_a
= cert
->export_mask_a
;
4102 #ifndef OPENSSL_NO_SRP
4103 if (s
->srp_ctx
.srp_Mask
& SSL_kSRP
) {
4105 emask_k
|= SSL_kSRP
;
4107 emask_a
|= SSL_aSRP
;
4113 * fprintf(stderr,"ssl3_choose_cipher %d alg= %lx\n",
4116 #endif /* KSSL_DEBUG */
4118 alg_k
= c
->algorithm_mkey
;
4119 alg_a
= c
->algorithm_auth
;
4121 #ifndef OPENSSL_NO_KRB5
4122 if (alg_k
& SSL_kKRB5
) {
4123 if (!kssl_keytab_is_available(s
->kssl_ctx
))
4126 #endif /* OPENSSL_NO_KRB5 */
4127 #ifndef OPENSSL_NO_PSK
4128 /* with PSK there must be server callback set */
4129 if ((alg_k
& SSL_kPSK
) && s
->psk_server_callback
== NULL
)
4131 #endif /* OPENSSL_NO_PSK */
4133 if (SSL_C_IS_EXPORT(c
)) {
4134 ok
= (alg_k
& emask_k
) && (alg_a
& emask_a
);
4136 fprintf(stderr
, "%d:[%08lX:%08lX:%08lX:%08lX]%p:%s (export)\n",
4137 ok
, alg_k
, alg_a
, emask_k
, emask_a
, (void *)c
, c
->name
);
4140 ok
= (alg_k
& mask_k
) && (alg_a
& mask_a
);
4142 fprintf(stderr
, "%d:[%08lX:%08lX:%08lX:%08lX]%p:%s\n", ok
, alg_k
,
4143 alg_a
, mask_k
, mask_a
, (void *)c
, c
->name
);
4147 #ifndef OPENSSL_NO_TLSEXT
4148 # ifndef OPENSSL_NO_EC
4149 # ifndef OPENSSL_NO_ECDH
4151 * if we are considering an ECC cipher suite that uses an ephemeral
4154 if (alg_k
& SSL_kEECDH
)
4155 ok
= ok
&& tls1_check_ec_tmp_key(s
, c
->id
);
4156 # endif /* OPENSSL_NO_ECDH */
4157 # endif /* OPENSSL_NO_EC */
4158 #endif /* OPENSSL_NO_TLSEXT */
4162 ii
= sk_SSL_CIPHER_find(allow
, c
);
4164 #if !defined(OPENSSL_NO_EC) && !defined(OPENSSL_NO_TLSEXT)
4165 if ((alg_k
& SSL_kEECDH
) && (alg_a
& SSL_aECDSA
)
4166 && s
->s3
->is_probably_safari
) {
4168 ret
= sk_SSL_CIPHER_value(allow
, ii
);
4172 ret
= sk_SSL_CIPHER_value(allow
, ii
);
4179 int ssl3_get_req_cert_type(SSL
*s
, unsigned char *p
)
4182 const unsigned char *sig
;
4184 int have_rsa_sign
= 0, have_dsa_sign
= 0;
4185 #ifndef OPENSSL_NO_ECDSA
4186 int have_ecdsa_sign
= 0;
4189 unsigned long alg_k
;
4191 /* If we have custom certificate types set, use them */
4192 if (s
->cert
->ctypes
) {
4193 memcpy(p
, s
->cert
->ctypes
, s
->cert
->ctype_num
);
4194 return (int)s
->cert
->ctype_num
;
4196 /* get configured sigalgs */
4197 siglen
= tls12_get_psigalgs(s
, &sig
);
4198 if (s
->cert
->cert_flags
& SSL_CERT_FLAGS_CHECK_TLS_STRICT
)
4200 for (i
= 0; i
< siglen
; i
+= 2, sig
+= 2) {
4202 case TLSEXT_signature_rsa
:
4206 case TLSEXT_signature_dsa
:
4209 #ifndef OPENSSL_NO_ECDSA
4210 case TLSEXT_signature_ecdsa
:
4211 have_ecdsa_sign
= 1;
4217 alg_k
= s
->s3
->tmp
.new_cipher
->algorithm_mkey
;
4219 #ifndef OPENSSL_NO_GOST
4220 if (s
->version
>= TLS1_VERSION
) {
4221 if (alg_k
& SSL_kGOST
) {
4222 p
[ret
++] = TLS_CT_GOST94_SIGN
;
4223 p
[ret
++] = TLS_CT_GOST01_SIGN
;
4229 #ifndef OPENSSL_NO_DH
4230 if (alg_k
& (SSL_kDHr
| SSL_kEDH
)) {
4231 # ifndef OPENSSL_NO_RSA
4233 * Since this refers to a certificate signed with an RSA algorithm,
4234 * only check for rsa signing in strict mode.
4236 if (nostrict
|| have_rsa_sign
)
4237 p
[ret
++] = SSL3_CT_RSA_FIXED_DH
;
4239 # ifndef OPENSSL_NO_DSA
4240 if (nostrict
|| have_dsa_sign
)
4241 p
[ret
++] = SSL3_CT_DSS_FIXED_DH
;
4244 if ((s
->version
== SSL3_VERSION
) &&
4245 (alg_k
& (SSL_kEDH
| SSL_kDHd
| SSL_kDHr
))) {
4246 # ifndef OPENSSL_NO_RSA
4247 p
[ret
++] = SSL3_CT_RSA_EPHEMERAL_DH
;
4249 # ifndef OPENSSL_NO_DSA
4250 p
[ret
++] = SSL3_CT_DSS_EPHEMERAL_DH
;
4253 #endif /* !OPENSSL_NO_DH */
4254 #ifndef OPENSSL_NO_RSA
4256 p
[ret
++] = SSL3_CT_RSA_SIGN
;
4258 #ifndef OPENSSL_NO_DSA
4260 p
[ret
++] = SSL3_CT_DSS_SIGN
;
4262 #ifndef OPENSSL_NO_ECDH
4263 if ((alg_k
& (SSL_kECDHr
| SSL_kECDHe
)) && (s
->version
>= TLS1_VERSION
)) {
4264 if (nostrict
|| have_rsa_sign
)
4265 p
[ret
++] = TLS_CT_RSA_FIXED_ECDH
;
4266 if (nostrict
|| have_ecdsa_sign
)
4267 p
[ret
++] = TLS_CT_ECDSA_FIXED_ECDH
;
4271 #ifndef OPENSSL_NO_ECDSA
4273 * ECDSA certs can be used with RSA cipher suites as well so we don't
4274 * need to check for SSL_kECDH or SSL_kEECDH
4276 if (s
->version
>= TLS1_VERSION
) {
4277 if (have_ecdsa_sign
)
4278 p
[ret
++] = TLS_CT_ECDSA_SIGN
;
4284 static int ssl3_set_req_cert_type(CERT
*c
, const unsigned char *p
, size_t len
)
4287 OPENSSL_free(c
->ctypes
);
4294 c
->ctypes
= OPENSSL_malloc(len
);
4297 memcpy(c
->ctypes
, p
, len
);
4302 int ssl3_shutdown(SSL
*s
)
4307 * Don't do anything much if we have not done the handshake or we don't
4308 * want to send messages :-)
4310 if ((s
->quiet_shutdown
) || (s
->state
== SSL_ST_BEFORE
)) {
4311 s
->shutdown
= (SSL_SENT_SHUTDOWN
| SSL_RECEIVED_SHUTDOWN
);
4315 if (!(s
->shutdown
& SSL_SENT_SHUTDOWN
)) {
4316 s
->shutdown
|= SSL_SENT_SHUTDOWN
;
4318 ssl3_send_alert(s
, SSL3_AL_WARNING
, SSL_AD_CLOSE_NOTIFY
);
4321 * our shutdown alert has been sent now, and if it still needs to be
4322 * written, s->s3->alert_dispatch will be true
4324 if (s
->s3
->alert_dispatch
)
4325 return (-1); /* return WANT_WRITE */
4326 } else if (s
->s3
->alert_dispatch
) {
4327 /* resend it if not sent */
4329 ret
= s
->method
->ssl_dispatch_alert(s
);
4332 * we only get to return -1 here the 2nd/Nth invocation, we must
4333 * have already signalled return 0 upon a previous invoation,
4339 } else if (!(s
->shutdown
& SSL_RECEIVED_SHUTDOWN
)) {
4341 * If we are waiting for a close from our peer, we are closed
4343 s
->method
->ssl_read_bytes(s
, 0, NULL
, 0, 0);
4344 if (!(s
->shutdown
& SSL_RECEIVED_SHUTDOWN
)) {
4345 return (-1); /* return WANT_READ */
4349 if ((s
->shutdown
== (SSL_SENT_SHUTDOWN
| SSL_RECEIVED_SHUTDOWN
)) &&
4350 !s
->s3
->alert_dispatch
)
4356 int ssl3_write(SSL
*s
, const void *buf
, int len
)
4361 if (s
->shutdown
& SSL_SEND_SHUTDOWN
) {
4362 s
->rwstate
= SSL_NOTHING
;
4367 if (s
->s3
->renegotiate
)
4368 ssl3_renegotiate_check(s
);
4371 * This is an experimental flag that sends the last handshake message in
4372 * the same packet as the first use data - used to see if it helps the
4373 * TCP protocol during session-id reuse
4375 /* The second test is because the buffer may have been removed */
4376 if ((s
->s3
->flags
& SSL3_FLAGS_POP_BUFFER
) && (s
->wbio
== s
->bbio
)) {
4377 /* First time through, we write into the buffer */
4378 if (s
->s3
->delay_buf_pop_ret
== 0) {
4379 ret
= ssl3_write_bytes(s
, SSL3_RT_APPLICATION_DATA
, buf
, len
);
4383 s
->s3
->delay_buf_pop_ret
= ret
;
4386 s
->rwstate
= SSL_WRITING
;
4387 n
= BIO_flush(s
->wbio
);
4390 s
->rwstate
= SSL_NOTHING
;
4392 /* We have flushed the buffer, so remove it */
4393 ssl_free_wbio_buffer(s
);
4394 s
->s3
->flags
&= ~SSL3_FLAGS_POP_BUFFER
;
4396 ret
= s
->s3
->delay_buf_pop_ret
;
4397 s
->s3
->delay_buf_pop_ret
= 0;
4399 ret
= s
->method
->ssl_write_bytes(s
, SSL3_RT_APPLICATION_DATA
,
4408 static int ssl3_read_internal(SSL
*s
, void *buf
, int len
, int peek
)
4413 if (s
->s3
->renegotiate
)
4414 ssl3_renegotiate_check(s
);
4415 s
->s3
->in_read_app_data
= 1;
4417 s
->method
->ssl_read_bytes(s
, SSL3_RT_APPLICATION_DATA
, buf
, len
,
4419 if ((ret
== -1) && (s
->s3
->in_read_app_data
== 2)) {
4421 * ssl3_read_bytes decided to call s->handshake_func, which called
4422 * ssl3_read_bytes to read handshake data. However, ssl3_read_bytes
4423 * actually found application data and thinks that application data
4424 * makes sense here; so disable handshake processing and try to read
4425 * application data again.
4429 s
->method
->ssl_read_bytes(s
, SSL3_RT_APPLICATION_DATA
, buf
, len
,
4433 s
->s3
->in_read_app_data
= 0;
4438 int ssl3_read(SSL
*s
, void *buf
, int len
)
4440 return ssl3_read_internal(s
, buf
, len
, 0);
4443 int ssl3_peek(SSL
*s
, void *buf
, int len
)
4445 return ssl3_read_internal(s
, buf
, len
, 1);
4448 int ssl3_renegotiate(SSL
*s
)
4450 if (s
->handshake_func
== NULL
)
4453 if (s
->s3
->flags
& SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS
)
4456 s
->s3
->renegotiate
= 1;
4460 int ssl3_renegotiate_check(SSL
*s
)
4464 if (s
->s3
->renegotiate
) {
4465 if ((s
->s3
->rbuf
.left
== 0) &&
4466 (s
->s3
->wbuf
.left
== 0) && !SSL_in_init(s
)) {
4468 * if we are the server, and we have sent a 'RENEGOTIATE'
4469 * message, we need to go to SSL_ST_ACCEPT.
4472 s
->state
= SSL_ST_RENEGOTIATE
;
4473 s
->s3
->renegotiate
= 0;
4474 s
->s3
->num_renegotiations
++;
4475 s
->s3
->total_renegotiations
++;
4483 * If we are using default SHA1+MD5 algorithms switch to new SHA256 PRF and
4484 * handshake macs if required.
4486 long ssl_get_algorithm2(SSL
*s
)
4488 long alg2
= s
->s3
->tmp
.new_cipher
->algorithm2
;
4489 if (s
->method
->ssl3_enc
->enc_flags
& SSL_ENC_FLAG_SHA256_PRF
4490 && alg2
== (SSL_HANDSHAKE_MAC_DEFAULT
| TLS1_PRF
))
4491 return SSL_HANDSHAKE_MAC_SHA256
| TLS1_PRF_SHA256
;