OSDN Git Service

Update OpenSSL to 1.0.2a.
[ffftp/ffftp.git] / contrib / openssl / include / openssl / ssl3.h
1 /* ssl/ssl3.h */\r
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r
3  * All rights reserved.\r
4  *\r
5  * This package is an SSL implementation written\r
6  * by Eric Young (eay@cryptsoft.com).\r
7  * The implementation was written so as to conform with Netscapes SSL.\r
8  *\r
9  * This library is free for commercial and non-commercial use as long as\r
10  * the following conditions are aheared to.  The following conditions\r
11  * apply to all code found in this distribution, be it the RC4, RSA,\r
12  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\r
13  * included with this distribution is covered by the same copyright terms\r
14  * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r
15  *\r
16  * Copyright remains Eric Young's, and as such any Copyright notices in\r
17  * the code are not to be removed.\r
18  * If this package is used in a product, Eric Young should be given attribution\r
19  * as the author of the parts of the library used.\r
20  * This can be in the form of a textual message at program startup or\r
21  * in documentation (online or textual) provided with the package.\r
22  *\r
23  * Redistribution and use in source and binary forms, with or without\r
24  * modification, are permitted provided that the following conditions\r
25  * are met:\r
26  * 1. Redistributions of source code must retain the copyright\r
27  *    notice, this list of conditions and the following disclaimer.\r
28  * 2. Redistributions in binary form must reproduce the above copyright\r
29  *    notice, this list of conditions and the following disclaimer in the\r
30  *    documentation and/or other materials provided with the distribution.\r
31  * 3. All advertising materials mentioning features or use of this software\r
32  *    must display the following acknowledgement:\r
33  *    "This product includes cryptographic software written by\r
34  *     Eric Young (eay@cryptsoft.com)"\r
35  *    The word 'cryptographic' can be left out if the rouines from the library\r
36  *    being used are not cryptographic related :-).\r
37  * 4. If you include any Windows specific code (or a derivative thereof) from\r
38  *    the apps directory (application code) you must include an acknowledgement:\r
39  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"\r
40  *\r
41  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r
42  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
43  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
44  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r
45  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
46  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
47  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
48  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
49  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
50  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
51  * SUCH DAMAGE.\r
52  *\r
53  * The licence and distribution terms for any publically available version or\r
54  * derivative of this code cannot be changed.  i.e. this code cannot simply be\r
55  * copied and put under another distribution licence\r
56  * [including the GNU Public Licence.]\r
57  */\r
58 /* ====================================================================\r
59  * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.\r
60  *\r
61  * Redistribution and use in source and binary forms, with or without\r
62  * modification, are permitted provided that the following conditions\r
63  * are met:\r
64  *\r
65  * 1. Redistributions of source code must retain the above copyright\r
66  *    notice, this list of conditions and the following disclaimer.\r
67  *\r
68  * 2. Redistributions in binary form must reproduce the above copyright\r
69  *    notice, this list of conditions and the following disclaimer in\r
70  *    the documentation and/or other materials provided with the\r
71  *    distribution.\r
72  *\r
73  * 3. All advertising materials mentioning features or use of this\r
74  *    software must display the following acknowledgment:\r
75  *    "This product includes software developed by the OpenSSL Project\r
76  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"\r
77  *\r
78  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to\r
79  *    endorse or promote products derived from this software without\r
80  *    prior written permission. For written permission, please contact\r
81  *    openssl-core@openssl.org.\r
82  *\r
83  * 5. Products derived from this software may not be called "OpenSSL"\r
84  *    nor may "OpenSSL" appear in their names without prior written\r
85  *    permission of the OpenSSL Project.\r
86  *\r
87  * 6. Redistributions of any form whatsoever must retain the following\r
88  *    acknowledgment:\r
89  *    "This product includes software developed by the OpenSSL Project\r
90  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"\r
91  *\r
92  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\r
93  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
94  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
95  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\r
96  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
97  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r
98  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
99  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
100  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r
101  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
102  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r
103  * OF THE POSSIBILITY OF SUCH DAMAGE.\r
104  * ====================================================================\r
105  *\r
106  * This product includes cryptographic software written by Eric Young\r
107  * (eay@cryptsoft.com).  This product includes software written by Tim\r
108  * Hudson (tjh@cryptsoft.com).\r
109  *\r
110  */\r
111 /* ====================================================================\r
112  * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\r
113  * ECC cipher suite support in OpenSSL originally developed by\r
114  * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.\r
115  */\r
116 \r
117 #ifndef HEADER_SSL3_H\r
118 # define HEADER_SSL3_H\r
119 \r
120 # ifndef OPENSSL_NO_COMP\r
121 #  include <openssl/comp.h>\r
122 # endif\r
123 # include <openssl/buffer.h>\r
124 # include <openssl/evp.h>\r
125 # include <openssl/ssl.h>\r
126 \r
127 #ifdef  __cplusplus\r
128 extern "C" {\r
129 #endif\r
130 \r
131 /*\r
132  * Signalling cipher suite value from RFC 5746\r
133  * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV)\r
134  */\r
135 # define SSL3_CK_SCSV                            0x030000FF\r
136 \r
137 /*\r
138  * Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00\r
139  * (TLS_FALLBACK_SCSV)\r
140  */\r
141 # define SSL3_CK_FALLBACK_SCSV                   0x03005600\r
142 \r
143 # define SSL3_CK_RSA_NULL_MD5                    0x03000001\r
144 # define SSL3_CK_RSA_NULL_SHA                    0x03000002\r
145 # define SSL3_CK_RSA_RC4_40_MD5                  0x03000003\r
146 # define SSL3_CK_RSA_RC4_128_MD5                 0x03000004\r
147 # define SSL3_CK_RSA_RC4_128_SHA                 0x03000005\r
148 # define SSL3_CK_RSA_RC2_40_MD5                  0x03000006\r
149 # define SSL3_CK_RSA_IDEA_128_SHA                0x03000007\r
150 # define SSL3_CK_RSA_DES_40_CBC_SHA              0x03000008\r
151 # define SSL3_CK_RSA_DES_64_CBC_SHA              0x03000009\r
152 # define SSL3_CK_RSA_DES_192_CBC3_SHA            0x0300000A\r
153 \r
154 # define SSL3_CK_DH_DSS_DES_40_CBC_SHA           0x0300000B\r
155 # define SSL3_CK_DH_DSS_DES_64_CBC_SHA           0x0300000C\r
156 # define SSL3_CK_DH_DSS_DES_192_CBC3_SHA         0x0300000D\r
157 # define SSL3_CK_DH_RSA_DES_40_CBC_SHA           0x0300000E\r
158 # define SSL3_CK_DH_RSA_DES_64_CBC_SHA           0x0300000F\r
159 # define SSL3_CK_DH_RSA_DES_192_CBC3_SHA         0x03000010\r
160 \r
161 # define SSL3_CK_EDH_DSS_DES_40_CBC_SHA          0x03000011\r
162 # define SSL3_CK_DHE_DSS_DES_40_CBC_SHA          SSL3_CK_EDH_DSS_DES_40_CBC_SHA\r
163 # define SSL3_CK_EDH_DSS_DES_64_CBC_SHA          0x03000012\r
164 # define SSL3_CK_DHE_DSS_DES_64_CBC_SHA          SSL3_CK_EDH_DSS_DES_64_CBC_SHA\r
165 # define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA        0x03000013\r
166 # define SSL3_CK_DHE_DSS_DES_192_CBC3_SHA        SSL3_CK_EDH_DSS_DES_192_CBC3_SHA\r
167 # define SSL3_CK_EDH_RSA_DES_40_CBC_SHA          0x03000014\r
168 # define SSL3_CK_DHE_RSA_DES_40_CBC_SHA          SSL3_CK_EDH_RSA_DES_40_CBC_SHA\r
169 # define SSL3_CK_EDH_RSA_DES_64_CBC_SHA          0x03000015\r
170 # define SSL3_CK_DHE_RSA_DES_64_CBC_SHA          SSL3_CK_EDH_RSA_DES_64_CBC_SHA\r
171 # define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA        0x03000016\r
172 # define SSL3_CK_DHE_RSA_DES_192_CBC3_SHA        SSL3_CK_EDH_RSA_DES_192_CBC3_SHA\r
173 \r
174 # define SSL3_CK_ADH_RC4_40_MD5                  0x03000017\r
175 # define SSL3_CK_ADH_RC4_128_MD5                 0x03000018\r
176 # define SSL3_CK_ADH_DES_40_CBC_SHA              0x03000019\r
177 # define SSL3_CK_ADH_DES_64_CBC_SHA              0x0300001A\r
178 # define SSL3_CK_ADH_DES_192_CBC_SHA             0x0300001B\r
179 \r
180 # if 0\r
181 #  define SSL3_CK_FZA_DMS_NULL_SHA                0x0300001C\r
182 #  define SSL3_CK_FZA_DMS_FZA_SHA                 0x0300001D\r
183 #  if 0                         /* Because it clashes with KRB5, is never\r
184                                  * used any more, and is safe to remove\r
185                                  * according to David Hopwood\r
186                                  * <david.hopwood@zetnet.co.uk> of the\r
187                                  * ietf-tls list */\r
188 #   define SSL3_CK_FZA_DMS_RC4_SHA                 0x0300001E\r
189 #  endif\r
190 # endif\r
191 \r
192 /*\r
193  * VRS Additional Kerberos5 entries\r
194  */\r
195 # define SSL3_CK_KRB5_DES_64_CBC_SHA             0x0300001E\r
196 # define SSL3_CK_KRB5_DES_192_CBC3_SHA           0x0300001F\r
197 # define SSL3_CK_KRB5_RC4_128_SHA                0x03000020\r
198 # define SSL3_CK_KRB5_IDEA_128_CBC_SHA           0x03000021\r
199 # define SSL3_CK_KRB5_DES_64_CBC_MD5             0x03000022\r
200 # define SSL3_CK_KRB5_DES_192_CBC3_MD5           0x03000023\r
201 # define SSL3_CK_KRB5_RC4_128_MD5                0x03000024\r
202 # define SSL3_CK_KRB5_IDEA_128_CBC_MD5           0x03000025\r
203 \r
204 # define SSL3_CK_KRB5_DES_40_CBC_SHA             0x03000026\r
205 # define SSL3_CK_KRB5_RC2_40_CBC_SHA             0x03000027\r
206 # define SSL3_CK_KRB5_RC4_40_SHA                 0x03000028\r
207 # define SSL3_CK_KRB5_DES_40_CBC_MD5             0x03000029\r
208 # define SSL3_CK_KRB5_RC2_40_CBC_MD5             0x0300002A\r
209 # define SSL3_CK_KRB5_RC4_40_MD5                 0x0300002B\r
210 \r
211 # define SSL3_TXT_RSA_NULL_MD5                   "NULL-MD5"\r
212 # define SSL3_TXT_RSA_NULL_SHA                   "NULL-SHA"\r
213 # define SSL3_TXT_RSA_RC4_40_MD5                 "EXP-RC4-MD5"\r
214 # define SSL3_TXT_RSA_RC4_128_MD5                "RC4-MD5"\r
215 # define SSL3_TXT_RSA_RC4_128_SHA                "RC4-SHA"\r
216 # define SSL3_TXT_RSA_RC2_40_MD5                 "EXP-RC2-CBC-MD5"\r
217 # define SSL3_TXT_RSA_IDEA_128_SHA               "IDEA-CBC-SHA"\r
218 # define SSL3_TXT_RSA_DES_40_CBC_SHA             "EXP-DES-CBC-SHA"\r
219 # define SSL3_TXT_RSA_DES_64_CBC_SHA             "DES-CBC-SHA"\r
220 # define SSL3_TXT_RSA_DES_192_CBC3_SHA           "DES-CBC3-SHA"\r
221 \r
222 # define SSL3_TXT_DH_DSS_DES_40_CBC_SHA          "EXP-DH-DSS-DES-CBC-SHA"\r
223 # define SSL3_TXT_DH_DSS_DES_64_CBC_SHA          "DH-DSS-DES-CBC-SHA"\r
224 # define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA        "DH-DSS-DES-CBC3-SHA"\r
225 # define SSL3_TXT_DH_RSA_DES_40_CBC_SHA          "EXP-DH-RSA-DES-CBC-SHA"\r
226 # define SSL3_TXT_DH_RSA_DES_64_CBC_SHA          "DH-RSA-DES-CBC-SHA"\r
227 # define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA        "DH-RSA-DES-CBC3-SHA"\r
228 \r
229 # define SSL3_TXT_DHE_DSS_DES_40_CBC_SHA         "EXP-DHE-DSS-DES-CBC-SHA"\r
230 # define SSL3_TXT_DHE_DSS_DES_64_CBC_SHA         "DHE-DSS-DES-CBC-SHA"\r
231 # define SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA       "DHE-DSS-DES-CBC3-SHA"\r
232 # define SSL3_TXT_DHE_RSA_DES_40_CBC_SHA         "EXP-DHE-RSA-DES-CBC-SHA"\r
233 # define SSL3_TXT_DHE_RSA_DES_64_CBC_SHA         "DHE-RSA-DES-CBC-SHA"\r
234 # define SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA       "DHE-RSA-DES-CBC3-SHA"\r
235 \r
236 /*\r
237  * This next block of six "EDH" labels is for backward compatibility with\r
238  * older versions of OpenSSL.  New code should use the six "DHE" labels above\r
239  * instead:\r
240  */\r
241 # define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA         "EXP-EDH-DSS-DES-CBC-SHA"\r
242 # define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA         "EDH-DSS-DES-CBC-SHA"\r
243 # define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA       "EDH-DSS-DES-CBC3-SHA"\r
244 # define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA         "EXP-EDH-RSA-DES-CBC-SHA"\r
245 # define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA         "EDH-RSA-DES-CBC-SHA"\r
246 # define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA       "EDH-RSA-DES-CBC3-SHA"\r
247 \r
248 # define SSL3_TXT_ADH_RC4_40_MD5                 "EXP-ADH-RC4-MD5"\r
249 # define SSL3_TXT_ADH_RC4_128_MD5                "ADH-RC4-MD5"\r
250 # define SSL3_TXT_ADH_DES_40_CBC_SHA             "EXP-ADH-DES-CBC-SHA"\r
251 # define SSL3_TXT_ADH_DES_64_CBC_SHA             "ADH-DES-CBC-SHA"\r
252 # define SSL3_TXT_ADH_DES_192_CBC_SHA            "ADH-DES-CBC3-SHA"\r
253 \r
254 # if 0\r
255 #  define SSL3_TXT_FZA_DMS_NULL_SHA               "FZA-NULL-SHA"\r
256 #  define SSL3_TXT_FZA_DMS_FZA_SHA                "FZA-FZA-CBC-SHA"\r
257 #  define SSL3_TXT_FZA_DMS_RC4_SHA                "FZA-RC4-SHA"\r
258 # endif\r
259 \r
260 # define SSL3_TXT_KRB5_DES_64_CBC_SHA            "KRB5-DES-CBC-SHA"\r
261 # define SSL3_TXT_KRB5_DES_192_CBC3_SHA          "KRB5-DES-CBC3-SHA"\r
262 # define SSL3_TXT_KRB5_RC4_128_SHA               "KRB5-RC4-SHA"\r
263 # define SSL3_TXT_KRB5_IDEA_128_CBC_SHA          "KRB5-IDEA-CBC-SHA"\r
264 # define SSL3_TXT_KRB5_DES_64_CBC_MD5            "KRB5-DES-CBC-MD5"\r
265 # define SSL3_TXT_KRB5_DES_192_CBC3_MD5          "KRB5-DES-CBC3-MD5"\r
266 # define SSL3_TXT_KRB5_RC4_128_MD5               "KRB5-RC4-MD5"\r
267 # define SSL3_TXT_KRB5_IDEA_128_CBC_MD5          "KRB5-IDEA-CBC-MD5"\r
268 \r
269 # define SSL3_TXT_KRB5_DES_40_CBC_SHA            "EXP-KRB5-DES-CBC-SHA"\r
270 # define SSL3_TXT_KRB5_RC2_40_CBC_SHA            "EXP-KRB5-RC2-CBC-SHA"\r
271 # define SSL3_TXT_KRB5_RC4_40_SHA                "EXP-KRB5-RC4-SHA"\r
272 # define SSL3_TXT_KRB5_DES_40_CBC_MD5            "EXP-KRB5-DES-CBC-MD5"\r
273 # define SSL3_TXT_KRB5_RC2_40_CBC_MD5            "EXP-KRB5-RC2-CBC-MD5"\r
274 # define SSL3_TXT_KRB5_RC4_40_MD5                "EXP-KRB5-RC4-MD5"\r
275 \r
276 # define SSL3_SSL_SESSION_ID_LENGTH              32\r
277 # define SSL3_MAX_SSL_SESSION_ID_LENGTH          32\r
278 \r
279 # define SSL3_MASTER_SECRET_SIZE                 48\r
280 # define SSL3_RANDOM_SIZE                        32\r
281 # define SSL3_SESSION_ID_SIZE                    32\r
282 # define SSL3_RT_HEADER_LENGTH                   5\r
283 \r
284 # define SSL3_HM_HEADER_LENGTH                  4\r
285 \r
286 # ifndef SSL3_ALIGN_PAYLOAD\r
287  /*\r
288   * Some will argue that this increases memory footprint, but it's not\r
289   * actually true. Point is that malloc has to return at least 64-bit aligned\r
290   * pointers, meaning that allocating 5 bytes wastes 3 bytes in either case.\r
291   * Suggested pre-gaping simply moves these wasted bytes from the end of\r
292   * allocated region to its front, but makes data payload aligned, which\r
293   * improves performance:-)\r
294   */\r
295 #  define SSL3_ALIGN_PAYLOAD                     8\r
296 # else\r
297 #  if (SSL3_ALIGN_PAYLOAD&(SSL3_ALIGN_PAYLOAD-1))!=0\r
298 #   error "insane SSL3_ALIGN_PAYLOAD"\r
299 #   undef SSL3_ALIGN_PAYLOAD\r
300 #  endif\r
301 # endif\r
302 \r
303 /*\r
304  * This is the maximum MAC (digest) size used by the SSL library. Currently\r
305  * maximum of 20 is used by SHA1, but we reserve for future extension for\r
306  * 512-bit hashes.\r
307  */\r
308 \r
309 # define SSL3_RT_MAX_MD_SIZE                     64\r
310 \r
311 /*\r
312  * Maximum block size used in all ciphersuites. Currently 16 for AES.\r
313  */\r
314 \r
315 # define SSL_RT_MAX_CIPHER_BLOCK_SIZE            16\r
316 \r
317 # define SSL3_RT_MAX_EXTRA                       (16384)\r
318 \r
319 /* Maximum plaintext length: defined by SSL/TLS standards */\r
320 # define SSL3_RT_MAX_PLAIN_LENGTH                16384\r
321 /* Maximum compression overhead: defined by SSL/TLS standards */\r
322 # define SSL3_RT_MAX_COMPRESSED_OVERHEAD         1024\r
323 \r
324 /*\r
325  * The standards give a maximum encryption overhead of 1024 bytes. In\r
326  * practice the value is lower than this. The overhead is the maximum number\r
327  * of padding bytes (256) plus the mac size.\r
328  */\r
329 # define SSL3_RT_MAX_ENCRYPTED_OVERHEAD  (256 + SSL3_RT_MAX_MD_SIZE)\r
330 \r
331 /*\r
332  * OpenSSL currently only uses a padding length of at most one block so the\r
333  * send overhead is smaller.\r
334  */\r
335 \r
336 # define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \\r
337                         (SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE)\r
338 \r
339 /* If compression isn't used don't include the compression overhead */\r
340 \r
341 # ifdef OPENSSL_NO_COMP\r
342 #  define SSL3_RT_MAX_COMPRESSED_LENGTH           SSL3_RT_MAX_PLAIN_LENGTH\r
343 # else\r
344 #  define SSL3_RT_MAX_COMPRESSED_LENGTH   \\r
345                 (SSL3_RT_MAX_PLAIN_LENGTH+SSL3_RT_MAX_COMPRESSED_OVERHEAD)\r
346 # endif\r
347 # define SSL3_RT_MAX_ENCRYPTED_LENGTH    \\r
348                 (SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH)\r
349 # define SSL3_RT_MAX_PACKET_SIZE         \\r
350                 (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH)\r
351 \r
352 # define SSL3_MD_CLIENT_FINISHED_CONST   "\x43\x4C\x4E\x54"\r
353 # define SSL3_MD_SERVER_FINISHED_CONST   "\x53\x52\x56\x52"\r
354 \r
355 # define SSL3_VERSION                    0x0300\r
356 # define SSL3_VERSION_MAJOR              0x03\r
357 # define SSL3_VERSION_MINOR              0x00\r
358 \r
359 # define SSL3_RT_CHANGE_CIPHER_SPEC      20\r
360 # define SSL3_RT_ALERT                   21\r
361 # define SSL3_RT_HANDSHAKE               22\r
362 # define SSL3_RT_APPLICATION_DATA        23\r
363 # define TLS1_RT_HEARTBEAT               24\r
364 \r
365 /* Pseudo content types to indicate additional parameters */\r
366 # define TLS1_RT_CRYPTO                  0x1000\r
367 # define TLS1_RT_CRYPTO_PREMASTER        (TLS1_RT_CRYPTO | 0x1)\r
368 # define TLS1_RT_CRYPTO_CLIENT_RANDOM    (TLS1_RT_CRYPTO | 0x2)\r
369 # define TLS1_RT_CRYPTO_SERVER_RANDOM    (TLS1_RT_CRYPTO | 0x3)\r
370 # define TLS1_RT_CRYPTO_MASTER           (TLS1_RT_CRYPTO | 0x4)\r
371 \r
372 # define TLS1_RT_CRYPTO_READ             0x0000\r
373 # define TLS1_RT_CRYPTO_WRITE            0x0100\r
374 # define TLS1_RT_CRYPTO_MAC              (TLS1_RT_CRYPTO | 0x5)\r
375 # define TLS1_RT_CRYPTO_KEY              (TLS1_RT_CRYPTO | 0x6)\r
376 # define TLS1_RT_CRYPTO_IV               (TLS1_RT_CRYPTO | 0x7)\r
377 # define TLS1_RT_CRYPTO_FIXED_IV         (TLS1_RT_CRYPTO | 0x8)\r
378 \r
379 /* Pseudo content type for SSL/TLS header info */\r
380 # define SSL3_RT_HEADER                  0x100\r
381 \r
382 # define SSL3_AL_WARNING                 1\r
383 # define SSL3_AL_FATAL                   2\r
384 \r
385 # define SSL3_AD_CLOSE_NOTIFY             0\r
386 # define SSL3_AD_UNEXPECTED_MESSAGE      10/* fatal */\r
387 # define SSL3_AD_BAD_RECORD_MAC          20/* fatal */\r
388 # define SSL3_AD_DECOMPRESSION_FAILURE   30/* fatal */\r
389 # define SSL3_AD_HANDSHAKE_FAILURE       40/* fatal */\r
390 # define SSL3_AD_NO_CERTIFICATE          41\r
391 # define SSL3_AD_BAD_CERTIFICATE         42\r
392 # define SSL3_AD_UNSUPPORTED_CERTIFICATE 43\r
393 # define SSL3_AD_CERTIFICATE_REVOKED     44\r
394 # define SSL3_AD_CERTIFICATE_EXPIRED     45\r
395 # define SSL3_AD_CERTIFICATE_UNKNOWN     46\r
396 # define SSL3_AD_ILLEGAL_PARAMETER       47/* fatal */\r
397 \r
398 # define TLS1_HB_REQUEST         1\r
399 # define TLS1_HB_RESPONSE        2\r
400 \r
401 # ifndef OPENSSL_NO_SSL_INTERN\r
402 \r
403 typedef struct ssl3_record_st {\r
404     /* type of record */\r
405     /*\r
406      * r\r
407      */ int type;\r
408     /* How many bytes available */\r
409     /*\r
410      * rw\r
411      */ unsigned int length;\r
412     /* read/write offset into 'buf' */\r
413     /*\r
414      * r\r
415      */ unsigned int off;\r
416     /* pointer to the record data */\r
417     /*\r
418      * rw\r
419      */ unsigned char *data;\r
420     /* where the decode bytes are */\r
421     /*\r
422      * rw\r
423      */ unsigned char *input;\r
424     /* only used with decompression - malloc()ed */\r
425     /*\r
426      * r\r
427      */ unsigned char *comp;\r
428     /* epoch number, needed by DTLS1 */\r
429     /*\r
430      * r\r
431      */ unsigned long epoch;\r
432     /* sequence number, needed by DTLS1 */\r
433     /*\r
434      * r\r
435      */ unsigned char seq_num[8];\r
436 } SSL3_RECORD;\r
437 \r
438 typedef struct ssl3_buffer_st {\r
439     /* at least SSL3_RT_MAX_PACKET_SIZE bytes, see ssl3_setup_buffers() */\r
440     unsigned char *buf;\r
441     /* buffer size */\r
442     size_t len;\r
443     /* where to 'copy from' */\r
444     int offset;\r
445     /* how many bytes left */\r
446     int left;\r
447 } SSL3_BUFFER;\r
448 \r
449 # endif\r
450 \r
451 # define SSL3_CT_RSA_SIGN                        1\r
452 # define SSL3_CT_DSS_SIGN                        2\r
453 # define SSL3_CT_RSA_FIXED_DH                    3\r
454 # define SSL3_CT_DSS_FIXED_DH                    4\r
455 # define SSL3_CT_RSA_EPHEMERAL_DH                5\r
456 # define SSL3_CT_DSS_EPHEMERAL_DH                6\r
457 # define SSL3_CT_FORTEZZA_DMS                    20\r
458 /*\r
459  * SSL3_CT_NUMBER is used to size arrays and it must be large enough to\r
460  * contain all of the cert types defined either for SSLv3 and TLSv1.\r
461  */\r
462 # define SSL3_CT_NUMBER                  9\r
463 \r
464 # define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS       0x0001\r
465 # define SSL3_FLAGS_DELAY_CLIENT_FINISHED        0x0002\r
466 # define SSL3_FLAGS_POP_BUFFER                   0x0004\r
467 # define TLS1_FLAGS_TLS_PADDING_BUG              0x0008\r
468 # define TLS1_FLAGS_SKIP_CERT_VERIFY             0x0010\r
469 # define TLS1_FLAGS_KEEP_HANDSHAKE               0x0020\r
470 /*\r
471  * Set when the handshake is ready to process peer's ChangeCipherSpec message.\r
472  * Cleared after the message has been processed.\r
473  */\r
474 # define SSL3_FLAGS_CCS_OK                       0x0080\r
475 \r
476 /* SSL3_FLAGS_SGC_RESTART_DONE is no longer used */\r
477 # define SSL3_FLAGS_SGC_RESTART_DONE             0x0040\r
478 \r
479 # ifndef OPENSSL_NO_SSL_INTERN\r
480 \r
481 typedef struct ssl3_state_st {\r
482     long flags;\r
483     int delay_buf_pop_ret;\r
484     unsigned char read_sequence[8];\r
485     int read_mac_secret_size;\r
486     unsigned char read_mac_secret[EVP_MAX_MD_SIZE];\r
487     unsigned char write_sequence[8];\r
488     int write_mac_secret_size;\r
489     unsigned char write_mac_secret[EVP_MAX_MD_SIZE];\r
490     unsigned char server_random[SSL3_RANDOM_SIZE];\r
491     unsigned char client_random[SSL3_RANDOM_SIZE];\r
492     /* flags for countermeasure against known-IV weakness */\r
493     int need_empty_fragments;\r
494     int empty_fragment_done;\r
495     /* The value of 'extra' when the buffers were initialized */\r
496     int init_extra;\r
497     SSL3_BUFFER rbuf;           /* read IO goes into here */\r
498     SSL3_BUFFER wbuf;           /* write IO goes into here */\r
499     SSL3_RECORD rrec;           /* each decoded record goes in here */\r
500     SSL3_RECORD wrec;           /* goes out from here */\r
501     /*\r
502      * storage for Alert/Handshake protocol data received but not yet\r
503      * processed by ssl3_read_bytes:\r
504      */\r
505     unsigned char alert_fragment[2];\r
506     unsigned int alert_fragment_len;\r
507     unsigned char handshake_fragment[4];\r
508     unsigned int handshake_fragment_len;\r
509     /* partial write - check the numbers match */\r
510     unsigned int wnum;          /* number of bytes sent so far */\r
511     int wpend_tot;              /* number bytes written */\r
512     int wpend_type;\r
513     int wpend_ret;              /* number of bytes submitted */\r
514     const unsigned char *wpend_buf;\r
515     /* used during startup, digest all incoming/outgoing packets */\r
516     BIO *handshake_buffer;\r
517     /*\r
518      * When set of handshake digests is determined, buffer is hashed and\r
519      * freed and MD_CTX-es for all required digests are stored in this array\r
520      */\r
521     EVP_MD_CTX **handshake_dgst;\r
522     /*\r
523      * Set whenever an expected ChangeCipherSpec message is processed.\r
524      * Unset when the peer's Finished message is received.\r
525      * Unexpected ChangeCipherSpec messages trigger a fatal alert.\r
526      */\r
527     int change_cipher_spec;\r
528     int warn_alert;\r
529     int fatal_alert;\r
530     /*\r
531      * we allow one fatal and one warning alert to be outstanding, send close\r
532      * alert via the warning alert\r
533      */\r
534     int alert_dispatch;\r
535     unsigned char send_alert[2];\r
536     /*\r
537      * This flag is set when we should renegotiate ASAP, basically when there\r
538      * is no more data in the read or write buffers\r
539      */\r
540     int renegotiate;\r
541     int total_renegotiations;\r
542     int num_renegotiations;\r
543     int in_read_app_data;\r
544     /*\r
545      * Opaque PRF input as used for the current handshake. These fields are\r
546      * used only if TLSEXT_TYPE_opaque_prf_input is defined (otherwise, they\r
547      * are merely present to improve binary compatibility)\r
548      */\r
549     void *client_opaque_prf_input;\r
550     size_t client_opaque_prf_input_len;\r
551     void *server_opaque_prf_input;\r
552     size_t server_opaque_prf_input_len;\r
553     struct {\r
554         /* actually only needs to be 16+20 */\r
555         unsigned char cert_verify_md[EVP_MAX_MD_SIZE * 2];\r
556         /* actually only need to be 16+20 for SSLv3 and 12 for TLS */\r
557         unsigned char finish_md[EVP_MAX_MD_SIZE * 2];\r
558         int finish_md_len;\r
559         unsigned char peer_finish_md[EVP_MAX_MD_SIZE * 2];\r
560         int peer_finish_md_len;\r
561         unsigned long message_size;\r
562         int message_type;\r
563         /* used to hold the new cipher we are going to use */\r
564         const SSL_CIPHER *new_cipher;\r
565 #  ifndef OPENSSL_NO_DH\r
566         DH *dh;\r
567 #  endif\r
568 #  ifndef OPENSSL_NO_ECDH\r
569         EC_KEY *ecdh;           /* holds short lived ECDH key */\r
570 #  endif\r
571         /* used when SSL_ST_FLUSH_DATA is entered */\r
572         int next_state;\r
573         int reuse_message;\r
574         /* used for certificate requests */\r
575         int cert_req;\r
576         int ctype_num;\r
577         char ctype[SSL3_CT_NUMBER];\r
578         STACK_OF(X509_NAME) *ca_names;\r
579         int use_rsa_tmp;\r
580         int key_block_length;\r
581         unsigned char *key_block;\r
582         const EVP_CIPHER *new_sym_enc;\r
583         const EVP_MD *new_hash;\r
584         int new_mac_pkey_type;\r
585         int new_mac_secret_size;\r
586 #  ifndef OPENSSL_NO_COMP\r
587         const SSL_COMP *new_compression;\r
588 #  else\r
589         char *new_compression;\r
590 #  endif\r
591         int cert_request;\r
592     } tmp;\r
593 \r
594     /* Connection binding to prevent renegotiation attacks */\r
595     unsigned char previous_client_finished[EVP_MAX_MD_SIZE];\r
596     unsigned char previous_client_finished_len;\r
597     unsigned char previous_server_finished[EVP_MAX_MD_SIZE];\r
598     unsigned char previous_server_finished_len;\r
599     int send_connection_binding; /* TODOEKR */\r
600 \r
601 #  ifndef OPENSSL_NO_NEXTPROTONEG\r
602     /*\r
603      * Set if we saw the Next Protocol Negotiation extension from our peer.\r
604      */\r
605     int next_proto_neg_seen;\r
606 #  endif\r
607 \r
608 #  ifndef OPENSSL_NO_TLSEXT\r
609 #   ifndef OPENSSL_NO_EC\r
610     /*\r
611      * This is set to true if we believe that this is a version of Safari\r
612      * running on OS X 10.6 or newer. We wish to know this because Safari on\r
613      * 10.8 .. 10.8.3 has broken ECDHE-ECDSA support.\r
614      */\r
615     char is_probably_safari;\r
616 #   endif                       /* !OPENSSL_NO_EC */\r
617 \r
618     /*\r
619      * ALPN information (we are in the process of transitioning from NPN to\r
620      * ALPN.)\r
621      */\r
622 \r
623     /*\r
624      * In a server these point to the selected ALPN protocol after the\r
625      * ClientHello has been processed. In a client these contain the protocol\r
626      * that the server selected once the ServerHello has been processed.\r
627      */\r
628     unsigned char *alpn_selected;\r
629     unsigned alpn_selected_len;\r
630 #  endif                        /* OPENSSL_NO_TLSEXT */\r
631 } SSL3_STATE;\r
632 \r
633 # endif\r
634 \r
635 /* SSLv3 */\r
636 /*\r
637  * client\r
638  */\r
639 /* extra state */\r
640 # define SSL3_ST_CW_FLUSH                (0x100|SSL_ST_CONNECT)\r
641 # ifndef OPENSSL_NO_SCTP\r
642 #  define DTLS1_SCTP_ST_CW_WRITE_SOCK                     (0x310|SSL_ST_CONNECT)\r
643 #  define DTLS1_SCTP_ST_CR_READ_SOCK                      (0x320|SSL_ST_CONNECT)\r
644 # endif\r
645 /* write to server */\r
646 # define SSL3_ST_CW_CLNT_HELLO_A         (0x110|SSL_ST_CONNECT)\r
647 # define SSL3_ST_CW_CLNT_HELLO_B         (0x111|SSL_ST_CONNECT)\r
648 /* read from server */\r
649 # define SSL3_ST_CR_SRVR_HELLO_A         (0x120|SSL_ST_CONNECT)\r
650 # define SSL3_ST_CR_SRVR_HELLO_B         (0x121|SSL_ST_CONNECT)\r
651 # define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A (0x126|SSL_ST_CONNECT)\r
652 # define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B (0x127|SSL_ST_CONNECT)\r
653 # define SSL3_ST_CR_CERT_A               (0x130|SSL_ST_CONNECT)\r
654 # define SSL3_ST_CR_CERT_B               (0x131|SSL_ST_CONNECT)\r
655 # define SSL3_ST_CR_KEY_EXCH_A           (0x140|SSL_ST_CONNECT)\r
656 # define SSL3_ST_CR_KEY_EXCH_B           (0x141|SSL_ST_CONNECT)\r
657 # define SSL3_ST_CR_CERT_REQ_A           (0x150|SSL_ST_CONNECT)\r
658 # define SSL3_ST_CR_CERT_REQ_B           (0x151|SSL_ST_CONNECT)\r
659 # define SSL3_ST_CR_SRVR_DONE_A          (0x160|SSL_ST_CONNECT)\r
660 # define SSL3_ST_CR_SRVR_DONE_B          (0x161|SSL_ST_CONNECT)\r
661 /* write to server */\r
662 # define SSL3_ST_CW_CERT_A               (0x170|SSL_ST_CONNECT)\r
663 # define SSL3_ST_CW_CERT_B               (0x171|SSL_ST_CONNECT)\r
664 # define SSL3_ST_CW_CERT_C               (0x172|SSL_ST_CONNECT)\r
665 # define SSL3_ST_CW_CERT_D               (0x173|SSL_ST_CONNECT)\r
666 # define SSL3_ST_CW_KEY_EXCH_A           (0x180|SSL_ST_CONNECT)\r
667 # define SSL3_ST_CW_KEY_EXCH_B           (0x181|SSL_ST_CONNECT)\r
668 # define SSL3_ST_CW_CERT_VRFY_A          (0x190|SSL_ST_CONNECT)\r
669 # define SSL3_ST_CW_CERT_VRFY_B          (0x191|SSL_ST_CONNECT)\r
670 # define SSL3_ST_CW_CHANGE_A             (0x1A0|SSL_ST_CONNECT)\r
671 # define SSL3_ST_CW_CHANGE_B             (0x1A1|SSL_ST_CONNECT)\r
672 # ifndef OPENSSL_NO_NEXTPROTONEG\r
673 #  define SSL3_ST_CW_NEXT_PROTO_A         (0x200|SSL_ST_CONNECT)\r
674 #  define SSL3_ST_CW_NEXT_PROTO_B         (0x201|SSL_ST_CONNECT)\r
675 # endif\r
676 # define SSL3_ST_CW_FINISHED_A           (0x1B0|SSL_ST_CONNECT)\r
677 # define SSL3_ST_CW_FINISHED_B           (0x1B1|SSL_ST_CONNECT)\r
678 /* read from server */\r
679 # define SSL3_ST_CR_CHANGE_A             (0x1C0|SSL_ST_CONNECT)\r
680 # define SSL3_ST_CR_CHANGE_B             (0x1C1|SSL_ST_CONNECT)\r
681 # define SSL3_ST_CR_FINISHED_A           (0x1D0|SSL_ST_CONNECT)\r
682 # define SSL3_ST_CR_FINISHED_B           (0x1D1|SSL_ST_CONNECT)\r
683 # define SSL3_ST_CR_SESSION_TICKET_A     (0x1E0|SSL_ST_CONNECT)\r
684 # define SSL3_ST_CR_SESSION_TICKET_B     (0x1E1|SSL_ST_CONNECT)\r
685 # define SSL3_ST_CR_CERT_STATUS_A        (0x1F0|SSL_ST_CONNECT)\r
686 # define SSL3_ST_CR_CERT_STATUS_B        (0x1F1|SSL_ST_CONNECT)\r
687 \r
688 /* server */\r
689 /* extra state */\r
690 # define SSL3_ST_SW_FLUSH                (0x100|SSL_ST_ACCEPT)\r
691 # ifndef OPENSSL_NO_SCTP\r
692 #  define DTLS1_SCTP_ST_SW_WRITE_SOCK                     (0x310|SSL_ST_ACCEPT)\r
693 #  define DTLS1_SCTP_ST_SR_READ_SOCK                      (0x320|SSL_ST_ACCEPT)\r
694 # endif\r
695 /* read from client */\r
696 /* Do not change the number values, they do matter */\r
697 # define SSL3_ST_SR_CLNT_HELLO_A         (0x110|SSL_ST_ACCEPT)\r
698 # define SSL3_ST_SR_CLNT_HELLO_B         (0x111|SSL_ST_ACCEPT)\r
699 # define SSL3_ST_SR_CLNT_HELLO_C         (0x112|SSL_ST_ACCEPT)\r
700 # define SSL3_ST_SR_CLNT_HELLO_D         (0x115|SSL_ST_ACCEPT)\r
701 /* write to client */\r
702 # define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A (0x113|SSL_ST_ACCEPT)\r
703 # define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B (0x114|SSL_ST_ACCEPT)\r
704 # define SSL3_ST_SW_HELLO_REQ_A          (0x120|SSL_ST_ACCEPT)\r
705 # define SSL3_ST_SW_HELLO_REQ_B          (0x121|SSL_ST_ACCEPT)\r
706 # define SSL3_ST_SW_HELLO_REQ_C          (0x122|SSL_ST_ACCEPT)\r
707 # define SSL3_ST_SW_SRVR_HELLO_A         (0x130|SSL_ST_ACCEPT)\r
708 # define SSL3_ST_SW_SRVR_HELLO_B         (0x131|SSL_ST_ACCEPT)\r
709 # define SSL3_ST_SW_CERT_A               (0x140|SSL_ST_ACCEPT)\r
710 # define SSL3_ST_SW_CERT_B               (0x141|SSL_ST_ACCEPT)\r
711 # define SSL3_ST_SW_KEY_EXCH_A           (0x150|SSL_ST_ACCEPT)\r
712 # define SSL3_ST_SW_KEY_EXCH_B           (0x151|SSL_ST_ACCEPT)\r
713 # define SSL3_ST_SW_CERT_REQ_A           (0x160|SSL_ST_ACCEPT)\r
714 # define SSL3_ST_SW_CERT_REQ_B           (0x161|SSL_ST_ACCEPT)\r
715 # define SSL3_ST_SW_SRVR_DONE_A          (0x170|SSL_ST_ACCEPT)\r
716 # define SSL3_ST_SW_SRVR_DONE_B          (0x171|SSL_ST_ACCEPT)\r
717 /* read from client */\r
718 # define SSL3_ST_SR_CERT_A               (0x180|SSL_ST_ACCEPT)\r
719 # define SSL3_ST_SR_CERT_B               (0x181|SSL_ST_ACCEPT)\r
720 # define SSL3_ST_SR_KEY_EXCH_A           (0x190|SSL_ST_ACCEPT)\r
721 # define SSL3_ST_SR_KEY_EXCH_B           (0x191|SSL_ST_ACCEPT)\r
722 # define SSL3_ST_SR_CERT_VRFY_A          (0x1A0|SSL_ST_ACCEPT)\r
723 # define SSL3_ST_SR_CERT_VRFY_B          (0x1A1|SSL_ST_ACCEPT)\r
724 # define SSL3_ST_SR_CHANGE_A             (0x1B0|SSL_ST_ACCEPT)\r
725 # define SSL3_ST_SR_CHANGE_B             (0x1B1|SSL_ST_ACCEPT)\r
726 # ifndef OPENSSL_NO_NEXTPROTONEG\r
727 #  define SSL3_ST_SR_NEXT_PROTO_A         (0x210|SSL_ST_ACCEPT)\r
728 #  define SSL3_ST_SR_NEXT_PROTO_B         (0x211|SSL_ST_ACCEPT)\r
729 # endif\r
730 # define SSL3_ST_SR_FINISHED_A           (0x1C0|SSL_ST_ACCEPT)\r
731 # define SSL3_ST_SR_FINISHED_B           (0x1C1|SSL_ST_ACCEPT)\r
732 /* write to client */\r
733 # define SSL3_ST_SW_CHANGE_A             (0x1D0|SSL_ST_ACCEPT)\r
734 # define SSL3_ST_SW_CHANGE_B             (0x1D1|SSL_ST_ACCEPT)\r
735 # define SSL3_ST_SW_FINISHED_A           (0x1E0|SSL_ST_ACCEPT)\r
736 # define SSL3_ST_SW_FINISHED_B           (0x1E1|SSL_ST_ACCEPT)\r
737 # define SSL3_ST_SW_SESSION_TICKET_A     (0x1F0|SSL_ST_ACCEPT)\r
738 # define SSL3_ST_SW_SESSION_TICKET_B     (0x1F1|SSL_ST_ACCEPT)\r
739 # define SSL3_ST_SW_CERT_STATUS_A        (0x200|SSL_ST_ACCEPT)\r
740 # define SSL3_ST_SW_CERT_STATUS_B        (0x201|SSL_ST_ACCEPT)\r
741 \r
742 # define SSL3_MT_HELLO_REQUEST                   0\r
743 # define SSL3_MT_CLIENT_HELLO                    1\r
744 # define SSL3_MT_SERVER_HELLO                    2\r
745 # define SSL3_MT_NEWSESSION_TICKET               4\r
746 # define SSL3_MT_CERTIFICATE                     11\r
747 # define SSL3_MT_SERVER_KEY_EXCHANGE             12\r
748 # define SSL3_MT_CERTIFICATE_REQUEST             13\r
749 # define SSL3_MT_SERVER_DONE                     14\r
750 # define SSL3_MT_CERTIFICATE_VERIFY              15\r
751 # define SSL3_MT_CLIENT_KEY_EXCHANGE             16\r
752 # define SSL3_MT_FINISHED                        20\r
753 # define SSL3_MT_CERTIFICATE_STATUS              22\r
754 # ifndef OPENSSL_NO_NEXTPROTONEG\r
755 #  define SSL3_MT_NEXT_PROTO                      67\r
756 # endif\r
757 # define DTLS1_MT_HELLO_VERIFY_REQUEST    3\r
758 \r
759 # define SSL3_MT_CCS                             1\r
760 \r
761 /* These are used when changing over to a new cipher */\r
762 # define SSL3_CC_READ            0x01\r
763 # define SSL3_CC_WRITE           0x02\r
764 # define SSL3_CC_CLIENT          0x10\r
765 # define SSL3_CC_SERVER          0x20\r
766 # define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE)\r
767 # define SSL3_CHANGE_CIPHER_SERVER_READ  (SSL3_CC_SERVER|SSL3_CC_READ)\r
768 # define SSL3_CHANGE_CIPHER_CLIENT_READ  (SSL3_CC_CLIENT|SSL3_CC_READ)\r
769 # define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE)\r
770 \r
771 #ifdef  __cplusplus\r
772 }\r
773 #endif\r
774 #endif\r