1 /* $OpenBSD: ssl3.h,v 1.57 2021/09/10 14:49:13 tb Exp $ */
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3  * All rights reserved.
4  *
5  * This package is an SSL implementation written
6  * by Eric Young (eay@cryptsoft.com).
7  * The implementation was written so as to conform with Netscapes SSL.
8  *
9  * This library is free for commercial and non-commercial use as core.stdc.config.c_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).
15  *
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.
22  *
23  * Redistribution and use in source and binary forms, with or without
24  * modification, are permitted provided that the following conditions
25  * are met:
26  * 1. Redistributions of source code must retain the copyright
27  *    notice, this list of conditions and the following disclaimer.
28  * 2. Redistributions in binary form must reproduce the above copyright
29  *    notice, this list of conditions and the following disclaimer in the
30  *    documentation and/or other materials provided with the distribution.
31  * 3. All advertising materials mentioning features or use of this software
32  *    must display the following acknowledgement:
33  *    "This product includes cryptographic software written by
34  *     Eric Young (eay@cryptsoft.com)"
35  *    The word 'cryptographic' can be left out if the rouines from the library
36  *    being used are not cryptographic related :-).
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)"
40  *
41  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51  * SUCH DAMAGE.
52  *
53  * The licence and distribution terms for any publically available version or
54  * derivative of this code cannot be changed.  i.e. this code cannot simply be
55  * copied and put under another distribution licence
56  * [including the GNU Public Licence.]
57  */
58 /* ====================================================================
59  * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
60  *
61  * Redistribution and use in source and binary forms, with or without
62  * modification, are permitted provided that the following conditions
63  * are met:
64  *
65  * 1. Redistributions of source code must retain the above copyright
66  *    notice, this list of conditions and the following disclaimer.
67  *
68  * 2. Redistributions in binary form must reproduce the above copyright
69  *    notice, this list of conditions and the following disclaimer in
70  *    the documentation and/or other materials provided with the
71  *    distribution.
72  *
73  * 3. All advertising materials mentioning features or use of this
74  *    software must display the following acknowledgment:
75  *    "This product includes software developed by the OpenSSL Project
76  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77  *
78  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79  *    endorse or promote products derived from this software without
80  *    prior written permission. For written permission, please contact
81  *    openssl-core@openssl.org.
82  *
83  * 5. Products derived from this software may not be called "OpenSSL"
84  *    nor may "OpenSSL" appear in their names without prior written
85  *    permission of the OpenSSL Project.
86  *
87  * 6. Redistributions of any form whatsoever must retain the following
88  *    acknowledgment:
89  *    "This product includes software developed by the OpenSSL Project
90  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91  *
92  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
96  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103  * OF THE POSSIBILITY OF SUCH DAMAGE.
104  * ====================================================================
105  *
106  * This product includes cryptographic software written by Eric Young
107  * (eay@cryptsoft.com).  This product includes software written by Tim
108  * Hudson (tjh@cryptsoft.com).
109  *
110  */
111 /* ====================================================================
112  * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
113  * ECC cipher suite support in OpenSSL originally developed by
114  * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
115  */
116 module libressl_d.openssl.ssl3;
117 
118 
119 private static import core.stdc.config;
120 public import libressl_d.openssl.buffer;
121 public import libressl_d.openssl.evp;
122 public import libressl_d.openssl.opensslconf;
123 public import libressl_d.openssl.ssl;
124 
125 extern (C):
126 nothrow @nogc:
127 
128 /**
129  * TLS_EMPTY_RENEGOTIATION_INFO_SCSV from RFC 5746.
130  */
131 enum SSL3_CK_SCSV = 0x030000FF;
132 
133 /**
134  * TLS_FALLBACK_SCSV from draft-ietf-tls-downgrade-scsv-03.
135  */
136 enum SSL3_CK_FALLBACK_SCSV = 0x03005600;
137 
138 enum SSL3_CK_RSA_NULL_MD5 = 0x03000001;
139 enum SSL3_CK_RSA_NULL_SHA = 0x03000002;
140 enum SSL3_CK_RSA_RC4_40_MD5 = 0x03000003;
141 enum SSL3_CK_RSA_RC4_128_MD5 = 0x03000004;
142 enum SSL3_CK_RSA_RC4_128_SHA = 0x03000005;
143 enum SSL3_CK_RSA_RC2_40_MD5 = 0x03000006;
144 enum SSL3_CK_RSA_IDEA_128_SHA = 0x03000007;
145 enum SSL3_CK_RSA_DES_40_CBC_SHA = 0x03000008;
146 enum SSL3_CK_RSA_DES_64_CBC_SHA = 0x03000009;
147 enum SSL3_CK_RSA_DES_192_CBC3_SHA = 0x0300000A;
148 
149 enum SSL3_CK_DH_DSS_DES_40_CBC_SHA = 0x0300000B;
150 enum SSL3_CK_DH_DSS_DES_64_CBC_SHA = 0x0300000C;
151 enum SSL3_CK_DH_DSS_DES_192_CBC3_SHA = 0x0300000D;
152 enum SSL3_CK_DH_RSA_DES_40_CBC_SHA = 0x0300000E;
153 enum SSL3_CK_DH_RSA_DES_64_CBC_SHA = 0x0300000F;
154 enum SSL3_CK_DH_RSA_DES_192_CBC3_SHA = 0x03000010;
155 
156 enum SSL3_CK_EDH_DSS_DES_40_CBC_SHA = 0x03000011;
157 enum SSL3_CK_EDH_DSS_DES_64_CBC_SHA = 0x03000012;
158 enum SSL3_CK_EDH_DSS_DES_192_CBC3_SHA = 0x03000013;
159 enum SSL3_CK_EDH_RSA_DES_40_CBC_SHA = 0x03000014;
160 enum SSL3_CK_EDH_RSA_DES_64_CBC_SHA = 0x03000015;
161 enum SSL3_CK_EDH_RSA_DES_192_CBC3_SHA = 0x03000016;
162 
163 enum SSL3_CK_ADH_RC4_40_MD5 = 0x03000017;
164 enum SSL3_CK_ADH_RC4_128_MD5 = 0x03000018;
165 enum SSL3_CK_ADH_DES_40_CBC_SHA = 0x03000019;
166 enum SSL3_CK_ADH_DES_64_CBC_SHA = 0x0300001A;
167 enum SSL3_CK_ADH_DES_192_CBC_SHA = 0x0300001B;
168 
169 /*
170  * VRS Additional Kerberos5 entries
171  */
172 enum SSL3_CK_KRB5_DES_64_CBC_SHA = 0x0300001E;
173 enum SSL3_CK_KRB5_DES_192_CBC3_SHA = 0x0300001F;
174 enum SSL3_CK_KRB5_RC4_128_SHA = 0x03000020;
175 enum SSL3_CK_KRB5_IDEA_128_CBC_SHA = 0x03000021;
176 enum SSL3_CK_KRB5_DES_64_CBC_MD5 = 0x03000022;
177 enum SSL3_CK_KRB5_DES_192_CBC3_MD5 = 0x03000023;
178 enum SSL3_CK_KRB5_RC4_128_MD5 = 0x03000024;
179 enum SSL3_CK_KRB5_IDEA_128_CBC_MD5 = 0x03000025;
180 
181 enum SSL3_CK_KRB5_DES_40_CBC_SHA = 0x03000026;
182 enum SSL3_CK_KRB5_RC2_40_CBC_SHA = 0x03000027;
183 enum SSL3_CK_KRB5_RC4_40_SHA = 0x03000028;
184 enum SSL3_CK_KRB5_DES_40_CBC_MD5 = 0x03000029;
185 enum SSL3_CK_KRB5_RC2_40_CBC_MD5 = 0x0300002A;
186 enum SSL3_CK_KRB5_RC4_40_MD5 = 0x0300002B;
187 
188 enum SSL3_TXT_RSA_NULL_MD5 = "null-MD5";
189 enum SSL3_TXT_RSA_NULL_SHA = "null-SHA";
190 enum SSL3_TXT_RSA_RC4_40_MD5 = "EXP-RC4-MD5";
191 enum SSL3_TXT_RSA_RC4_128_MD5 = "RC4-MD5";
192 enum SSL3_TXT_RSA_RC4_128_SHA = "RC4-SHA";
193 enum SSL3_TXT_RSA_RC2_40_MD5 = "EXP-RC2-CBC-MD5";
194 enum SSL3_TXT_RSA_IDEA_128_SHA = "IDEA-CBC-SHA";
195 enum SSL3_TXT_RSA_DES_40_CBC_SHA = "EXP-DES-CBC-SHA";
196 enum SSL3_TXT_RSA_DES_64_CBC_SHA = "DES-CBC-SHA";
197 enum SSL3_TXT_RSA_DES_192_CBC3_SHA = "DES-CBC3-SHA";
198 
199 enum SSL3_TXT_DH_DSS_DES_40_CBC_SHA = "EXP-DH-DSS-DES-CBC-SHA";
200 enum SSL3_TXT_DH_DSS_DES_64_CBC_SHA = "DH-DSS-DES-CBC-SHA";
201 enum SSL3_TXT_DH_DSS_DES_192_CBC3_SHA = "DH-DSS-DES-CBC3-SHA";
202 enum SSL3_TXT_DH_RSA_DES_40_CBC_SHA = "EXP-DH-RSA-DES-CBC-SHA";
203 enum SSL3_TXT_DH_RSA_DES_64_CBC_SHA = "DH-RSA-DES-CBC-SHA";
204 enum SSL3_TXT_DH_RSA_DES_192_CBC3_SHA = "DH-RSA-DES-CBC3-SHA";
205 
206 enum SSL3_TXT_EDH_DSS_DES_40_CBC_SHA = "EXP-EDH-DSS-DES-CBC-SHA";
207 enum SSL3_TXT_EDH_DSS_DES_64_CBC_SHA = "EDH-DSS-DES-CBC-SHA";
208 enum SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA = "EDH-DSS-DES-CBC3-SHA";
209 enum SSL3_TXT_EDH_RSA_DES_40_CBC_SHA = "EXP-EDH-RSA-DES-CBC-SHA";
210 enum SSL3_TXT_EDH_RSA_DES_64_CBC_SHA = "EDH-RSA-DES-CBC-SHA";
211 enum SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA = "EDH-RSA-DES-CBC3-SHA";
212 
213 enum SSL3_TXT_ADH_RC4_40_MD5 = "EXP-ADH-RC4-MD5";
214 enum SSL3_TXT_ADH_RC4_128_MD5 = "ADH-RC4-MD5";
215 enum SSL3_TXT_ADH_DES_40_CBC_SHA = "EXP-ADH-DES-CBC-SHA";
216 enum SSL3_TXT_ADH_DES_64_CBC_SHA = "ADH-DES-CBC-SHA";
217 enum SSL3_TXT_ADH_DES_192_CBC_SHA = "ADH-DES-CBC3-SHA";
218 
219 enum SSL3_TXT_KRB5_DES_64_CBC_SHA = "KRB5-DES-CBC-SHA";
220 enum SSL3_TXT_KRB5_DES_192_CBC3_SHA = "KRB5-DES-CBC3-SHA";
221 enum SSL3_TXT_KRB5_RC4_128_SHA = "KRB5-RC4-SHA";
222 enum SSL3_TXT_KRB5_IDEA_128_CBC_SHA = "KRB5-IDEA-CBC-SHA";
223 enum SSL3_TXT_KRB5_DES_64_CBC_MD5 = "KRB5-DES-CBC-MD5";
224 enum SSL3_TXT_KRB5_DES_192_CBC3_MD5 = "KRB5-DES-CBC3-MD5";
225 enum SSL3_TXT_KRB5_RC4_128_MD5 = "KRB5-RC4-MD5";
226 enum SSL3_TXT_KRB5_IDEA_128_CBC_MD5 = "KRB5-IDEA-CBC-MD5";
227 
228 enum SSL3_TXT_KRB5_DES_40_CBC_SHA = "EXP-KRB5-DES-CBC-SHA";
229 enum SSL3_TXT_KRB5_RC2_40_CBC_SHA = "EXP-KRB5-RC2-CBC-SHA";
230 enum SSL3_TXT_KRB5_RC4_40_SHA = "EXP-KRB5-RC4-SHA";
231 enum SSL3_TXT_KRB5_DES_40_CBC_MD5 = "EXP-KRB5-DES-CBC-MD5";
232 enum SSL3_TXT_KRB5_RC2_40_CBC_MD5 = "EXP-KRB5-RC2-CBC-MD5";
233 enum SSL3_TXT_KRB5_RC4_40_MD5 = "EXP-KRB5-RC4-MD5";
234 
235 enum SSL3_SSL_SESSION_ID_LENGTH = 32;
236 enum SSL3_MAX_SSL_SESSION_ID_LENGTH = 32;
237 
238 enum SSL3_MASTER_SECRET_SIZE = 48;
239 enum SSL3_RANDOM_SIZE = 32;
240 enum SSL3_SEQUENCE_SIZE = 8;
241 enum SSL3_SESSION_ID_SIZE = 32;
242 enum SSL3_CIPHER_VALUE_SIZE = 2;
243 
244 enum SSL3_RT_HEADER_LENGTH = 5;
245 enum SSL3_HM_HEADER_LENGTH = 4;
246 
247 enum SSL3_ALIGN_PAYLOAD = 8;
248 
249 /**
250  * This is the maximum MAC (digest) size used by the SSL library.
251  * Currently maximum of 20 is used by SHA1, but we reserve for
252  * future extension for 512-bit hashes.
253  */
254 enum SSL3_RT_MAX_MD_SIZE = 64;
255 
256 /**
257  * Maximum block size used in all ciphersuites. Currently 16 for AES.
258  */
259 enum SSL_RT_MAX_CIPHER_BLOCK_SIZE = 16;
260 
261 enum SSL3_RT_MAX_EXTRA = 16384;
262 
263 /**
264  * Maximum plaintext length: defined by SSL/TLS standards
265  */
266 enum SSL3_RT_MAX_PLAIN_LENGTH = 16384;
267 
268 /**
269  * Maximum compression overhead: defined by SSL/TLS standards
270  */
271 enum SSL3_RT_MAX_COMPRESSED_OVERHEAD = 1024;
272 
273 /**
274  * The standards give a maximum encryption overhead of 1024 bytes.
275  * In practice the value is lower than this. The overhead is the maximum
276  * number of padding bytes (256) plus the mac size.
277  */
278 enum SSL3_RT_MAX_ENCRYPTED_OVERHEAD = 256 + .SSL3_RT_MAX_MD_SIZE;
279 
280 /*
281  * OpenSSL currently only uses a padding length of at most one block so
282  * the send overhead is smaller.
283  */
284 
285 enum SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD = .SSL_RT_MAX_CIPHER_BLOCK_SIZE + .SSL3_RT_MAX_MD_SIZE;
286 
287 /* If compression isn't used don't include the compression overhead */
288 enum SSL3_RT_MAX_COMPRESSED_LENGTH = .SSL3_RT_MAX_PLAIN_LENGTH;
289 enum SSL3_RT_MAX_ENCRYPTED_LENGTH = .SSL3_RT_MAX_ENCRYPTED_OVERHEAD + .SSL3_RT_MAX_COMPRESSED_LENGTH;
290 enum SSL3_RT_MAX_PACKET_SIZE = .SSL3_RT_MAX_ENCRYPTED_LENGTH + .SSL3_RT_HEADER_LENGTH;
291 
292 enum SSL3_MD_CLIENT_FINISHED_CONST = "\x43\x4C\x4E\x54";
293 enum SSL3_MD_SERVER_FINISHED_CONST = "\x53\x52\x56\x52";
294 
295 enum SSL3_VERSION = 0x0300;
296 enum SSL3_VERSION_MAJOR = 0x03;
297 enum SSL3_VERSION_MINOR = 0x00;
298 
299 enum SSL3_RT_CHANGE_CIPHER_SPEC = 20;
300 enum SSL3_RT_ALERT = 21;
301 enum SSL3_RT_HANDSHAKE = 22;
302 enum SSL3_RT_APPLICATION_DATA = 23;
303 
304 enum SSL3_AL_WARNING = 1;
305 enum SSL3_AL_FATAL = 2;
306 
307 version (LIBRESSL_INTERNAL) {
308 } else {
309 	enum SSL3_AD_CLOSE_NOTIFY = 0;
310 
311 	/**
312 	 * fatal
313 	 */
314 	enum SSL3_AD_UNEXPECTED_MESSAGE = 10;
315 
316 	///Ditto
317 	enum SSL3_AD_BAD_RECORD_MAC = 20;
318 
319 	///Ditto
320 	enum SSL3_AD_DECOMPRESSION_FAILURE = 30;
321 
322 	///Ditto
323 	enum SSL3_AD_HANDSHAKE_FAILURE = 40;
324 
325 	enum SSL3_AD_NO_CERTIFICATE = 41;
326 	enum SSL3_AD_BAD_CERTIFICATE = 42;
327 	enum SSL3_AD_UNSUPPORTED_CERTIFICATE = 43;
328 	enum SSL3_AD_CERTIFICATE_REVOKED = 44;
329 	enum SSL3_AD_CERTIFICATE_EXPIRED = 45;
330 	enum SSL3_AD_CERTIFICATE_UNKNOWN = 46;
331 
332 	/**
333 	 * fatal
334 	 */
335 	enum SSL3_AD_ILLEGAL_PARAMETER = 47;
336 }
337 
338 enum TLS1_HB_REQUEST = 1;
339 enum TLS1_HB_RESPONSE = 2;
340 
341 enum SSL3_CT_RSA_SIGN = 1;
342 enum SSL3_CT_DSS_SIGN = 2;
343 enum SSL3_CT_RSA_FIXED_DH = 3;
344 enum SSL3_CT_DSS_FIXED_DH = 4;
345 enum SSL3_CT_RSA_EPHEMERAL_DH = 5;
346 enum SSL3_CT_DSS_EPHEMERAL_DH = 6;
347 enum SSL3_CT_FORTEZZA_DMS = 20;
348 
349 /**
350  * SSL3_CT_NUMBER is used to size arrays and it must be large
351  * enough to contain all of the cert types defined either for
352  * SSLv3 and TLSv1.
353  */
354 enum SSL3_CT_NUMBER = 13;
355 
356 enum SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS = 0x0001;
357 enum TLS1_FLAGS_SKIP_CERT_VERIFY = 0x0010;
358 enum TLS1_FLAGS_FREEZE_TRANSCRIPT = 0x0020;
359 enum SSL3_FLAGS_CCS_OK = 0x0080;
360 
361 /* SSLv3 */
362 /*client */
363 /* extra state */
364 enum SSL3_ST_CW_FLUSH = 0x0100 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
365 /* write to server */
366 enum SSL3_ST_CW_CLNT_HELLO_A = 0x0110 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
367 enum SSL3_ST_CW_CLNT_HELLO_B = 0x0111 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
368 /* read from server */
369 enum SSL3_ST_CR_SRVR_HELLO_A = 0x0120 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
370 enum SSL3_ST_CR_SRVR_HELLO_B = 0x0121 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
371 enum DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A = 0x0126 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
372 enum DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B = 0x0127 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
373 enum SSL3_ST_CR_CERT_A = 0x0130 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
374 enum SSL3_ST_CR_CERT_B = 0x0131 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
375 enum SSL3_ST_CR_KEY_EXCH_A = 0x0140 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
376 enum SSL3_ST_CR_KEY_EXCH_B = 0x0141 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
377 enum SSL3_ST_CR_CERT_REQ_A = 0x0150 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
378 enum SSL3_ST_CR_CERT_REQ_B = 0x0151 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
379 enum SSL3_ST_CR_SRVR_DONE_A = 0x0160 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
380 enum SSL3_ST_CR_SRVR_DONE_B = 0x0161 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
381 /* write to server */
382 enum SSL3_ST_CW_CERT_A = 0x0170 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
383 enum SSL3_ST_CW_CERT_B = 0x0171 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
384 enum SSL3_ST_CW_CERT_C = 0x0172 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
385 enum SSL3_ST_CW_CERT_D = 0x0173 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
386 enum SSL3_ST_CW_KEY_EXCH_A = 0x0180 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
387 enum SSL3_ST_CW_KEY_EXCH_B = 0x0181 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
388 enum SSL3_ST_CW_CERT_VRFY_A = 0x0190 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
389 enum SSL3_ST_CW_CERT_VRFY_B = 0x0191 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
390 enum SSL3_ST_CW_CHANGE_A = 0x01A0 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
391 enum SSL3_ST_CW_CHANGE_B = 0x01A1 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
392 enum SSL3_ST_CW_FINISHED_A = 0x01B0 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
393 enum SSL3_ST_CW_FINISHED_B = 0x01B1 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
394 /* read from server */
395 enum SSL3_ST_CR_CHANGE_A = 0x01C0 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
396 enum SSL3_ST_CR_CHANGE_B = 0x01C1 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
397 enum SSL3_ST_CR_FINISHED_A = 0x01D0 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
398 enum SSL3_ST_CR_FINISHED_B = 0x01D1 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
399 enum SSL3_ST_CR_SESSION_TICKET_A = 0x01E0 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
400 enum SSL3_ST_CR_SESSION_TICKET_B = 0x01E1 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
401 enum SSL3_ST_CR_CERT_STATUS_A = 0x01F0 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
402 enum SSL3_ST_CR_CERT_STATUS_B = 0x01F1 | libressl_d.openssl.ssl.SSL_ST_CONNECT;
403 
404 /* server */
405 /* extra state */
406 enum SSL3_ST_SW_FLUSH = 0x0100 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
407 /* read from client */
408 /* Do not change the number values, they do matter */
409 enum SSL3_ST_SR_CLNT_HELLO_A = 0x0110 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
410 enum SSL3_ST_SR_CLNT_HELLO_B = 0x0111 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
411 enum SSL3_ST_SR_CLNT_HELLO_C = 0x0112 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
412 /* write to client */
413 enum DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A = 0x0113 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
414 enum DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B = 0x0114 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
415 enum SSL3_ST_SW_HELLO_REQ_A = 0x0120 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
416 enum SSL3_ST_SW_HELLO_REQ_B = 0x0121 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
417 enum SSL3_ST_SW_HELLO_REQ_C = 0x0122 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
418 enum SSL3_ST_SW_SRVR_HELLO_A = 0x0130 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
419 enum SSL3_ST_SW_SRVR_HELLO_B = 0x0131 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
420 enum SSL3_ST_SW_CERT_A = 0x0140 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
421 enum SSL3_ST_SW_CERT_B = 0x0141 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
422 enum SSL3_ST_SW_KEY_EXCH_A = 0x0150 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
423 enum SSL3_ST_SW_KEY_EXCH_B = 0x0151 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
424 enum SSL3_ST_SW_CERT_REQ_A = 0x0160 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
425 enum SSL3_ST_SW_CERT_REQ_B = 0x0161 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
426 enum SSL3_ST_SW_SRVR_DONE_A = 0x0170 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
427 enum SSL3_ST_SW_SRVR_DONE_B = 0x0171 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
428 /* read from client */
429 enum SSL3_ST_SR_CERT_A = 0x0180 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
430 enum SSL3_ST_SR_CERT_B = 0x0181 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
431 enum SSL3_ST_SR_KEY_EXCH_A = 0x0190 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
432 enum SSL3_ST_SR_KEY_EXCH_B = 0x0191 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
433 enum SSL3_ST_SR_CERT_VRFY_A = 0x01A0 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
434 enum SSL3_ST_SR_CERT_VRFY_B = 0x01A1 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
435 enum SSL3_ST_SR_CHANGE_A = 0x01B0 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
436 enum SSL3_ST_SR_CHANGE_B = 0x01B1 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
437 enum SSL3_ST_SR_FINISHED_A = 0x01C0 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
438 enum SSL3_ST_SR_FINISHED_B = 0x01C1 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
439 /* write to client */
440 enum SSL3_ST_SW_CHANGE_A = 0x01D0 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
441 enum SSL3_ST_SW_CHANGE_B = 0x01D1 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
442 enum SSL3_ST_SW_FINISHED_A = 0x01E0 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
443 enum SSL3_ST_SW_FINISHED_B = 0x01E1 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
444 enum SSL3_ST_SW_SESSION_TICKET_A = 0x01F0 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
445 enum SSL3_ST_SW_SESSION_TICKET_B = 0x01F1 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
446 enum SSL3_ST_SW_CERT_STATUS_A = 0x0200 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
447 enum SSL3_ST_SW_CERT_STATUS_B = 0x0201 | libressl_d.openssl.ssl.SSL_ST_ACCEPT;
448 
449 enum SSL3_MT_HELLO_REQUEST = 0;
450 enum SSL3_MT_CLIENT_HELLO = 1;
451 enum SSL3_MT_SERVER_HELLO = 2;
452 enum SSL3_MT_NEWSESSION_TICKET = 4;
453 enum SSL3_MT_CERTIFICATE = 11;
454 enum SSL3_MT_SERVER_KEY_EXCHANGE = 12;
455 enum SSL3_MT_CERTIFICATE_REQUEST = 13;
456 enum SSL3_MT_SERVER_DONE = 14;
457 enum SSL3_MT_CERTIFICATE_VERIFY = 15;
458 enum SSL3_MT_CLIENT_KEY_EXCHANGE = 16;
459 enum SSL3_MT_FINISHED = 20;
460 enum SSL3_MT_CERTIFICATE_STATUS = 22;
461 
462 enum DTLS1_MT_HELLO_VERIFY_REQUEST = 3;
463 
464 enum SSL3_MT_CCS = 1;
465 
466 version (LIBRESSL_INTERNAL) {
467 } else {
468 	/* These are used when changing over to a new cipher */
469 	enum SSL3_CC_READ = 0x01;
470 	enum SSL3_CC_WRITE = 0x02;
471 	enum SSL3_CC_CLIENT = 0x10;
472 	enum SSL3_CC_SERVER = 0x20;
473 	enum SSL3_CHANGE_CIPHER_CLIENT_WRITE = .SSL3_CC_CLIENT | .SSL3_CC_WRITE;
474 	enum SSL3_CHANGE_CIPHER_SERVER_READ = .SSL3_CC_SERVER | .SSL3_CC_READ;
475 	enum SSL3_CHANGE_CIPHER_CLIENT_READ = .SSL3_CC_CLIENT | .SSL3_CC_READ;
476 	enum SSL3_CHANGE_CIPHER_SERVER_WRITE = .SSL3_CC_SERVER | .SSL3_CC_WRITE;
477 }