1 /* ssl/ssl.h */
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 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-2007 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 /* ====================================================================
117  * Copyright 2005 Nokia. All rights reserved.
118  *
119  * The portions of the attached software ("Contribution") is developed by
120  * Nokia Corporation and is licensed pursuant to the OpenSSL open source
121  * license.
122  *
123  * The Contribution, originally written by Mika Kousa and Pasi Eronen of
124  * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
125  * support (see RFC 4279) to OpenSSL.
126  *
127  * No patent licenses or other rights except those expressly stated in
128  * the OpenSSL open source license shall be deemed granted or received
129  * expressly, by implication, estoppel, or otherwise.
130  *
131  * No assurances are provided by Nokia that the Contribution does not
132  * infringe the patent or other intellectual property rights of any third
133  * party or that the license provides you with all the necessary rights
134  * to make use of the Contribution.
135  *
136  * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
137  * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
138  * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
139  * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
140  * OTHERWISE.
141  */
142 
143 module deimos.openssl.ssl;
144 
145 
146 import deimos.openssl._d_util;
147 
148 import deimos.openssl.x509_vfy; // Needed for x509_store_st.
149 import deimos.openssl.ssl2; // Needed for SSL2_TXT_NULL_WITH_MD5, etc.
150 import deimos.openssl.ssl3; // Needed for SSL3_TXT_KRB5_DES_64_CBC_SHA, etc.
151 version (OPENSSL_NO_KRB5) {} else {
152 	import deimos.openssl.kssl; // Needed for KSSL_CTX.
153 }
154 
155 // Declare cert_st used multiple times below.
156 struct cert_st;
157 
158 public import deimos.openssl.e_os2;
159 
160 version(OPENSSL_NO_COMP) {} else {
161 public import deimos.openssl.comp;
162 }
163 version(OPENSSL_NO_BIO) {} else {
164 public import deimos.openssl.bio;
165 }
166 version (OPENSSL_NO_DEPRECATED) {} else {
167 version(OPENSSL_NO_X509) {} else {
168 public import deimos.openssl.x509;
169 }
170 public import deimos.openssl.crypto;
171 public import deimos.openssl.buffer;
172 }
173 public import deimos.openssl.lhash; // Needed for DECLARE_LHASH_OF.
174 public import deimos.openssl.pem;
175 public import deimos.openssl.hmac;
176 
177 public import deimos.openssl.kssl;
178 public import deimos.openssl.safestack;
179 public import deimos.openssl.symhacks;
180 public import deimos.openssl.pool;
181 
182 import std.stdint;
183 
184 extern (C):
185 nothrow:
186 
187 /* SSLeay version number for ASN.1 encoding of the session information */
188 /* Version 0 - initial version
189  * Version 1 - added the optional peer certificate
190  */
191 enum SSL_SESSION_ASN1_VERSION = 0x0001;
192 
193 /* text strings for the ciphers */
194 alias SSL2_TXT_NULL_WITH_MD5 SSL_TXT_NULL_WITH_MD5;
195 alias SSL2_TXT_RC4_128_WITH_MD5 SSL_TXT_RC4_128_WITH_MD5;
196 alias SSL2_TXT_RC4_128_EXPORT40_WITH_MD5 SSL_TXT_RC4_128_EXPORT40_WITH_MD5;
197 alias SSL2_TXT_RC2_128_CBC_WITH_MD5 SSL_TXT_RC2_128_CBC_WITH_MD5;
198 alias SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 SSL_TXT_RC2_128_CBC_EXPORT40_WITH_MD5;
199 alias SSL2_TXT_IDEA_128_CBC_WITH_MD5 SSL_TXT_IDEA_128_CBC_WITH_MD5;
200 alias SSL2_TXT_DES_64_CBC_WITH_MD5 SSL_TXT_DES_64_CBC_WITH_MD5;
201 alias SSL2_TXT_DES_64_CBC_WITH_SHA SSL_TXT_DES_64_CBC_WITH_SHA;
202 alias SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5 SSL_TXT_DES_192_EDE3_CBC_WITH_MD5;
203 alias SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA SSL_TXT_DES_192_EDE3_CBC_WITH_SHA;
204 
205 /*   VRS Additional Kerberos5 entries
206  */
207 alias SSL3_TXT_KRB5_DES_64_CBC_SHA SSL_TXT_KRB5_DES_64_CBC_SHA;
208 alias SSL3_TXT_KRB5_DES_192_CBC3_SHA SSL_TXT_KRB5_DES_192_CBC3_SHA;
209 alias SSL3_TXT_KRB5_RC4_128_SHA SSL_TXT_KRB5_RC4_128_SHA;
210 alias SSL3_TXT_KRB5_IDEA_128_CBC_SHA SSL_TXT_KRB5_IDEA_128_CBC_SHA;
211 alias SSL3_TXT_KRB5_DES_64_CBC_MD5 SSL_TXT_KRB5_DES_64_CBC_MD5;
212 alias SSL3_TXT_KRB5_DES_192_CBC3_MD5 SSL_TXT_KRB5_DES_192_CBC3_MD5;
213 alias SSL3_TXT_KRB5_RC4_128_MD5 SSL_TXT_KRB5_RC4_128_MD5;
214 alias SSL3_TXT_KRB5_IDEA_128_CBC_MD5 SSL_TXT_KRB5_IDEA_128_CBC_MD5;
215 
216 alias SSL3_TXT_KRB5_DES_40_CBC_SHA SSL_TXT_KRB5_DES_40_CBC_SHA;
217 alias SSL3_TXT_KRB5_RC2_40_CBC_SHA SSL_TXT_KRB5_RC2_40_CBC_SHA;
218 alias SSL3_TXT_KRB5_RC4_40_SHA SSL_TXT_KRB5_RC4_40_SHA;
219 alias SSL3_TXT_KRB5_DES_40_CBC_MD5 SSL_TXT_KRB5_DES_40_CBC_MD5;
220 alias SSL3_TXT_KRB5_RC2_40_CBC_MD5 SSL_TXT_KRB5_RC2_40_CBC_MD5;
221 alias SSL3_TXT_KRB5_RC4_40_MD5 SSL_TXT_KRB5_RC4_40_MD5;
222 
223 // Oversight in the original headers: Already defined above.
224 // alias SSL3_TXT_KRB5_DES_40_CBC_SHA SSL_TXT_KRB5_DES_40_CBC_SHA;
225 // alias SSL3_TXT_KRB5_DES_40_CBC_MD5 SSL_TXT_KRB5_DES_40_CBC_MD5;
226 // alias SSL3_TXT_KRB5_DES_64_CBC_SHA SSL_TXT_KRB5_DES_64_CBC_SHA;
227 // alias SSL3_TXT_KRB5_DES_64_CBC_MD5 SSL_TXT_KRB5_DES_64_CBC_MD5;
228 // alias SSL3_TXT_KRB5_DES_192_CBC3_SHA SSL_TXT_KRB5_DES_192_CBC3_SHA;
229 // alias SSL3_TXT_KRB5_DES_192_CBC3_MD5 SSL_TXT_KRB5_DES_192_CBC3_MD5;
230 enum SSL_MAX_KRB5_PRINCIPAL_LENGTH = 256;
231 
232 enum SSL_MAX_SSL_SESSION_ID_LENGTH = 32;
233 enum SSL_MAX_SID_CTX_LENGTH = 32;
234 
235 enum SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES = (512/8);
236 enum SSL_MAX_KEY_ARG_LENGTH = 8;
237 enum SSL_MAX_MASTER_KEY_LENGTH = 48;
238 
239 
240 /* These are used to specify which ciphers to use and not to use */
241 
242 enum SSL_TXT_EXP40 = "EXPORT40";
243 enum SSL_TXT_EXP56 = "EXPORT56";
244 enum SSL_TXT_LOW = "LOW";
245 enum SSL_TXT_MEDIUM = "MEDIUM";
246 enum SSL_TXT_HIGH = "HIGH";
247 enum SSL_TXT_FIPS = "FIPS";
248 
249 enum SSL_TXT_kFZA = "kFZA"; /* unused! */
250 enum SSL_TXT_aFZA = "aFZA"; /* unused! */
251 enum SSL_TXT_eFZA = "eFZA"; /* unused! */
252 enum SSL_TXT_FZA = "FZA";  /* unused! */
253 
254 enum SSL_TXT_aNULL = "aNULL";
255 enum SSL_TXT_eNULL = "eNULL";
256 enum SSL_TXT_NULL = "NULL";
257 
258 enum SSL_TXT_kRSA = "kRSA";
259 enum SSL_TXT_kDHr = "kDHr"; /* no such ciphersuites supported! */
260 enum SSL_TXT_kDHd = "kDHd"; /* no such ciphersuites supported! */
261 enum SSL_TXT_kDH = "kDH";  /* no such ciphersuites supported! */
262 enum SSL_TXT_kEDH = "kEDH";
263 enum SSL_TXT_kKRB5 = "kKRB5";
264 enum SSL_TXT_kECDHr = "kECDHr";
265 enum SSL_TXT_kECDHe = "kECDHe";
266 enum SSL_TXT_kECDH = "kECDH";
267 enum SSL_TXT_kEECDH = "kEECDH";
268 enum SSL_TXT_kPSK = "kPSK";
269 enum SSL_TXT_kGOST = "kGOST";
270 enum SSL_TXT_kSRP = "kSRP";
271 
272 enum SSL_TXT_aRSA = "aRSA";
273 enum SSL_TXT_aDSS = "aDSS";
274 enum SSL_TXT_aDH = "aDH"; /* no such ciphersuites supported! */
275 enum SSL_TXT_aECDH = "aECDH";
276 enum SSL_TXT_aKRB5 = "aKRB5";
277 enum SSL_TXT_aECDSA = "aECDSA";
278 enum SSL_TXT_aPSK = "aPSK";
279 enum SSL_TXT_aGOST94 = "aGOST94";
280 enum SSL_TXT_aGOST01 = "aGOST01";
281 enum SSL_TXT_aGOST = "aGOST";
282 
283 enum SSL_TXT_DSS = "DSS";
284 enum SSL_TXT_DH = "DH";
285 enum SSL_TXT_EDH = "EDH"; /* same as "kEDH:-ADH" */
286 enum SSL_TXT_ADH = "ADH";
287 enum SSL_TXT_RSA = "RSA";
288 enum SSL_TXT_ECDH = "ECDH";
289 enum SSL_TXT_EECDH = "EECDH"; /* same as "kEECDH:-AECDH" */
290 enum SSL_TXT_AECDH = "AECDH";
291 enum SSL_TXT_ECDSA = "ECDSA";
292 enum SSL_TXT_KRB5 = "KRB5";
293 enum SSL_TXT_PSK = "PSK";
294 enum SSL_TXT_SRP = "SRP";
295 
296 enum SSL_TXT_DES = "DES";
297 enum SSL_TXT_3DES = "3DES";
298 enum SSL_TXT_RC4 = "RC4";
299 enum SSL_TXT_RC2 = "RC2";
300 enum SSL_TXT_IDEA = "IDEA";
301 enum SSL_TXT_SEED = "SEED";
302 enum SSL_TXT_AES128 = "AES128";
303 enum SSL_TXT_AES256 = "AES256";
304 enum SSL_TXT_AES = "AES";
305 enum SSL_TXT_AES_GCM = "AESGCM";
306 enum SSL_TXT_CAMELLIA128 = "CAMELLIA128";
307 enum SSL_TXT_CAMELLIA256 = "CAMELLIA256";
308 enum SSL_TXT_CAMELLIA = "CAMELLIA";
309 
310 enum SSL_TXT_MD5 = "MD5";
311 enum SSL_TXT_SHA1 = "SHA1";
312 enum SSL_TXT_SHA = "SHA"; /* same as "SHA1" */
313 enum SSL_TXT_GOST94 = "GOST94";
314 enum SSL_TXT_GOST89MAC = "GOST89MAC";
315 enum SSL_TXT_SHA256 = "SHA256";
316 enum SSL_TXT_SHA384 = "SHA384";
317 
318 enum SSL_TXT_SSLV2 = "SSLv2";
319 enum SSL_TXT_SSLV3 = "SSLv3";
320 enum SSL_TXT_TLSV1 = "TLSv1";
321 enum SSL_TXT_TLSV1_1 = "TLSv1.1";
322 enum SSL_TXT_TLSV1_2 = "TLSv1.2";
323 
324 enum SSL_TXT_EXP = "EXP";
325 enum SSL_TXT_EXPORT = "EXPORT";
326 
327 enum SSL_TXT_ALL = "ALL";
328 
329 /*
330  * COMPLEMENTOF* definitions. These identifiers are used to (de-select)
331  * ciphers normally not being used.
332  * Example: "RC4" will activate all ciphers using RC4 including ciphers
333  * without authentication, which would normally disabled by DEFAULT (due
334  * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT"
335  * will make sure that it is also disabled in the specific selection.
336  * COMPLEMENTOF* identifiers are portable between version_, as adjustments
337  * to the default cipher setup will also be included here.
338  *
339  * COMPLEMENTOFDEFAULT does not experience the same special treatment that
340  * DEFAULT gets, as only selection is being done and no sorting as needed
341  * for DEFAULT.
342  */
343 enum SSL_TXT_CMPALL = "COMPLEMENTOFALL";
344 enum SSL_TXT_CMPDEF = "COMPLEMENTOFDEFAULT";
345 
346 /* The following cipher list is used by default.
347  * It also is substituted when an application-defined cipher list string
348  * starts with 'DEFAULT'. */
349 enum SSL_DEFAULT_CIPHER_LIST = "ALL:!aNULL:!eNULL:!SSLv2";
350 /* As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always
351  * starts with a reasonable order, and all we have to do for DEFAULT is
352  * throwing out anonymous and unencrypted ciphersuites!
353  * (The latter are not actually enabled by ALL, but "ALL:RSA" would enable
354  * some of them.)
355  */
356 
357 /* Used in SSL_set_shutdown()/SSL_get_shutdown(); */
358 enum SSL_SENT_SHUTDOWN = 1;
359 enum SSL_RECEIVED_SHUTDOWN = 2;
360 
361 extern (C):
362 nothrow:
363 
364 version (OPENSSL_NO_RSA) { version = OPENSSL_NO_SSL2; }
365 version (OPENSSL_NO_MD5) { version = OPENSSL_NO_SSL2; }
366 
367 alias X509_FILETYPE_ASN1 SSL_FILETYPE_ASN1;
368 alias X509_FILETYPE_PEM SSL_FILETYPE_PEM;
369 
370 /* This is needed to stop compilers complaining about the
371  * 'ssl_st* ' function parameters used to prototype callbacks
372  * in SSL_CTX. */
373 alias ssl_st* ssl_crock_st;
374 import deimos.openssl.tls1;
375 alias tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT;
376 alias ssl_method_st SSL_METHOD;
377 alias ssl_cipher_st SSL_CIPHER;
378 alias ssl_session_st SSL_SESSION;
379 
380 /+mixin DECLARE_STACK_OF(SSL_CIPHER);+/
381 
382 /* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/
383 struct srtp_protection_profile_st
384        {
385        const(char)* name;
386        c_ulong id;
387        }
388 alias srtp_protection_profile_st SRTP_PROTECTION_PROFILE;
389 
390 /+mixin DECLARE_STACK_OF(SRTP_PROTECTION_PROFILE);+/
391 
392 alias ExternC!(int function(SSL* s, const(ubyte)* data, int len, void* arg)) tls_session_ticket_ext_cb_fn;
393 alias ExternC!(int function(SSL* s, void* secret, int* secret_len, STACK_OF!(SSL_CIPHER) *peer_ciphers, SSL_CIPHER** cipher, void* arg)) tls_session_secret_cb_fn;
394 
395 
396 version(OPENSSL_NO_SSL_INTERN) {} else {
397 
398 /* used to hold info on the particular ciphers used */
399 struct ssl_cipher_st {
400 	int valid;
401 	const(char)* name;		/* text name */
402 	c_ulong id;		/* id, 4 bytes, first is version */
403 
404 	/* changed in 0.9.9: these four used to be portions of a single value 'algorithms' */
405 	c_ulong algorithm_mkey;	/* key exchange algorithm */
406 	c_ulong algorithm_auth;	/* server authentication */
407 	c_ulong algorithm_enc;	/* symmetric encryption */
408 	c_ulong algorithm_mac;	/* symmetric authentication */
409 	c_ulong algorithm_ssl;	/* (major) protocol version */
410 
411 	c_ulong algo_strength;	/* strength and export flags */
412 	c_ulong algorithm2;	/* Extra flags */
413 	int strength_bits;		/* Number of bits really used */
414 	int alg_bits;			/* Number of bits for algorithm */
415 	}
416 
417 
418 /* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */
419 struct ssl_method_st {
420 	int version_;
421 	ExternC!(int function(SSL* s)) ssl_new;
422 	ExternC!(void function(SSL* s)) ssl_clear;
423 	ExternC!(void function(SSL* s)) ssl_free;
424 	ExternC!(int function(SSL* s)) ssl_accept;
425 	ExternC!(int function(SSL* s)) ssl_connect;
426 	ExternC!(int function(SSL* s,void* buf,int len)) ssl_read;
427 	ExternC!(int function(SSL* s,void* buf,int len)) ssl_peek;
428 	ExternC!(int function(SSL* s,const(void)* buf,int len)) ssl_write;
429 	ExternC!(int function(SSL* s)) ssl_shutdown;
430 	ExternC!(int function(SSL* s)) ssl_renegotiate;
431 	ExternC!(int function(SSL* s)) ssl_renegotiate_check;
432 	ExternC!(c_long function(SSL* s, int st1, int stn, int mt, c_long
433 		max, int* ok)) ssl_get_message;
434 	ExternC!(int function(SSL* s, int type, ubyte* buf, int len,
435 		int peek)) ssl_read_bytes;
436 	ExternC!(int function(SSL* s, int type, const(void)* buf_, int len)) ssl_write_bytes;
437 	ExternC!(int function(SSL* s)) ssl_dispatch_alert;
438 	ExternC!(c_long function(SSL* s,int cmd,c_long larg,void* parg)) ssl_ctrl;
439 	ExternC!(c_long function(SSL_CTX* ctx,int cmd,c_long larg,void* parg)) ssl_ctx_ctrl;
440 	const ExternC!(SSL_CIPHER* function(const(ubyte)* ptr)) get_cipher_by_char;
441 	ExternC!(int function(const(SSL_CIPHER)* cipher,ubyte* ptr)) put_cipher_by_char;
442 	ExternC!(int function(const(SSL)* s)) ssl_pending;
443 	ExternC!(int function()) num_ciphers;
444 	const ExternC!(SSL_CIPHER* function(uint ncipher)) get_cipher;
445 	const ExternC!(ssl_method_st* function(int version_)) get_ssl_method;
446 	ExternC!(c_long function()) get_timeout;
447 	struct ssl3_enc_method;
448 	ssl3_enc_method* ssl3_enc; /* Extra SSLv3/TLS stuff */
449 	ExternC!(int function()) ssl_version;
450 	ExternC!(c_long function(SSL* s, int cb_id, ExternC!(void function()) fp)) ssl_callback_ctrl;
451 	ExternC!(c_long function(SSL_CTX* s, int cb_id, ExternC!(void function()) fp)) ssl_ctx_callback_ctrl;
452 	}
453 
454 /* Lets make this into an ASN.1 type structure as follows
455  * SSL_SESSION_ID ::= SEQUENCE {
456  *	version 		INTEGER,	-- structure version number
457  *	SSLversion 		INTEGER,	-- SSL version number
458  *	Cipher 			OCTET STRING,	-- the 3 byte cipher ID
459  *	Session_ID 		OCTET STRING,	-- the Session ID
460  *	Master_key 		OCTET STRING,	-- the master key
461  *	KRB5_principal		OCTET STRING	-- optional Kerberos principal
462  *	Key_Arg [ 0 ] IMPLICIT	OCTET STRING,	-- the optional Key argument
463  *	Time [ 1 ] EXPLICIT	INTEGER,	-- optional Start Time
464  *	Timeout [ 2 ] EXPLICIT	INTEGER,	-- optional Timeout ins seconds
465  *	Peer [ 3 ] EXPLICIT	X509,		-- optional Peer Certificate
466  *	Session_ID_context [ 4 ] EXPLICIT OCTET STRING,   -- the Session ID context
467  *	Verify_result [ 5 ] EXPLICIT INTEGER,   -- X509_V_... code for `Peer'
468  *	HostName [ 6 ] EXPLICIT OCTET STRING,   -- optional HostName from servername TLS extension
469  *	PSK_identity_hint [ 7 ] EXPLICIT OCTET STRING, -- optional PSK identity hint
470  *	PSK_identity [ 8 ] EXPLICIT OCTET STRING,  -- optional PSK identity
471  *	Ticket_lifetime_hint [9] EXPLICIT INTEGER, -- server's lifetime hint for session ticket
472  *	Ticket [10]             EXPLICIT OCTET STRING, -- session ticket (clients only)
473  *	Compression_meth [11]   EXPLICIT OCTET STRING, -- optional compression method
474  *	SRP_username [ 12 ] EXPLICIT OCTET STRING -- optional SRP username
475  *	}
476  * Look in ssl/ssl_asn1.c for more details
477  * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-).
478  */
479 struct ssl_session_st
480 	{
481 	int ssl_version;	/* what ssl version session info is
482 				 * being kept in here? */
483 
484 	/* only really used in SSLv2 */
485 	uint key_arg_length;
486 	ubyte[SSL_MAX_KEY_ARG_LENGTH] key_arg;
487 	int master_key_length;
488 	ubyte[SSL_MAX_MASTER_KEY_LENGTH] master_key;
489 	/* session_id - valid? */
490 	uint session_id_length;
491 	ubyte[SSL_MAX_SSL_SESSION_ID_LENGTH] session_id;
492 	/* this is used to determine whether the session is being reused in
493 	 * the appropriate context. It is up to the application to set this,
494 	 * via SSL_new */
495 	uint sid_ctx_length;
496 	ubyte[SSL_MAX_SID_CTX_LENGTH] sid_ctx;
497 
498 version(OPENSSL_NO_KRB5) {} else {
499         uint krb5_client_princ_len;
500         ubyte[SSL_MAX_KRB5_PRINCIPAL_LENGTH] krb5_client_princ;
501 } /* OPENSSL_NO_KRB5 */
502 version(OPENSSL_NO_PSK) {} else {
503 	char* psk_identity_hint;
504 	char* psk_identity;
505 }
506 	/* Used to indicate that session resumption is not allowed.
507 	 * Applications can also set this bit for a new session via
508 	 * not_resumable_session_cb to disable session caching and tickets. */
509 	int not_resumable;
510 
511 	/* The cert is the certificate used to establish this connection */
512 	struct sess_cert_st;
513 	sess_cert_st /* SESS_CERT */ *sess_cert;
514 
515 	/* This is the cert for the other end.
516 	 * On clients, it will be the same as sess_cert->peer_key->x509
517 	 * (the latter is not enough as sess_cert is not retained
518 	 * in the external representation of sessions, see ssl_asn1.c). */
519 	X509* peer;
520 	/* when app_verify_callback accepts a session where the peer's certificate
521 	 * is not ok, we must remember the error for session reuse: */
522 	c_long verify_result; /* only for servers */
523 
524 	int references;
525 	c_long timeout;
526 	c_long time;
527 
528 	uint compress_meth;	/* Need to lookup the method */
529 
530 	const(SSL_CIPHER)* cipher;
531 	c_ulong cipher_id;	/* when ASN.1 loaded, this
532 					 * needs to be used to load
533 					 * the 'cipher' structure */
534 
535 	STACK_OF!(SSL_CIPHER) *ciphers; /* shared ciphers? */
536 
537 	CRYPTO_EX_DATA ex_data; /* application specific data */
538 
539 	/* These are used to make removal of session-ids more
540 	 * efficient and to implement a maximum cache size. */
541 	ssl_session_st* prev,next;
542 version (OPENSSL_NO_TLSEXT) {} else {
543 	char* tlsext_hostname;
544 version(OPENSSL_NO_EC) {} else {
545 	size_t tlsext_ecpointformatlist_length;
546 	ubyte* tlsext_ecpointformatlist; /* peer's list */
547 	size_t tlsext_ellipticcurvelist_length;
548 	ubyte* tlsext_ellipticcurvelist; /* peer's list */
549 } /* OPENSSL_NO_EC */
550 	/* RFC4507 info */
551 	ubyte* tlsext_tick;	/* Session ticket */
552 	size_t tlsext_ticklen;		/* Session ticket length */
553 	c_long tlsext_tick_lifetime_hint;	/* Session lifetime hint in seconds */
554 }
555 version(OPENSSL_NO_SRP) {} else {
556 	char *srp_username;
557 }
558 	}
559 
560 } // OPENSSL_NO_SSL_INTERN
561 
562 enum SSL_OP_MICROSOFT_SESS_ID_BUG = 0x00000001;
563 enum SSL_OP_NETSCAPE_CHALLENGE_BUG = 0x00000002;
564 /* Allow initial connection to servers that don't support RI */
565 enum SSL_OP_LEGACY_SERVER_CONNECT = 0x00000004;
566 enum SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG = 0x00000008;
567 enum SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG = 0x00000010;
568 enum SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER = 0x00000020;
569 enum SSL_OP_SAFARI_ECDHE_ECDSA_BUG = 0x00000040;
570 enum SSL_OP_SSLEAY_080_CLIENT_DH_BUG = 0x00000080;
571 enum SSL_OP_TLS_D5_BUG = 0x00000100;
572 enum SSL_OP_TLS_BLOCK_PADDING_BUG = 0x00000200;
573 
574 /* Hasn't done anything since OpenSSL 0.9.7h, retained for compatibility */
575 enum SSL_OP_MSIE_SSLV2_RSA_PADDING = 0x0;
576 
577 /* Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added
578  * in OpenSSL 0.9.6d.  Usually (depending on the application protocol)
579  * the workaround is not needed.  Unfortunately some broken SSL/TLS
580  * implementations cannot handle it at all, which is why we include
581  * it in SSL_OP_ALL. */
582 enum SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS = 0x00000800; /* added in 0.9.6e */
583 
584 /* SSL_OP_ALL: various bug workarounds that should be rather harmless.
585  *            This used to be 0x000FFFFFL before 0.9.7. */
586 enum SSL_OP_ALL = 0x80000BFFL;
587 
588 /* DTLS options */
589 enum SSL_OP_NO_QUERY_MTU = 0x00001000;
590 /* Turn on Cookie Exchange (on relevant for servers) */
591 enum SSL_OP_COOKIE_EXCHANGE = 0x00002000;
592 /* Don't use RFC4507 ticket extension */
593 enum SSL_OP_NO_TICKET = 0x00004000;
594 /* Use Cisco's "speshul" version of DTLS_BAD_VER (as client)  */
595 enum SSL_OP_CISCO_ANYCONNECT = 0x00008000;
596 
597 /* As server, disallow session resumption on renegotiation */
598 enum SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION = 0x00010000;
599 /* Don't use compression even if supported */
600 enum SSL_OP_NO_COMPRESSION = 0x00020000;
601 /* Permit unsafe legacy renegotiation */
602 enum SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION = 0x00040000;
603 /* If set, always create a new key when using tmp_ecdh parameters */
604 enum SSL_OP_SINGLE_ECDH_USE = 0x00080000;
605 /* If set, always create a new key when using tmp_dh parameters */
606 enum SSL_OP_SINGLE_DH_USE = 0x00100000;
607 /* Set to always use the tmp_rsa key when doing RSA operations,
608  * even when this violates protocol specs */
609 enum SSL_OP_EPHEMERAL_RSA = 0x00200000;
610 /* Set on servers to choose the cipher according to the server's
611  * preferences */
612 enum SSL_OP_CIPHER_SERVER_PREFERENCE = 0x00400000;
613 /* If set, a server will allow a client to issue a SSLv3.0 version number
614  * as latest version supported in the premaster secret, even when TLSv1.0
615  * (version 3.1) was announced in the client hello. Normally this is
616  * forbidden to prevent version rollback attacks. */
617 enum SSL_OP_TLS_ROLLBACK_BUG = 0x00800000;
618 
619 enum SSL_OP_NO_SSLv2 = 0x01000000;
620 enum SSL_OP_NO_SSLv3 = 0x02000000;
621 enum SSL_OP_NO_TLSv1 = 0x04000000;
622 enum SSL_OP_NO_TLSv1_2 = 0x08000000L;
623 enum SSL_OP_NO_TLSv1_1 = 0x10000000L;
624 
625 /* These next two were never actually used for anything since SSLeay
626  * zap so we have some more flags.
627  */
628 /* The next flag deliberately changes the ciphertest, this is a check
629  * for the PKCS#1 attack */
630 enum SSL_OP_PKCS1_CHECK_1 = 0x0;
631 enum SSL_OP_PKCS1_CHECK_2 = 0x0;
632 
633 enum SSL_OP_NETSCAPE_CA_DN_BUG = 0x20000000;
634 enum SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG = 0x40000000;
635 /* Make server add server-hello extension from early version of
636  * cryptopro draft, when GOST ciphersuite is negotiated.
637  * Required for interoperability with CryptoPro CSP 3.x
638  */
639 enum SSL_OP_CRYPTOPRO_TLSEXT_BUG = 0x80000000;
640 
641 /* Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success
642  * when just a single record has been written): */
643 enum SSL_MODE_ENABLE_PARTIAL_WRITE = 0x00000001;
644 /* Make it possible to retry SSL_write() with changed buffer location
645  * (buffer contents must stay the same!); this is not the default to avoid
646  * the misconception that non-blocking SSL_write() behaves like
647  * non-blocking write(): */
648 enum SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER = 0x00000002;
649 /* Never bother the application with retries if the transport
650  * is blocking: */
651 enum SSL_MODE_AUTO_RETRY = 0x00000004;
652 /* Don't attempt to automatically build certificate chain */
653 enum SSL_MODE_NO_AUTO_CHAIN = 0x00000008;
654 
655 
656 // SSL_MODE_ENABLE_FALSE_START allows clients to send application data before
657 // receipt of ChangeCipherSpec and Finished. This mode enables full handshakes
658 // to 'complete' in one RTT. See RFC 7918.
659 //
660 // When False Start is enabled, |SSL_do_handshake| may succeed before the
661 // handshake has completely finished. |SSL_write| will function at this point,
662 // and |SSL_read| will transparently wait for the final handshake leg before
663 // returning application data. To determine if False Start occurred or when the
664 // handshake is completely finished, see |SSL_in_false_start|, |SSL_in_init|,
665 // and |SSL_CB_HANDSHAKE_DONE| from |SSL_CTX_set_info_callback|.
666 enum SSL_MODE_ENABLE_FALSE_START = 0x00000080L;
667 
668 // SSL_MODE_CBC_RECORD_SPLITTING causes multi-byte CBC records in TLS 1.0 to be
669 // split in two: the first record will contain a single byte and the second will
670 // contain the remainder. This effectively randomises the IV and prevents BEAST
671 // attacks.
672 enum SSL_MODE_CBC_RECORD_SPLITTING = 0x00000100L;
673 
674 // SSL_MODE_NO_SESSION_CREATION will cause any attempts to create a session to
675 // fail with SSL_R_SESSION_MAY_NOT_BE_CREATED. This can be used to enforce that
676 // session resumption is used for a given SSL*.
677 enum SSL_MODE_NO_SESSION_CREATION = 0x00000200L;
678 
679 // SSL_MODE_SEND_FALLBACK_SCSV sends TLS_FALLBACK_SCSV in the ClientHello.
680 // To be set only by applications that reconnect with a downgraded protocol
681 // version; see RFC 7507 for details.
682 //
683 // DO NOT ENABLE THIS if your application attempts a normal handshake. Only use
684 // this in explicit fallback retries, following the guidance in RFC 7507.
685 enum SSL_MODE_SEND_FALLBACK_SCSV = 0x00000400L;
686 
687 
688 /* Save RAM by releasing read and write buffers when they're empty. (SSL3 and
689  * TLS only.)  "Released" buffers are put onto a free-list in the context
690  * or just freed (depending on the context's setting for freelist_max_len). */
691 enum SSL_MODE_RELEASE_BUFFERS = 0x00000010;
692 /* Send the current time in the Random fields of the ClientHello and
693  * ServerHello records for compatibility with hypothetical implementations
694  * that require it.
695  */
696 enum SSL_MODE_SEND_CLIENTHELLO_TIME = 0x00000020L;
697 enum SSL_MODE_SEND_SERVERHELLO_TIME = 0x00000040L;
698 
699 /* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value,
700  * they cannot be used to clear bits. */
701 
702 auto SSL_CTX_set_options(SSL_CTX* ctx, c_long op) {
703 	return SSL_CTX_ctrl(ctx,SSL_CTRL_OPTIONS,op,null);
704 }
705 auto SSL_CTX_clear_options(SSL_CTX* ctx, c_long op) {
706 	return SSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_OPTIONS,op,null);
707 }
708 auto SSL_CTX_get_options(SSL_CTX* ctx) {
709 	return SSL_CTX_ctrl(ctx,SSL_CTRL_OPTIONS,0,null);
710 }
711 
712 auto SSL_CTX_set_mode(SSL_CTX* ctx, c_long op) {
713 	return SSL_CTX_ctrl(ctx,SSL_CTRL_MODE,op,null);
714 }
715 auto SSL_CTX_clear_mode(SSL_CTX* ctx, c_long op) {
716 	return SSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_MODE,op,null);
717 }
718 auto SSL_CTX_get_mode(SSL_CTX* ctx) {
719 	return SSL_CTX_ctrl(ctx,SSL_CTRL_MODE,0,null);
720 }
721 auto SSL_get_mode(SSL* ssl) {
722 	return SSL_ctrl(ssl,SSL_CTRL_MODE,0,null);
723 }
724 
725 // SSL_set_mtu sets the |ssl|'s MTU in DTLS to |mtu|. It returns one on success
726 // and zero on failure.
727 int SSL_set_mtu(SSL *ssl, uint mtu);
728 
729 auto SSL_get_secure_renegotiation_support(SSL* ssl) {
730 	return SSL_ctrl(ssl,SSL_CTRL_GET_RI_SUPPORT,0,null);
731 }
732 
733 version(OPENSSL_NO_HEARTBEATS) {} else {
734 	auto SSL_get_secure_renegotiation_support(SSL* ssl) {
735         return SSL_ctrl(ssl,SSL_CTRL_TLS_EXT_SEND_HEARTBEAT,0,null);
736 	}
737 }
738 
739 void SSL_CTX_set_msg_callback(SSL_CTX* ctx, ExternC!(void function(int write_p, int version_, int content_type, const(void)* buf, size_t len, SSL* ssl, void* arg)) cb);
740 void SSL_set_msg_callback(SSL* ssl, ExternC!(void function(int write_p, int version_, int content_type, const(void)* buf, size_t len, SSL* ssl, void* arg)) cb);
741 auto SSL_CTX_set_msg_callback_arg(SSL_CTX* ctx, void* arg) {
742     return SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, arg);
743 }
744 
745 // SSL_CTX_set_msg_callback_arg sets the |arg| parameter of the message
746 // callback.
747 void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg);
748 
749 
750 version(OPENSSL_NO_SRP) {} else {
751 
752 version(OPENSSL_NO_SSL_INTERN) {} else {
753 
754 struct srp_ctx_st
755 	{
756 	/* param for all the callbacks */
757 	void *SRP_cb_arg;
758 	/* set client Hello login callback */
759 	ExternC!(int function(SSL *, int *, void *)) TLS_ext_srp_username_callback;
760 	/* set SRP N/g param callback for verification */
761 	ExternC!(int function(SSL *, void *)) SRP_verify_param_callback;
762 	/* set SRP client passwd callback */
763 	ExternC!(char* function(SSL *, void *)) SRP_give_srp_client_pwd_callback;
764 
765 	char *login;
766 	BIGNUM* N, g, s, B, A;
767 	BIGNUM* a, b, v;
768 	char* info;
769 	int strength;
770 
771 	c_ulong srp_Mask;
772 	}
773 alias srp_ctx_st SRP_CTX;
774 }
775 
776 /* see tls_srp.c */
777 int SSL_SRP_CTX_init(SSL *s);
778 int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx);
779 int SSL_SRP_CTX_free(SSL *ctx);
780 int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx);
781 int SSL_srp_server_param_with_username(SSL *s, int *ad);
782 int SRP_generate_server_master_secret(SSL *s,ubyte *master_key);
783 int SRP_Calc_A_param(SSL *s);
784 int SRP_generate_client_master_secret(SSL *s,ubyte *master_key);
785 
786 }
787 
788 version (Win32) {
789 enum SSL_MAX_CERT_LIST_DEFAULT = 1024*30; /* 30k max cert list :-) */
790 } else {
791 enum SSL_MAX_CERT_LIST_DEFAULT = 1024*100; /* 100k max cert list :-) */
792 }
793 
794 enum SSL_SESSION_CACHE_MAX_SIZE_DEFAULT = (1024*20);
795 
796 /* This callback type is used inside SSL_CTX, SSL, and in the functions that set
797  * them. It is used to override the generation of SSL/TLS session IDs in a
798  * server. Return value should be zero on an error, non-zero to proceed. Also,
799  * callbacks should themselves check if the id they generate is unique otherwise
800  * the SSL handshake will fail with an error - callbacks can do this using the
801  * 'ssl' value they're passed by;
802  *     SSL_has_matching_session_id(ssl, id, *id_len)
803  * The length value passed in is set at the maximum size the session ID can be.
804  * In SSLv2 this is 16 bytes, whereas SSLv3/TLSv1 it is 32 bytes. The callback
805  * can alter this length to be less if desired, but under SSLv2 session IDs are
806  * supposed to be fixed at 16 bytes so the id will be padded after the callback
807  * returns in this case. It is also an error for the callback to set the size to
808  * zero. */
809 alias ExternC!(int function(/+ FIXME: @@BUG7127@@ const+/ SSL* ssl, ubyte* id,
810 uint* id_len)) GEN_SESSION_CB;
811 
812 alias ssl_comp_st SSL_COMP;
813 
814 version(OPENSSL_NO_SSL_INTERN) {
815     struct ssl_comp_st;
816 } else {
817     struct ssl_comp_st
818 	{
819 	int id;
820 	const(char)* name;
821 version(OPENSSL_NO_COMP) {
822 	char* method;
823 } else {
824 	COMP_METHOD* method;
825 }
826 	}
827 
828 /+mixin DECLARE_STACK_OF!(SSL_COMP);+/
829 mixin DECLARE_LHASH_OF!(SSL_SESSION);
830 
831 struct ssl_ctx_st
832 	{
833 	const(SSL_METHOD)* method;
834 
835 	STACK_OF!(SSL_CIPHER) *cipher_list;
836 	/* same as above but sorted for lookup */
837 	STACK_OF!(SSL_CIPHER) *cipher_list_by_id;
838 
839 	x509_store_st /* X509_STORE */ *cert_store;
840 	LHASH_OF!(SSL_SESSION) *sessions;
841 	/* Most session-ids that will be cached, default is
842 	 * SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited. */
843 	c_ulong session_cache_size;
844 	ssl_session_st* session_cache_head;
845 	ssl_session_st* session_cache_tail;
846 
847 	/* This can have one of 2 values, ored together,
848 	 * SSL_SESS_CACHE_CLIENT,
849 	 * SSL_SESS_CACHE_SERVER,
850 	 * Default is SSL_SESSION_CACHE_SERVER, which means only
851 	 * SSL_accept which cache SSL_SESSIONS. */
852 	int session_cache_mode;
853 
854 	/* If timeout is not 0, it is the default timeout value set
855 	 * when SSL_new() is called.  This has been put in to make
856 	 * life easier to set things up */
857 	c_long session_timeout;
858 
859 	/* If this callback is not null, it will be called each
860 	 * time a session id is added to the cache.  If this function
861 	 * returns 1, it means that the callback will do a
862 	 * SSL_SESSION_free() when it has finished using it.  Otherwise,
863 	 * on 0, it means the callback has finished with it.
864 	 * If remove_session_cb is not null, it will be called when
865 	 * a session-id is removed from the cache.  After the call,
866 	 * OpenSSL will SSL_SESSION_free() it. */
867 	ExternC!(int function(ssl_st* ssl,SSL_SESSION* sess)) new_session_cb;
868 	ExternC!(void function(ssl_ctx_st* ctx,SSL_SESSION* sess)) remove_session_cb;
869 	ExternC!(SSL_SESSION* function(ssl_st* ssl,
870 		ubyte* data,int len,int* copy)) get_session_cb;
871 
872 	struct stats_
873 		{
874 		int sess_connect;	/* SSL new conn - started */
875 		int sess_connect_renegotiate;/* SSL reneg - requested */
876 		int sess_connect_good;	/* SSL new conne/reneg - finished */
877 		int sess_accept;	/* SSL new accept - started */
878 		int sess_accept_renegotiate;/* SSL reneg - requested */
879 		int sess_accept_good;	/* SSL accept/reneg - finished */
880 		int sess_miss;		/* session lookup misses  */
881 		int sess_timeout;	/* reuse attempt on timeouted session */
882 		int sess_cache_full;	/* session removed due to full cache */
883 		int sess_hit;		/* session reuse actually done */
884 		int sess_cb_hit;	/* session-id that was not
885 					 * in the cache was
886 					 * passed back via the callback.  This
887 					 * indicates that the application is
888 					 * supplying session-id's from other
889 					 * processes - spooky :-) */
890 		}
891 	stats_ stats;
892 
893 	int references;
894 
895 	/* if defined, these override the X509_verify_cert() calls */
896 	ExternC!(int function(X509_STORE_CTX*, void*)) app_verify_callback;
897 	void* app_verify_arg;
898 	/* before OpenSSL 0.9.7, 'app_verify_arg' was ignored
899 	 * ('app_verify_callback' was called with just one argument) */
900 
901 	/* Default password callback. */
902 	pem_password_cb* default_passwd_callback;
903 
904 	/* Default password callback user data. */
905 	void* default_passwd_callback_userdata;
906 
907 	/* get client cert callback */
908 	ExternC!(int function(SSL* ssl, X509** x509, EVP_PKEY** pkey)) client_cert_cb;
909 
910     /* cookie generate callback */
911     ExternC!(int function(SSL* ssl, ubyte* cookie,
912         uint* cookie_len)) app_gen_cookie_cb;
913 
914     /* verify cookie callback */
915     ExternC!(int function(SSL* ssl, ubyte* cookie,
916         uint cookie_len)) app_verify_cookie_cb;
917 
918 	CRYPTO_EX_DATA ex_data;
919 
920 	const(EVP_MD)* rsa_md5;/* For SSLv2 - name is 'ssl2-md5' */
921 	const(EVP_MD)* md5;	/* For SSLv3/TLSv1 'ssl3-md5' */
922 	const(EVP_MD)* sha1;   /* For SSLv3/TLSv1 'ssl3->sha1' */
923 
924 	STACK_OF!(X509) *extra_certs;
925 	STACK_OF!(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */
926 
927 
928 	/* Default values used when no per-SSL value is defined follow */
929 
930 	ExternC!(void function(const(SSL)* ssl,int type,int val)) info_callback; /* used if SSL's info_callback is NULL */
931 
932 	/* what we put in client cert requests */
933 	STACK_OF!(X509_NAME) *client_CA;
934 
935 
936 	/* Default values to use in SSL structures follow (these are copied by SSL_new) */
937 
938 	c_ulong options;
939 	c_ulong mode;
940 	c_long max_cert_list;
941 
942 	cert_st /* CERT */ *cert;
943 	int read_ahead;
944 
945 	/* callback that allows applications to peek at protocol messages */
946 	ExternC!(void function(int write_p, int version_, int content_type, const(void)* buf, size_t len, SSL* ssl, void* arg)) msg_callback;
947 	void* msg_callback_arg;
948 
949 	int verify_mode;
950 	uint sid_ctx_length;
951 	ubyte[SSL_MAX_SID_CTX_LENGTH] sid_ctx;
952 	ExternC!(int function(int ok,X509_STORE_CTX* ctx)) default_verify_callback; /* called 'verify_callback' in the SSL */
953 
954 	/* Default generate session ID callback. */
955 	GEN_SESSION_CB generate_session_id;
956 
957 	X509_VERIFY_PARAM* param;
958 
959 version (none) {
960 	int purpose;		/* Purpose setting */
961 	int trust;		/* Trust setting */
962 }
963 
964 	int quiet_shutdown;
965 
966 	/* Maximum amount of data to send in one fragment.
967 	 * actual record size can be more than this due to
968 	 * padding and MAC overheads.
969 	 */
970 	uint max_send_fragment;
971 
972 version(OPENSSL_NO_ENGINE) {} else {
973 	/* Engine to pass requests for client certs to
974 	 */
975 	ENGINE* client_cert_engine;
976 }
977 
978 version(OPENSSL_NO_TLSEXT) {} else {
979 	/* TLS extensions servername callback */
980 	ExternC!(int function(SSL*, int*, void*)) tlsext_servername_callback;
981 	void* tlsext_servername_arg;
982 	/* RFC 4507 session ticket keys */
983 	ubyte[16] tlsext_tick_key_name;
984 	ubyte[16] tlsext_tick_hmac_key;
985 	ubyte[16] tlsext_tick_aes_key;
986 	/* Callback to support customisation of ticket key setting */
987 	ExternC!(int function(SSL* ssl,
988 					ubyte* name, ubyte* iv,
989 					EVP_CIPHER_CTX* ectx,
990  					HMAC_CTX* hctx, int enc)) tlsext_ticket_key_cb;
991 
992 	/* certificate status request info */
993 	/* Callback for status request */
994 	ExternC!(int function(SSL* ssl, void* arg)) tlsext_status_cb;
995 	void* tlsext_status_arg;
996 
997 	/* draft-rescorla-tls-opaque-prf-input-00.txt information */
998 	ExternC!(int function(SSL*, void* peerinput, size_t len, void* arg)) tlsext_opaque_prf_input_callback;
999 	void* tlsext_opaque_prf_input_callback_arg;
1000 }
1001 
1002 version(OPENSSL_NO_PSK) {} else {
1003 	char* psk_identity_hint;
1004 	ExternC!(uint function(SSL* ssl, const(char)* hint, char* identity,
1005 		uint max_identity_len, ubyte* psk,
1006 		uint max_psk_len)) psk_client_callback;
1007 	ExternC!(uint function(SSL* ssl, const(char)* identity,
1008 		ubyte* psk, uint max_psk_len)) psk_server_callback;
1009 }
1010 
1011 version(OPENSSL_NO_BUF_FREELISTS) {} else {
1012 enum SSL_MAX_BUF_FREELIST_LEN_DEFAULT = 32;
1013 	uint freelist_max_len;
1014 	struct ssl3_buf_freelist_st;
1015 	ssl3_buf_freelist_st* wbuf_freelist;
1016 	ssl3_buf_freelist_st* rbuf_freelist;
1017 }
1018 version(OPENSSL_NO_SRP) {} else {
1019 	SRP_CTX srp_ctx; /* ctx for SRP authentication */
1020 }
1021 
1022 version(OPENSSL_NO_TLSEXT) {} else {
1023 
1024 version(OPENSSL_NO_NEXTPROTONEG) {} else {
1025 	/* Next protocol negotiation information */
1026 	/* (for experimental NPN extension). */
1027 
1028 	/* For a server, this contains a callback function by which the set of
1029 	 * advertised protocols can be provided. */
1030 	ExternC!(int function(SSL *s, const(ubyte)** buf,
1031 			                 uint *len, void *arg)) next_protos_advertised_cb;
1032 	void *next_protos_advertised_cb_arg;
1033 	/* For a client, this contains a callback function that selects the
1034 	 * next protocol from the list provided by the server. */
1035 	ExternC!(int function(SSL *s, ubyte** out_,
1036 				    ubyte* outlen,
1037 				    const(ubyte)* in_,
1038 				    uint inlen,
1039 				    void *arg)) next_proto_select_cb;
1040 	void *next_proto_select_cb_arg;
1041 }
1042         /* SRTP profiles we are willing to do from RFC 5764 */
1043         STACK_OF!(SRTP_PROTECTION_PROFILE) *srtp_profiles;
1044 }
1045 	}
1046 alias SSL_CTX = ssl_ctx_st;
1047 }
1048 
1049 enum SSL_SESS_CACHE_OFF = 0x0000;
1050 enum SSL_SESS_CACHE_CLIENT = 0x0001;
1051 enum SSL_SESS_CACHE_SERVER = 0x0002;
1052 enum SSL_SESS_CACHE_BOTH = (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER);
1053 enum SSL_SESS_CACHE_NO_AUTO_CLEAR = 0x0080;
1054 /* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */
1055 enum SSL_SESS_CACHE_NO_INTERNAL_LOOKUP = 0x0100;
1056 enum SSL_SESS_CACHE_NO_INTERNAL_STORE = 0x0200;
1057 enum SSL_SESS_CACHE_NO_INTERNAL = (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE);
1058 
1059 LHASH_OF!(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX* ctx);
1060 auto SSL_CTX_sess_number(SSL_CTX* ctx) {
1061     return SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,null);
1062 }
1063 auto SSL_CTX_sess_connect(SSL_CTX* ctx) {
1064     return SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,null);
1065 }
1066 auto SSL_CTX_sess_connect_good(SSL_CTX* ctx) {
1067     return SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,null);
1068 }
1069 auto SSL_CTX_sess_connect_renegotiate(SSL_CTX* ctx) {
1070     return SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,null);
1071 }
1072 auto SSL_CTX_sess_accept(SSL_CTX* ctx) {
1073     return SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,null);
1074 }
1075 auto SSL_CTX_sess_accept_renegotiate(SSL_CTX* ctx) {
1076     return SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,null);
1077 }
1078 auto SSL_CTX_sess_accept_good(SSL_CTX* ctx) {
1079     return SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,null);
1080 }
1081 auto SSL_CTX_sess_hits(SSL_CTX* ctx) {
1082     return SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,null);
1083 }
1084 auto SSL_CTX_sess_cb_hits(SSL_CTX* ctx) {
1085     return SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,null);
1086 }
1087 auto SSL_CTX_sess_misses(SSL_CTX* ctx) {
1088     return SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,null);
1089 }
1090 auto SSL_CTX_sess_timeouts(SSL_CTX* ctx) {
1091     return SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,null);
1092 }
1093 auto SSL_CTX_sess_cache_full(SSL_CTX* ctx) {
1094     return SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,null);
1095 }
1096 
1097 void SSL_CTX_sess_set_new_cb(SSL_CTX* ctx, ExternC!(int function(ssl_st* ssl,SSL_SESSION* sess)) new_session_cb);
1098 ExternC!(int function(ssl_st* ssl, SSL_SESSION* sess)) SSL_CTX_sess_get_new_cb(SSL_CTX* ctx);
1099 void SSL_CTX_sess_set_remove_cb(SSL_CTX* ctx, ExternC!(void function(ssl_ctx_st* ctx,SSL_SESSION* sess)) remove_session_cb);
1100 ExternC!(void function(ssl_st* ssl, SSL_SESSION* sess)) SSL_CTX_sess_get_remove_cb(SSL_CTX* ctx);
1101 void SSL_CTX_sess_set_get_cb(SSL_CTX* ctx, ExternC!(SSL_SESSION* function(ssl_st* ssl, ubyte* data,int len,int* copy)) get_session_cb);
1102 ExternC!(SSL_SESSION* function(ssl_st* ssl, ubyte* Data, int len, int* copy)) SSL_CTX_sess_get_get_cb(SSL_CTX* ctx);
1103 void SSL_CTX_set_info_callback(SSL_CTX* ctx, ExternC!(void function(const(SSL)* ssl,int type,int val)) cb);
1104 ExternC!(void function(const(SSL)* ssl,int type,int val)) SSL_CTX_get_info_callback(SSL_CTX* ctx);
1105 void SSL_CTX_set_client_cert_cb(SSL_CTX* ctx, ExternC!(int function(SSL* ssl, X509** x509, EVP_PKEY** pkey)) client_cert_cb);
1106 ExternC!(int function(SSL* ssl, X509** x509, EVP_PKEY** pkey)) SSL_CTX_get_client_cert_cb(SSL_CTX* ctx);
1107 version(OPENSSL_NO_ENGINE) {} else {
1108 int SSL_CTX_set_client_cert_engine(SSL_CTX* ctx, ENGINE* e);
1109 }
1110 void SSL_CTX_set_cookie_generate_cb(SSL_CTX* ctx, ExternC!(int function(SSL* ssl, ubyte* cookie, uint* cookie_len)) app_gen_cookie_cb);
1111 void SSL_CTX_set_cookie_verify_cb(SSL_CTX* ctx, ExternC!(int function(SSL* ssl, ubyte* cookie, uint cookie_len)) app_verify_cookie_cb);
1112 version(OPENSSL_NO_NEXTPROTONEG) {} else {
1113 void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s,
1114 					   ExternC!(int function(SSL *ssl,
1115 						      const(ubyte)** out_,
1116 						      uint* outlen,
1117 						      void* arg)),
1118 					   void* arg);
1119 void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s,
1120 				      ExternC!(int function(SSL *ssl,
1121 						 ubyte** out_,
1122 						 ubyte* outlen,
1123 						 const(ubyte)* in_,
1124 						 uint inlen,
1125 						 void *arg)),
1126 				      void *arg);
1127 
1128 int SSL_select_next_proto(ubyte** out_, ubyte* outlen,
1129 			  const(ubyte)* in_, uint inlen,
1130 			  const(ubyte)* client, uint client_len);
1131 void SSL_get0_next_proto_negotiated(const(SSL) *s,
1132 				    const(ubyte)** data, uint *len);
1133 
1134 enum OPENSSL_NPN_UNSUPPORTED = 0;
1135 enum OPENSSL_NPN_NEGOTIATED = 1;
1136 enum OPENSSL_NPN_NO_OVERLAP = 2;
1137 }
1138 
1139 version(OPENSSL_NO_PSK) {} else {
1140 /* the maximum length of the buffer given to callbacks containing the
1141  * resulting identity/psk */
1142 enum PSK_MAX_IDENTITY_LEN = 128;
1143 enum PSK_MAX_PSK_LEN = 256;
1144 void SSL_CTX_set_psk_client_callback(SSL_CTX* ctx,
1145 	ExternC!(uint function(SSL* ssl, const(char)* hint,
1146 		char* identity, uint max_identity_len, ubyte* psk,
1147 		uint max_psk_len)) psk_client_callback);
1148 void SSL_set_psk_client_callback(SSL* ssl,
1149 	ExternC!(uint function(SSL* ssl, const(char)* hint,
1150 		char* identity, uint max_identity_len, ubyte* psk,
1151 		uint max_psk_len)) psk_client_callback);
1152 void SSL_CTX_set_psk_server_callback(SSL_CTX* ctx,
1153 	ExternC!(uint function(SSL* ssl, const(char)* identity,
1154 		ubyte* psk, uint max_psk_len)) psk_server_callback);
1155 void SSL_set_psk_server_callback(SSL* ssl,
1156 	ExternC!(uint function(SSL* ssl, const(char)* identity,
1157 		ubyte* psk, uint max_psk_len)) psk_server_callback);
1158 int SSL_CTX_use_psk_identity_hint(SSL_CTX* ctx, const(char)* identity_hint);
1159 int SSL_use_psk_identity_hint(SSL* s, const(char)* identity_hint);
1160 const(char)* SSL_get_psk_identity_hint(const(SSL)* s);
1161 const(char)* SSL_get_psk_identity(const(SSL)* s);
1162 }
1163 
1164 enum SSL_NOTHING = 1;
1165 enum SSL_WRITING = 2;
1166 enum SSL_READING = 3;
1167 enum SSL_X509_LOOKUP = 4;
1168 
1169 /* These will only be used when doing non-blocking IO */
1170 auto SSL_want_nothing(const(SSL)* s) { return (SSL_want(s) == SSL_NOTHING); }
1171 auto SSL_want_read(const(SSL)* s) { return (SSL_want(s) == SSL_READING); }
1172 auto SSL_want_write(const(SSL)* s) { return (SSL_want(s) == SSL_WRITING); }
1173 auto SSL_want_x509_lookup(const(SSL)* s) { return (SSL_want(s) == SSL_X509_LOOKUP); }
1174 
1175 enum SSL_MAC_FLAG_READ_MAC_STREAM = 1;
1176 enum SSL_MAC_FLAG_WRITE_MAC_STREAM = 2;
1177 
1178 version(OPENSSL_NO_SSL_INTERN) {} else {
1179 
1180 struct ssl_st
1181 	{
1182 	/* protocol version
1183 	 * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, DTLS1_VERSION)
1184 	 */
1185 	int version_;
1186 	int type; /* SSL_ST_CONNECT or SSL_ST_ACCEPT */
1187 
1188 	const(SSL_METHOD)* method; /* SSLv3 */
1189 
1190 	/* There are 2 BIO's even though they are normally both the
1191 	 * same.  This is so data can be read and written to different
1192 	 * handlers */
1193 
1194 version(OPENSSL_NO_BIO) {
1195 	char* rbio; /* used by SSL_read */
1196 	char* wbio; /* used by SSL_write */
1197 	char* bbio;
1198 } else {
1199 	BIO* rbio; /* used by SSL_read */
1200 	BIO* wbio; /* used by SSL_write */
1201 	BIO* bbio; /* used during session-id reuse to concatenate
1202 		    * messages */
1203 }
1204 	/* This holds a variable that indicates what we were doing
1205 	 * when a 0 or -1 is returned.  This is needed for
1206 	 * non-blocking IO so we know what request needs re-doing when
1207 	 * in SSL_accept or SSL_connect */
1208 	int rwstate;
1209 
1210 	/* true when we are actually in SSL_accept() or SSL_connect() */
1211 	int in_handshake;
1212 	ExternC!(int function(SSL*)) handshake_func;
1213 
1214 	/* Imagine that here's a boolean member "init" that is
1215 	 * switched as soon as SSL_set_{accept/connect}_state
1216 	 * is called for the first time, so that "state" and
1217 	 * "handshake_func" are properly initialized.  But as
1218 	 * handshake_func is == 0 until then, we use this
1219 	 * test instead of an "init" member.
1220 	 */
1221 
1222 	int server;	/* are we the server side? - mostly used by SSL_clear*/
1223 
1224 	int new_session;/* Generate a new session or reuse an old one.
1225 	                 * NB: For servers, the 'new' session may actually be a previously
1226 	                 * cached session or even the previous session unless
1227 	                 * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */
1228 	int quiet_shutdown;/* don't send shutdown packets */
1229 	int shutdown;	/* we have shut things down, 0x01 sent, 0x02
1230 			 * for received */
1231 	int state;	/* where we are */
1232 	int rstate;	/* where we are when reading */
1233 
1234 	BUF_MEM* init_buf;	/* buffer used during init */
1235 	void* init_msg;   	/* pointer to handshake message body, set by ssl3_get_message() */
1236 	int init_num;		/* amount read/written */
1237 	int init_off;		/* amount read/written */
1238 
1239 	/* used internally to point at a raw packet */
1240 	ubyte* packet;
1241 	uint packet_length;
1242 
1243 	ssl2_state_st* s2; /* SSLv2 variables */
1244 	ssl3_state_st* s3; /* SSLv3 variables */
1245 	import deimos.openssl.dtls1;
1246 	dtls1_state_st* d1; /* DTLSv1 variables */
1247 
1248 	int read_ahead;		/* Read as many input bytes as possible
1249 	               	 	 * (for non-blocking reads) */
1250 
1251 	/* callback that allows applications to peek at protocol messages */
1252 	ExternC!(void function(int write_p, int version_, int content_type, const(void)* buf, size_t len, SSL* ssl, void* arg)) msg_callback;
1253 	void* msg_callback_arg;
1254 
1255 	int hit;		/* reusing a previous session */
1256 
1257 	X509_VERIFY_PARAM* param;
1258 
1259 version (none) {
1260 	int purpose;		/* Purpose setting */
1261 	int trust;		/* Trust setting */
1262 }
1263 
1264 	/* crypto */
1265 	STACK_OF!(SSL_CIPHER) *cipher_list;
1266 	STACK_OF!(SSL_CIPHER) *cipher_list_by_id;
1267 
1268 	/* These are the ones being used, the ones in SSL_SESSION are
1269 	 * the ones to be 'copied' into these ones */
1270 	int mac_flags;
1271 	EVP_CIPHER_CTX* enc_read_ctx;		/* cryptographic state */
1272 	EVP_MD_CTX* read_hash;		/* used for mac generation */
1273 version(OPENSSL_NO_COMP) {
1274 	char* expand;
1275 } else {
1276 	COMP_CTX* expand;			/* uncompress */
1277 }
1278 
1279 	EVP_CIPHER_CTX* enc_write_ctx;		/* cryptographic state */
1280 	EVP_MD_CTX* write_hash;		/* used for mac generation */
1281 version(OPENSSL_NO_COMP) {
1282 	char* compress;
1283 } else {
1284 	COMP_CTX* compress;			/* compression */
1285 }
1286 
1287 	/* session info */
1288 
1289 	/* client cert? */
1290 	/* This is used to hold the server certificate used */
1291 	cert_st /* CERT */ *cert;
1292 
1293 	/* the session_id_context is used to ensure sessions are only reused
1294 	 * in the appropriate context */
1295 	uint sid_ctx_length;
1296 	ubyte[SSL_MAX_SID_CTX_LENGTH] sid_ctx;
1297 
1298 	/* This can also be in the session once a session is established */
1299 	SSL_SESSION* session;
1300 
1301 	/* Default generate session ID callback. */
1302 	GEN_SESSION_CB generate_session_id;
1303 
1304 	/* Used in SSL2 and SSL3 */
1305 	int verify_mode;	/* 0 don't care about verify failure.
1306 				 * 1 fail if verify fails */
1307 	ExternC!(int function(int ok,X509_STORE_CTX* ctx)) verify_callback; /* fail if callback returns 0 */
1308 
1309 	ExternC!(void function(/+ FIXME: @@BUG7127@@ const+/ SSL* ssl,int type,int val)) info_callback; /* optional informational callback */
1310 
1311 	int error;		/* error bytes to be written */
1312 	int error_code;		/* actual code */
1313 
1314 version(OPENSSL_NO_KRB5) {} else {
1315 	KSSL_CTX* kssl_ctx;     /* Kerberos 5 context */
1316 }	/* OPENSSL_NO_KRB5 */
1317 
1318 version(OPENSSL_NO_PSK) {} else {
1319 	ExternC!(uint function(SSL* ssl, const(char)* hint, char* identity,
1320 		uint max_identity_len, ubyte* psk,
1321 		uint max_psk_len)) psk_client_callback;
1322 	ExternC!(uint function(SSL* ssl, const(char)* identity,
1323 		ubyte* psk, uint max_psk_len)) psk_server_callback;
1324 }
1325 
1326 	SSL_CTX* ctx;
1327 	/* set this flag to 1 and a sleep(1) is put into all SSL_read()
1328 	 * and SSL_write() calls, good for nbio debuging :-) */
1329 	int debug_;
1330 
1331 	/* extra application data */
1332 	c_long verify_result;
1333 	CRYPTO_EX_DATA ex_data;
1334 
1335 	/* for server side, keep the list of CA_dn we can use */
1336 	STACK_OF!(X509_NAME) *client_CA;
1337 
1338 	int references;
1339 	c_ulong options; /* protocol behaviour */
1340 	c_ulong mode; /* API behaviour */
1341 	c_long max_cert_list;
1342 	int first_packet;
1343 	int client_version;	/* what was passed, used for
1344 				 * SSLv3/TLS rollback check */
1345 	uint max_send_fragment;
1346 version(OPENSSL_NO_TLSEXT) {
1347 alias ctx session_ctx;
1348 } else {
1349 	/* TLS extension debug callback */
1350 	ExternC!(void function(SSL* s, int client_server, int type,
1351 					ubyte* data, int len,
1352 					void* arg)) tlsext_debug_cb;
1353 	void* tlsext_debug_arg;
1354 	char* tlsext_hostname;
1355 	int servername_done;   /* no further mod of servername
1356 	                          0 : call the servername extension callback.
1357 	                          1 : prepare 2, allow last ack just after in server callback.
1358 	                          2 : don't call servername callback, no ack in server hello
1359 	                       */
1360 	/* certificate status request info */
1361 	/* Status type or -1 if no status type */
1362 	int tlsext_status_type;
1363 	/* Expect OCSP CertificateStatus message */
1364 	int tlsext_status_expected;
1365 	/* OCSP status request only */
1366 	STACK_OF!(OCSP_RESPID) *tlsext_ocsp_ids;
1367 	X509_EXTENSIONS* tlsext_ocsp_exts;
1368 	/* OCSP response received or to be sent */
1369 	ubyte* tlsext_ocsp_resp;
1370 	int tlsext_ocsp_resplen;
1371 
1372 	/* RFC4507 session ticket expected to be received or sent */
1373 	int tlsext_ticket_expected;
1374 version(OPENSSL_NO_EC) {} else {
1375 	size_t tlsext_ecpointformatlist_length;
1376 	ubyte* tlsext_ecpointformatlist; /* our list */
1377 	size_t tlsext_ellipticcurvelist_length;
1378 	ubyte* tlsext_ellipticcurvelist; /* our list */
1379 } /* OPENSSL_NO_EC */
1380 
1381 	/* draft-rescorla-tls-opaque-prf-input-00.txt information to be used for handshakes */
1382 	void* tlsext_opaque_prf_input;
1383 	size_t tlsext_opaque_prf_input_len;
1384 
1385 	/* TLS Session Ticket extension override */
1386 	TLS_SESSION_TICKET_EXT* tlsext_session_ticket;
1387 
1388 	/* TLS Session Ticket extension callback */
1389 	tls_session_ticket_ext_cb_fn tls_session_ticket_ext_cb;
1390 	void* tls_session_ticket_ext_cb_arg;
1391 
1392 	/* TLS pre-shared secret session resumption */
1393 	tls_session_secret_cb_fn tls_session_secret_cb;
1394 	void* tls_session_secret_cb_arg;
1395 
1396 	SSL_CTX* initial_ctx; /* initial ctx, used to store sessions */
1397 
1398 version(OPENSSL_NO_NEXTPROTONEG) {} else {
1399 	/* Next protocol negotiation. For the client, this is the protocol that
1400 	 * we sent in NextProtocol and is set when handling ServerHello
1401 	 * extensions.
1402 	 *
1403 	 * For a server, this is the client's selected_protocol from
1404 	 * NextProtocol and is set when handling the NextProtocol message,
1405 	 * before the Finished message. */
1406     ubyte* next_proto_negotiated;
1407 	ubyte next_proto_negotiated_len;
1408 }
1409 
1410 alias initial_ctx session_ctx;
1411 
1412 	STACK_OF!(SRTP_PROTECTION_PROFILE)* srtp_profiles;  /* What we'll do */
1413 	SRTP_PROTECTION_PROFILE* srtp_profile;            /* What's been chosen */
1414 
1415 	uint tlsext_heartbeat;  /* Is use of the Heartbeat extension negotiated?
1416 	                                   0: disabled
1417 	                                   1: enabled
1418 	                                   2: enabled, but not allowed to send Requests
1419 	                                 */
1420 	uint tlsext_hb_pending; /* Indicates if a HeartbeatRequest is in flight */
1421 	uint tlsext_hb_seq;     /* HeartbeatRequest sequence number */
1422 } /* OPENSSL_NO_TLSEXT */
1423 
1424 	int renegotiate;/* 1 if we are renegotiating.
1425 	                 * 2 if we are a server and are inside a handshake
1426 	                 * (i.e. not just sending a HelloRequest) */
1427 
1428 version(OPENSSL_NO_SRP) {} else {
1429 	SRP_CTX srp_ctx; /* ctx for SRP authentication */
1430 }
1431 	}
1432 alias SSL = ssl_st;
1433 }
1434 
1435 public import deimos.openssl.ssl2;
1436 public import deimos.openssl.ssl3;
1437 public import deimos.openssl.tls1; /* This is mostly sslv3 with a few tweaks */
1438 public import deimos.openssl.dtls1; /* Datagram TLS */
1439 public import deimos.openssl.ssl23;
1440 public import deimos.openssl.srtp; /* Support for the use_srtp extension */
1441 
1442 extern (C):
1443 nothrow:
1444 
1445 /* compatibility */
1446 auto SSL_set_app_data(SSL* s, char* arg) { return (SSL_set_ex_data(s,0,arg)); }
1447 auto SSL_get_app_data(const(SSL)* s) { return (SSL_get_ex_data(s,0)); }
1448 auto SSL_SESSION_set_app_data(SSL_SESSION* s, char* a) { return (SSL_SESSION_set_ex_data(s,0,a)); }
1449 auto SSL_SESSION_get_app_data(const(SSL_SESSION)* s) { return (SSL_SESSION_get_ex_data(s,0)); }
1450 auto SSL_CTX_get_app_data(const(SSL_CTX)* ctx) { return (SSL_CTX_get_ex_data(ctx,0)); }
1451 auto SSL_CTX_set_app_data(SSL_CTX* ctx, char* arg) { return (SSL_CTX_set_ex_data(ctx,0,arg)); }
1452 
1453 /* The following are the possible values for ssl->state are are
1454  * used to indicate where we are up to in the SSL connection establishment.
1455  * The macros that follow are about the only things you should need to use
1456  * and even then, only when using non-blocking IO.
1457  * It can also be useful to work out where you were when the connection
1458  * failed */
1459 
1460 enum SSL_ST_CONNECT = 0x1000;
1461 enum SSL_ST_ACCEPT = 0x2000;
1462 enum SSL_ST_MASK = 0x0FFF;
1463 enum SSL_ST_INIT = (SSL_ST_CONNECT|SSL_ST_ACCEPT);
1464 enum SSL_ST_BEFORE = 0x4000;
1465 enum SSL_ST_OK = 0x03;
1466 enum SSL_ST_RENEGOTIATE = (0x04|SSL_ST_INIT);
1467 
1468 enum SSL_CB_LOOP = 0x01;
1469 enum SSL_CB_EXIT = 0x02;
1470 enum SSL_CB_READ = 0x04;
1471 enum SSL_CB_WRITE = 0x08;
1472 enum SSL_CB_ALERT = 0x4000; /* used in callback */
1473 enum SSL_CB_READ_ALERT = (SSL_CB_ALERT|SSL_CB_READ);
1474 enum SSL_CB_WRITE_ALERT = (SSL_CB_ALERT|SSL_CB_WRITE);
1475 enum SSL_CB_ACCEPT_LOOP = (SSL_ST_ACCEPT|SSL_CB_LOOP);
1476 enum SSL_CB_ACCEPT_EXIT = (SSL_ST_ACCEPT|SSL_CB_EXIT);
1477 enum SSL_CB_CONNECT_LOOP = (SSL_ST_CONNECT|SSL_CB_LOOP);
1478 enum SSL_CB_CONNECT_EXIT = (SSL_ST_CONNECT|SSL_CB_EXIT);
1479 enum SSL_CB_HANDSHAKE_START = 0x10;
1480 enum SSL_CB_HANDSHAKE_DONE = 0x20;
1481 
1482 /* Is the SSL_connection established? */
1483 auto SSL_get_state(const(SSL)* a) { return SSL_state(a); }
1484 auto SSL_is_init_finished(const(SSL)* a) { return (SSL_state(a) == SSL_ST_OK); }
1485 auto SSL_in_init(const(SSL)* a) { return (SSL_state(a)&SSL_ST_INIT); }
1486 auto SSL_in_before(const(SSL)* a) { return (SSL_state(a)&SSL_ST_BEFORE); }
1487 auto SSL_in_connect_init(const(SSL)* a) { return (SSL_state(a)&SSL_ST_CONNECT); }
1488 auto SSL_in_accept_init(const(SSL)* a) { return (SSL_state(a)&SSL_ST_ACCEPT); }
1489 
1490 /* The following 2 states are kept in ssl->rstate when reads fail,
1491  * you should not need these */
1492 enum SSL_ST_READ_HEADER = 0xF0;
1493 enum SSL_ST_READ_BODY = 0xF1;
1494 enum SSL_ST_READ_DONE = 0xF2;
1495 
1496 /* Obtain latest Finished message
1497  *  -- that we sent (SSL_get_finished)
1498  *  -- that we expected from peer (SSL_get_peer_finished).
1499  * Returns length (0 == no Finished so far), copies up to 'count' bytes. */
1500 size_t SSL_get_finished(const(SSL)* s, void* buf, size_t count);
1501 size_t SSL_get_peer_finished(const(SSL)* s, void* buf, size_t count);
1502 
1503 // SSL_VERIFY_NONE, on a client, verifies the server certificate but does not
1504 // make errors fatal. The result may be checked with |SSL_get_verify_result|. On
1505 // a server it does not request a client certificate. This is the default.
1506 enum SSL_VERIFY_NONE = 0x00;
1507 
1508 // SSL_VERIFY_PEER, on a client, makes server certificate errors fatal. On a
1509 // server it requests a client certificate and makes errors fatal. However,
1510 // anonymous clients are still allowed. See
1511 // |SSL_VERIFY_FAIL_IF_NO_PEER_CERT|.
1512 enum SSL_VERIFY_PEER = 0x01;
1513 
1514 // SSL_VERIFY_FAIL_IF_NO_PEER_CERT configures a server to reject connections if
1515 // the client declines to send a certificate. This flag must be used together
1516 // with |SSL_VERIFY_PEER|, otherwise it won't work.
1517 enum SSL_VERIFY_FAIL_IF_NO_PEER_CERT = 0x02;
1518 
1519 // SSL_VERIFY_PEER_IF_NO_OBC configures a server to request a client certificate
1520 // if and only if Channel ID is not negotiated.
1521 enum SSL_VERIFY_PEER_IF_NO_OBC = 0x04;
1522 
1523 enum SSL_VERIFY_CLIENT_ONCE = 0x00;
1524 
1525 alias SSL_library_init OpenSSL_add_ssl_algorithms;
1526 alias SSL_library_init SSLeay_add_ssl_algorithms;
1527 
1528 /* this is for backward compatibility */
1529 //#if 0 /* NEW_SSLEAY */
1530 //#define SSL_CTX_set_default_verify(a,b,c) SSL_CTX_set_verify(a,b,c)
1531 //#define SSL_set_pref_cipher(c,n)	SSL_set_cipher_list(c,n)
1532 //#define SSL_add_session(a,b)            SSL_CTX_add_session((a),(b))
1533 //#define SSL_remove_session(a,b)		SSL_CTX_remove_session((a),(b))
1534 //#define SSL_flush_sessions(a,b)		SSL_CTX_flush_sessions((a),(b))
1535 //#endif
1536 /* More backward compatibility */
1537 auto SSL_get_cipher(const(SSL)* s) {
1538     return SSL_CIPHER_get_name(SSL_get_current_cipher(s));
1539 }
1540 auto SSL_get_cipher_bits(const(SSL)* s, int* np) {
1541     return SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np);
1542 }
1543 auto SSL_get_cipher_version(const(SSL)* s) {
1544     return SSL_CIPHER_get_version(SSL_get_current_cipher(s));
1545 }
1546 auto SSL_get_cipher_name(const(SSL)* s) {
1547     return SSL_CIPHER_get_name(SSL_get_current_cipher(s));
1548 }
1549 alias SSL_SESSION_get_time SSL_get_time;
1550 alias SSL_SESSION_set_time SSL_set_time;
1551 alias SSL_SESSION_get_timeout SSL_get_timeout;
1552 alias SSL_SESSION_set_timeout SSL_set_timeout;
1553 
1554 // auto d2i_SSL_SESSION_bio(BIO* bp,SSL_SESSION** s_id) {
1555 //     return ASN1_d2i_bio_of!SSL_SESSION(&SSL_SESSION_new,&d2i_SSL_SESSION,bp,s_id);
1556 // }
1557 // auto i2d_SSL_SESSION_bio(BIO* bp,SSL_SESSION** s_id) {
1558 //     return ASN1_i2d_bio_of!SSL_SESSION(&i2d_SSL_SESSION,bp,s_id);
1559 // }
1560 
1561 mixin(DECLARE_PEM_rw!("SSL_SESSION", "SSL_SESSION")());
1562 
1563 enum SSL_AD_REASON_OFFSET = 1000; /* offset to get SSL_R_... value from SSL_AD_... */
1564 
1565 /* These alert types are for SSLv3 and TLSv1 */
1566 alias SSL3_AD_CLOSE_NOTIFY SSL_AD_CLOSE_NOTIFY;
1567 alias SSL3_AD_UNEXPECTED_MESSAGE SSL_AD_UNEXPECTED_MESSAGE; /* fatal */
1568 alias SSL3_AD_BAD_RECORD_MAC SSL_AD_BAD_RECORD_MAC;     /* fatal */
1569 alias TLS1_AD_DECRYPTION_FAILED SSL_AD_DECRYPTION_FAILED;
1570 alias TLS1_AD_RECORD_OVERFLOW SSL_AD_RECORD_OVERFLOW;
1571 alias SSL3_AD_DECOMPRESSION_FAILURE SSL_AD_DECOMPRESSION_FAILURE;/* fatal */
1572 alias SSL3_AD_HANDSHAKE_FAILURE SSL_AD_HANDSHAKE_FAILURE;/* fatal */
1573 alias SSL3_AD_NO_CERTIFICATE SSL_AD_NO_CERTIFICATE; /* Not for TLS */
1574 alias SSL3_AD_BAD_CERTIFICATE SSL_AD_BAD_CERTIFICATE;
1575 alias SSL3_AD_UNSUPPORTED_CERTIFICATE SSL_AD_UNSUPPORTED_CERTIFICATE;
1576 alias SSL3_AD_CERTIFICATE_REVOKED SSL_AD_CERTIFICATE_REVOKED;
1577 alias SSL3_AD_CERTIFICATE_EXPIRED SSL_AD_CERTIFICATE_EXPIRED;
1578 alias SSL3_AD_CERTIFICATE_UNKNOWN SSL_AD_CERTIFICATE_UNKNOWN;
1579 alias SSL3_AD_ILLEGAL_PARAMETER SSL_AD_ILLEGAL_PARAMETER;   /* fatal */
1580 alias TLS1_AD_UNKNOWN_CA SSL_AD_UNKNOWN_CA;	/* fatal */
1581 alias TLS1_AD_ACCESS_DENIED SSL_AD_ACCESS_DENIED;	/* fatal */
1582 alias TLS1_AD_DECODE_ERROR SSL_AD_DECODE_ERROR;	/* fatal */
1583 alias TLS1_AD_DECRYPT_ERROR SSL_AD_DECRYPT_ERROR;
1584 alias TLS1_AD_EXPORT_RESTRICTION SSL_AD_EXPORT_RESTRICTION;/* fatal */
1585 alias TLS1_AD_PROTOCOL_VERSION SSL_AD_PROTOCOL_VERSION; /* fatal */
1586 alias TLS1_AD_INSUFFICIENT_SECURITY SSL_AD_INSUFFICIENT_SECURITY;/* fatal */
1587 alias TLS1_AD_INTERNAL_ERROR SSL_AD_INTERNAL_ERROR;	/* fatal */
1588 alias TLS1_AD_USER_CANCELLED SSL_AD_USER_CANCELLED;
1589 alias TLS1_AD_NO_RENEGOTIATION SSL_AD_NO_RENEGOTIATION;
1590 alias TLS1_AD_UNSUPPORTED_EXTENSION SSL_AD_UNSUPPORTED_EXTENSION;
1591 alias TLS1_AD_CERTIFICATE_UNOBTAINABLE SSL_AD_CERTIFICATE_UNOBTAINABLE;
1592 alias TLS1_AD_UNRECOGNIZED_NAME SSL_AD_UNRECOGNIZED_NAME;
1593 alias TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE;
1594 alias TLS1_AD_BAD_CERTIFICATE_HASH_VALUE SSL_AD_BAD_CERTIFICATE_HASH_VALUE;
1595 alias TLS1_AD_UNKNOWN_PSK_IDENTITY SSL_AD_UNKNOWN_PSK_IDENTITY; /* fatal */
1596 
1597 enum SSL_ERROR_NONE = 0;
1598 enum SSL_ERROR_SSL = 1;
1599 enum SSL_ERROR_WANT_READ = 2;
1600 enum SSL_ERROR_WANT_WRITE = 3;
1601 enum SSL_ERROR_WANT_X509_LOOKUP = 4;
1602 enum SSL_ERROR_SYSCALL = 5; /* look at error stack/return value/errno */
1603 enum SSL_ERROR_ZERO_RETURN = 6;
1604 enum SSL_ERROR_WANT_CONNECT = 7;
1605 enum SSL_ERROR_WANT_ACCEPT = 8;
1606 
1607 enum SSL_CTRL_NEED_TMP_RSA = 1;
1608 enum SSL_CTRL_SET_TMP_RSA = 2;
1609 enum SSL_CTRL_SET_TMP_DH = 3;
1610 enum SSL_CTRL_SET_TMP_ECDH = 4;
1611 enum SSL_CTRL_SET_TMP_RSA_CB = 5;
1612 enum SSL_CTRL_SET_TMP_DH_CB = 6;
1613 enum SSL_CTRL_SET_TMP_ECDH_CB = 7;
1614 
1615 enum SSL_CTRL_GET_SESSION_REUSED = 8;
1616 enum SSL_CTRL_GET_CLIENT_CERT_REQUEST = 9;
1617 enum SSL_CTRL_GET_NUM_RENEGOTIATIONS = 10;
1618 enum SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS = 11;
1619 enum SSL_CTRL_GET_TOTAL_RENEGOTIATIONS = 12;
1620 enum SSL_CTRL_GET_FLAGS = 13;
1621 enum SSL_CTRL_EXTRA_CHAIN_CERT = 14;
1622 
1623 enum SSL_CTRL_SET_MSG_CALLBACK = 15;
1624 enum SSL_CTRL_SET_MSG_CALLBACK_ARG = 16;
1625 
1626 /* only applies to datagram connections */
1627 enum SSL_CTRL_SET_MTU = 17;
1628 /* Stats */
1629 enum SSL_CTRL_SESS_NUMBER = 20;
1630 enum SSL_CTRL_SESS_CONNECT = 21;
1631 enum SSL_CTRL_SESS_CONNECT_GOOD = 22;
1632 enum SSL_CTRL_SESS_CONNECT_RENEGOTIATE = 23;
1633 enum SSL_CTRL_SESS_ACCEPT = 24;
1634 enum SSL_CTRL_SESS_ACCEPT_GOOD = 25;
1635 enum SSL_CTRL_SESS_ACCEPT_RENEGOTIATE = 26;
1636 enum SSL_CTRL_SESS_HIT = 27;
1637 enum SSL_CTRL_SESS_CB_HIT = 28;
1638 enum SSL_CTRL_SESS_MISSES = 29;
1639 enum SSL_CTRL_SESS_TIMEOUTS = 30;
1640 enum SSL_CTRL_SESS_CACHE_FULL = 31;
1641 enum SSL_CTRL_OPTIONS = 32;
1642 enum SSL_CTRL_MODE = 33;
1643 
1644 enum SSL_CTRL_GET_READ_AHEAD = 40;
1645 enum SSL_CTRL_SET_READ_AHEAD = 41;
1646 enum SSL_CTRL_SET_SESS_CACHE_SIZE = 42;
1647 enum SSL_CTRL_GET_SESS_CACHE_SIZE = 43;
1648 enum SSL_CTRL_SET_SESS_CACHE_MODE = 44;
1649 enum SSL_CTRL_GET_SESS_CACHE_MODE = 45;
1650 
1651 enum SSL_CTRL_GET_MAX_CERT_LIST = 50;
1652 enum SSL_CTRL_SET_MAX_CERT_LIST = 51;
1653 
1654 enum SSL_CTRL_SET_MAX_SEND_FRAGMENT = 52;
1655 
1656 /* see tls1.h for macros based on these */
1657 version(OPENSSL_NO_TLSEXT) {} else {
1658 enum SSL_CTRL_SET_TLSEXT_SERVERNAME_CB = 53;
1659 enum SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG = 54;
1660 enum SSL_CTRL_SET_TLSEXT_HOSTNAME = 55;
1661 enum SSL_CTRL_SET_TLSEXT_DEBUG_CB = 56;
1662 enum SSL_CTRL_SET_TLSEXT_DEBUG_ARG = 57;
1663 enum SSL_CTRL_GET_TLSEXT_TICKET_KEYS = 58;
1664 enum SSL_CTRL_SET_TLSEXT_TICKET_KEYS = 59;
1665 enum SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT = 60;
1666 enum SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB = 61;
1667 enum SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG = 62;
1668 enum SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB = 63;
1669 enum SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG = 64;
1670 enum SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE = 65;
1671 enum SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS = 66;
1672 enum SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS = 67;
1673 enum SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS = 68;
1674 enum SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS = 69;
1675 enum SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP = 70;
1676 enum SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP = 71;
1677 
1678 enum SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB = 72;
1679 
1680 enum SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB = 75;
1681 enum SSL_CTRL_SET_SRP_VERIFY_PARAM_CB = 76;
1682 enum SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB = 77;
1683 
1684 enum SSL_CTRL_SET_SRP_ARG = 78;
1685 enum SSL_CTRL_SET_TLS_EXT_SRP_USERNAME = 79;
1686 enum SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH = 80;
1687 enum SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD = 81;
1688 version(OPENSSL_NO_HEARTBEATS) {} else {
1689     enum SSL_CTRL_TLS_EXT_SEND_HEARTBEAT = 85;
1690     enum SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING = 86;
1691     enum SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS = 87;
1692 }
1693 }
1694 
1695 enum DTLS_CTRL_GET_TIMEOUT = 73;
1696 enum DTLS_CTRL_HANDLE_TIMEOUT = 74;
1697 enum DTLS_CTRL_LISTEN = 75;
1698 
1699 enum SSL_CTRL_GET_RI_SUPPORT = 76;
1700 enum SSL_CTRL_CLEAR_OPTIONS = 77;
1701 enum SSL_CTRL_CLEAR_MODE = 78;
1702 
1703 enum SSL_CTRL_GET_EXTRA_CHAIN_CERTS = 82;
1704 enum SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS = 83;
1705 
1706 auto DTLSv1_get_timeout(SSL* ssl, void* arg) {
1707     return SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0,arg);
1708 }
1709 auto DTLSv1_handle_timeout(SSL* ssl) {
1710     return SSL_ctrl(ssl,DTLS_CTRL_HANDLE_TIMEOUT,0,null);
1711 }
1712 auto DTLSv1_listen(SSL* ssl, void* peer) {
1713     return SSL_ctrl(ssl,DTLS_CTRL_LISTEN,0,peer);
1714 }
1715 
1716 auto SSL_session_reused(SSL* ssl) {
1717     return SSL_ctrl(ssl,SSL_CTRL_GET_SESSION_REUSED,0,null);
1718 }
1719 auto SSL_session_reused(SSL* ssl) {
1720     return SSL_ctrl(ssl,SSL_CTRL_GET_SESSION_REUSED,0,null);
1721 }
1722 auto SSL_num_renegotiations(SSL* ssl) {
1723     return SSL_ctrl(ssl,SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,null);
1724 }
1725 auto SSL_clear_num_renegotiations(SSL* ssl) {
1726     return SSL_ctrl(ssl,SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,null);
1727 }
1728 auto SSL_total_renegotiations(SSL* ssl) {
1729     return SSL_ctrl(ssl,SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,null);
1730 }
1731 
1732 auto SSL_CTX_need_tmp_RSA(SSL_CTX* ctx) {
1733     return SSL_CTX_ctrl(ctx,SSL_CTRL_NEED_TMP_RSA,0,null);
1734 }
1735 auto SSL_CTX_set_tmp_rsa(SSL_CTX* ctx, void* rsa) {
1736     return SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_RSA,0,rsa);
1737 }
1738 auto SSL_CTX_set_tmp_dh(SSL_CTX* ctx, void* dh) {
1739     return SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,dh);
1740 }
1741 auto SSL_CTX_set_tmp_ecdh(SSL_CTX* ctx, void* ecdh) {
1742     return SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,ecdh);
1743 }
1744 
1745 auto SSL_need_tmp_RSA(SSL* ssl) {
1746     return SSL_ctrl(ssl,SSL_CTRL_NEED_TMP_RSA,0,null);
1747 }
1748 auto SSL_set_tmp_rsa(SSL* ssl, void* rsa) {
1749     return SSL_ctrl(ssl,SSL_CTRL_SET_TMP_RSA,0,rsa);
1750 }
1751 auto SSL_set_tmp_dh(SSL* ssl, void* dh) {
1752     return SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,dh);
1753 }
1754 auto SSL_set_tmp_ecdh(SSL* ssl, void* ecdh) {
1755     return SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,ecdh);
1756 }
1757 
1758 auto SSL_CTX_add_extra_chain_cert(SSL_CTX* ctx, void* x509) {
1759     return SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,x509);
1760 }
1761 // SSL_CTX_get_extra_chain_certs calls |SSL_CTX_get0_chain_certs|.
1762 // int SSL_CTX_get_extra_chain_certs(const SSL_CTX *ctx,
1763 //                                                  STACK_OF!(X509) **out_chain);
1764 // auto SSL_CTX_get_extra_chain_certs(SSL_CTX* ctx, void* x509) {
1765 //     return SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,0,px509);
1766 // }
1767 auto SSL_CTX_clear_extra_chain_certs(SSL_CTX* ctx, void* x509) {
1768     return SSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS,0,null);
1769 }
1770 
1771 version(OPENSSL_NO_BIO) {} else {
1772 BIO_METHOD* BIO_f_ssl();
1773 BIO* BIO_new_ssl(SSL_CTX* ctx,int client);
1774 BIO* BIO_new_ssl_connect(SSL_CTX* ctx);
1775 BIO* BIO_new_buffer_ssl_connect(SSL_CTX* ctx);
1776 int BIO_ssl_copy_session_id(BIO* to,BIO* from);
1777 void BIO_ssl_shutdown(BIO* ssl_bio);
1778 
1779 }
1780 
1781 int	SSL_CTX_set_cipher_list(SSL_CTX*,const(char)* str);
1782 SSL_CTX* SSL_CTX_new(const(SSL_METHOD)* meth);
1783 void	SSL_CTX_free(SSL_CTX*);
1784 c_long SSL_CTX_set_timeout(SSL_CTX* ctx,c_long t);
1785 c_long SSL_CTX_get_timeout(const(SSL_CTX)* ctx);
1786 X509_STORE* SSL_CTX_get_cert_store(const(SSL_CTX)*);
1787 void SSL_CTX_set_cert_store(SSL_CTX*,X509_STORE*);
1788 int SSL_want(const(SSL)* s);
1789 int	SSL_clear(SSL* s);
1790 
1791 void	SSL_CTX_flush_sessions(SSL_CTX* ctx,c_long tm);
1792 
1793 const(SSL_CIPHER)* SSL_get_current_cipher(const(SSL)* s);
1794 int	SSL_CIPHER_get_bits(const(SSL_CIPHER)* c,int* alg_bits);
1795 char* 	SSL_CIPHER_get_version(const(SSL_CIPHER)* c);
1796 
1797 // SSL_CIPHER_standard_name returns the standard IETF name for |cipher|. For
1798 // example, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256".
1799 const(char)* 	SSL_CIPHER_standard_name(const(SSL_CIPHER)* c);
1800 
1801 // SSL_CIPHER_get_name returns the OpenSSL name of |cipher|. For example,
1802 // "ECDHE-RSA-AES128-GCM-SHA256".
1803 const(char)* 	SSL_CIPHER_get_name(const(SSL_CIPHER)* c);
1804 
1805 // SSL_CIPHER_get_kx_name returns a string that describes the key-exchange
1806 // method used by |cipher|. For example, "ECDHE_ECDSA". TLS 1.3 AEAD-only
1807 // ciphers return the string "GENERIC".
1808 const(char)* 	SSL_CIPHER_get_kx_name(const(SSL_CIPHER)* c);
1809 c_ulong 	SSL_CIPHER_get_id(const SSL_CIPHER *c);
1810 
1811 int	SSL_get_fd(const(SSL)* s);
1812 int	SSL_get_rfd(const(SSL)* s);
1813 int	SSL_get_wfd(const(SSL)* s);
1814 const(char)* SSL_get_cipher_list(const(SSL)* s,int n);
1815 char* 	SSL_get_shared_ciphers(const(SSL)* s, char* buf, int len);
1816 int	SSL_get_read_ahead(const(SSL)* s);
1817 int	SSL_pending(const(SSL)* s);
1818 version(OPENSSL_NO_SOCK) {} else {
1819 int	SSL_set_fd(SSL* s, int fd);
1820 int	SSL_set_rfd(SSL* s, int fd);
1821 int	SSL_set_wfd(SSL* s, int fd);
1822 }
1823 version(OPENSSL_NO_BIO) {} else {
1824 void	SSL_set_bio(SSL* s, BIO* rbio,BIO* wbio);
1825 BIO* 	SSL_get_rbio(const(SSL)* s);
1826 BIO* 	SSL_get_wbio(const(SSL)* s);
1827 }
1828 int	SSL_set_cipher_list(SSL* s, const(char)* str);
1829 void	SSL_set_read_ahead(SSL* s, int yes);
1830 int	SSL_get_verify_mode(const(SSL)* s);
1831 int	SSL_get_verify_depth(const(SSL)* s);
1832 int	function(int,X509_STORE_CTX*) SSL_get_verify_callback(const(SSL)* s);
1833 
1834 // SSL_set_verify configures certificate verification behavior. |mode| is one of
1835 // the |SSL_VERIFY_*| values defined above. |callback|, if not NULL, is used to
1836 // customize certificate verification. See the behavior of
1837 // |X509_STORE_CTX_set_verify_cb|.
1838 //
1839 // The callback may use |SSL_get_ex_data_X509_STORE_CTX_idx| with
1840 // |X509_STORE_CTX_get_ex_data| to look up the |SSL| from |store_ctx|.
1841 void	SSL_set_verify(SSL* s, int mode,
1842 		       ExternC!(int function(int ok,X509_STORE_CTX* ctx)) callback);
1843 
1844 void	SSL_set_verify_depth(SSL* s, int depth);
1845 
1846 enum ssl_verify_result_t {
1847   ssl_verify_ok,
1848   ssl_verify_invalid,
1849   ssl_verify_retry
1850 }
1851 
1852 // SSL_set_custom_verify behaves like |SSL_CTX_set_custom_verify| but configures
1853 // an individual |SSL|.
1854 void SSL_set_custom_verify(
1855     SSL *ssl, int mode,
1856     ExternC!(ssl_verify_result_t function(SSL *ssl, uint8_t *out_alert)) callback);
1857 
1858 
1859 // Certificate and private key convenience functions.
1860 
1861 // Custom private keys.
1862 enum ssl_private_key_result_t {
1863   ssl_private_key_success,
1864   ssl_private_key_retry,
1865   ssl_private_key_failure
1866 }
1867 
1868 // ssl_private_key_method_st (aka |SSL_PRIVATE_KEY_METHOD|) describes private
1869 // key hooks. This is used to off-load signing operations to a custom,
1870 // potentially asynchronous, backend. Metadata about the key such as the type
1871 // and size are parsed out of the certificate.
1872 struct ssl_private_key_method_st {
1873   // sign signs the message |in| in using the specified signature algorithm. On
1874   // success, it returns |ssl_private_key_success| and writes at most |max_out|
1875   // bytes of signature data to |out| and sets |*out_len| to the number of bytes
1876   // written. On failure, it returns |ssl_private_key_failure|. If the operation
1877   // has not completed, it returns |ssl_private_key_retry|. |sign| should
1878   // arrange for the high-level operation on |ssl| to be retried when the
1879   // operation is completed. This will result in a call to |complete|.
1880   //
1881   // |signature_algorithm| is one of the |SSL_SIGN_*| values, as defined in TLS
1882   // 1.3. Note that, in TLS 1.2, ECDSA algorithms do not require that curve
1883   // sizes match hash sizes, so the curve portion of |SSL_SIGN_ECDSA_*| values
1884   // must be ignored. BoringSSL will internally handle the curve matching logic
1885   // where appropriate.
1886   //
1887   // It is an error to call |sign| while another private key operation is in
1888   // progress on |ssl|.
1889   ExternC!(ssl_private_key_result_t function(SSL *ssl, uint8_t *output, size_t *out_len,
1890                                         size_t max_out,
1891                                         uint16_t signature_algorithm,
1892                                         const(uint8_t) *input, size_t in_len)) sign;
1893 
1894   // decrypt decrypts |in_len| bytes of encrypted data from |in|. On success it
1895   // returns |ssl_private_key_success|, writes at most |max_out| bytes of
1896   // decrypted data to |out| and sets |*out_len| to the actual number of bytes
1897   // written. On failure it returns |ssl_private_key_failure|. If the operation
1898   // has not completed, it returns |ssl_private_key_retry|. The caller should
1899   // arrange for the high-level operation on |ssl| to be retried when the
1900   // operation is completed, which will result in a call to |complete|. This
1901   // function only works with RSA keys and should perform a raw RSA decryption
1902   // operation with no padding.
1903   //
1904   // It is an error to call |decrypt| while another private key operation is in
1905   // progress on |ssl|.
1906   ExternC!(ssl_private_key_result_t function(SSL *ssl, uint8_t *output,
1907                                            size_t *out_len, size_t max_out,
1908                                            const(uint8_t) *input, size_t in_len)) decrypt;
1909   
1910 
1911   // complete completes a pending operation. If the operation has completed, it
1912   // returns |ssl_private_key_success| and writes the result to |out| as in
1913   // |sign|. Otherwise, it returns |ssl_private_key_failure| on failure and
1914   // |ssl_private_key_retry| if the operation is still in progress.
1915   //
1916   // |complete| may be called arbitrarily many times before completion, but it
1917   // is an error to call |complete| if there is no pending operation in progress
1918   // on |ssl|.
1919   ExternC!(ssl_private_key_result_t function(SSL *ssl, uint8_t *ot,
1920                                             size_t *out_len, size_t max_out)) complete;
1921 }
1922 
1923 alias SSL_PRIVATE_KEY_METHOD = ssl_private_key_method_st;
1924 
1925 // SSL_CTX_set_chain_and_key sets the certificate chain and private key for a
1926 // TLS client or server. References to the given |CRYPTO_BUFFER| and |EVP_PKEY|
1927 // objects are added as needed. Exactly one of |privkey| or |privkey_method|
1928 // may be non-NULL. Returns one on success and zero on error.
1929 int SSL_CTX_set_chain_and_key(
1930     SSL_CTX *ctx, CRYPTO_BUFFER **certs, size_t num_certs,
1931     EVP_PKEY *privkey, SSL_PRIVATE_KEY_METHOD *privkey_method);
1932 
1933 // SSL_set_chain_and_key sets the certificate chain and private key for a TLS
1934 // client or server. References to the given |CRYPTO_BUFFER| and |EVP_PKEY|
1935 // objects are added as needed. Exactly one of |privkey| or |privkey_method|
1936 // may be non-NULL. Returns one on success and zero on error.
1937 int SSL_set_chain_and_key(
1938     SSL *ssl, CRYPTO_BUFFER **certs, size_t num_certs, EVP_PKEY *privkey,
1939     SSL_PRIVATE_KEY_METHOD *privkey_method);
1940 
1941 
1942 
1943 version(OPENSSL_NO_RSA) {} else {
1944 
1945 // SSL_use_RSAPrivateKey sets |ctx|'s private key to |rsa|. It returns one on
1946 // success and zero on failure.
1947 int	SSL_use_RSAPrivateKey(SSL* ssl, RSA* rsa);
1948 }
1949 int	SSL_use_RSAPrivateKey_ASN1(SSL* ssl, ubyte* d, c_long len);
1950 int	SSL_use_PrivateKey(SSL* ssl, EVP_PKEY* pkey);
1951 int	SSL_use_PrivateKey_ASN1(int pk,SSL* ssl, const(ubyte)* d, c_long len);
1952 int	SSL_use_certificate(SSL* ssl, X509* x);
1953 int	SSL_use_certificate_ASN1(SSL* ssl, const(ubyte)* d, int len);
1954 
1955 version (OPENSSL_NO_STDIO) {} else {
1956 int	SSL_use_RSAPrivateKey_file(SSL* ssl, const(char)* file, int type);
1957 int	SSL_use_PrivateKey_file(SSL* ssl, const(char)* file, int type);
1958 int	SSL_use_certificate_file(SSL* ssl, const(char)* file, int type);
1959 int	SSL_CTX_use_RSAPrivateKey_file(SSL_CTX* ctx, const(char)* file, int type);
1960 int	SSL_CTX_use_PrivateKey_file(SSL_CTX* ctx, const(char)* file, int type);
1961 int	SSL_CTX_use_certificate_file(SSL_CTX* ctx, const(char)* file, int type);
1962 int	SSL_CTX_use_certificate_chain_file(SSL_CTX* ctx, const(char)* file); /* PEM type */
1963 STACK_OF!(X509_NAME) *SSL_load_client_CA_file(const(char)* file);
1964 int	SSL_add_file_cert_subjects_to_stack(STACK_OF!(X509_NAME) *stackCAs,
1965 					    const(char)* file);
1966 //#ifndef OPENSSL_SYS_VMS
1967 //#ifndef OPENSSL_SYS_MACINTOSH_CLASSIC /* XXXXX: Better scheme needed! [was: #ifndef MAC_OS_pre_X] */
1968 int	SSL_add_dir_cert_subjects_to_stack(STACK_OF!(X509_NAME) *stackCAs,
1969 					   const(char)* dir);
1970 //#endif
1971 //#endif
1972 }
1973 
1974 void	SSL_load_error_strings();
1975 const(char)* SSL_state_string(const(SSL)* s);
1976 const(char)* SSL_rstate_string(const(SSL)* s);
1977 const(char)* SSL_state_string_long(const(SSL)* s);
1978 const(char)* SSL_rstate_string_long(const(SSL)* s);
1979 c_long	SSL_SESSION_get_time(const(SSL_SESSION)* s);
1980 c_long	SSL_SESSION_set_time(SSL_SESSION* s, c_long t);
1981 c_long	SSL_SESSION_get_timeout(const(SSL_SESSION)* s);
1982 c_long	SSL_SESSION_set_timeout(SSL_SESSION* s, c_long t);
1983 void	SSL_copy_session_id(SSL* to,const(SSL)* from);
1984 X509 *SSL_SESSION_get0_peer(SSL_SESSION *s);
1985 int SSL_SESSION_set1_id_context(SSL_SESSION *s,const(ubyte)* sid_ctx,
1986 			       uint sid_ctx_len);
1987 
1988 SSL_SESSION* SSL_SESSION_new();
1989 const(ubyte)* SSL_SESSION_get_id(const(SSL_SESSION)* s,
1990 					uint* len);
1991 uint SSL_SESSION_get_compress_id(const SSL_SESSION *s);
1992 version(OPENSSL_NO_FP_API) {} else {
1993 int	SSL_SESSION_print_fp(FILE* fp,const(SSL_SESSION)* ses);
1994 }
1995 version(OPENSSL_NO_BIO) {} else {
1996 int	SSL_SESSION_print(BIO* fp,const(SSL_SESSION)* ses);
1997 }
1998 void	SSL_SESSION_free(SSL_SESSION* ses);
1999 int	i2d_SSL_SESSION(SSL_SESSION* in_,ubyte** pp);
2000 int	SSL_set_session(SSL* to, SSL_SESSION* session);
2001 int	SSL_CTX_add_session(SSL_CTX* s, SSL_SESSION* c);
2002 int	SSL_CTX_remove_session(SSL_CTX*,SSL_SESSION* c);
2003 int	SSL_CTX_set_generate_session_id(SSL_CTX*, GEN_SESSION_CB);
2004 int	SSL_set_generate_session_id(SSL*, GEN_SESSION_CB);
2005 int	SSL_has_matching_session_id(const(SSL)* ssl, const(ubyte)* id,
2006 					uint id_len);
2007 SSL_SESSION* d2i_SSL_SESSION(SSL_SESSION** a,const(ubyte)** pp,
2008 			     c_long length);
2009 
2010 
2011 // SSL_get_peer_certificate returns the peer's leaf certificate or NULL if the
2012 // peer did not use certificates. The caller must call |X509_free| on the
2013 // result to release it.
2014 X509* 	SSL_get_peer_certificate(const(SSL)* s);
2015 
2016 // SSL_get_peer_cert_chain returns the peer's certificate chain or NULL if
2017 // unavailable or the peer did not use certificates. This is the unverified list
2018 // of certificates as sent by the peer, not the final chain built during
2019 // verification. The caller does not take ownership of the result.
2020 //
2021 // WARNING: This function behaves differently between client and server. If
2022 // |ssl| is a server, the returned chain does not include the leaf certificate.
2023 // If a client, it does.
2024 STACK_OF!(X509) *SSL_get_peer_cert_chain(const(SSL)* s);
2025 
2026 // SSL_get_peer_full_cert_chain returns the peer's certificate chain, or NULL if
2027 // unavailable or the peer did not use certificates. This is the unverified list
2028 // of certificates as sent by the peer, not the final chain built during
2029 // verification. The caller does not take ownership of the result.
2030 //
2031 // This is the same as |SSL_get_peer_cert_chain| except that this function
2032 // always returns the full chain, i.e. the first element of the return value
2033 // (if any) will be the leaf certificate. In constrast,
2034 // |SSL_get_peer_cert_chain| returns only the intermediate certificates if the
2035 // |ssl| is a server.
2036 STACK_OF!(X509) *SSL_get_peer_full_cert_chain(const(SSL)* s);
2037 
2038 // SSL_get0_peer_certificates returns the peer's certificate chain, or NULL if
2039 // unavailable or the peer did not use certificates. This is the unverified list
2040 // of certificates as sent by the peer, not the final chain built during
2041 // verification. The caller does not take ownership of the result.
2042 //
2043 // This is the |CRYPTO_BUFFER| variant of |SSL_get_peer_full_cert_chain|.
2044 STACK_OF!(X509) *SSL_get0_peer_certificates(const(SSL)* s);
2045 
2046 // STACK_OF!(X509) *SSL_get_peer_full_cert_chain(const(SSL)* s);
2047 
2048 int SSL_CTX_get_verify_mode(const(SSL_CTX)* ctx);
2049 int SSL_CTX_get_verify_depth(const(SSL_CTX)* ctx);
2050 ExternC!(int function(int,X509_STORE_CTX*)) SSL_CTX_get_verify_callback(const(SSL_CTX)* ctx);
2051 
2052 // SSL_CTX_set_verify configures certificate verification behavior. |mode| is
2053 // one of the |SSL_VERIFY_*| values defined above. |callback|, if not NULL, is
2054 // used to customize certificate verification. See the behavior of
2055 // |X509_STORE_CTX_set_verify_cb|.
2056 //
2057 // The callback may use |SSL_get_ex_data_X509_STORE_CTX_idx| with
2058 // |X509_STORE_CTX_get_ex_data| to look up the |SSL| from |store_ctx|.
2059 void SSL_CTX_set_verify(SSL_CTX* ctx,int mode,
2060 			ExternC!(int function(int, X509_STORE_CTX*)) callback);
2061 
2062 void SSL_CTX_set_verify_depth(SSL_CTX* ctx,int depth);
2063 
2064 
2065 
2066 void SSL_CTX_set_cert_verify_callback(SSL_CTX* ctx, ExternC!(int function(X509_STORE_CTX*,void*)) cb, void* arg);
2067 
2068 // SSL_enable_signed_cert_timestamps causes |ssl| (which must be the client end
2069 // of a connection) to request SCTs from the server. See
2070 // https://tools.ietf.org/html/rfc6962.
2071 //
2072 // Call |SSL_get0_signed_cert_timestamp_list| to recover the SCT after the
2073 // handshake.
2074 void SSL_enable_signed_cert_timestamps(const(SSL)* ssl);
2075 
2076 // SSL_CTX_enable_signed_cert_timestamps enables SCT requests on all client SSL
2077 // objects created from |ctx|.
2078 //
2079 // Call |SSL_get0_signed_cert_timestamp_list| to recover the SCT after the
2080 // handshake.
2081 void SSL_CTX_enable_signed_cert_timestamps(const(SSL_CTX)* ctx);
2082 
2083 
2084 // SSL_enable_ocsp_stapling causes |ssl| (which must be the client end of a
2085 // connection) to request a stapled OCSP response from the server.
2086 //
2087 // Call |SSL_get0_ocsp_response| to recover the OCSP response after the
2088 // handshake.
2089 void SSL_enable_ocsp_stapling(SSL *ssl);
2090 
2091 // SSL_CTX_enable_ocsp_stapling enables OCSP stapling on all client SSL objects
2092 // created from |ctx|.
2093 //
2094 // Call |SSL_get0_ocsp_response| to recover the OCSP response after the
2095 // handshake.
2096 void SSL_CTX_enable_ocsp_stapling(SSL_CTX *ctx);
2097 
2098 // SSL_CTX_set0_verify_cert_store sets an |X509_STORE| that will be used
2099 // exclusively for certificate verification and returns one. Ownership of
2100 // |store| is transferred to the |SSL_CTX|.
2101 int SSL_CTX_set0_verify_cert_store(SSL_CTX *ctx,
2102                                                   X509_STORE *store);
2103 
2104 // SSL_CTX_set1_verify_cert_store sets an |X509_STORE| that will be used
2105 // exclusively for certificate verification and returns one. An additional
2106 // reference to |store| will be taken.
2107 int SSL_CTX_set1_verify_cert_store(SSL_CTX *ctx,
2108                                                   X509_STORE *store);
2109 
2110 // SSL_set0_verify_cert_store sets an |X509_STORE| that will be used
2111 // exclusively for certificate verification and returns one. Ownership of
2112 // |store| is transferred to the |SSL|.
2113 int SSL_set0_verify_cert_store(SSL *ssl, X509_STORE *store);
2114 
2115 // SSL_set1_verify_cert_store sets an |X509_STORE| that will be used
2116 // exclusively for certificate verification and returns one. An additional
2117 // reference to |store| will be taken.
2118 int SSL_set1_verify_cert_store(SSL *ssl, X509_STORE *store);
2119 
2120 // SSL_CTX_set_ed25519_enabled configures whether |ctx| advertises support for
2121 // the Ed25519 signature algorithm when using the default preference list. It is
2122 // disabled by default and may be enabled if the certificate verifier supports
2123 // Ed25519.
2124 void SSL_CTX_set_ed25519_enabled(SSL_CTX *ctx, int enabled);
2125 
2126 // SSL_CTX_set_rsa_pss_rsae_certs_enabled configures whether |ctx| advertises
2127 // support for rsa_pss_rsae_* signatures within the certificate chain. It is
2128 // enabled by default but should be disabled if using a custom certificate
2129 // verifier which does not support RSA-PSS signatures.
2130 void SSL_CTX_set_rsa_pss_rsae_certs_enabled(SSL_CTX *ctx,
2131                                                            int enabled);
2132 
2133 // SSL_CTX_set_verify_algorithm_prefs configures |ctx| to use |prefs| as the
2134 // preference list when verifying signature's from the peer's long-term key. It
2135 // returns one on zero on error. |prefs| should not include the internal-only
2136 // value |SSL_SIGN_RSA_PKCS1_MD5_SHA1|.
2137 int SSL_CTX_set_verify_algorithm_prefs(SSL_CTX *ctx,
2138                                                       const uint16_t *prefs,
2139                                                       size_t num_prefs);
2140 
2141 
2142 version(OPENSSL_NO_RSA) {} else {
2143 // SSL_CTX_use_RSAPrivateKey sets |ctx|'s private key to |rsa|. It returns one
2144 // on success and zero on failure.
2145 int SSL_CTX_use_RSAPrivateKey(SSL_CTX* ctx, RSA* rsa);
2146 }
2147 int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX* ctx, const(ubyte)* d, c_long len);
2148 int SSL_CTX_use_PrivateKey(SSL_CTX* ctx, EVP_PKEY* pkey);
2149 int SSL_CTX_use_PrivateKey_ASN1(int pk,SSL_CTX* ctx,
2150 	const(ubyte)* d, c_long len);
2151 int SSL_CTX_use_certificate(SSL_CTX* ctx, X509* x);
2152 int SSL_CTX_use_certificate_ASN1(SSL_CTX* ctx, int len, const(ubyte)* d);
2153 
2154 void SSL_CTX_set_default_passwd_cb(SSL_CTX* ctx, pem_password_cb* cb);
2155 void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX* ctx, void* u);
2156 
2157 int SSL_CTX_check_private_key(const(SSL_CTX)* ctx);
2158 int SSL_check_private_key(const(SSL)* ctx);
2159 
2160 int	SSL_CTX_set_session_id_context(SSL_CTX* ctx,const(ubyte)* sid_ctx,
2161 				       uint sid_ctx_len);
2162 
2163 SSL* 	SSL_new(SSL_CTX* ctx);
2164 int	SSL_set_session_id_context(SSL* ssl,const(ubyte)* sid_ctx,
2165 				   uint sid_ctx_len);
2166 
2167 int SSL_CTX_set_purpose(SSL_CTX* s, int purpose);
2168 int SSL_set_purpose(SSL* s, int purpose);
2169 int SSL_CTX_set_trust(SSL_CTX* s, int trust);
2170 int SSL_set_trust(SSL* s, int trust);
2171 
2172 int SSL_CTX_set1_param(SSL_CTX* ctx, X509_VERIFY_PARAM* vpm);
2173 int SSL_set1_param(SSL* ssl, X509_VERIFY_PARAM* vpm);
2174 
2175 version(OPENSSL_NO_SRP) {} else {
2176 int SSL_CTX_set_srp_username(SSL_CTX *ctx,char *name);
2177 int SSL_CTX_set_srp_password(SSL_CTX *ctx,char *password);
2178 int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength);
2179 int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx,
2180 					ExternC!(char function(SSL *,void *)) cb);
2181 int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx,
2182 					  ExternC!(char function(SSL *,void *)) cb);
2183 int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx,
2184 				      ExternC!(char function(SSL *,int *,void *)) cb);
2185 int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg);
2186 
2187 int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g,
2188 			     BIGNUM *sa, BIGNUM *v, char *info);
2189 int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass,
2190 				const char *grp);
2191 
2192 BIGNUM *SSL_get_srp_g(SSL *s);
2193 BIGNUM *SSL_get_srp_N(SSL *s);
2194 
2195 char *SSL_get_srp_username(SSL *s);
2196 char *SSL_get_srp_userinfo(SSL *s);
2197 }
2198 
2199 void	SSL_free(SSL* ssl);
2200 int 	SSL_accept(SSL* ssl);
2201 int 	SSL_connect(SSL* ssl);
2202 int 	SSL_read(SSL* ssl,void* buf,int num);
2203 int 	SSL_peek(SSL* ssl,void* buf,int num);
2204 int 	SSL_write(SSL* ssl,const(void)* buf,int num);
2205 c_long	SSL_ctrl(SSL* ssl,int cmd, c_long larg, void* parg);
2206 c_long	SSL_callback_ctrl(SSL*, int, ExternC!(void function()) );
2207 c_long	SSL_CTX_ctrl(SSL_CTX* ctx,int cmd, c_long larg, void* parg);
2208 c_long	SSL_CTX_callback_ctrl(SSL_CTX*, int, ExternC!(void function()) );
2209 
2210 uint32_t SSL_get_options(const(SSL) *ssl);
2211 uint32_t SSL_set_options(SSL *ssl, uint32_t options);
2212 uint32_t SSL_clear_options(SSL *ssl, uint32_t options);
2213 uint32_t SSL_set_mode(SSL *ssl, uint32_t mode);
2214 uint32_t SSL_clear_mode(SSL *ssl, uint32_t mode);
2215 
2216 int	SSL_get_error(const(SSL)* s,int ret_code);
2217 const(char)* SSL_get_version(const(SSL)* s);
2218 
2219 /* This sets the 'default' SSL version that SSL_new() will create */
2220 int SSL_CTX_set_ssl_version(SSL_CTX* ctx, const(SSL_METHOD)* meth);
2221 
2222 version(OPENSSL_NO_SSL2) {} else {
2223 const(SSL_METHOD)* SSLv2_method();		/* SSLv2 */
2224 const(SSL_METHOD)* SSLv2_server_method();	/* SSLv2 */
2225 const(SSL_METHOD)* SSLv2_client_method();	/* SSLv2 */
2226 }
2227 
2228 const(SSL_METHOD)* SSLv3_method();		/* SSLv3 */
2229 const(SSL_METHOD)* SSLv3_server_method();	/* SSLv3 */
2230 const(SSL_METHOD)* SSLv3_client_method();	/* SSLv3 */
2231 
2232 const(SSL_METHOD)* SSLv23_method();	/* SSLv3 but can rollback to v2 */
2233 const(SSL_METHOD)* SSLv23_server_method();	/* SSLv3 but can rollback to v2 */
2234 const(SSL_METHOD)* SSLv23_client_method();	/* SSLv3 but can rollback to v2 */
2235 
2236 const(SSL_METHOD)* TLSv1_method();		/* TLSv1.0 */
2237 const(SSL_METHOD)* TLSv1_server_method();	/* TLSv1.0 */
2238 const(SSL_METHOD)* TLSv1_client_method();	/* TLSv1.0 */
2239 
2240 const(SSL_METHOD)* TLSv1_1_method();		/* TLSv1.1 */
2241 const(SSL_METHOD)* TLSv1_1_server_method();	/* TLSv1.1 */
2242 const(SSL_METHOD)* TLSv1_1_client_method();	/* TLSv1.1 */
2243 
2244 const(SSL_METHOD)* TLSv1_2_method();		/* TLSv1.2 */
2245 const(SSL_METHOD)* TLSv1_2_server_method();	/* TLSv1.2 */
2246 const(SSL_METHOD)* TLSv1_2_client_method();	/* TLSv1.2 */
2247 
2248 
2249 const(SSL_METHOD)* DTLSv1_method();		/* DTLSv1.0 */
2250 const(SSL_METHOD)* DTLSv1_server_method();	/* DTLSv1.0 */
2251 const(SSL_METHOD)* DTLSv1_client_method();	/* DTLSv1.0 */
2252 
2253 // TLS_method is the |SSL_METHOD| used for TLS connections.
2254 const(SSL_METHOD)* TLS_method();
2255 
2256 // DTLS_method is the |SSL_METHOD| used for DTLS connections.
2257 const(SSL_METHOD)* DTLS_method();
2258 
2259 // TLS_with_buffers_method is like |TLS_method|, but avoids all use of
2260 // crypto/x509. All client connections created with |TLS_with_buffers_method|
2261 // will fail unless a certificate verifier is installed with
2262 // |SSL_set_custom_verify| or |SSL_CTX_set_custom_verify|.
2263 const(SSL_METHOD)* TLS_with_buffers_method();
2264 
2265 // DTLS_with_buffers_method is like |DTLS_method|, but avoids all use of
2266 // crypto/x509.
2267 const(SSL_METHOD)* DTLS_with_buffers_method();
2268 
2269 STACK_OF!(SSL_CIPHER) *SSL_get_ciphers(const(SSL)* s);
2270 
2271 int SSL_do_handshake(SSL* s);
2272 int SSL_renegotiate(SSL* s);
2273 int SSL_renegotiate_abbreviated(SSL *s);
2274 int SSL_renegotiate_pending(SSL* s);
2275 int SSL_shutdown(SSL* s);
2276 
2277 const(SSL_METHOD)* SSL_get_ssl_method(SSL* s);
2278 int SSL_set_ssl_method(SSL* s, const(SSL_METHOD)* method);
2279 const(char)* SSL_alert_type_string_long(int value);
2280 const(char)* SSL_alert_type_string(int value);
2281 const(char)* SSL_alert_desc_string_long(int value);
2282 const(char)* SSL_alert_desc_string(int value);
2283 
2284 void SSL_set_client_CA_list(SSL* s, STACK_OF!(X509_NAME) *name_list);
2285 void SSL_CTX_set_client_CA_list(SSL_CTX* ctx, STACK_OF!(X509_NAME) *name_list);
2286 STACK_OF!(X509_NAME) *SSL_get_client_CA_list(const(SSL)* s);
2287 STACK_OF!(X509_NAME) *SSL_CTX_get_client_CA_list(const(SSL_CTX)* s);
2288 int SSL_add_client_CA(SSL* ssl,X509* x);
2289 int SSL_CTX_add_client_CA(SSL_CTX* ctx,X509* x);
2290 
2291 void SSL_set_connect_state(SSL* s);
2292 void SSL_set_accept_state(SSL* s);
2293 
2294 c_long SSL_get_default_timeout(const(SSL)* s);
2295 
2296 int SSL_library_init();
2297 
2298 char* SSL_CIPHER_description(const(SSL_CIPHER)*,char* buf,int size);
2299 STACK_OF!(X509_NAME) *SSL_dup_CA_list(STACK_OF!(X509_NAME) *sk);
2300 
2301 SSL* SSL_dup(SSL* ssl);
2302 
2303 X509* SSL_get_certificate(const(SSL)* ssl);
2304 /* EVP_PKEY */ evp_pkey_st* SSL_get_privatekey(SSL* ssl);
2305 
2306 void SSL_CTX_set_quiet_shutdown(SSL_CTX* ctx,int mode);
2307 int SSL_CTX_get_quiet_shutdown(const(SSL_CTX)* ctx);
2308 void SSL_set_quiet_shutdown(SSL* ssl,int mode);
2309 int SSL_get_quiet_shutdown(const(SSL)* ssl);
2310 void SSL_set_shutdown(SSL* ssl,int mode);
2311 int SSL_get_shutdown(const(SSL)* ssl);
2312 int SSL_version(const(SSL)* ssl);
2313 int SSL_CTX_set_default_verify_paths(SSL_CTX* ctx);
2314 int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const(char)* CAfile,
2315 	const(char)* CApath);
2316 alias SSL_get_session SSL_get0_session; /* just peek at pointer */
2317 SSL_SESSION* SSL_get_session(const(SSL)* ssl);
2318 SSL_SESSION* SSL_get1_session(SSL* ssl); /* obtain a reference count */
2319 SSL_CTX* SSL_get_SSL_CTX(const(SSL)* ssl);
2320 
2321 // SSL_set_SSL_CTX changes |ssl|'s |SSL_CTX|. |ssl| will use the
2322 // certificate-related settings from |ctx|, and |SSL_get_SSL_CTX| will report
2323 // |ctx|. This function may be used during the callbacks registered by
2324 // |SSL_CTX_set_select_certificate_cb|,
2325 // |SSL_CTX_set_tlsext_servername_callback|, and |SSL_CTX_set_cert_cb| or when
2326 // the handshake is paused from them. It is typically used to switch
2327 // certificates based on SNI.
2328 //
2329 // Note the session cache and related settings will continue to use the initial
2330 // |SSL_CTX|. Callers should use |SSL_CTX_set_session_id_context| to partition
2331 // the session cache between different domains.
2332 //
2333 // TODO(davidben): Should other settings change after this call?
2334 SSL_CTX* SSL_set_SSL_CTX(SSL* ssl, SSL_CTX* ctx);
2335 
2336 
2337 
2338 // Application-layer protocol negotiation.
2339 //
2340 // The ALPN extension (RFC 7301) allows negotiating different application-layer
2341 // protocols over a single port. This is used, for example, to negotiate
2342 // HTTP/2.
2343 
2344 // SSL_CTX_set_alpn_protos sets the client ALPN protocol list on |ctx| to
2345 // |protos|. |protos| must be in wire-format (i.e. a series of non-empty, 8-bit
2346 // length-prefixed strings). It returns zero on success and one on failure.
2347 // Configuring this list enables ALPN on a client.
2348 //
2349 // WARNING: this function is dangerous because it breaks the usual return value
2350 // convention.
2351 int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const(uint8_t) *protos,
2352                                            uint protos_len);
2353 
2354 // SSL_set_alpn_protos sets the client ALPN protocol list on |ssl| to |protos|.
2355 // |protos| must be in wire-format (i.e. a series of non-empty, 8-bit
2356 // length-prefixed strings). It returns zero on success and one on failure.
2357 // Configuring this list enables ALPN on a client.
2358 //
2359 // WARNING: this function is dangerous because it breaks the usual return value
2360 // convention.
2361 int SSL_set_alpn_protos(SSL *ssl, const(uint8_t) *protos,
2362                                        uint protos_len);
2363 
2364 // SSL_CTX_set_alpn_select_cb sets a callback function on |ctx| that is called
2365 // during ClientHello processing in order to select an ALPN protocol from the
2366 // client's list of offered protocols. Configuring this callback enables ALPN on
2367 // a server.
2368 //
2369 // The callback is passed a wire-format (i.e. a series of non-empty, 8-bit
2370 // length-prefixed strings) ALPN protocol list in |in|. It should set |*out| and
2371 // |*out_len| to the selected protocol and return |SSL_TLSEXT_ERR_OK| on
2372 // success. It does not pass ownership of the buffer. Otherwise, it should
2373 // return |SSL_TLSEXT_ERR_NOACK|. Other |SSL_TLSEXT_ERR_*| values are
2374 // unimplemented and will be treated as |SSL_TLSEXT_ERR_NOACK|.
2375 //
2376 // The cipher suite is selected before negotiating ALPN. The callback may use
2377 // |SSL_get_pending_cipher| to query the cipher suite.
2378 void SSL_CTX_set_alpn_select_cb(
2379     SSL_CTX *ctx, 
2380 	ExternC!(int function(SSL *ssl, uint8_t ** outBuffer, uint8_t *out_len,
2381                             const(uint8_t)* inBuffer, uint in_len, void *arg)) cb,
2382     void *arg);
2383 
2384 // SSL_get0_alpn_selected gets the selected ALPN protocol (if any) from |ssl|.
2385 // On return it sets |*out_data| to point to |*out_len| bytes of protocol name
2386 // (not including the leading length-prefix byte). If the server didn't respond
2387 // with a negotiated protocol then |*out_len| will be zero.
2388 void SSL_get0_alpn_selected(const(SSL) *ssl,
2389                                            uint8_t**out_data,
2390                                            uint *out_len);
2391 
2392 // SSL_CTX_set_allow_unknown_alpn_protos configures client connections on |ctx|
2393 // to allow unknown ALPN protocols from the server. Otherwise, by default, the
2394 // client will require that the protocol be advertised in
2395 // |SSL_CTX_set_alpn_protos|.
2396 void SSL_CTX_set_allow_unknown_alpn_protos(SSL_CTX *ctx, int enabled);
2397 
2398 
2399 
2400 void SSL_set_info_callback(SSL* ssl,
2401 			   ExternC!(void function(const(SSL)* ssl,int type,int val)) cb);
2402 ExternC!(void function(const(SSL)* ssl,int type,int val)) SSL_get_info_callback(const(SSL)* ssl);
2403 int SSL_state(const(SSL)* ssl);
2404 void SSL_set_state(SSL *ssl, int state);
2405 
2406 void SSL_set_verify_result(SSL* ssl,c_long v);
2407 c_long SSL_get_verify_result(const(SSL)* ssl);
2408 
2409 int SSL_set_ex_data(SSL* ssl,int idx,void* data);
2410 void* SSL_get_ex_data(const(SSL)* ssl,int idx);
2411 int SSL_get_ex_new_index(c_long argl, void* argp, CRYPTO_EX_new* new_func,
2412 	CRYPTO_EX_dup* dup_func, CRYPTO_EX_free* free_func);
2413 
2414 int SSL_SESSION_set_ex_data(SSL_SESSION* ss,int idx,void* data);
2415 void* SSL_SESSION_get_ex_data(const(SSL_SESSION)* ss,int idx);
2416 int SSL_SESSION_get_ex_new_index(c_long argl, void* argp, CRYPTO_EX_new* new_func,
2417 	CRYPTO_EX_dup* dup_func, CRYPTO_EX_free* free_func);
2418 
2419 int SSL_CTX_set_ex_data(SSL_CTX* ssl,int idx,void* data);
2420 void* SSL_CTX_get_ex_data(const(SSL_CTX)* ssl,int idx);
2421 int SSL_CTX_get_ex_new_index(c_long argl, void* argp, CRYPTO_EX_new* new_func,
2422 	CRYPTO_EX_dup* dup_func, CRYPTO_EX_free* free_func);
2423 
2424 int SSL_get_ex_data_X509_STORE_CTX_idx();
2425 
2426 auto SSL_CTX_sess_set_cache_size(SSL_CTX* ctx, c_long t) {
2427 	return SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,null);
2428 }
2429 auto SSL_CTX_sess_get_cache_size(SSL_CTX* ctx) {
2430 	return SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,null);
2431 }
2432 auto SSL_CTX_set_session_cache_mode(SSL_CTX* ctx, c_long m) {
2433 	return SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,null);
2434 }
2435 auto SSL_CTX_get_session_cache_mode(SSL_CTX* ctx) {
2436 	return SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,null);
2437 }
2438 
2439 alias SSL_CTX_get_read_ahead SSL_CTX_get_default_read_ahead;
2440 alias SSL_CTX_set_read_ahead SSL_CTX_set_default_read_ahead;
2441 auto SSL_CTX_get_read_ahead(SSL_CTX* ctx) {
2442 	return SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,null);
2443 }
2444 auto SSL_CTX_set_read_ahead(SSL_CTX* ctx, c_long m) {
2445 	return SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,null);
2446 }
2447 auto SSL_CTX_get_max_cert_list(SSL_CTX* ctx) {
2448 	return SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,null);
2449 }
2450 auto SSL_CTX_set_max_cert_list(SSL_CTX* ctx, c_long m) {
2451 	return SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,null);
2452 }
2453 auto SSL_get_max_cert_list(SSL* ssl) {
2454 	SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,null);
2455 }
2456 auto SSL_set_max_cert_list(SSL* ssl,c_long m) {
2457 	SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,null);
2458 }
2459 
2460 auto SSL_CTX_set_max_send_fragment(SSL_CTX* ctx, c_long m) {
2461 	return SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,null);
2462 }
2463 auto SSL_set_max_send_fragment(SSL* ssl, c_long m) {
2464 	SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,null);
2465 }
2466 
2467      /* NB: the keylength is only applicable when is_export is true */
2468 version(OPENSSL_NO_RSA) {} else {
2469 void SSL_CTX_set_tmp_rsa_callback(SSL_CTX* ctx,
2470 				  ExternC!(RSA* function(SSL* ssl,int is_export,
2471 					     int keylength)) cb);
2472 
2473 void SSL_set_tmp_rsa_callback(SSL* ssl,
2474 				  ExternC!(RSA* function(SSL* ssl,int is_export,
2475 					     int keylength)) cb);
2476 }
2477 version(OPENSSL_NO_DH) {} else {
2478 void SSL_CTX_set_tmp_dh_callback(SSL_CTX* ctx,
2479 				 ExternC!(DH* function(SSL* ssl,int is_export,
2480 					   int keylength)) dh);
2481 void SSL_set_tmp_dh_callback(SSL* ssl,
2482 				 ExternC!(DH* function(SSL* ssl,int is_export,
2483 					   int keylength)) dh);
2484 }
2485 version(OPENSSL_NO_ECDH) {} else {
2486 void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX* ctx,
2487 				 ExternC!(EC_KEY* function(SSL* ssl,int is_export,
2488 					   int keylength)) ecdh);
2489 void SSL_set_tmp_ecdh_callback(SSL* ssl,
2490 				 ExternC!(EC_KEY* function(SSL* ssl,int is_export,
2491 					   int keylength)) ecdh);
2492 }
2493 
2494 version(OPENSSL_NO_COMP) {
2495 const(void)* SSL_get_current_compression(SSL* s);
2496 const(void)* SSL_get_current_expansion(SSL* s);
2497 const(char)* SSL_COMP_get_name(const(void)* comp);
2498 void* SSL_COMP_get_compression_methods();
2499 int SSL_COMP_add_compression_method(int id,void* cm);
2500 } else {
2501 const(COMP_METHOD)* SSL_get_current_compression(SSL* s);
2502 const(COMP_METHOD)* SSL_get_current_expansion(SSL* s);
2503 const(char)* SSL_COMP_get_name(const(COMP_METHOD)* comp);
2504 STACK_OF!(SSL_COMP) *SSL_COMP_get_compression_methods();
2505 int SSL_COMP_add_compression_method(int id,COMP_METHOD* cm);
2506 }
2507 
2508 /* TLS extensions functions */
2509 int SSL_set_session_ticket_ext(SSL* s, void* ext_data, int ext_len);
2510 
2511 int SSL_set_session_ticket_ext_cb(SSL* s, tls_session_ticket_ext_cb_fn cb,
2512 				  void* arg);
2513 
2514 /* Pre-shared secret session resumption functions */
2515 int SSL_set_session_secret_cb(SSL* s, tls_session_secret_cb_fn tls_session_secret_cb, void* arg);
2516 
2517 void SSL_set_debug(SSL *s, int debug_);
2518 int SSL_cache_hit(SSL *s);
2519 
2520 
2521 enum ssl_renegotiate_mode_t {
2522   ssl_renegotiate_never = 0,
2523   ssl_renegotiate_once,
2524   ssl_renegotiate_freely,
2525   ssl_renegotiate_ignore,
2526 }
2527 
2528 // SSL_set_renegotiate_mode configures how |ssl|, a client, reacts to
2529 // renegotiation attempts by a server. If |ssl| is a server, peer-initiated
2530 // renegotiations are *always* rejected and this function does nothing.
2531 //
2532 // The renegotiation mode defaults to |ssl_renegotiate_never|, but may be set
2533 // at any point in a connection's lifetime. Set it to |ssl_renegotiate_once| to
2534 // allow one renegotiation, |ssl_renegotiate_freely| to allow all
2535 // renegotiations or |ssl_renegotiate_ignore| to ignore HelloRequest messages.
2536 // Note that ignoring HelloRequest messages may cause the connection to stall
2537 // if the server waits for the renegotiation to complete.
2538 //
2539 // If configuration shedding is enabled (see |SSL_set_shed_handshake_config|),
2540 // configuration is released if, at any point after the handshake, renegotiation
2541 // is disabled. It is not possible to switch from disabling renegotiation to
2542 // enabling it on a given connection. Callers that condition renegotiation on,
2543 // e.g., ALPN must enable renegotiation before the handshake and conditionally
2544 // disable it afterwards.
2545 //
2546 // There is no support in BoringSSL for initiating renegotiations as a client
2547 // or server.
2548 void SSL_set_renegotiate_mode(SSL *ssl, ssl_renegotiate_mode_t mode);
2549 
2550 // SSL_renegotiate_pending returns one if |ssl| is in the middle of a
2551 // renegotiation.
2552 int SSL_renegotiate_pending(SSL *ssl);
2553 
2554 // SSL_total_renegotiations returns the total number of renegotiation handshakes
2555 // performed by |ssl|. This includes the pending renegotiation, if any.
2556 int SSL_total_renegotiations(const(SSL) *ssl);
2557 
2558 enum tls13_variant_t {
2559   tls13_default = 0,
2560   tls13_draft23,
2561   tls13_draft28,
2562 }
2563 
2564 
2565 // SSL_get_peer_signature_algorithm returns the signature algorithm used by the
2566 // peer. If not applicable, it returns zero.
2567 uint16_t SSL_get_peer_signature_algorithm(const(SSL) *ssl);
2568 
2569 // SSL_get_client_random writes up to |max_out| bytes of the most recent
2570 // handshake's client_random to |out| and returns the number of bytes written.
2571 // If |max_out| is zero, it returns the size of the client_random.
2572 size_t SSL_get_client_random(const(SSL) *ssl, uint8_t *ot, size_t max_out);
2573 
2574 // SSL_get_server_random writes up to |max_out| bytes of the most recent
2575 // handshake's server_random to |out| and returns the number of bytes written.
2576 // If |max_out| is zero, it returns the size of the server_random.
2577 size_t SSL_get_server_random(const(SSL) *ssl, uint8_t *ot, size_t max_out);
2578 
2579 // SSL_get_pending_cipher returns the cipher suite for the current handshake or
2580 // NULL if one has not been negotiated yet or there is no pending handshake.
2581 const(SSL_CIPHER) *SSL_get_pending_cipher(const(SSL) *ssl);
2582 
2583 // SSL_set_retain_only_sha256_of_client_certs, on a server, sets whether only
2584 // the SHA-256 hash of peer's certificate should be saved in memory and in the
2585 // session. This can save memory, ticket size and session cache space. If
2586 // enabled, |SSL_get_peer_certificate| will return NULL after the handshake
2587 // completes. See |SSL_SESSION_has_peer_sha256| and
2588 // |SSL_SESSION_get0_peer_sha256| to query the hash.
2589 void SSL_set_retain_only_sha256_of_client_certs(SSL *ssl, int enable);
2590 
2591 // SSL_CTX_set_retain_only_sha256_of_client_certs, on a server, sets whether
2592 // only the SHA-256 hash of peer's certificate should be saved in memory and in
2593 // the session. This can save memory, ticket size and session cache space. If
2594 // enabled, |SSL_get_peer_certificate| will return NULL after the handshake
2595 // completes. See |SSL_SESSION_has_peer_sha256| and
2596 // |SSL_SESSION_get0_peer_sha256| to query the hash.
2597 void SSL_CTX_set_retain_only_sha256_of_client_certs(SSL_CTX *ctx, int enable);
2598 
2599 // SSL_CTX_set_grease_enabled configures whether sockets on |ctx| should enable
2600 // GREASE. See draft-davidben-tls-grease-01.
2601 void SSL_CTX_set_grease_enabled(SSL_CTX *ctx, int enabled);
2602 
2603 // SSL_max_seal_overhead returns the maximum overhead, in bytes, of sealing a
2604 // record with |ssl|.
2605 size_t SSL_max_seal_overhead(const(SSL) *ssl);
2606 
2607 // SSL_get_ticket_age_skew returns the difference, in seconds, between the
2608 // client-sent ticket age and the server-computed value in TLS 1.3 server
2609 // connections which resumed a session.
2610 int SSL_get_ticket_age_skew(const(SSL) *ssl);
2611 
2612 // SSL_CTX_set_false_start_allowed_without_alpn configures whether connections
2613 // on |ctx| may use False Start (if |SSL_MODE_ENABLE_FALSE_START| is enabled)
2614 // without negotiating ALPN.
2615 void SSL_CTX_set_false_start_allowed_without_alpn(SSL_CTX *ctx, int allowed);
2616 
2617 // SSL_is_draft_downgrade returns one if the TLS 1.3 anti-downgrade mechanism
2618 // would have aborted |ssl|'s handshake and zero otherwise.
2619 int SSL_is_draft_downgrade(const(SSL) *ssl);
2620 
2621 
2622 /* BEGIN ERROR CODES */
2623 /* The following lines are auto generated by the script mkerr.pl. Any changes
2624  * made after this point may be overwritten when the script is next run.
2625  */
2626 void ERR_load_SSL_strings();
2627 
2628 /* Error codes for the SSL functions. */
2629 
2630 /* Function codes. */
2631 enum SSL_F_CLIENT_CERTIFICATE = 100;
2632 enum SSL_F_CLIENT_FINISHED = 167;
2633 enum SSL_F_CLIENT_HELLO = 101;
2634 enum SSL_F_CLIENT_MASTER_KEY = 102;
2635 enum SSL_F_D2I_SSL_SESSION = 103;
2636 enum SSL_F_DO_DTLS1_WRITE = 245;
2637 enum SSL_F_DO_SSL3_WRITE = 104;
2638 enum SSL_F_DTLS1_ACCEPT = 246;
2639 enum SSL_F_DTLS1_ADD_CERT_TO_BUF = 295;
2640 enum SSL_F_DTLS1_BUFFER_RECORD = 247;
2641 enum SSL_F_DTLS1_CHECK_TIMEOUT_NUM = 316;
2642 enum SSL_F_DTLS1_CLIENT_HELLO = 248;
2643 enum SSL_F_DTLS1_CONNECT = 249;
2644 enum SSL_F_DTLS1_ENC = 250;
2645 enum SSL_F_DTLS1_GET_HELLO_VERIFY = 251;
2646 enum SSL_F_DTLS1_GET_MESSAGE = 252;
2647 enum SSL_F_DTLS1_GET_MESSAGE_FRAGMENT = 253;
2648 enum SSL_F_DTLS1_GET_RECORD = 254;
2649 enum SSL_F_DTLS1_HANDLE_TIMEOUT = 297;
2650 enum SSL_F_DTLS1_HEARTBEAT = 305;
2651 enum SSL_F_DTLS1_OUTPUT_CERT_CHAIN = 255;
2652 enum SSL_F_DTLS1_PREPROCESS_FRAGMENT = 288;
2653 enum SSL_F_DTLS1_PROCESS_OUT_OF_SEQ_MESSAGE = 256;
2654 enum SSL_F_DTLS1_PROCESS_RECORD = 257;
2655 enum SSL_F_DTLS1_READ_BYTES = 258;
2656 enum SSL_F_DTLS1_READ_FAILED = 259;
2657 enum SSL_F_DTLS1_SEND_CERTIFICATE_REQUEST = 260;
2658 enum SSL_F_DTLS1_SEND_CLIENT_CERTIFICATE = 261;
2659 enum SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE = 262;
2660 enum SSL_F_DTLS1_SEND_CLIENT_VERIFY = 263;
2661 enum SSL_F_DTLS1_SEND_HELLO_VERIFY_REQUEST = 264;
2662 enum SSL_F_DTLS1_SEND_SERVER_CERTIFICATE = 265;
2663 enum SSL_F_DTLS1_SEND_SERVER_HELLO = 266;
2664 enum SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE = 267;
2665 enum SSL_F_DTLS1_WRITE_APP_DATA_BYTES = 268;
2666 enum SSL_F_GET_CLIENT_FINISHED = 105;
2667 enum SSL_F_GET_CLIENT_HELLO = 106;
2668 enum SSL_F_GET_CLIENT_MASTER_KEY = 107;
2669 enum SSL_F_GET_SERVER_FINISHED = 108;
2670 enum SSL_F_GET_SERVER_HELLO = 109;
2671 enum SSL_F_GET_SERVER_VERIFY = 110;
2672 enum SSL_F_I2D_SSL_SESSION = 111;
2673 enum SSL_F_READ_N = 112;
2674 enum SSL_F_REQUEST_CERTIFICATE = 113;
2675 enum SSL_F_SERVER_FINISH = 239;
2676 enum SSL_F_SERVER_HELLO = 114;
2677 enum SSL_F_SERVER_VERIFY = 240;
2678 enum SSL_F_SSL23_ACCEPT = 115;
2679 enum SSL_F_SSL23_CLIENT_HELLO = 116;
2680 enum SSL_F_SSL23_CONNECT = 117;
2681 enum SSL_F_SSL23_GET_CLIENT_HELLO = 118;
2682 enum SSL_F_SSL23_GET_SERVER_HELLO = 119;
2683 enum SSL_F_SSL23_PEEK = 237;
2684 enum SSL_F_SSL23_READ = 120;
2685 enum SSL_F_SSL23_WRITE = 121;
2686 enum SSL_F_SSL2_ACCEPT = 122;
2687 enum SSL_F_SSL2_CONNECT = 123;
2688 enum SSL_F_SSL2_ENC_INIT = 124;
2689 enum SSL_F_SSL2_GENERATE_KEY_MATERIAL = 241;
2690 enum SSL_F_SSL2_PEEK = 234;
2691 enum SSL_F_SSL2_READ = 125;
2692 enum SSL_F_SSL2_READ_INTERNAL = 236;
2693 enum SSL_F_SSL2_SET_CERTIFICATE = 126;
2694 enum SSL_F_SSL2_WRITE = 127;
2695 enum SSL_F_SSL3_ACCEPT = 128;
2696 enum SSL_F_SSL3_ADD_CERT_TO_BUF = 296;
2697 enum SSL_F_SSL3_CALLBACK_CTRL = 233;
2698 enum SSL_F_SSL3_CHANGE_CIPHER_STATE = 129;
2699 enum SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM = 130;
2700 enum SSL_F_SSL3_CHECK_CLIENT_HELLO = 304;
2701 enum SSL_F_SSL3_CLIENT_HELLO = 131;
2702 enum SSL_F_SSL3_CONNECT = 132;
2703 enum SSL_F_SSL3_CTRL = 213;
2704 enum SSL_F_SSL3_CTX_CTRL = 133;
2705 enum SSL_F_SSL3_DIGEST_CACHED_RECORDS = 293;
2706 enum SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC = 292;
2707 enum SSL_F_SSL3_ENC = 134;
2708 enum SSL_F_SSL3_GENERATE_KEY_BLOCK = 238;
2709 enum SSL_F_SSL3_GET_CERTIFICATE_REQUEST = 135;
2710 enum SSL_F_SSL3_GET_CERT_STATUS = 289;
2711 enum SSL_F_SSL3_GET_CERT_VERIFY = 136;
2712 enum SSL_F_SSL3_GET_CLIENT_CERTIFICATE = 137;
2713 enum SSL_F_SSL3_GET_CLIENT_HELLO = 138;
2714 enum SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE = 139;
2715 enum SSL_F_SSL3_GET_FINISHED = 140;
2716 enum SSL_F_SSL3_GET_KEY_EXCHANGE = 141;
2717 enum SSL_F_SSL3_GET_MESSAGE = 142;
2718 enum SSL_F_SSL3_GET_NEW_SESSION_TICKET = 283;
2719 enum SSL_F_SSL3_GET_NEXT_PROTO = 306;
2720 enum SSL_F_SSL3_GET_RECORD = 143;
2721 enum SSL_F_SSL3_GET_SERVER_CERTIFICATE = 144;
2722 enum SSL_F_SSL3_GET_SERVER_DONE = 145;
2723 enum SSL_F_SSL3_GET_SERVER_HELLO = 146;
2724 enum SSL_F_SSL3_HANDSHAKE_MAC = 285;
2725 enum SSL_F_SSL3_NEW_SESSION_TICKET = 287;
2726 enum SSL_F_SSL3_OUTPUT_CERT_CHAIN = 147;
2727 enum SSL_F_SSL3_PEEK = 235;
2728 enum SSL_F_SSL3_READ_BYTES = 148;
2729 enum SSL_F_SSL3_READ_N = 149;
2730 enum SSL_F_SSL3_SEND_CERTIFICATE_REQUEST = 150;
2731 enum SSL_F_SSL3_SEND_CLIENT_CERTIFICATE = 151;
2732 enum SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE = 152;
2733 enum SSL_F_SSL3_SEND_CLIENT_VERIFY = 153;
2734 enum SSL_F_SSL3_SEND_SERVER_CERTIFICATE = 154;
2735 enum SSL_F_SSL3_SEND_SERVER_HELLO = 242;
2736 enum SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE = 155;
2737 enum SSL_F_SSL3_SETUP_KEY_BLOCK = 157;
2738 enum SSL_F_SSL3_SETUP_READ_BUFFER = 156;
2739 enum SSL_F_SSL3_SETUP_WRITE_BUFFER = 291;
2740 enum SSL_F_SSL3_WRITE_BYTES = 158;
2741 enum SSL_F_SSL3_WRITE_PENDING = 159;
2742 enum SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT = 298;
2743 enum SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT = 277;
2744 enum SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT = 307;
2745 enum SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK = 215;
2746 enum SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK = 216;
2747 enum SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT = 299;
2748 enum SSL_F_SSL_ADD_SERVERHELLO_TLSEXT = 278;
2749 enum SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT = 308;
2750 enum SSL_F_SSL_BAD_METHOD = 160;
2751 enum SSL_F_SSL_BYTES_TO_CIPHER_LIST = 161;
2752 enum SSL_F_SSL_CERT_DUP = 221;
2753 enum SSL_F_SSL_CERT_INST = 222;
2754 enum SSL_F_SSL_CERT_INSTANTIATE = 214;
2755 enum SSL_F_SSL_CERT_NEW = 162;
2756 enum SSL_F_SSL_CHECK_PRIVATE_KEY = 163;
2757 enum SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT = 280;
2758 enum SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG = 279;
2759 enum SSL_F_SSL_CIPHER_PROCESS_RULESTR = 230;
2760 enum SSL_F_SSL_CIPHER_STRENGTH_SORT = 231;
2761 enum SSL_F_SSL_CLEAR = 164;
2762 enum SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD = 165;
2763 enum SSL_F_SSL_CREATE_CIPHER_LIST = 166;
2764 enum SSL_F_SSL_CTRL = 232;
2765 enum SSL_F_SSL_CTX_CHECK_PRIVATE_KEY = 168;
2766 enum SSL_F_SSL_CTX_MAKE_PROFILES = 309;
2767 enum SSL_F_SSL_CTX_NEW = 169;
2768 enum SSL_F_SSL_CTX_SET_CIPHER_LIST = 269;
2769 enum SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE = 290;
2770 enum SSL_F_SSL_CTX_SET_PURPOSE = 226;
2771 enum SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT = 219;
2772 enum SSL_F_SSL_CTX_SET_SSL_VERSION = 170;
2773 enum SSL_F_SSL_CTX_SET_TRUST = 229;
2774 enum SSL_F_SSL_CTX_USE_CERTIFICATE = 171;
2775 enum SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 = 172;
2776 enum SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE = 220;
2777 enum SSL_F_SSL_CTX_USE_CERTIFICATE_FILE = 173;
2778 enum SSL_F_SSL_CTX_USE_PRIVATEKEY = 174;
2779 enum SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 = 175;
2780 enum SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE = 176;
2781 enum SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT = 272;
2782 enum SSL_F_SSL_CTX_USE_RSAPRIVATEKEY = 177;
2783 enum SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 = 178;
2784 enum SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE = 179;
2785 enum SSL_F_SSL_DO_HANDSHAKE = 180;
2786 enum SSL_F_SSL_GET_NEW_SESSION = 181;
2787 enum SSL_F_SSL_GET_PREV_SESSION = 217;
2788 enum SSL_F_SSL_GET_SERVER_SEND_CERT = 182;
2789 enum SSL_F_SSL_GET_SERVER_SEND_PKEY = 317;
2790 enum SSL_F_SSL_GET_SIGN_PKEY = 183;
2791 enum SSL_F_SSL_INIT_WBIO_BUFFER = 184;
2792 enum SSL_F_SSL_LOAD_CLIENT_CA_FILE = 185;
2793 enum SSL_F_SSL_NEW = 186;
2794 enum SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT = 300;
2795 enum SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT = 302;
2796 enum SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT = 310;
2797 enum SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT = 301;
2798 enum SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT = 303;
2799 enum SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT = 311;
2800 enum SSL_F_SSL_PEEK = 270;
2801 enum SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT = 281;
2802 enum SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT = 282;
2803 enum SSL_F_SSL_READ = 223;
2804 enum SSL_F_SSL_RSA_PRIVATE_DECRYPT = 187;
2805 enum SSL_F_SSL_RSA_PUBLIC_ENCRYPT = 188;
2806 enum SSL_F_SSL_SESSION_NEW = 189;
2807 enum SSL_F_SSL_SESSION_PRINT_FP = 190;
2808 enum SSL_F_SSL_SESSION_SET1_ID_CONTEXT = 312;
2809 enum SSL_F_SSL_SESS_CERT_NEW = 225;
2810 enum SSL_F_SSL_SET_CERT = 191;
2811 enum SSL_F_SSL_SET_CIPHER_LIST = 271;
2812 enum SSL_F_SSL_SET_FD = 192;
2813 enum SSL_F_SSL_SET_PKEY = 193;
2814 enum SSL_F_SSL_SET_PURPOSE = 227;
2815 enum SSL_F_SSL_SET_RFD = 194;
2816 enum SSL_F_SSL_SET_SESSION = 195;
2817 enum SSL_F_SSL_SET_SESSION_ID_CONTEXT = 218;
2818 enum SSL_F_SSL_SET_SESSION_TICKET_EXT = 294;
2819 enum SSL_F_SSL_SET_TRUST = 228;
2820 enum SSL_F_SSL_SET_WFD = 196;
2821 enum SSL_F_SSL_SHUTDOWN = 224;
2822 enum SSL_F_SSL_SRP_CTX_INIT = 313;
2823 enum SSL_F_SSL_UNDEFINED_CONST_FUNCTION = 243;
2824 enum SSL_F_SSL_UNDEFINED_FUNCTION = 197;
2825 enum SSL_F_SSL_UNDEFINED_VOID_FUNCTION = 244;
2826 enum SSL_F_SSL_USE_CERTIFICATE = 198;
2827 enum SSL_F_SSL_USE_CERTIFICATE_ASN1 = 199;
2828 enum SSL_F_SSL_USE_CERTIFICATE_FILE = 200;
2829 enum SSL_F_SSL_USE_PRIVATEKEY = 201;
2830 enum SSL_F_SSL_USE_PRIVATEKEY_ASN1 = 202;
2831 enum SSL_F_SSL_USE_PRIVATEKEY_FILE = 203;
2832 enum SSL_F_SSL_USE_PSK_IDENTITY_HINT = 273;
2833 enum SSL_F_SSL_USE_RSAPRIVATEKEY = 204;
2834 enum SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 = 205;
2835 enum SSL_F_SSL_USE_RSAPRIVATEKEY_FILE = 206;
2836 enum SSL_F_SSL_VERIFY_CERT_CHAIN = 207;
2837 enum SSL_F_SSL_WRITE = 208;
2838 enum SSL_F_TLS1_CERT_VERIFY_MAC = 286;
2839 enum SSL_F_TLS1_CHANGE_CIPHER_STATE = 209;
2840 enum SSL_F_TLS1_CHECK_SERVERHELLO_TLSEXT = 274;
2841 enum SSL_F_TLS1_ENC = 210;
2842 enum SSL_F_TLS1_EXPORT_KEYING_MATERIAL = 314;
2843 enum SSL_F_TLS1_HEARTBEAT = 315;
2844 enum SSL_F_TLS1_PREPARE_CLIENTHELLO_TLSEXT = 275;
2845 enum SSL_F_TLS1_PREPARE_SERVERHELLO_TLSEXT = 276;
2846 enum SSL_F_TLS1_PRF = 284;
2847 enum SSL_F_TLS1_SETUP_KEY_BLOCK = 211;
2848 enum SSL_F_WRITE_PENDING = 212;
2849 
2850 /* Reason codes. */
2851 enum SSL_R_APP_DATA_IN_HANDSHAKE = 100;
2852 enum SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT = 272;
2853 enum SSL_R_BAD_ALERT_RECORD = 101;
2854 enum SSL_R_BAD_AUTHENTICATION_TYPE = 102;
2855 enum SSL_R_BAD_CHANGE_CIPHER_SPEC = 103;
2856 enum SSL_R_BAD_CHECKSUM = 104;
2857 enum SSL_R_BAD_DATA_RETURNED_BY_CALLBACK = 106;
2858 enum SSL_R_BAD_DECOMPRESSION = 107;
2859 enum SSL_R_BAD_DH_G_LENGTH = 108;
2860 enum SSL_R_BAD_DH_PUB_KEY_LENGTH = 109;
2861 enum SSL_R_BAD_DH_P_LENGTH = 110;
2862 enum SSL_R_BAD_DIGEST_LENGTH = 111;
2863 enum SSL_R_BAD_DSA_SIGNATURE = 112;
2864 enum SSL_R_BAD_ECC_CERT = 304;
2865 enum SSL_R_BAD_ECDSA_SIGNATURE = 305;
2866 enum SSL_R_BAD_ECPOINT = 306;
2867 enum SSL_R_BAD_HANDSHAKE_LENGTH = 332;
2868 enum SSL_R_BAD_HELLO_REQUEST = 105;
2869 enum SSL_R_BAD_LENGTH = 271;
2870 enum SSL_R_BAD_MAC_DECODE = 113;
2871 enum SSL_R_BAD_MAC_LENGTH = 333;
2872 enum SSL_R_BAD_MESSAGE_TYPE = 114;
2873 enum SSL_R_BAD_PACKET_LENGTH = 115;
2874 enum SSL_R_BAD_PROTOCOL_VERSION_NUMBER = 116;
2875 enum SSL_R_BAD_PSK_IDENTITY_HINT_LENGTH = 316;
2876 enum SSL_R_BAD_RESPONSE_ARGUMENT = 117;
2877 enum SSL_R_BAD_RSA_DECRYPT = 118;
2878 enum SSL_R_BAD_RSA_ENCRYPT = 119;
2879 enum SSL_R_BAD_RSA_E_LENGTH = 120;
2880 enum SSL_R_BAD_RSA_MODULUS_LENGTH = 121;
2881 enum SSL_R_BAD_RSA_SIGNATURE = 122;
2882 enum SSL_R_BAD_SIGNATURE = 123;
2883 enum SSL_R_BAD_SRP_A_LENGTH = 347;
2884 enum SSL_R_BAD_SRP_B_LENGTH = 348;
2885 enum SSL_R_BAD_SRP_G_LENGTH = 349;
2886 enum SSL_R_BAD_SRP_N_LENGTH = 350;
2887 enum SSL_R_BAD_SRP_S_LENGTH = 351;
2888 enum SSL_R_BAD_SRTP_MKI_VALUE = 352;
2889 enum SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST = 353;
2890 enum SSL_R_BAD_SSL_FILETYPE = 124;
2891 enum SSL_R_BAD_SSL_SESSION_ID_LENGTH = 125;
2892 enum SSL_R_BAD_STATE = 126;
2893 enum SSL_R_BAD_WRITE_RETRY = 127;
2894 enum SSL_R_BIO_NOT_SET = 128;
2895 enum SSL_R_BLOCK_CIPHER_PAD_IS_WRONG = 129;
2896 enum SSL_R_BN_LIB = 130;
2897 enum SSL_R_CA_DN_LENGTH_MISMATCH = 131;
2898 enum SSL_R_CA_DN_TOO_LONG = 132;
2899 enum SSL_R_CCS_RECEIVED_EARLY = 133;
2900 enum SSL_R_CERTIFICATE_VERIFY_FAILED = 134;
2901 enum SSL_R_CERT_LENGTH_MISMATCH = 135;
2902 enum SSL_R_CHALLENGE_IS_DIFFERENT = 136;
2903 enum SSL_R_CIPHER_CODE_WRONG_LENGTH = 137;
2904 enum SSL_R_CIPHER_OR_HASH_UNAVAILABLE = 138;
2905 enum SSL_R_CIPHER_TABLE_SRC_ERROR = 139;
2906 enum SSL_R_CLIENTHELLO_TLSEXT = 226;
2907 enum SSL_R_COMPRESSED_LENGTH_TOO_LONG = 140;
2908 enum SSL_R_COMPRESSION_DISABLED = 343;
2909 enum SSL_R_COMPRESSION_FAILURE = 141;
2910 enum SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE = 307;
2911 enum SSL_R_COMPRESSION_LIBRARY_ERROR = 142;
2912 enum SSL_R_CONNECTION_ID_IS_DIFFERENT = 143;
2913 enum SSL_R_CONNECTION_TYPE_NOT_SET = 144;
2914 enum SSL_R_COOKIE_MISMATCH = 308;
2915 enum SSL_R_DATA_BETWEEN_CCS_AND_FINISHED = 145;
2916 enum SSL_R_DATA_LENGTH_TOO_LONG = 146;
2917 enum SSL_R_DECRYPTION_FAILED = 147;
2918 enum SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC = 281;
2919 enum SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG = 148;
2920 enum SSL_R_DIGEST_CHECK_FAILED = 149;
2921 enum SSL_R_DTLS_MESSAGE_TOO_BIG = 334;
2922 enum SSL_R_DUPLICATE_COMPRESSION_ID = 309;
2923 enum SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT = 317;
2924 enum SSL_R_ECC_CERT_NOT_FOR_SIGNING = 318;
2925 enum SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE = 322;
2926 enum SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE = 323;
2927 enum SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER = 310;
2928 enum SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST = 354;
2929 enum SSL_R_ENCRYPTED_LENGTH_TOO_LONG = 150;
2930 enum SSL_R_ERROR_GENERATING_TMP_RSA_KEY = 282;
2931 enum SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST = 151;
2932 enum SSL_R_EXCESSIVE_MESSAGE_SIZE = 152;
2933 enum SSL_R_EXTRA_DATA_IN_MESSAGE = 153;
2934 enum SSL_R_GOT_A_FIN_BEFORE_A_CCS = 154;
2935 enum SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS = 355;
2936 enum SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION = 356;
2937 enum SSL_R_HTTPS_PROXY_REQUEST = 155;
2938 enum SSL_R_HTTP_REQUEST = 156;
2939 enum SSL_R_ILLEGAL_PADDING = 283;
2940 enum SSL_R_INCONSISTENT_COMPRESSION = 340;
2941 enum SSL_R_INVALID_CHALLENGE_LENGTH = 158;
2942 enum SSL_R_INVALID_COMMAND = 280;
2943 enum SSL_R_INVALID_COMPRESSION_ALGORITHM = 341;
2944 enum SSL_R_INVALID_PURPOSE = 278;
2945 enum SSL_R_INVALID_SRP_USERNAME = 357;
2946 enum SSL_R_INVALID_STATUS_RESPONSE = 328;
2947 enum SSL_R_INVALID_TICKET_KEYS_LENGTH = 325;
2948 enum SSL_R_INVALID_TRUST = 279;
2949 enum SSL_R_KEY_ARG_TOO_LONG = 284;
2950 enum SSL_R_KRB5 = 285;
2951 enum SSL_R_KRB5_C_CC_PRINC = 286;
2952 enum SSL_R_KRB5_C_GET_CRED = 287;
2953 enum SSL_R_KRB5_C_INIT = 288;
2954 enum SSL_R_KRB5_C_MK_REQ = 289;
2955 enum SSL_R_KRB5_S_BAD_TICKET = 290;
2956 enum SSL_R_KRB5_S_INIT = 291;
2957 enum SSL_R_KRB5_S_RD_REQ = 292;
2958 enum SSL_R_KRB5_S_TKT_EXPIRED = 293;
2959 enum SSL_R_KRB5_S_TKT_NYV = 294;
2960 enum SSL_R_KRB5_S_TKT_SKEW = 295;
2961 enum SSL_R_LENGTH_MISMATCH = 159;
2962 enum SSL_R_LENGTH_TOO_SHORT = 160;
2963 enum SSL_R_LIBRARY_BUG = 274;
2964 enum SSL_R_LIBRARY_HAS_NO_CIPHERS = 161;
2965 enum SSL_R_MESSAGE_TOO_LONG = 296;
2966 enum SSL_R_MISSING_DH_DSA_CERT = 162;
2967 enum SSL_R_MISSING_DH_KEY = 163;
2968 enum SSL_R_MISSING_DH_RSA_CERT = 164;
2969 enum SSL_R_MISSING_DSA_SIGNING_CERT = 165;
2970 enum SSL_R_MISSING_EXPORT_TMP_DH_KEY = 166;
2971 enum SSL_R_MISSING_EXPORT_TMP_RSA_KEY = 167;
2972 enum SSL_R_MISSING_RSA_CERTIFICATE = 168;
2973 enum SSL_R_MISSING_RSA_ENCRYPTING_CERT = 169;
2974 enum SSL_R_MISSING_RSA_SIGNING_CERT = 170;
2975 enum SSL_R_MISSING_SRP_PARAM = 358;
2976 enum SSL_R_MISSING_TMP_DH_KEY = 171;
2977 enum SSL_R_MISSING_TMP_ECDH_KEY = 311;
2978 enum SSL_R_MISSING_TMP_RSA_KEY = 172;
2979 enum SSL_R_MISSING_TMP_RSA_PKEY = 173;
2980 enum SSL_R_MISSING_VERIFY_MESSAGE = 174;
2981 enum SSL_R_MULTIPLE_SGC_RESTARTS = 346;
2982 enum SSL_R_NON_SSLV2_INITIAL_PACKET = 175;
2983 enum SSL_R_NO_CERTIFICATES_RETURNED = 176;
2984 enum SSL_R_NO_CERTIFICATE_ASSIGNED = 177;
2985 enum SSL_R_NO_CERTIFICATE_RETURNED = 178;
2986 enum SSL_R_NO_CERTIFICATE_SET = 179;
2987 enum SSL_R_NO_CERTIFICATE_SPECIFIED = 180;
2988 enum SSL_R_NO_CIPHERS_AVAILABLE = 181;
2989 enum SSL_R_NO_CIPHERS_PASSED = 182;
2990 enum SSL_R_NO_CIPHERS_SPECIFIED = 183;
2991 enum SSL_R_NO_CIPHER_LIST = 184;
2992 enum SSL_R_NO_CIPHER_MATCH = 185;
2993 enum SSL_R_NO_CLIENT_CERT_METHOD = 331;
2994 enum SSL_R_NO_CLIENT_CERT_RECEIVED = 186;
2995 enum SSL_R_NO_COMPRESSION_SPECIFIED = 187;
2996 enum SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER = 330;
2997 enum SSL_R_NO_METHOD_SPECIFIED = 188;
2998 enum SSL_R_NO_PRIVATEKEY = 189;
2999 enum SSL_R_NO_PRIVATE_KEY_ASSIGNED = 190;
3000 enum SSL_R_NO_PROTOCOLS_AVAILABLE = 191;
3001 enum SSL_R_NO_PUBLICKEY = 192;
3002 enum SSL_R_NO_RENEGOTIATION = 339;
3003 enum SSL_R_NO_REQUIRED_DIGEST = 324;
3004 enum SSL_R_NO_SHARED_CIPHER = 193;
3005 enum SSL_R_NO_SRTP_PROFILES = 359;
3006 enum SSL_R_NO_VERIFY_CALLBACK = 194;
3007 enum SSL_R_NULL_SSL_CTX = 195;
3008 enum SSL_R_NULL_SSL_METHOD_PASSED = 196;
3009 enum SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED = 197;
3010 enum SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED = 344;
3011 enum SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE = 297;
3012 enum SSL_R_OPAQUE_PRF_INPUT_TOO_LONG = 327;
3013 enum SSL_R_PACKET_LENGTH_TOO_LONG = 198;
3014 enum SSL_R_PARSE_TLSEXT = 227;
3015 enum SSL_R_PATH_TOO_LONG = 270;
3016 enum SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE = 199;
3017 enum SSL_R_PEER_ERROR = 200;
3018 enum SSL_R_PEER_ERROR_CERTIFICATE = 201;
3019 enum SSL_R_PEER_ERROR_NO_CERTIFICATE = 202;
3020 enum SSL_R_PEER_ERROR_NO_CIPHER = 203;
3021 enum SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE = 204;
3022 enum SSL_R_PRE_MAC_LENGTH_TOO_LONG = 205;
3023 enum SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS = 206;
3024 enum SSL_R_PROTOCOL_IS_SHUTDOWN = 207;
3025 enum SSL_R_PSK_IDENTITY_NOT_FOUND = 223;
3026 enum SSL_R_PSK_NO_CLIENT_CB = 224;
3027 enum SSL_R_PSK_NO_SERVER_CB = 225;
3028 enum SSL_R_PUBLIC_KEY_ENCRYPT_ERROR = 208;
3029 enum SSL_R_PUBLIC_KEY_IS_NOT_RSA = 209;
3030 enum SSL_R_PUBLIC_KEY_NOT_RSA = 210;
3031 enum SSL_R_READ_BIO_NOT_SET = 211;
3032 enum SSL_R_READ_TIMEOUT_EXPIRED = 312;
3033 enum SSL_R_READ_WRONG_PACKET_TYPE = 212;
3034 enum SSL_R_RECORD_LENGTH_MISMATCH = 213;
3035 enum SSL_R_RECORD_TOO_LARGE = 214;
3036 enum SSL_R_RECORD_TOO_SMALL = 298;
3037 enum SSL_R_RENEGOTIATE_EXT_TOO_LONG = 335;
3038 enum SSL_R_RENEGOTIATION_ENCODING_ERR = 336;
3039 enum SSL_R_RENEGOTIATION_MISMATCH = 337;
3040 enum SSL_R_REQUIRED_CIPHER_MISSING = 215;
3041 enum SSL_R_REQUIRED_COMPRESSSION_ALGORITHM_MISSING = 342;
3042 enum SSL_R_REUSE_CERT_LENGTH_NOT_ZERO = 216;
3043 enum SSL_R_REUSE_CERT_TYPE_NOT_ZERO = 217;
3044 enum SSL_R_REUSE_CIPHER_LIST_NOT_ZERO = 218;
3045 enum SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING = 345;
3046 enum SSL_R_SERVERHELLO_TLSEXT = 275;
3047 enum SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED = 277;
3048 enum SSL_R_SHORT_READ = 219;
3049 enum SSL_R_SIGNATURE_ALGORITHMS_ERROR = 360;
3050 enum SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE = 220;
3051 enum SSL_R_SRP_A_CALC = 361;
3052 enum SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES = 362;
3053 enum SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG = 363;
3054 enum SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE = 364;
3055 enum SSL_R_SSL23_DOING_SESSION_ID_REUSE = 221;
3056 enum SSL_R_SSL2_CONNECTION_ID_TOO_LONG = 299;
3057 enum SSL_R_SSL3_EXT_INVALID_ECPOINTFORMAT = 321;
3058 enum SSL_R_SSL3_EXT_INVALID_SERVERNAME = 319;
3059 enum SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE = 320;
3060 enum SSL_R_SSL3_SESSION_ID_TOO_LONG = 300;
3061 enum SSL_R_SSL3_SESSION_ID_TOO_SHORT = 222;
3062 enum SSL_R_SSLV3_ALERT_BAD_CERTIFICATE = 1042;
3063 enum SSL_R_SSLV3_ALERT_BAD_RECORD_MAC = 1020;
3064 enum SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED = 1045;
3065 enum SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED = 1044;
3066 enum SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN = 1046;
3067 enum SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE = 1030;
3068 enum SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE = 1040;
3069 enum SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER = 1047;
3070 enum SSL_R_SSLV3_ALERT_NO_CERTIFICATE = 1041;
3071 enum SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE = 1010;
3072 enum SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE = 1043;
3073 enum SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION = 228;
3074 enum SSL_R_SSL_HANDSHAKE_FAILURE = 229;
3075 enum SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS = 230;
3076 enum SSL_R_SSL_SESSION_ID_CALLBACK_FAILED = 301;
3077 enum SSL_R_SSL_SESSION_ID_CONFLICT = 302;
3078 enum SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG = 273;
3079 enum SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH = 303;
3080 enum SSL_R_SSL_SESSION_ID_IS_DIFFERENT = 231;
3081 enum SSL_R_TLSV1_ALERT_ACCESS_DENIED = 1049;
3082 enum SSL_R_TLSV1_ALERT_DECODE_ERROR = 1050;
3083 enum SSL_R_TLSV1_ALERT_DECRYPTION_FAILED = 1021;
3084 enum SSL_R_TLSV1_ALERT_DECRYPT_ERROR = 1051;
3085 enum SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION = 1060;
3086 enum SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY = 1071;
3087 enum SSL_R_TLSV1_ALERT_INTERNAL_ERROR = 1080;
3088 enum SSL_R_TLSV1_ALERT_NO_RENEGOTIATION = 1100;
3089 enum SSL_R_TLSV1_ALERT_PROTOCOL_VERSION = 1070;
3090 enum SSL_R_TLSV1_ALERT_RECORD_OVERFLOW = 1022;
3091 enum SSL_R_TLSV1_ALERT_UNKNOWN_CA = 1048;
3092 enum SSL_R_TLSV1_ALERT_USER_CANCELLED = 1090;
3093 enum SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE = 1114;
3094 enum SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE = 1113;
3095 enum SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE = 1111;
3096 enum SSL_R_TLSV1_UNRECOGNIZED_NAME = 1112;
3097 enum SSL_R_TLSV1_UNSUPPORTED_EXTENSION = 1110;
3098 enum SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER = 232;
3099 enum SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT = 365;
3100 enum SSL_R_TLS_HEARTBEAT_PENDING = 366;
3101 enum SSL_R_TLS_ILLEGAL_EXPORTER_LABEL = 367;
3102 enum SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST = 157;
3103 enum SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST = 233;
3104 enum SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG = 234;
3105 enum SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER = 235;
3106 enum SSL_R_UNABLE_TO_DECODE_DH_CERTS = 236;
3107 enum SSL_R_UNABLE_TO_DECODE_ECDH_CERTS = 313;
3108 enum SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY = 237;
3109 enum SSL_R_UNABLE_TO_FIND_DH_PARAMETERS = 238;
3110 enum SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS = 314;
3111 enum SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS = 239;
3112 enum SSL_R_UNABLE_TO_FIND_SSL_METHOD = 240;
3113 enum SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES = 241;
3114 enum SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES = 242;
3115 enum SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES = 243;
3116 enum SSL_R_UNEXPECTED_MESSAGE = 244;
3117 enum SSL_R_UNEXPECTED_RECORD = 245;
3118 enum SSL_R_UNINITIALIZED = 276;
3119 enum SSL_R_UNKNOWN_ALERT_TYPE = 246;
3120 enum SSL_R_UNKNOWN_CERTIFICATE_TYPE = 247;
3121 enum SSL_R_UNKNOWN_CIPHER_RETURNED = 248;
3122 enum SSL_R_UNKNOWN_CIPHER_TYPE = 249;
3123 enum SSL_R_UNKNOWN_DIGEST = 368;
3124 enum SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE = 250;
3125 enum SSL_R_UNKNOWN_PKEY_TYPE = 251;
3126 enum SSL_R_UNKNOWN_PROTOCOL = 252;
3127 enum SSL_R_UNKNOWN_REMOTE_ERROR_TYPE = 253;
3128 enum SSL_R_UNKNOWN_SSL_VERSION = 254;
3129 enum SSL_R_UNKNOWN_STATE = 255;
3130 enum SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED = 338;
3131 enum SSL_R_UNSUPPORTED_CIPHER = 256;
3132 enum SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM = 257;
3133 enum SSL_R_UNSUPPORTED_DIGEST_TYPE = 326;
3134 enum SSL_R_UNSUPPORTED_ELLIPTIC_CURVE = 315;
3135 enum SSL_R_UNSUPPORTED_PROTOCOL = 258;
3136 enum SSL_R_UNSUPPORTED_SSL_VERSION = 259;
3137 enum SSL_R_UNSUPPORTED_STATUS_TYPE = 329;
3138 enum SSL_R_USE_SRTP_NOT_NEGOTIATED = 369;
3139 enum SSL_R_WRITE_BIO_NOT_SET = 260;
3140 enum SSL_R_WRONG_CIPHER_RETURNED = 261;
3141 enum SSL_R_WRONG_MESSAGE_TYPE = 262;
3142 enum SSL_R_WRONG_NUMBER_OF_KEY_BITS = 263;
3143 enum SSL_R_WRONG_SIGNATURE_LENGTH = 264;
3144 enum SSL_R_WRONG_SIGNATURE_SIZE = 265;
3145 enum SSL_R_WRONG_SIGNATURE_TYPE = 370;
3146 enum SSL_R_WRONG_SSL_VERSION = 266;
3147 enum SSL_R_WRONG_VERSION_NUMBER = 267;
3148 enum SSL_R_X509_LIB = 268;
3149 enum SSL_R_X509_VERIFICATION_SETUP_PROBLEMS = 269;
3150 
3151