xref: /onnv-gate/usr/src/common/openssl/ssl/ssl.h (revision 682:07254920e51a)
10Sstevel@tonic-gate /* ssl/ssl.h */
20Sstevel@tonic-gate /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
30Sstevel@tonic-gate  * All rights reserved.
40Sstevel@tonic-gate  *
50Sstevel@tonic-gate  * This package is an SSL implementation written
60Sstevel@tonic-gate  * by Eric Young (eay@cryptsoft.com).
70Sstevel@tonic-gate  * The implementation was written so as to conform with Netscapes SSL.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * This library is free for commercial and non-commercial use as long as
100Sstevel@tonic-gate  * the following conditions are aheared to.  The following conditions
110Sstevel@tonic-gate  * apply to all code found in this distribution, be it the RC4, RSA,
120Sstevel@tonic-gate  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
130Sstevel@tonic-gate  * included with this distribution is covered by the same copyright terms
140Sstevel@tonic-gate  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
150Sstevel@tonic-gate  *
160Sstevel@tonic-gate  * Copyright remains Eric Young's, and as such any Copyright notices in
170Sstevel@tonic-gate  * the code are not to be removed.
180Sstevel@tonic-gate  * If this package is used in a product, Eric Young should be given attribution
190Sstevel@tonic-gate  * as the author of the parts of the library used.
200Sstevel@tonic-gate  * This can be in the form of a textual message at program startup or
210Sstevel@tonic-gate  * in documentation (online or textual) provided with the package.
220Sstevel@tonic-gate  *
230Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
240Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
250Sstevel@tonic-gate  * are met:
260Sstevel@tonic-gate  * 1. Redistributions of source code must retain the copyright
270Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
280Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
290Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
300Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
310Sstevel@tonic-gate  * 3. All advertising materials mentioning features or use of this software
320Sstevel@tonic-gate  *    must display the following acknowledgement:
330Sstevel@tonic-gate  *    "This product includes cryptographic software written by
340Sstevel@tonic-gate  *     Eric Young (eay@cryptsoft.com)"
350Sstevel@tonic-gate  *    The word 'cryptographic' can be left out if the rouines from the library
360Sstevel@tonic-gate  *    being used are not cryptographic related :-).
370Sstevel@tonic-gate  * 4. If you include any Windows specific code (or a derivative thereof) from
380Sstevel@tonic-gate  *    the apps directory (application code) you must include an acknowledgement:
390Sstevel@tonic-gate  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
400Sstevel@tonic-gate  *
410Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
420Sstevel@tonic-gate  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
430Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
440Sstevel@tonic-gate  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
450Sstevel@tonic-gate  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
460Sstevel@tonic-gate  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
470Sstevel@tonic-gate  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
480Sstevel@tonic-gate  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
490Sstevel@tonic-gate  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
500Sstevel@tonic-gate  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
510Sstevel@tonic-gate  * SUCH DAMAGE.
520Sstevel@tonic-gate  *
530Sstevel@tonic-gate  * The licence and distribution terms for any publically available version or
540Sstevel@tonic-gate  * derivative of this code cannot be changed.  i.e. this code cannot simply be
550Sstevel@tonic-gate  * copied and put under another distribution licence
560Sstevel@tonic-gate  * [including the GNU Public Licence.]
570Sstevel@tonic-gate  */
580Sstevel@tonic-gate /* ====================================================================
590Sstevel@tonic-gate  * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
600Sstevel@tonic-gate  *
610Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
620Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
630Sstevel@tonic-gate  * are met:
640Sstevel@tonic-gate  *
650Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
660Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
670Sstevel@tonic-gate  *
680Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
690Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in
700Sstevel@tonic-gate  *    the documentation and/or other materials provided with the
710Sstevel@tonic-gate  *    distribution.
720Sstevel@tonic-gate  *
730Sstevel@tonic-gate  * 3. All advertising materials mentioning features or use of this
740Sstevel@tonic-gate  *    software must display the following acknowledgment:
750Sstevel@tonic-gate  *    "This product includes software developed by the OpenSSL Project
760Sstevel@tonic-gate  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
770Sstevel@tonic-gate  *
780Sstevel@tonic-gate  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
790Sstevel@tonic-gate  *    endorse or promote products derived from this software without
800Sstevel@tonic-gate  *    prior written permission. For written permission, please contact
810Sstevel@tonic-gate  *    openssl-core@openssl.org.
820Sstevel@tonic-gate  *
830Sstevel@tonic-gate  * 5. Products derived from this software may not be called "OpenSSL"
840Sstevel@tonic-gate  *    nor may "OpenSSL" appear in their names without prior written
850Sstevel@tonic-gate  *    permission of the OpenSSL Project.
860Sstevel@tonic-gate  *
870Sstevel@tonic-gate  * 6. Redistributions of any form whatsoever must retain the following
880Sstevel@tonic-gate  *    acknowledgment:
890Sstevel@tonic-gate  *    "This product includes software developed by the OpenSSL Project
900Sstevel@tonic-gate  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
910Sstevel@tonic-gate  *
920Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
930Sstevel@tonic-gate  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
940Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
950Sstevel@tonic-gate  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
960Sstevel@tonic-gate  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
970Sstevel@tonic-gate  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
980Sstevel@tonic-gate  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
990Sstevel@tonic-gate  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1000Sstevel@tonic-gate  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1010Sstevel@tonic-gate  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1020Sstevel@tonic-gate  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
1030Sstevel@tonic-gate  * OF THE POSSIBILITY OF SUCH DAMAGE.
1040Sstevel@tonic-gate  * ====================================================================
1050Sstevel@tonic-gate  *
1060Sstevel@tonic-gate  * This product includes cryptographic software written by Eric Young
1070Sstevel@tonic-gate  * (eay@cryptsoft.com).  This product includes software written by Tim
1080Sstevel@tonic-gate  * Hudson (tjh@cryptsoft.com).
1090Sstevel@tonic-gate  *
1100Sstevel@tonic-gate  */
1110Sstevel@tonic-gate /* ====================================================================
1120Sstevel@tonic-gate  * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
1130Sstevel@tonic-gate  *
1140Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
1150Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
1160Sstevel@tonic-gate  * are met:
1170Sstevel@tonic-gate  *
1180Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
1190Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
1200Sstevel@tonic-gate  *
1210Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
1220Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in
1230Sstevel@tonic-gate  *    the documentation and/or other materials provided with the
1240Sstevel@tonic-gate  *    distribution.
1250Sstevel@tonic-gate  *
1260Sstevel@tonic-gate  * 3. All advertising materials mentioning features or use of this
1270Sstevel@tonic-gate  *    software must display the following acknowledgment:
1280Sstevel@tonic-gate  *    "This product includes software developed by the OpenSSL Project
1290Sstevel@tonic-gate  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
1300Sstevel@tonic-gate  *
1310Sstevel@tonic-gate  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
1320Sstevel@tonic-gate  *    endorse or promote products derived from this software without
1330Sstevel@tonic-gate  *    prior written permission. For written permission, please contact
1340Sstevel@tonic-gate  *    openssl-core@openssl.org.
1350Sstevel@tonic-gate  *
1360Sstevel@tonic-gate  * 5. Products derived from this software may not be called "OpenSSL"
1370Sstevel@tonic-gate  *    nor may "OpenSSL" appear in their names without prior written
1380Sstevel@tonic-gate  *    permission of the OpenSSL Project.
1390Sstevel@tonic-gate  *
1400Sstevel@tonic-gate  * 6. Redistributions of any form whatsoever must retain the following
1410Sstevel@tonic-gate  *    acknowledgment:
1420Sstevel@tonic-gate  *    "This product includes software developed by the OpenSSL Project
1430Sstevel@tonic-gate  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
1440Sstevel@tonic-gate  *
1450Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
1460Sstevel@tonic-gate  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1470Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1480Sstevel@tonic-gate  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
1490Sstevel@tonic-gate  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1500Sstevel@tonic-gate  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1510Sstevel@tonic-gate  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1520Sstevel@tonic-gate  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1530Sstevel@tonic-gate  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1540Sstevel@tonic-gate  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1550Sstevel@tonic-gate  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
1560Sstevel@tonic-gate  * OF THE POSSIBILITY OF SUCH DAMAGE.
1570Sstevel@tonic-gate  * ====================================================================
1580Sstevel@tonic-gate  *
1590Sstevel@tonic-gate  * This product includes cryptographic software written by Eric Young
1600Sstevel@tonic-gate  * (eay@cryptsoft.com).  This product includes software written by Tim
1610Sstevel@tonic-gate  * Hudson (tjh@cryptsoft.com).
1620Sstevel@tonic-gate  *
1630Sstevel@tonic-gate  */
1640Sstevel@tonic-gate 
1650Sstevel@tonic-gate /*
1660Sstevel@tonic-gate  * The portions of this code that are #ifdef CRYPTO_UNLIMITED are
1670Sstevel@tonic-gate  *
168*682Sjp161948  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
1690Sstevel@tonic-gate  * Use is subject to license terms.
1700Sstevel@tonic-gate  *
1710Sstevel@tonic-gate  */
1720Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
1730Sstevel@tonic-gate 
1740Sstevel@tonic-gate #ifndef HEADER_SSL_H
1750Sstevel@tonic-gate #define HEADER_SSL_H
1760Sstevel@tonic-gate 
1770Sstevel@tonic-gate #include <openssl/e_os2.h>
1780Sstevel@tonic-gate 
1790Sstevel@tonic-gate #ifndef OPENSSL_NO_COMP
1800Sstevel@tonic-gate #include <openssl/comp.h>
1810Sstevel@tonic-gate #endif
1820Sstevel@tonic-gate #ifndef OPENSSL_NO_BIO
1830Sstevel@tonic-gate #include <openssl/bio.h>
1840Sstevel@tonic-gate #endif
1850Sstevel@tonic-gate #ifndef OPENSSL_NO_X509
1860Sstevel@tonic-gate #include <openssl/x509.h>
1870Sstevel@tonic-gate #endif
1880Sstevel@tonic-gate #include <openssl/kssl.h>
1890Sstevel@tonic-gate #include <openssl/safestack.h>
1900Sstevel@tonic-gate #include <openssl/symhacks.h>
1910Sstevel@tonic-gate 
1920Sstevel@tonic-gate #ifdef  __cplusplus
1930Sstevel@tonic-gate extern "C" {
1940Sstevel@tonic-gate #endif
1950Sstevel@tonic-gate 
1960Sstevel@tonic-gate /* SSLeay version number for ASN.1 encoding of the session information */
1970Sstevel@tonic-gate /* Version 0 - initial version
1980Sstevel@tonic-gate  * Version 1 - added the optional peer certificate
1990Sstevel@tonic-gate  */
2000Sstevel@tonic-gate #define SSL_SESSION_ASN1_VERSION 0x0001
2010Sstevel@tonic-gate 
2020Sstevel@tonic-gate /* text strings for the ciphers */
2030Sstevel@tonic-gate #define SSL_TXT_NULL_WITH_MD5		SSL2_TXT_NULL_WITH_MD5
2040Sstevel@tonic-gate #define SSL_TXT_RC4_128_WITH_MD5	SSL2_TXT_RC4_128_WITH_MD5
2050Sstevel@tonic-gate #define SSL_TXT_RC4_128_EXPORT40_WITH_MD5 SSL2_TXT_RC4_128_EXPORT40_WITH_MD5
2060Sstevel@tonic-gate #define SSL_TXT_RC2_128_CBC_WITH_MD5	SSL2_TXT_RC2_128_CBC_WITH_MD5
2070Sstevel@tonic-gate #define SSL_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5
2080Sstevel@tonic-gate #define SSL_TXT_IDEA_128_CBC_WITH_MD5	SSL2_TXT_IDEA_128_CBC_WITH_MD5
2090Sstevel@tonic-gate #define SSL_TXT_DES_64_CBC_WITH_MD5	SSL2_TXT_DES_64_CBC_WITH_MD5
2100Sstevel@tonic-gate #define SSL_TXT_DES_64_CBC_WITH_SHA	SSL2_TXT_DES_64_CBC_WITH_SHA
2110Sstevel@tonic-gate #define SSL_TXT_DES_192_EDE3_CBC_WITH_MD5 SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5
2120Sstevel@tonic-gate #define SSL_TXT_DES_192_EDE3_CBC_WITH_SHA SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA
2130Sstevel@tonic-gate 
2140Sstevel@tonic-gate /*    VRS Additional Kerberos5 entries
2150Sstevel@tonic-gate  */
2160Sstevel@tonic-gate #define SSL_TXT_KRB5_DES_64_CBC_SHA   SSL3_TXT_KRB5_DES_64_CBC_SHA
2170Sstevel@tonic-gate #define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA
2180Sstevel@tonic-gate #define SSL_TXT_KRB5_RC4_128_SHA      SSL3_TXT_KRB5_RC4_128_SHA
2190Sstevel@tonic-gate #define SSL_TXT_KRB5_IDEA_128_CBC_SHA SSL3_TXT_KRB5_IDEA_128_CBC_SHA
2200Sstevel@tonic-gate #define SSL_TXT_KRB5_DES_64_CBC_MD5   SSL3_TXT_KRB5_DES_64_CBC_MD5
2210Sstevel@tonic-gate #define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5
2220Sstevel@tonic-gate #define SSL_TXT_KRB5_RC4_128_MD5      SSL3_TXT_KRB5_RC4_128_MD5
2230Sstevel@tonic-gate #define SSL_TXT_KRB5_IDEA_128_CBC_MD5 SSL3_TXT_KRB5_IDEA_128_CBC_MD5
2240Sstevel@tonic-gate 
2250Sstevel@tonic-gate #define SSL_TXT_KRB5_DES_40_CBC_SHA   SSL3_TXT_KRB5_DES_40_CBC_SHA
2260Sstevel@tonic-gate #define SSL_TXT_KRB5_RC2_40_CBC_SHA   SSL3_TXT_KRB5_RC2_40_CBC_SHA
2270Sstevel@tonic-gate #define SSL_TXT_KRB5_RC4_40_SHA	      SSL3_TXT_KRB5_RC4_40_SHA
2280Sstevel@tonic-gate #define SSL_TXT_KRB5_DES_40_CBC_MD5   SSL3_TXT_KRB5_DES_40_CBC_MD5
2290Sstevel@tonic-gate #define SSL_TXT_KRB5_RC2_40_CBC_MD5   SSL3_TXT_KRB5_RC2_40_CBC_MD5
2300Sstevel@tonic-gate #define SSL_TXT_KRB5_RC4_40_MD5	      SSL3_TXT_KRB5_RC4_40_MD5
2310Sstevel@tonic-gate 
2320Sstevel@tonic-gate #define SSL_TXT_KRB5_DES_40_CBC_SHA   SSL3_TXT_KRB5_DES_40_CBC_SHA
2330Sstevel@tonic-gate #define SSL_TXT_KRB5_DES_40_CBC_MD5   SSL3_TXT_KRB5_DES_40_CBC_MD5
2340Sstevel@tonic-gate #define SSL_TXT_KRB5_DES_64_CBC_SHA   SSL3_TXT_KRB5_DES_64_CBC_SHA
2350Sstevel@tonic-gate #define SSL_TXT_KRB5_DES_64_CBC_MD5   SSL3_TXT_KRB5_DES_64_CBC_MD5
2360Sstevel@tonic-gate #define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA
2370Sstevel@tonic-gate #define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5
2380Sstevel@tonic-gate #define SSL_MAX_KRB5_PRINCIPAL_LENGTH  256
2390Sstevel@tonic-gate 
2400Sstevel@tonic-gate #define SSL_MAX_SSL_SESSION_ID_LENGTH		32
2410Sstevel@tonic-gate #define SSL_MAX_SID_CTX_LENGTH			32
2420Sstevel@tonic-gate 
2430Sstevel@tonic-gate #define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES	(512/8)
2440Sstevel@tonic-gate #define SSL_MAX_KEY_ARG_LENGTH			8
2450Sstevel@tonic-gate #define SSL_MAX_MASTER_KEY_LENGTH		48
2460Sstevel@tonic-gate 
2470Sstevel@tonic-gate /* These are used to specify which ciphers to use and not to use */
2480Sstevel@tonic-gate #define SSL_TXT_LOW		"LOW"
2490Sstevel@tonic-gate #define SSL_TXT_MEDIUM		"MEDIUM"
2500Sstevel@tonic-gate #define SSL_TXT_HIGH		"HIGH"
2510Sstevel@tonic-gate #define SSL_TXT_kFZA		"kFZA"
2520Sstevel@tonic-gate #define	SSL_TXT_aFZA		"aFZA"
2530Sstevel@tonic-gate #define SSL_TXT_eFZA		"eFZA"
2540Sstevel@tonic-gate #define SSL_TXT_FZA		"FZA"
2550Sstevel@tonic-gate 
2560Sstevel@tonic-gate #define	SSL_TXT_aNULL		"aNULL"
2570Sstevel@tonic-gate #define	SSL_TXT_eNULL		"eNULL"
2580Sstevel@tonic-gate #define	SSL_TXT_NULL		"NULL"
2590Sstevel@tonic-gate 
2600Sstevel@tonic-gate #define SSL_TXT_kKRB5     	"kKRB5"
2610Sstevel@tonic-gate #define SSL_TXT_aKRB5     	"aKRB5"
2620Sstevel@tonic-gate #define SSL_TXT_KRB5      	"KRB5"
2630Sstevel@tonic-gate 
2640Sstevel@tonic-gate #define SSL_TXT_kRSA		"kRSA"
2650Sstevel@tonic-gate #define SSL_TXT_kDHr		"kDHr"
2660Sstevel@tonic-gate #define SSL_TXT_kDHd		"kDHd"
2670Sstevel@tonic-gate #define SSL_TXT_kEDH		"kEDH"
2680Sstevel@tonic-gate #define	SSL_TXT_aRSA		"aRSA"
2690Sstevel@tonic-gate #define	SSL_TXT_aDSS		"aDSS"
2700Sstevel@tonic-gate #define	SSL_TXT_aDH		"aDH"
2710Sstevel@tonic-gate #define	SSL_TXT_DSS		"DSS"
2720Sstevel@tonic-gate #define SSL_TXT_DH		"DH"
2730Sstevel@tonic-gate #define SSL_TXT_EDH		"EDH"
2740Sstevel@tonic-gate #define SSL_TXT_ADH		"ADH"
2750Sstevel@tonic-gate #define SSL_TXT_RSA		"RSA"
2760Sstevel@tonic-gate #define SSL_TXT_DES		"DES"
2770Sstevel@tonic-gate #define SSL_TXT_3DES		"3DES"
2780Sstevel@tonic-gate #define SSL_TXT_RC4		"RC4"
2790Sstevel@tonic-gate #define SSL_TXT_RC2		"RC2"
2800Sstevel@tonic-gate #define SSL_TXT_IDEA		"IDEA"
2810Sstevel@tonic-gate #define SSL_TXT_AES		"AES"
2820Sstevel@tonic-gate #define SSL_TXT_MD5		"MD5"
2830Sstevel@tonic-gate #define SSL_TXT_SHA1		"SHA1"
2840Sstevel@tonic-gate #define SSL_TXT_SHA		"SHA"
2850Sstevel@tonic-gate #define SSL_TXT_EXP		"EXP"
2860Sstevel@tonic-gate #define SSL_TXT_EXPORT		"EXPORT"
2870Sstevel@tonic-gate #define SSL_TXT_EXP40		"EXPORT40"
2880Sstevel@tonic-gate #define SSL_TXT_EXP56		"EXPORT56"
2890Sstevel@tonic-gate #define SSL_TXT_SSLV2		"SSLv2"
2900Sstevel@tonic-gate #define SSL_TXT_SSLV3		"SSLv3"
2910Sstevel@tonic-gate #define SSL_TXT_TLSV1		"TLSv1"
2920Sstevel@tonic-gate #define SSL_TXT_ALL		"ALL"
2930Sstevel@tonic-gate 
2940Sstevel@tonic-gate /*
2950Sstevel@tonic-gate  * COMPLEMENTOF* definitions. These identifiers are used to (de-select)
2960Sstevel@tonic-gate  * ciphers normally not being used.
2970Sstevel@tonic-gate  * Example: "RC4" will activate all ciphers using RC4 including ciphers
2980Sstevel@tonic-gate  * without authentication, which would normally disabled by DEFAULT (due
2990Sstevel@tonic-gate  * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT"
3000Sstevel@tonic-gate  * will make sure that it is also disabled in the specific selection.
3010Sstevel@tonic-gate  * COMPLEMENTOF* identifiers are portable between version, as adjustments
3020Sstevel@tonic-gate  * to the default cipher setup will also be included here.
3030Sstevel@tonic-gate  *
3040Sstevel@tonic-gate  * COMPLEMENTOFDEFAULT does not experience the same special treatment that
3050Sstevel@tonic-gate  * DEFAULT gets, as only selection is being done and no sorting as needed
3060Sstevel@tonic-gate  * for DEFAULT.
3070Sstevel@tonic-gate  */
3080Sstevel@tonic-gate #define SSL_TXT_CMPALL		"COMPLEMENTOFALL"
3090Sstevel@tonic-gate #define SSL_TXT_CMPDEF		"COMPLEMENTOFDEFAULT"
3100Sstevel@tonic-gate 
3110Sstevel@tonic-gate /* The following cipher list is used by default.
3120Sstevel@tonic-gate  * It also is substituted when an application-defined cipher list string
3130Sstevel@tonic-gate  * starts with 'DEFAULT'. */
3140Sstevel@tonic-gate #ifdef CRYPTO_UNLIMITED
3150Sstevel@tonic-gate #define SSL_DEFAULT_CIPHER_LIST	"ALL:!ADH:+RC4:@STRENGTH" /* low priority for RC4 */
3160Sstevel@tonic-gate #else
3170Sstevel@tonic-gate #define SSL_DEFAULT_CIPHER_LIST	"ALL:!DHE-RSA-AES256-SHA:!DHE-DSS-AES256-SHA:!AES256-SHA:!ADH:+RC4:@STRENGTH" /* low priority for RC4 */
3180Sstevel@tonic-gate #endif /* CRYPTO_UNLIMITED */
3190Sstevel@tonic-gate 
3200Sstevel@tonic-gate /* Used in SSL_set_shutdown()/SSL_get_shutdown(); */
3210Sstevel@tonic-gate #define SSL_SENT_SHUTDOWN	1
3220Sstevel@tonic-gate #define SSL_RECEIVED_SHUTDOWN	2
3230Sstevel@tonic-gate 
3240Sstevel@tonic-gate #ifdef __cplusplus
3250Sstevel@tonic-gate }
3260Sstevel@tonic-gate #endif
3270Sstevel@tonic-gate 
3280Sstevel@tonic-gate #include <openssl/crypto.h>
3290Sstevel@tonic-gate #include <openssl/lhash.h>
3300Sstevel@tonic-gate #include <openssl/buffer.h>
3310Sstevel@tonic-gate #include <openssl/pem.h>
3320Sstevel@tonic-gate 
3330Sstevel@tonic-gate #ifdef  __cplusplus
3340Sstevel@tonic-gate extern "C" {
3350Sstevel@tonic-gate #endif
3360Sstevel@tonic-gate 
3370Sstevel@tonic-gate #if (defined(OPENSSL_NO_RSA) || defined(OPENSSL_NO_MD5)) && !defined(OPENSSL_NO_SSL2)
3380Sstevel@tonic-gate #define OPENSSL_NO_SSL2
3390Sstevel@tonic-gate #endif
3400Sstevel@tonic-gate 
3410Sstevel@tonic-gate #define SSL_FILETYPE_ASN1	X509_FILETYPE_ASN1
3420Sstevel@tonic-gate #define SSL_FILETYPE_PEM	X509_FILETYPE_PEM
3430Sstevel@tonic-gate 
3440Sstevel@tonic-gate /* This is needed to stop compilers complaining about the
3450Sstevel@tonic-gate  * 'struct ssl_st *' function parameters used to prototype callbacks
3460Sstevel@tonic-gate  * in SSL_CTX. */
3470Sstevel@tonic-gate typedef struct ssl_st *ssl_crock_st;
3480Sstevel@tonic-gate 
3490Sstevel@tonic-gate /* used to hold info on the particular ciphers used */
3500Sstevel@tonic-gate typedef struct ssl_cipher_st
3510Sstevel@tonic-gate 	{
3520Sstevel@tonic-gate 	int valid;
3530Sstevel@tonic-gate 	const char *name;		/* text name */
3540Sstevel@tonic-gate 	unsigned long id;		/* id, 4 bytes, first is version */
3550Sstevel@tonic-gate 	unsigned long algorithms;	/* what ciphers are used */
3560Sstevel@tonic-gate 	unsigned long algo_strength;	/* strength and export flags */
3570Sstevel@tonic-gate 	unsigned long algorithm2;	/* Extra flags */
3580Sstevel@tonic-gate 	int strength_bits;		/* Number of bits really used */
3590Sstevel@tonic-gate 	int alg_bits;			/* Number of bits for algorithm */
3600Sstevel@tonic-gate 	unsigned long mask;		/* used for matching */
3610Sstevel@tonic-gate 	unsigned long mask_strength;	/* also used for matching */
3620Sstevel@tonic-gate 	} SSL_CIPHER;
3630Sstevel@tonic-gate 
3640Sstevel@tonic-gate DECLARE_STACK_OF(SSL_CIPHER)
3650Sstevel@tonic-gate 
3660Sstevel@tonic-gate typedef struct ssl_st SSL;
3670Sstevel@tonic-gate typedef struct ssl_ctx_st SSL_CTX;
3680Sstevel@tonic-gate 
3690Sstevel@tonic-gate /* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */
3700Sstevel@tonic-gate typedef struct ssl_method_st
3710Sstevel@tonic-gate 	{
3720Sstevel@tonic-gate 	int version;
3730Sstevel@tonic-gate 	int (*ssl_new)(SSL *s);
3740Sstevel@tonic-gate 	void (*ssl_clear)(SSL *s);
3750Sstevel@tonic-gate 	void (*ssl_free)(SSL *s);
3760Sstevel@tonic-gate 	int (*ssl_accept)(SSL *s);
3770Sstevel@tonic-gate 	int (*ssl_connect)(SSL *s);
3780Sstevel@tonic-gate 	int (*ssl_read)(SSL *s,void *buf,int len);
3790Sstevel@tonic-gate 	int (*ssl_peek)(SSL *s,void *buf,int len);
3800Sstevel@tonic-gate 	int (*ssl_write)(SSL *s,const void *buf,int len);
3810Sstevel@tonic-gate 	int (*ssl_shutdown)(SSL *s);
3820Sstevel@tonic-gate 	int (*ssl_renegotiate)(SSL *s);
3830Sstevel@tonic-gate 	int (*ssl_renegotiate_check)(SSL *s);
3840Sstevel@tonic-gate 	long (*ssl_ctrl)(SSL *s,int cmd,long larg,void *parg);
3850Sstevel@tonic-gate 	long (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg);
3860Sstevel@tonic-gate 	SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);
3870Sstevel@tonic-gate 	int (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr);
3880Sstevel@tonic-gate 	int (*ssl_pending)(SSL *s);
3890Sstevel@tonic-gate 	int (*num_ciphers)(void);
3900Sstevel@tonic-gate 	SSL_CIPHER *(*get_cipher)(unsigned ncipher);
3910Sstevel@tonic-gate 	struct ssl_method_st *(*get_ssl_method)(int version);
3920Sstevel@tonic-gate 	long (*get_timeout)(void);
3930Sstevel@tonic-gate 	struct ssl3_enc_method *ssl3_enc; /* Extra SSLv3/TLS stuff */
3940Sstevel@tonic-gate 	int (*ssl_version)();
3950Sstevel@tonic-gate 	long (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)());
3960Sstevel@tonic-gate 	long (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)());
3970Sstevel@tonic-gate 	} SSL_METHOD;
3980Sstevel@tonic-gate 
3990Sstevel@tonic-gate /* Lets make this into an ASN.1 type structure as follows
4000Sstevel@tonic-gate  * SSL_SESSION_ID ::= SEQUENCE {
4010Sstevel@tonic-gate  *	version 		INTEGER,	-- structure version number
4020Sstevel@tonic-gate  *	SSLversion 		INTEGER,	-- SSL version number
4030Sstevel@tonic-gate  *	Cipher 			OCTET_STRING,	-- the 3 byte cipher ID
4040Sstevel@tonic-gate  *	Session_ID 		OCTET_STRING,	-- the Session ID
4050Sstevel@tonic-gate  *	Master_key 		OCTET_STRING,	-- the master key
4060Sstevel@tonic-gate  *	KRB5_principal		OCTET_STRING	-- optional Kerberos principal
4070Sstevel@tonic-gate  *	Key_Arg [ 0 ] IMPLICIT	OCTET_STRING,	-- the optional Key argument
4080Sstevel@tonic-gate  *	Time [ 1 ] EXPLICIT	INTEGER,	-- optional Start Time
4090Sstevel@tonic-gate  *	Timeout [ 2 ] EXPLICIT	INTEGER,	-- optional Timeout ins seconds
4100Sstevel@tonic-gate  *	Peer [ 3 ] EXPLICIT	X509,		-- optional Peer Certificate
4110Sstevel@tonic-gate  *	Session_ID_context [ 4 ] EXPLICIT OCTET_STRING,   -- the Session ID context
4120Sstevel@tonic-gate  *	Verify_result [ 5 ] EXPLICIT INTEGER    -- X509_V_... code for `Peer'
4130Sstevel@tonic-gate  *	Compression [6] IMPLICIT ASN1_OBJECT	-- compression OID XXXXX
4140Sstevel@tonic-gate  *	}
4150Sstevel@tonic-gate  * Look in ssl/ssl_asn1.c for more details
4160Sstevel@tonic-gate  * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-).
4170Sstevel@tonic-gate  */
4180Sstevel@tonic-gate typedef struct ssl_session_st
4190Sstevel@tonic-gate 	{
4200Sstevel@tonic-gate 	int ssl_version;	/* what ssl version session info is
4210Sstevel@tonic-gate 				 * being kept in here? */
4220Sstevel@tonic-gate 
4230Sstevel@tonic-gate 	/* only really used in SSLv2 */
4240Sstevel@tonic-gate 	unsigned int key_arg_length;
4250Sstevel@tonic-gate 	unsigned char key_arg[SSL_MAX_KEY_ARG_LENGTH];
4260Sstevel@tonic-gate 	int master_key_length;
4270Sstevel@tonic-gate 	unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH];
4280Sstevel@tonic-gate 	/* session_id - valid? */
4290Sstevel@tonic-gate 	unsigned int session_id_length;
4300Sstevel@tonic-gate 	unsigned char session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];
4310Sstevel@tonic-gate 	/* this is used to determine whether the session is being reused in
4320Sstevel@tonic-gate 	 * the appropriate context. It is up to the application to set this,
4330Sstevel@tonic-gate 	 * via SSL_new */
4340Sstevel@tonic-gate 	unsigned int sid_ctx_length;
4350Sstevel@tonic-gate 	unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
4360Sstevel@tonic-gate 
4370Sstevel@tonic-gate #ifndef OPENSSL_NO_KRB5
4380Sstevel@tonic-gate         unsigned int krb5_client_princ_len;
4390Sstevel@tonic-gate         unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH];
4400Sstevel@tonic-gate #endif /* OPENSSL_NO_KRB5 */
4410Sstevel@tonic-gate 
4420Sstevel@tonic-gate 	int not_resumable;
4430Sstevel@tonic-gate 
4440Sstevel@tonic-gate 	/* The cert is the certificate used to establish this connection */
4450Sstevel@tonic-gate 	struct sess_cert_st /* SESS_CERT */ *sess_cert;
4460Sstevel@tonic-gate 
4470Sstevel@tonic-gate 	/* This is the cert for the other end.
4480Sstevel@tonic-gate 	 * On clients, it will be the same as sess_cert->peer_key->x509
4490Sstevel@tonic-gate 	 * (the latter is not enough as sess_cert is not retained
4500Sstevel@tonic-gate 	 * in the external representation of sessions, see ssl_asn1.c). */
4510Sstevel@tonic-gate 	X509 *peer;
4520Sstevel@tonic-gate 	/* when app_verify_callback accepts a session where the peer's certificate
4530Sstevel@tonic-gate 	 * is not ok, we must remember the error for session reuse: */
4540Sstevel@tonic-gate 	long verify_result; /* only for servers */
4550Sstevel@tonic-gate 
4560Sstevel@tonic-gate 	int references;
4570Sstevel@tonic-gate 	long timeout;
4580Sstevel@tonic-gate 	long time;
4590Sstevel@tonic-gate 
4600Sstevel@tonic-gate 	int compress_meth;		/* Need to lookup the method */
4610Sstevel@tonic-gate 
4620Sstevel@tonic-gate 	SSL_CIPHER *cipher;
4630Sstevel@tonic-gate 	unsigned long cipher_id;	/* when ASN.1 loaded, this
4640Sstevel@tonic-gate 					 * needs to be used to load
4650Sstevel@tonic-gate 					 * the 'cipher' structure */
4660Sstevel@tonic-gate 
4670Sstevel@tonic-gate 	STACK_OF(SSL_CIPHER) *ciphers; /* shared ciphers? */
4680Sstevel@tonic-gate 
4690Sstevel@tonic-gate 	CRYPTO_EX_DATA ex_data; /* application specific data */
4700Sstevel@tonic-gate 
4710Sstevel@tonic-gate 	/* These are used to make removal of session-ids more
4720Sstevel@tonic-gate 	 * efficient and to implement a maximum cache size. */
4730Sstevel@tonic-gate 	struct ssl_session_st *prev,*next;
4740Sstevel@tonic-gate 	} SSL_SESSION;
4750Sstevel@tonic-gate 
4760Sstevel@tonic-gate 
4770Sstevel@tonic-gate #define SSL_OP_MICROSOFT_SESS_ID_BUG			0x00000001L
4780Sstevel@tonic-gate #define SSL_OP_NETSCAPE_CHALLENGE_BUG			0x00000002L
4790Sstevel@tonic-gate #define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG		0x00000008L
4800Sstevel@tonic-gate #define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG		0x00000010L
4810Sstevel@tonic-gate #define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER		0x00000020L
482*682Sjp161948 #define SSL_OP_MSIE_SSLV2_RSA_PADDING			0x00000040L /* no effect since 0.9.7h and 0.9.8b */
4830Sstevel@tonic-gate #define SSL_OP_SSLEAY_080_CLIENT_DH_BUG			0x00000080L
4840Sstevel@tonic-gate #define SSL_OP_TLS_D5_BUG				0x00000100L
4850Sstevel@tonic-gate #define SSL_OP_TLS_BLOCK_PADDING_BUG			0x00000200L
4860Sstevel@tonic-gate 
4870Sstevel@tonic-gate /* Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added
4880Sstevel@tonic-gate  * in OpenSSL 0.9.6d.  Usually (depending on the application protocol)
4890Sstevel@tonic-gate  * the workaround is not needed.  Unfortunately some broken SSL/TLS
4900Sstevel@tonic-gate  * implementations cannot handle it at all, which is why we include
4910Sstevel@tonic-gate  * it in SSL_OP_ALL. */
4920Sstevel@tonic-gate #define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS              0x00000800L /* added in 0.9.6e */
4930Sstevel@tonic-gate 
4940Sstevel@tonic-gate /* SSL_OP_ALL: various bug workarounds that should be rather harmless.
4950Sstevel@tonic-gate  *             This used to be 0x000FFFFFL before 0.9.7. */
4960Sstevel@tonic-gate #define SSL_OP_ALL					0x00000FFFL
4970Sstevel@tonic-gate 
4980Sstevel@tonic-gate /* As server, disallow session resumption on renegotiation */
4990Sstevel@tonic-gate #define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION	0x00010000L
5000Sstevel@tonic-gate /* If set, always create a new key when using tmp_dh parameters */
5010Sstevel@tonic-gate #define SSL_OP_SINGLE_DH_USE				0x00100000L
5020Sstevel@tonic-gate /* Set to always use the tmp_rsa key when doing RSA operations,
5030Sstevel@tonic-gate  * even when this violates protocol specs */
5040Sstevel@tonic-gate #define SSL_OP_EPHEMERAL_RSA				0x00200000L
5050Sstevel@tonic-gate /* Set on servers to choose the cipher according to the server's
5060Sstevel@tonic-gate  * preferences */
5070Sstevel@tonic-gate #define SSL_OP_CIPHER_SERVER_PREFERENCE			0x00400000L
5080Sstevel@tonic-gate /* If set, a server will allow a client to issue a SSLv3.0 version number
5090Sstevel@tonic-gate  * as latest version supported in the premaster secret, even when TLSv1.0
5100Sstevel@tonic-gate  * (version 3.1) was announced in the client hello. Normally this is
5110Sstevel@tonic-gate  * forbidden to prevent version rollback attacks. */
5120Sstevel@tonic-gate #define SSL_OP_TLS_ROLLBACK_BUG				0x00800000L
5130Sstevel@tonic-gate 
5140Sstevel@tonic-gate #define SSL_OP_NO_SSLv2					0x01000000L
5150Sstevel@tonic-gate #define SSL_OP_NO_SSLv3					0x02000000L
5160Sstevel@tonic-gate #define SSL_OP_NO_TLSv1					0x04000000L
5170Sstevel@tonic-gate 
5180Sstevel@tonic-gate /* The next flag deliberately changes the ciphertest, this is a check
5190Sstevel@tonic-gate  * for the PKCS#1 attack */
5200Sstevel@tonic-gate #define SSL_OP_PKCS1_CHECK_1				0x08000000L
5210Sstevel@tonic-gate #define SSL_OP_PKCS1_CHECK_2				0x10000000L
5220Sstevel@tonic-gate #define SSL_OP_NETSCAPE_CA_DN_BUG			0x20000000L
5230Sstevel@tonic-gate #define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG		0x40000000L
5240Sstevel@tonic-gate 
5250Sstevel@tonic-gate 
5260Sstevel@tonic-gate /* Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success
5270Sstevel@tonic-gate  * when just a single record has been written): */
5280Sstevel@tonic-gate #define SSL_MODE_ENABLE_PARTIAL_WRITE       0x00000001L
5290Sstevel@tonic-gate /* Make it possible to retry SSL_write() with changed buffer location
5300Sstevel@tonic-gate  * (buffer contents must stay the same!); this is not the default to avoid
5310Sstevel@tonic-gate  * the misconception that non-blocking SSL_write() behaves like
5320Sstevel@tonic-gate  * non-blocking write(): */
5330Sstevel@tonic-gate #define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002L
5340Sstevel@tonic-gate /* Never bother the application with retries if the transport
5350Sstevel@tonic-gate  * is blocking: */
5360Sstevel@tonic-gate #define SSL_MODE_AUTO_RETRY 0x00000004L
5370Sstevel@tonic-gate /* Don't attempt to automatically build certificate chain */
5380Sstevel@tonic-gate #define SSL_MODE_NO_AUTO_CHAIN 0x00000008L
5390Sstevel@tonic-gate 
5400Sstevel@tonic-gate 
5410Sstevel@tonic-gate /* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value,
5420Sstevel@tonic-gate  * they cannot be used to clear bits. */
5430Sstevel@tonic-gate 
5440Sstevel@tonic-gate #define SSL_CTX_set_options(ctx,op) \
5450Sstevel@tonic-gate 	SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,(op),NULL)
5460Sstevel@tonic-gate #define SSL_CTX_get_options(ctx) \
5470Sstevel@tonic-gate 	SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,0,NULL)
5480Sstevel@tonic-gate #define SSL_set_options(ssl,op) \
5490Sstevel@tonic-gate 	SSL_ctrl((ssl),SSL_CTRL_OPTIONS,(op),NULL)
5500Sstevel@tonic-gate #define SSL_get_options(ssl) \
5510Sstevel@tonic-gate         SSL_ctrl((ssl),SSL_CTRL_OPTIONS,0,NULL)
5520Sstevel@tonic-gate 
5530Sstevel@tonic-gate #define SSL_CTX_set_mode(ctx,op) \
5540Sstevel@tonic-gate 	SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL)
5550Sstevel@tonic-gate #define SSL_CTX_get_mode(ctx) \
5560Sstevel@tonic-gate 	SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL)
5570Sstevel@tonic-gate #define SSL_set_mode(ssl,op) \
5580Sstevel@tonic-gate 	SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL)
5590Sstevel@tonic-gate #define SSL_get_mode(ssl) \
5600Sstevel@tonic-gate         SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL)
5610Sstevel@tonic-gate 
5620Sstevel@tonic-gate 
5630Sstevel@tonic-gate void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg));
5640Sstevel@tonic-gate void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg));
5650Sstevel@tonic-gate #define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))
5660Sstevel@tonic-gate #define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))
5670Sstevel@tonic-gate 
5680Sstevel@tonic-gate 
5690Sstevel@tonic-gate 
5700Sstevel@tonic-gate #if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32)
5710Sstevel@tonic-gate #define SSL_MAX_CERT_LIST_DEFAULT 1024*30 /* 30k max cert list :-) */
5720Sstevel@tonic-gate #else
5730Sstevel@tonic-gate #define SSL_MAX_CERT_LIST_DEFAULT 1024*100 /* 100k max cert list :-) */
5740Sstevel@tonic-gate #endif
5750Sstevel@tonic-gate 
5760Sstevel@tonic-gate #define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT	(1024*20)
5770Sstevel@tonic-gate 
5780Sstevel@tonic-gate /* This callback type is used inside SSL_CTX, SSL, and in the functions that set
5790Sstevel@tonic-gate  * them. It is used to override the generation of SSL/TLS session IDs in a
5800Sstevel@tonic-gate  * server. Return value should be zero on an error, non-zero to proceed. Also,
5810Sstevel@tonic-gate  * callbacks should themselves check if the id they generate is unique otherwise
5820Sstevel@tonic-gate  * the SSL handshake will fail with an error - callbacks can do this using the
5830Sstevel@tonic-gate  * 'ssl' value they're passed by;
5840Sstevel@tonic-gate  *      SSL_has_matching_session_id(ssl, id, *id_len)
5850Sstevel@tonic-gate  * The length value passed in is set at the maximum size the session ID can be.
5860Sstevel@tonic-gate  * In SSLv2 this is 16 bytes, whereas SSLv3/TLSv1 it is 32 bytes. The callback
5870Sstevel@tonic-gate  * can alter this length to be less if desired, but under SSLv2 session IDs are
5880Sstevel@tonic-gate  * supposed to be fixed at 16 bytes so the id will be padded after the callback
5890Sstevel@tonic-gate  * returns in this case. It is also an error for the callback to set the size to
5900Sstevel@tonic-gate  * zero. */
5910Sstevel@tonic-gate typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id,
5920Sstevel@tonic-gate 				unsigned int *id_len);
5930Sstevel@tonic-gate 
5940Sstevel@tonic-gate typedef struct ssl_comp_st
5950Sstevel@tonic-gate 	{
5960Sstevel@tonic-gate 	int id;
5970Sstevel@tonic-gate 	char *name;
5980Sstevel@tonic-gate #ifndef OPENSSL_NO_COMP
5990Sstevel@tonic-gate 	COMP_METHOD *method;
6000Sstevel@tonic-gate #else
6010Sstevel@tonic-gate 	char *method;
6020Sstevel@tonic-gate #endif
6030Sstevel@tonic-gate 	} SSL_COMP;
6040Sstevel@tonic-gate 
6050Sstevel@tonic-gate DECLARE_STACK_OF(SSL_COMP)
6060Sstevel@tonic-gate 
6070Sstevel@tonic-gate struct ssl_ctx_st
6080Sstevel@tonic-gate 	{
6090Sstevel@tonic-gate 	SSL_METHOD *method;
6100Sstevel@tonic-gate 
6110Sstevel@tonic-gate 	STACK_OF(SSL_CIPHER) *cipher_list;
6120Sstevel@tonic-gate 	/* same as above but sorted for lookup */
6130Sstevel@tonic-gate 	STACK_OF(SSL_CIPHER) *cipher_list_by_id;
6140Sstevel@tonic-gate 
6150Sstevel@tonic-gate 	struct x509_store_st /* X509_STORE */ *cert_store;
6160Sstevel@tonic-gate 	struct lhash_st /* LHASH */ *sessions;	/* a set of SSL_SESSIONs */
6170Sstevel@tonic-gate 	/* Most session-ids that will be cached, default is
6180Sstevel@tonic-gate 	 * SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited. */
6190Sstevel@tonic-gate 	unsigned long session_cache_size;
6200Sstevel@tonic-gate 	struct ssl_session_st *session_cache_head;
6210Sstevel@tonic-gate 	struct ssl_session_st *session_cache_tail;
6220Sstevel@tonic-gate 
6230Sstevel@tonic-gate 	/* This can have one of 2 values, ored together,
6240Sstevel@tonic-gate 	 * SSL_SESS_CACHE_CLIENT,
6250Sstevel@tonic-gate 	 * SSL_SESS_CACHE_SERVER,
6260Sstevel@tonic-gate 	 * Default is SSL_SESSION_CACHE_SERVER, which means only
6270Sstevel@tonic-gate 	 * SSL_accept which cache SSL_SESSIONS. */
6280Sstevel@tonic-gate 	int session_cache_mode;
6290Sstevel@tonic-gate 
6300Sstevel@tonic-gate 	/* If timeout is not 0, it is the default timeout value set
6310Sstevel@tonic-gate 	 * when SSL_new() is called.  This has been put in to make
6320Sstevel@tonic-gate 	 * life easier to set things up */
6330Sstevel@tonic-gate 	long session_timeout;
6340Sstevel@tonic-gate 
6350Sstevel@tonic-gate 	/* If this callback is not null, it will be called each
6360Sstevel@tonic-gate 	 * time a session id is added to the cache.  If this function
6370Sstevel@tonic-gate 	 * returns 1, it means that the callback will do a
6380Sstevel@tonic-gate 	 * SSL_SESSION_free() when it has finished using it.  Otherwise,
6390Sstevel@tonic-gate 	 * on 0, it means the callback has finished with it.
6400Sstevel@tonic-gate 	 * If remove_session_cb is not null, it will be called when
6410Sstevel@tonic-gate 	 * a session-id is removed from the cache.  After the call,
6420Sstevel@tonic-gate 	 * OpenSSL will SSL_SESSION_free() it. */
6430Sstevel@tonic-gate 	int (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess);
6440Sstevel@tonic-gate 	void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess);
6450Sstevel@tonic-gate 	SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl,
6460Sstevel@tonic-gate 		unsigned char *data,int len,int *copy);
6470Sstevel@tonic-gate 
6480Sstevel@tonic-gate 	struct
6490Sstevel@tonic-gate 		{
6500Sstevel@tonic-gate 		int sess_connect;	/* SSL new conn - started */
6510Sstevel@tonic-gate 		int sess_connect_renegotiate;/* SSL reneg - requested */
6520Sstevel@tonic-gate 		int sess_connect_good;	/* SSL new conne/reneg - finished */
6530Sstevel@tonic-gate 		int sess_accept;	/* SSL new accept - started */
6540Sstevel@tonic-gate 		int sess_accept_renegotiate;/* SSL reneg - requested */
6550Sstevel@tonic-gate 		int sess_accept_good;	/* SSL accept/reneg - finished */
6560Sstevel@tonic-gate 		int sess_miss;		/* session lookup misses  */
6570Sstevel@tonic-gate 		int sess_timeout;	/* reuse attempt on timeouted session */
6580Sstevel@tonic-gate 		int sess_cache_full;	/* session removed due to full cache */
6590Sstevel@tonic-gate 		int sess_hit;		/* session reuse actually done */
6600Sstevel@tonic-gate 		int sess_cb_hit;	/* session-id that was not
6610Sstevel@tonic-gate 					 * in the cache was
6620Sstevel@tonic-gate 					 * passed back via the callback.  This
6630Sstevel@tonic-gate 					 * indicates that the application is
6640Sstevel@tonic-gate 					 * supplying session-id's from other
6650Sstevel@tonic-gate 					 * processes - spooky :-) */
6660Sstevel@tonic-gate 		} stats;
6670Sstevel@tonic-gate 
6680Sstevel@tonic-gate 	int references;
6690Sstevel@tonic-gate 
6700Sstevel@tonic-gate 	/* if defined, these override the X509_verify_cert() calls */
6710Sstevel@tonic-gate 	int (*app_verify_callback)(X509_STORE_CTX *, void *);
6720Sstevel@tonic-gate 	void *app_verify_arg;
6730Sstevel@tonic-gate 	/* before OpenSSL 0.9.7, 'app_verify_arg' was ignored
6740Sstevel@tonic-gate 	 * ('app_verify_callback' was called with just one argument) */
6750Sstevel@tonic-gate 
6760Sstevel@tonic-gate 	/* Default password callback. */
6770Sstevel@tonic-gate 	pem_password_cb *default_passwd_callback;
6780Sstevel@tonic-gate 
6790Sstevel@tonic-gate 	/* Default password callback user data. */
6800Sstevel@tonic-gate 	void *default_passwd_callback_userdata;
6810Sstevel@tonic-gate 
6820Sstevel@tonic-gate 	/* get client cert callback */
6830Sstevel@tonic-gate 	int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey);
6840Sstevel@tonic-gate 
6850Sstevel@tonic-gate 	CRYPTO_EX_DATA ex_data;
6860Sstevel@tonic-gate 
6870Sstevel@tonic-gate 	const EVP_MD *rsa_md5;/* For SSLv2 - name is 'ssl2-md5' */
6880Sstevel@tonic-gate 	const EVP_MD *md5;	/* For SSLv3/TLSv1 'ssl3-md5' */
6890Sstevel@tonic-gate 	const EVP_MD *sha1;   /* For SSLv3/TLSv1 'ssl3->sha1' */
6900Sstevel@tonic-gate 
6910Sstevel@tonic-gate 	STACK_OF(X509) *extra_certs;
6920Sstevel@tonic-gate 	STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */
6930Sstevel@tonic-gate 
6940Sstevel@tonic-gate 
6950Sstevel@tonic-gate 	/* Default values used when no per-SSL value is defined follow */
6960Sstevel@tonic-gate 
6970Sstevel@tonic-gate 	void (*info_callback)(const SSL *ssl,int type,int val); /* used if SSL's info_callback is NULL */
6980Sstevel@tonic-gate 
6990Sstevel@tonic-gate 	/* what we put in client cert requests */
7000Sstevel@tonic-gate 	STACK_OF(X509_NAME) *client_CA;
7010Sstevel@tonic-gate 
7020Sstevel@tonic-gate 
7030Sstevel@tonic-gate 	/* Default values to use in SSL structures follow (these are copied by SSL_new) */
7040Sstevel@tonic-gate 
7050Sstevel@tonic-gate 	unsigned long options;
7060Sstevel@tonic-gate 	unsigned long mode;
7070Sstevel@tonic-gate 	long max_cert_list;
7080Sstevel@tonic-gate 
7090Sstevel@tonic-gate 	struct cert_st /* CERT */ *cert;
7100Sstevel@tonic-gate 	int read_ahead;
7110Sstevel@tonic-gate 
7120Sstevel@tonic-gate 	/* callback that allows applications to peek at protocol messages */
7130Sstevel@tonic-gate 	void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);
7140Sstevel@tonic-gate 	void *msg_callback_arg;
7150Sstevel@tonic-gate 
7160Sstevel@tonic-gate 	int verify_mode;
7170Sstevel@tonic-gate 	int verify_depth;
7180Sstevel@tonic-gate 	unsigned int sid_ctx_length;
7190Sstevel@tonic-gate 	unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
7200Sstevel@tonic-gate 	int (*default_verify_callback)(int ok,X509_STORE_CTX *ctx); /* called 'verify_callback' in the SSL */
7210Sstevel@tonic-gate 
7220Sstevel@tonic-gate 	/* Default generate session ID callback. */
7230Sstevel@tonic-gate 	GEN_SESSION_CB generate_session_id;
7240Sstevel@tonic-gate 
7250Sstevel@tonic-gate 	int purpose;		/* Purpose setting */
7260Sstevel@tonic-gate 	int trust;		/* Trust setting */
7270Sstevel@tonic-gate 
7280Sstevel@tonic-gate 	int quiet_shutdown;
7290Sstevel@tonic-gate 	};
7300Sstevel@tonic-gate 
7310Sstevel@tonic-gate #define SSL_SESS_CACHE_OFF			0x0000
7320Sstevel@tonic-gate #define SSL_SESS_CACHE_CLIENT			0x0001
7330Sstevel@tonic-gate #define SSL_SESS_CACHE_SERVER			0x0002
7340Sstevel@tonic-gate #define SSL_SESS_CACHE_BOTH	(SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER)
7350Sstevel@tonic-gate #define SSL_SESS_CACHE_NO_AUTO_CLEAR		0x0080
7360Sstevel@tonic-gate /* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */
7370Sstevel@tonic-gate #define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP	0x0100
7380Sstevel@tonic-gate #define SSL_SESS_CACHE_NO_INTERNAL_STORE	0x0200
7390Sstevel@tonic-gate #define SSL_SESS_CACHE_NO_INTERNAL \
7400Sstevel@tonic-gate 	(SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE)
7410Sstevel@tonic-gate 
7420Sstevel@tonic-gate   struct lhash_st *SSL_CTX_sessions(SSL_CTX *ctx);
7430Sstevel@tonic-gate #define SSL_CTX_sess_number(ctx) \
7440Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL)
7450Sstevel@tonic-gate #define SSL_CTX_sess_connect(ctx) \
7460Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL)
7470Sstevel@tonic-gate #define SSL_CTX_sess_connect_good(ctx) \
7480Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL)
7490Sstevel@tonic-gate #define SSL_CTX_sess_connect_renegotiate(ctx) \
7500Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL)
7510Sstevel@tonic-gate #define SSL_CTX_sess_accept(ctx) \
7520Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL)
7530Sstevel@tonic-gate #define SSL_CTX_sess_accept_renegotiate(ctx) \
7540Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL)
7550Sstevel@tonic-gate #define SSL_CTX_sess_accept_good(ctx) \
7560Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL)
7570Sstevel@tonic-gate #define SSL_CTX_sess_hits(ctx) \
7580Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL)
7590Sstevel@tonic-gate #define SSL_CTX_sess_cb_hits(ctx) \
7600Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL)
7610Sstevel@tonic-gate #define SSL_CTX_sess_misses(ctx) \
7620Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL)
7630Sstevel@tonic-gate #define SSL_CTX_sess_timeouts(ctx) \
7640Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL)
7650Sstevel@tonic-gate #define SSL_CTX_sess_cache_full(ctx) \
7660Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL)
7670Sstevel@tonic-gate 
7680Sstevel@tonic-gate #define SSL_CTX_sess_set_new_cb(ctx,cb)	((ctx)->new_session_cb=(cb))
7690Sstevel@tonic-gate #define SSL_CTX_sess_get_new_cb(ctx)	((ctx)->new_session_cb)
7700Sstevel@tonic-gate #define SSL_CTX_sess_set_remove_cb(ctx,cb)	((ctx)->remove_session_cb=(cb))
7710Sstevel@tonic-gate #define SSL_CTX_sess_get_remove_cb(ctx)	((ctx)->remove_session_cb)
7720Sstevel@tonic-gate #define SSL_CTX_sess_set_get_cb(ctx,cb)	((ctx)->get_session_cb=(cb))
7730Sstevel@tonic-gate #define SSL_CTX_sess_get_get_cb(ctx)	((ctx)->get_session_cb)
7740Sstevel@tonic-gate #define SSL_CTX_set_info_callback(ctx,cb)	((ctx)->info_callback=(cb))
7750Sstevel@tonic-gate #define SSL_CTX_get_info_callback(ctx)		((ctx)->info_callback)
7760Sstevel@tonic-gate #define SSL_CTX_set_client_cert_cb(ctx,cb)	((ctx)->client_cert_cb=(cb))
7770Sstevel@tonic-gate #define SSL_CTX_get_client_cert_cb(ctx)		((ctx)->client_cert_cb)
7780Sstevel@tonic-gate 
7790Sstevel@tonic-gate #define SSL_NOTHING	1
7800Sstevel@tonic-gate #define SSL_WRITING	2
7810Sstevel@tonic-gate #define SSL_READING	3
7820Sstevel@tonic-gate #define SSL_X509_LOOKUP	4
7830Sstevel@tonic-gate 
7840Sstevel@tonic-gate /* These will only be used when doing non-blocking IO */
7850Sstevel@tonic-gate #define SSL_want_nothing(s)	(SSL_want(s) == SSL_NOTHING)
7860Sstevel@tonic-gate #define SSL_want_read(s)	(SSL_want(s) == SSL_READING)
7870Sstevel@tonic-gate #define SSL_want_write(s)	(SSL_want(s) == SSL_WRITING)
7880Sstevel@tonic-gate #define SSL_want_x509_lookup(s)	(SSL_want(s) == SSL_X509_LOOKUP)
7890Sstevel@tonic-gate 
7900Sstevel@tonic-gate struct ssl_st
7910Sstevel@tonic-gate 	{
7920Sstevel@tonic-gate 	/* protocol version
7930Sstevel@tonic-gate 	 * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION)
7940Sstevel@tonic-gate 	 */
7950Sstevel@tonic-gate 	int version;
7960Sstevel@tonic-gate 	int type; /* SSL_ST_CONNECT or SSL_ST_ACCEPT */
7970Sstevel@tonic-gate 
7980Sstevel@tonic-gate 	SSL_METHOD *method; /* SSLv3 */
7990Sstevel@tonic-gate 
8000Sstevel@tonic-gate 	/* There are 2 BIO's even though they are normally both the
8010Sstevel@tonic-gate 	 * same.  This is so data can be read and written to different
8020Sstevel@tonic-gate 	 * handlers */
8030Sstevel@tonic-gate 
8040Sstevel@tonic-gate #ifndef OPENSSL_NO_BIO
8050Sstevel@tonic-gate 	BIO *rbio; /* used by SSL_read */
8060Sstevel@tonic-gate 	BIO *wbio; /* used by SSL_write */
8070Sstevel@tonic-gate 	BIO *bbio; /* used during session-id reuse to concatenate
8080Sstevel@tonic-gate 		    * messages */
8090Sstevel@tonic-gate #else
8100Sstevel@tonic-gate 	char *rbio; /* used by SSL_read */
8110Sstevel@tonic-gate 	char *wbio; /* used by SSL_write */
8120Sstevel@tonic-gate 	char *bbio;
8130Sstevel@tonic-gate #endif
8140Sstevel@tonic-gate 	/* This holds a variable that indicates what we were doing
8150Sstevel@tonic-gate 	 * when a 0 or -1 is returned.  This is needed for
8160Sstevel@tonic-gate 	 * non-blocking IO so we know what request needs re-doing when
8170Sstevel@tonic-gate 	 * in SSL_accept or SSL_connect */
8180Sstevel@tonic-gate 	int rwstate;
8190Sstevel@tonic-gate 
8200Sstevel@tonic-gate 	/* true when we are actually in SSL_accept() or SSL_connect() */
8210Sstevel@tonic-gate 	int in_handshake;
8220Sstevel@tonic-gate 	int (*handshake_func)();
8230Sstevel@tonic-gate 
8240Sstevel@tonic-gate 	/* Imagine that here's a boolean member "init" that is
8250Sstevel@tonic-gate 	 * switched as soon as SSL_set_{accept/connect}_state
8260Sstevel@tonic-gate 	 * is called for the first time, so that "state" and
8270Sstevel@tonic-gate 	 * "handshake_func" are properly initialized.  But as
8280Sstevel@tonic-gate 	 * handshake_func is == 0 until then, we use this
8290Sstevel@tonic-gate 	 * test instead of an "init" member.
8300Sstevel@tonic-gate 	 */
8310Sstevel@tonic-gate 
8320Sstevel@tonic-gate 	int server;	/* are we the server side? - mostly used by SSL_clear*/
8330Sstevel@tonic-gate 
8340Sstevel@tonic-gate 	int new_session;/* 1 if we are to use a new session.
8350Sstevel@tonic-gate 	                 * 2 if we are a server and are inside a handshake
8360Sstevel@tonic-gate 	                 *   (i.e. not just sending a HelloRequest)
8370Sstevel@tonic-gate 	                 * NB: For servers, the 'new' session may actually be a previously
8380Sstevel@tonic-gate 	                 * cached session or even the previous session unless
8390Sstevel@tonic-gate 	                 * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */
8400Sstevel@tonic-gate 	int quiet_shutdown;/* don't send shutdown packets */
8410Sstevel@tonic-gate 	int shutdown;	/* we have shut things down, 0x01 sent, 0x02
8420Sstevel@tonic-gate 			 * for received */
8430Sstevel@tonic-gate 	int state;	/* where we are */
8440Sstevel@tonic-gate 	int rstate;	/* where we are when reading */
8450Sstevel@tonic-gate 
8460Sstevel@tonic-gate 	BUF_MEM *init_buf;	/* buffer used during init */
8470Sstevel@tonic-gate 	void *init_msg;   	/* pointer to handshake message body, set by ssl3_get_message() */
8480Sstevel@tonic-gate 	int init_num;		/* amount read/written */
8490Sstevel@tonic-gate 	int init_off;		/* amount read/written */
8500Sstevel@tonic-gate 
8510Sstevel@tonic-gate 	/* used internally to point at a raw packet */
8520Sstevel@tonic-gate 	unsigned char *packet;
8530Sstevel@tonic-gate 	unsigned int packet_length;
8540Sstevel@tonic-gate 
8550Sstevel@tonic-gate 	struct ssl2_state_st *s2; /* SSLv2 variables */
8560Sstevel@tonic-gate 	struct ssl3_state_st *s3; /* SSLv3 variables */
8570Sstevel@tonic-gate 
8580Sstevel@tonic-gate 	int read_ahead;		/* Read as many input bytes as possible
8590Sstevel@tonic-gate 	               	 	 * (for non-blocking reads) */
8600Sstevel@tonic-gate 
8610Sstevel@tonic-gate 	/* callback that allows applications to peek at protocol messages */
8620Sstevel@tonic-gate 	void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);
8630Sstevel@tonic-gate 	void *msg_callback_arg;
8640Sstevel@tonic-gate 
8650Sstevel@tonic-gate 	int hit;		/* reusing a previous session */
8660Sstevel@tonic-gate 
8670Sstevel@tonic-gate 	int purpose;		/* Purpose setting */
8680Sstevel@tonic-gate 	int trust;		/* Trust setting */
8690Sstevel@tonic-gate 
8700Sstevel@tonic-gate 	/* crypto */
8710Sstevel@tonic-gate 	STACK_OF(SSL_CIPHER) *cipher_list;
8720Sstevel@tonic-gate 	STACK_OF(SSL_CIPHER) *cipher_list_by_id;
8730Sstevel@tonic-gate 
8740Sstevel@tonic-gate 	/* These are the ones being used, the ones in SSL_SESSION are
8750Sstevel@tonic-gate 	 * the ones to be 'copied' into these ones */
8760Sstevel@tonic-gate 
8770Sstevel@tonic-gate 	EVP_CIPHER_CTX *enc_read_ctx;		/* cryptographic state */
8780Sstevel@tonic-gate 	const EVP_MD *read_hash;		/* used for mac generation */
8790Sstevel@tonic-gate #ifndef OPENSSL_NO_COMP
8800Sstevel@tonic-gate 	COMP_CTX *expand;			/* uncompress */
8810Sstevel@tonic-gate #else
8820Sstevel@tonic-gate 	char *expand;
8830Sstevel@tonic-gate #endif
8840Sstevel@tonic-gate 
8850Sstevel@tonic-gate 	EVP_CIPHER_CTX *enc_write_ctx;		/* cryptographic state */
8860Sstevel@tonic-gate 	const EVP_MD *write_hash;		/* used for mac generation */
8870Sstevel@tonic-gate #ifndef OPENSSL_NO_COMP
8880Sstevel@tonic-gate 	COMP_CTX *compress;			/* compression */
8890Sstevel@tonic-gate #else
8900Sstevel@tonic-gate 	char *compress;
8910Sstevel@tonic-gate #endif
8920Sstevel@tonic-gate 
8930Sstevel@tonic-gate 	/* session info */
8940Sstevel@tonic-gate 
8950Sstevel@tonic-gate 	/* client cert? */
8960Sstevel@tonic-gate 	/* This is used to hold the server certificate used */
8970Sstevel@tonic-gate 	struct cert_st /* CERT */ *cert;
8980Sstevel@tonic-gate 
8990Sstevel@tonic-gate 	/* the session_id_context is used to ensure sessions are only reused
9000Sstevel@tonic-gate 	 * in the appropriate context */
9010Sstevel@tonic-gate 	unsigned int sid_ctx_length;
9020Sstevel@tonic-gate 	unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
9030Sstevel@tonic-gate 
9040Sstevel@tonic-gate 	/* This can also be in the session once a session is established */
9050Sstevel@tonic-gate 	SSL_SESSION *session;
9060Sstevel@tonic-gate 
9070Sstevel@tonic-gate 	/* Default generate session ID callback. */
9080Sstevel@tonic-gate 	GEN_SESSION_CB generate_session_id;
9090Sstevel@tonic-gate 
9100Sstevel@tonic-gate 	/* Used in SSL2 and SSL3 */
9110Sstevel@tonic-gate 	int verify_mode;	/* 0 don't care about verify failure.
9120Sstevel@tonic-gate 				 * 1 fail if verify fails */
9130Sstevel@tonic-gate 	int verify_depth;
9140Sstevel@tonic-gate 	int (*verify_callback)(int ok,X509_STORE_CTX *ctx); /* fail if callback returns 0 */
9150Sstevel@tonic-gate 
9160Sstevel@tonic-gate 	void (*info_callback)(const SSL *ssl,int type,int val); /* optional informational callback */
9170Sstevel@tonic-gate 
9180Sstevel@tonic-gate 	int error;		/* error bytes to be written */
9190Sstevel@tonic-gate 	int error_code;		/* actual code */
9200Sstevel@tonic-gate 
9210Sstevel@tonic-gate #ifndef OPENSSL_NO_KRB5
9220Sstevel@tonic-gate 	KSSL_CTX *kssl_ctx;     /* Kerberos 5 context */
9230Sstevel@tonic-gate #endif	/* OPENSSL_NO_KRB5 */
9240Sstevel@tonic-gate 
9250Sstevel@tonic-gate 	SSL_CTX *ctx;
9260Sstevel@tonic-gate 	/* set this flag to 1 and a sleep(1) is put into all SSL_read()
9270Sstevel@tonic-gate 	 * and SSL_write() calls, good for nbio debuging :-) */
9280Sstevel@tonic-gate 	int debug;
9290Sstevel@tonic-gate 
9300Sstevel@tonic-gate 	/* extra application data */
9310Sstevel@tonic-gate 	long verify_result;
9320Sstevel@tonic-gate 	CRYPTO_EX_DATA ex_data;
9330Sstevel@tonic-gate 
9340Sstevel@tonic-gate 	/* for server side, keep the list of CA_dn we can use */
9350Sstevel@tonic-gate 	STACK_OF(X509_NAME) *client_CA;
9360Sstevel@tonic-gate 
9370Sstevel@tonic-gate 	int references;
9380Sstevel@tonic-gate 	unsigned long options; /* protocol behaviour */
9390Sstevel@tonic-gate 	unsigned long mode; /* API behaviour */
9400Sstevel@tonic-gate 	long max_cert_list;
9410Sstevel@tonic-gate 	int first_packet;
9420Sstevel@tonic-gate 	int client_version;	/* what was passed, used for
9430Sstevel@tonic-gate 				 * SSLv3/TLS rollback check */
9440Sstevel@tonic-gate 	};
9450Sstevel@tonic-gate 
9460Sstevel@tonic-gate #ifdef __cplusplus
9470Sstevel@tonic-gate }
9480Sstevel@tonic-gate #endif
9490Sstevel@tonic-gate 
9500Sstevel@tonic-gate #include <openssl/ssl2.h>
9510Sstevel@tonic-gate #include <openssl/ssl3.h>
9520Sstevel@tonic-gate #include <openssl/tls1.h> /* This is mostly sslv3 with a few tweaks */
9530Sstevel@tonic-gate #include <openssl/ssl23.h>
9540Sstevel@tonic-gate 
9550Sstevel@tonic-gate #ifdef  __cplusplus
9560Sstevel@tonic-gate extern "C" {
9570Sstevel@tonic-gate #endif
9580Sstevel@tonic-gate 
9590Sstevel@tonic-gate /* compatibility */
9600Sstevel@tonic-gate #define SSL_set_app_data(s,arg)		(SSL_set_ex_data(s,0,(char *)arg))
9610Sstevel@tonic-gate #define SSL_get_app_data(s)		(SSL_get_ex_data(s,0))
9620Sstevel@tonic-gate #define SSL_SESSION_set_app_data(s,a)	(SSL_SESSION_set_ex_data(s,0,(char *)a))
9630Sstevel@tonic-gate #define SSL_SESSION_get_app_data(s)	(SSL_SESSION_get_ex_data(s,0))
9640Sstevel@tonic-gate #define SSL_CTX_get_app_data(ctx)	(SSL_CTX_get_ex_data(ctx,0))
9650Sstevel@tonic-gate #define SSL_CTX_set_app_data(ctx,arg)	(SSL_CTX_set_ex_data(ctx,0,(char *)arg))
9660Sstevel@tonic-gate 
9670Sstevel@tonic-gate /* The following are the possible values for ssl->state are are
9680Sstevel@tonic-gate  * used to indicate where we are up to in the SSL connection establishment.
9690Sstevel@tonic-gate  * The macros that follow are about the only things you should need to use
9700Sstevel@tonic-gate  * and even then, only when using non-blocking IO.
9710Sstevel@tonic-gate  * It can also be useful to work out where you were when the connection
9720Sstevel@tonic-gate  * failed */
9730Sstevel@tonic-gate 
9740Sstevel@tonic-gate #define SSL_ST_CONNECT			0x1000
9750Sstevel@tonic-gate #define SSL_ST_ACCEPT			0x2000
9760Sstevel@tonic-gate #define SSL_ST_MASK			0x0FFF
9770Sstevel@tonic-gate #define SSL_ST_INIT			(SSL_ST_CONNECT|SSL_ST_ACCEPT)
9780Sstevel@tonic-gate #define SSL_ST_BEFORE			0x4000
9790Sstevel@tonic-gate #define SSL_ST_OK			0x03
9800Sstevel@tonic-gate #define SSL_ST_RENEGOTIATE		(0x04|SSL_ST_INIT)
9810Sstevel@tonic-gate 
9820Sstevel@tonic-gate #define SSL_CB_LOOP			0x01
9830Sstevel@tonic-gate #define SSL_CB_EXIT			0x02
9840Sstevel@tonic-gate #define SSL_CB_READ			0x04
9850Sstevel@tonic-gate #define SSL_CB_WRITE			0x08
9860Sstevel@tonic-gate #define SSL_CB_ALERT			0x4000 /* used in callback */
9870Sstevel@tonic-gate #define SSL_CB_READ_ALERT		(SSL_CB_ALERT|SSL_CB_READ)
9880Sstevel@tonic-gate #define SSL_CB_WRITE_ALERT		(SSL_CB_ALERT|SSL_CB_WRITE)
9890Sstevel@tonic-gate #define SSL_CB_ACCEPT_LOOP		(SSL_ST_ACCEPT|SSL_CB_LOOP)
9900Sstevel@tonic-gate #define SSL_CB_ACCEPT_EXIT		(SSL_ST_ACCEPT|SSL_CB_EXIT)
9910Sstevel@tonic-gate #define SSL_CB_CONNECT_LOOP		(SSL_ST_CONNECT|SSL_CB_LOOP)
9920Sstevel@tonic-gate #define SSL_CB_CONNECT_EXIT		(SSL_ST_CONNECT|SSL_CB_EXIT)
9930Sstevel@tonic-gate #define SSL_CB_HANDSHAKE_START		0x10
9940Sstevel@tonic-gate #define SSL_CB_HANDSHAKE_DONE		0x20
9950Sstevel@tonic-gate 
9960Sstevel@tonic-gate /* Is the SSL_connection established? */
9970Sstevel@tonic-gate #define SSL_get_state(a)		SSL_state(a)
9980Sstevel@tonic-gate #define SSL_is_init_finished(a)		(SSL_state(a) == SSL_ST_OK)
9990Sstevel@tonic-gate #define SSL_in_init(a)			(SSL_state(a)&SSL_ST_INIT)
10000Sstevel@tonic-gate #define SSL_in_before(a)		(SSL_state(a)&SSL_ST_BEFORE)
10010Sstevel@tonic-gate #define SSL_in_connect_init(a)		(SSL_state(a)&SSL_ST_CONNECT)
10020Sstevel@tonic-gate #define SSL_in_accept_init(a)		(SSL_state(a)&SSL_ST_ACCEPT)
10030Sstevel@tonic-gate 
10040Sstevel@tonic-gate /* The following 2 states are kept in ssl->rstate when reads fail,
10050Sstevel@tonic-gate  * you should not need these */
10060Sstevel@tonic-gate #define SSL_ST_READ_HEADER			0xF0
10070Sstevel@tonic-gate #define SSL_ST_READ_BODY			0xF1
10080Sstevel@tonic-gate #define SSL_ST_READ_DONE			0xF2
10090Sstevel@tonic-gate 
10100Sstevel@tonic-gate /* Obtain latest Finished message
10110Sstevel@tonic-gate  *   -- that we sent (SSL_get_finished)
10120Sstevel@tonic-gate  *   -- that we expected from peer (SSL_get_peer_finished).
10130Sstevel@tonic-gate  * Returns length (0 == no Finished so far), copies up to 'count' bytes. */
10140Sstevel@tonic-gate size_t SSL_get_finished(SSL *s, void *buf, size_t count);
10150Sstevel@tonic-gate size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count);
10160Sstevel@tonic-gate 
10170Sstevel@tonic-gate /* use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options
10180Sstevel@tonic-gate  * are 'ored' with SSL_VERIFY_PEER if they are desired */
10190Sstevel@tonic-gate #define SSL_VERIFY_NONE			0x00
10200Sstevel@tonic-gate #define SSL_VERIFY_PEER			0x01
10210Sstevel@tonic-gate #define SSL_VERIFY_FAIL_IF_NO_PEER_CERT	0x02
10220Sstevel@tonic-gate #define SSL_VERIFY_CLIENT_ONCE		0x04
10230Sstevel@tonic-gate 
10240Sstevel@tonic-gate #define OpenSSL_add_ssl_algorithms()	SSL_library_init()
10250Sstevel@tonic-gate #define SSLeay_add_ssl_algorithms()	SSL_library_init()
10260Sstevel@tonic-gate 
10270Sstevel@tonic-gate /* this is for backward compatibility */
10280Sstevel@tonic-gate #if 0 /* NEW_SSLEAY */
10290Sstevel@tonic-gate #define SSL_CTX_set_default_verify(a,b,c) SSL_CTX_set_verify(a,b,c)
10300Sstevel@tonic-gate #define SSL_set_pref_cipher(c,n)	SSL_set_cipher_list(c,n)
10310Sstevel@tonic-gate #define SSL_add_session(a,b)            SSL_CTX_add_session((a),(b))
10320Sstevel@tonic-gate #define SSL_remove_session(a,b)		SSL_CTX_remove_session((a),(b))
10330Sstevel@tonic-gate #define SSL_flush_sessions(a,b)		SSL_CTX_flush_sessions((a),(b))
10340Sstevel@tonic-gate #endif
10350Sstevel@tonic-gate /* More backward compatibility */
10360Sstevel@tonic-gate #define SSL_get_cipher(s) \
10370Sstevel@tonic-gate 		SSL_CIPHER_get_name(SSL_get_current_cipher(s))
10380Sstevel@tonic-gate #define SSL_get_cipher_bits(s,np) \
10390Sstevel@tonic-gate 		SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np)
10400Sstevel@tonic-gate #define SSL_get_cipher_version(s) \
10410Sstevel@tonic-gate 		SSL_CIPHER_get_version(SSL_get_current_cipher(s))
10420Sstevel@tonic-gate #define SSL_get_cipher_name(s) \
10430Sstevel@tonic-gate 		SSL_CIPHER_get_name(SSL_get_current_cipher(s))
10440Sstevel@tonic-gate #define SSL_get_time(a)		SSL_SESSION_get_time(a)
10450Sstevel@tonic-gate #define SSL_set_time(a,b)	SSL_SESSION_set_time((a),(b))
10460Sstevel@tonic-gate #define SSL_get_timeout(a)	SSL_SESSION_get_timeout(a)
10470Sstevel@tonic-gate #define SSL_set_timeout(a,b)	SSL_SESSION_set_timeout((a),(b))
10480Sstevel@tonic-gate 
10490Sstevel@tonic-gate #if 1 /*SSLEAY_MACROS*/
10500Sstevel@tonic-gate #define d2i_SSL_SESSION_bio(bp,s_id) (SSL_SESSION *)ASN1_d2i_bio( \
10510Sstevel@tonic-gate 	(char *(*)())SSL_SESSION_new,(char *(*)())d2i_SSL_SESSION, \
10520Sstevel@tonic-gate 	(bp),(unsigned char **)(s_id))
10530Sstevel@tonic-gate #define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio(i2d_SSL_SESSION, \
10540Sstevel@tonic-gate 	bp,(unsigned char *)s_id)
10550Sstevel@tonic-gate #define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \
10560Sstevel@tonic-gate 	(char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u)
10570Sstevel@tonic-gate #define PEM_read_bio_SSL_SESSION(bp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read_bio( \
10580Sstevel@tonic-gate 	(char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,(char **)x,cb,u)
10590Sstevel@tonic-gate #define PEM_write_SSL_SESSION(fp,x) \
10600Sstevel@tonic-gate 	PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \
10610Sstevel@tonic-gate 		PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL)
10620Sstevel@tonic-gate #define PEM_write_bio_SSL_SESSION(bp,x) \
10630Sstevel@tonic-gate 	PEM_ASN1_write_bio((int (*)())i2d_SSL_SESSION, \
10640Sstevel@tonic-gate 		PEM_STRING_SSL_SESSION,bp, (char *)x, NULL,NULL,0,NULL,NULL)
10650Sstevel@tonic-gate #endif
10660Sstevel@tonic-gate 
10670Sstevel@tonic-gate #define SSL_AD_REASON_OFFSET		1000
10680Sstevel@tonic-gate /* These alert types are for SSLv3 and TLSv1 */
10690Sstevel@tonic-gate #define SSL_AD_CLOSE_NOTIFY		SSL3_AD_CLOSE_NOTIFY
10700Sstevel@tonic-gate #define SSL_AD_UNEXPECTED_MESSAGE	SSL3_AD_UNEXPECTED_MESSAGE /* fatal */
10710Sstevel@tonic-gate #define SSL_AD_BAD_RECORD_MAC		SSL3_AD_BAD_RECORD_MAC     /* fatal */
10720Sstevel@tonic-gate #define SSL_AD_DECRYPTION_FAILED	TLS1_AD_DECRYPTION_FAILED
10730Sstevel@tonic-gate #define SSL_AD_RECORD_OVERFLOW		TLS1_AD_RECORD_OVERFLOW
10740Sstevel@tonic-gate #define SSL_AD_DECOMPRESSION_FAILURE	SSL3_AD_DECOMPRESSION_FAILURE/* fatal */
10750Sstevel@tonic-gate #define SSL_AD_HANDSHAKE_FAILURE	SSL3_AD_HANDSHAKE_FAILURE/* fatal */
10760Sstevel@tonic-gate #define SSL_AD_NO_CERTIFICATE		SSL3_AD_NO_CERTIFICATE /* Not for TLS */
10770Sstevel@tonic-gate #define SSL_AD_BAD_CERTIFICATE		SSL3_AD_BAD_CERTIFICATE
10780Sstevel@tonic-gate #define SSL_AD_UNSUPPORTED_CERTIFICATE	SSL3_AD_UNSUPPORTED_CERTIFICATE
10790Sstevel@tonic-gate #define SSL_AD_CERTIFICATE_REVOKED	SSL3_AD_CERTIFICATE_REVOKED
10800Sstevel@tonic-gate #define SSL_AD_CERTIFICATE_EXPIRED	SSL3_AD_CERTIFICATE_EXPIRED
10810Sstevel@tonic-gate #define SSL_AD_CERTIFICATE_UNKNOWN	SSL3_AD_CERTIFICATE_UNKNOWN
10820Sstevel@tonic-gate #define SSL_AD_ILLEGAL_PARAMETER	SSL3_AD_ILLEGAL_PARAMETER   /* fatal */
10830Sstevel@tonic-gate #define SSL_AD_UNKNOWN_CA		TLS1_AD_UNKNOWN_CA	/* fatal */
10840Sstevel@tonic-gate #define SSL_AD_ACCESS_DENIED		TLS1_AD_ACCESS_DENIED	/* fatal */
10850Sstevel@tonic-gate #define SSL_AD_DECODE_ERROR		TLS1_AD_DECODE_ERROR	/* fatal */
10860Sstevel@tonic-gate #define SSL_AD_DECRYPT_ERROR		TLS1_AD_DECRYPT_ERROR
10870Sstevel@tonic-gate #define SSL_AD_EXPORT_RESTRICTION	TLS1_AD_EXPORT_RESTRICTION/* fatal */
10880Sstevel@tonic-gate #define SSL_AD_PROTOCOL_VERSION		TLS1_AD_PROTOCOL_VERSION /* fatal */
10890Sstevel@tonic-gate #define SSL_AD_INSUFFICIENT_SECURITY	TLS1_AD_INSUFFICIENT_SECURITY/* fatal */
10900Sstevel@tonic-gate #define SSL_AD_INTERNAL_ERROR		TLS1_AD_INTERNAL_ERROR	/* fatal */
10910Sstevel@tonic-gate #define SSL_AD_USER_CANCELLED		TLS1_AD_USER_CANCELLED
10920Sstevel@tonic-gate #define SSL_AD_NO_RENEGOTIATION		TLS1_AD_NO_RENEGOTIATION
10930Sstevel@tonic-gate 
10940Sstevel@tonic-gate #define SSL_ERROR_NONE			0
10950Sstevel@tonic-gate #define SSL_ERROR_SSL			1
10960Sstevel@tonic-gate #define SSL_ERROR_WANT_READ		2
10970Sstevel@tonic-gate #define SSL_ERROR_WANT_WRITE		3
10980Sstevel@tonic-gate #define SSL_ERROR_WANT_X509_LOOKUP	4
10990Sstevel@tonic-gate #define SSL_ERROR_SYSCALL		5 /* look at error stack/return value/errno */
11000Sstevel@tonic-gate #define SSL_ERROR_ZERO_RETURN		6
11010Sstevel@tonic-gate #define SSL_ERROR_WANT_CONNECT		7
11020Sstevel@tonic-gate #define SSL_ERROR_WANT_ACCEPT		8
11030Sstevel@tonic-gate 
11040Sstevel@tonic-gate #define SSL_CTRL_NEED_TMP_RSA			1
11050Sstevel@tonic-gate #define SSL_CTRL_SET_TMP_RSA			2
11060Sstevel@tonic-gate #define SSL_CTRL_SET_TMP_DH			3
11070Sstevel@tonic-gate #define SSL_CTRL_SET_TMP_RSA_CB			4
11080Sstevel@tonic-gate #define SSL_CTRL_SET_TMP_DH_CB			5
11090Sstevel@tonic-gate 
11100Sstevel@tonic-gate #define SSL_CTRL_GET_SESSION_REUSED		6
11110Sstevel@tonic-gate #define SSL_CTRL_GET_CLIENT_CERT_REQUEST	7
11120Sstevel@tonic-gate #define SSL_CTRL_GET_NUM_RENEGOTIATIONS		8
11130Sstevel@tonic-gate #define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS	9
11140Sstevel@tonic-gate #define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS	10
11150Sstevel@tonic-gate #define SSL_CTRL_GET_FLAGS			11
11160Sstevel@tonic-gate #define SSL_CTRL_EXTRA_CHAIN_CERT		12
11170Sstevel@tonic-gate 
11180Sstevel@tonic-gate #define SSL_CTRL_SET_MSG_CALLBACK               13
11190Sstevel@tonic-gate #define SSL_CTRL_SET_MSG_CALLBACK_ARG           14
11200Sstevel@tonic-gate 
11210Sstevel@tonic-gate /* Stats */
11220Sstevel@tonic-gate #define SSL_CTRL_SESS_NUMBER			20
11230Sstevel@tonic-gate #define SSL_CTRL_SESS_CONNECT			21
11240Sstevel@tonic-gate #define SSL_CTRL_SESS_CONNECT_GOOD		22
11250Sstevel@tonic-gate #define SSL_CTRL_SESS_CONNECT_RENEGOTIATE	23
11260Sstevel@tonic-gate #define SSL_CTRL_SESS_ACCEPT			24
11270Sstevel@tonic-gate #define SSL_CTRL_SESS_ACCEPT_GOOD		25
11280Sstevel@tonic-gate #define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE	26
11290Sstevel@tonic-gate #define SSL_CTRL_SESS_HIT			27
11300Sstevel@tonic-gate #define SSL_CTRL_SESS_CB_HIT			28
11310Sstevel@tonic-gate #define SSL_CTRL_SESS_MISSES			29
11320Sstevel@tonic-gate #define SSL_CTRL_SESS_TIMEOUTS			30
11330Sstevel@tonic-gate #define SSL_CTRL_SESS_CACHE_FULL		31
11340Sstevel@tonic-gate #define SSL_CTRL_OPTIONS			32
11350Sstevel@tonic-gate #define SSL_CTRL_MODE				33
11360Sstevel@tonic-gate 
11370Sstevel@tonic-gate #define SSL_CTRL_GET_READ_AHEAD			40
11380Sstevel@tonic-gate #define SSL_CTRL_SET_READ_AHEAD			41
11390Sstevel@tonic-gate #define SSL_CTRL_SET_SESS_CACHE_SIZE		42
11400Sstevel@tonic-gate #define SSL_CTRL_GET_SESS_CACHE_SIZE		43
11410Sstevel@tonic-gate #define SSL_CTRL_SET_SESS_CACHE_MODE		44
11420Sstevel@tonic-gate #define SSL_CTRL_GET_SESS_CACHE_MODE		45
11430Sstevel@tonic-gate 
11440Sstevel@tonic-gate #define SSL_CTRL_GET_MAX_CERT_LIST		50
11450Sstevel@tonic-gate #define SSL_CTRL_SET_MAX_CERT_LIST		51
11460Sstevel@tonic-gate 
11470Sstevel@tonic-gate #define SSL_session_reused(ssl) \
11480Sstevel@tonic-gate 	SSL_ctrl((ssl),SSL_CTRL_GET_SESSION_REUSED,0,NULL)
11490Sstevel@tonic-gate #define SSL_num_renegotiations(ssl) \
11500Sstevel@tonic-gate 	SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL)
11510Sstevel@tonic-gate #define SSL_clear_num_renegotiations(ssl) \
11520Sstevel@tonic-gate 	SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL)
11530Sstevel@tonic-gate #define SSL_total_renegotiations(ssl) \
11540Sstevel@tonic-gate 	SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL)
11550Sstevel@tonic-gate 
11560Sstevel@tonic-gate #define SSL_CTX_need_tmp_RSA(ctx) \
11570Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_NEED_TMP_RSA,0,NULL)
11580Sstevel@tonic-gate #define SSL_CTX_set_tmp_rsa(ctx,rsa) \
11590Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)
11600Sstevel@tonic-gate #define SSL_CTX_set_tmp_dh(ctx,dh) \
11610Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)dh)
11620Sstevel@tonic-gate 
11630Sstevel@tonic-gate #define SSL_need_tmp_RSA(ssl) \
11640Sstevel@tonic-gate 	SSL_ctrl(ssl,SSL_CTRL_NEED_TMP_RSA,0,NULL)
11650Sstevel@tonic-gate #define SSL_set_tmp_rsa(ssl,rsa) \
11660Sstevel@tonic-gate 	SSL_ctrl(ssl,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)
11670Sstevel@tonic-gate #define SSL_set_tmp_dh(ssl,dh) \
11680Sstevel@tonic-gate 	SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)dh)
11690Sstevel@tonic-gate 
11700Sstevel@tonic-gate #define SSL_CTX_add_extra_chain_cert(ctx,x509) \
11710Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509)
11720Sstevel@tonic-gate 
11730Sstevel@tonic-gate #ifndef OPENSSL_NO_BIO
11740Sstevel@tonic-gate BIO_METHOD *BIO_f_ssl(void);
11750Sstevel@tonic-gate BIO *BIO_new_ssl(SSL_CTX *ctx,int client);
11760Sstevel@tonic-gate BIO *BIO_new_ssl_connect(SSL_CTX *ctx);
11770Sstevel@tonic-gate BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx);
11780Sstevel@tonic-gate int BIO_ssl_copy_session_id(BIO *to,BIO *from);
11790Sstevel@tonic-gate void BIO_ssl_shutdown(BIO *ssl_bio);
11800Sstevel@tonic-gate 
11810Sstevel@tonic-gate #endif
11820Sstevel@tonic-gate 
11830Sstevel@tonic-gate int	SSL_CTX_set_cipher_list(SSL_CTX *,const char *str);
11840Sstevel@tonic-gate SSL_CTX *SSL_CTX_new(SSL_METHOD *meth);
11850Sstevel@tonic-gate void	SSL_CTX_free(SSL_CTX *);
11860Sstevel@tonic-gate long SSL_CTX_set_timeout(SSL_CTX *ctx,long t);
11870Sstevel@tonic-gate long SSL_CTX_get_timeout(SSL_CTX *ctx);
11880Sstevel@tonic-gate X509_STORE *SSL_CTX_get_cert_store(SSL_CTX *);
11890Sstevel@tonic-gate void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *);
11900Sstevel@tonic-gate int SSL_want(SSL *s);
11910Sstevel@tonic-gate int	SSL_clear(SSL *s);
11920Sstevel@tonic-gate 
11930Sstevel@tonic-gate void	SSL_CTX_flush_sessions(SSL_CTX *ctx,long tm);
11940Sstevel@tonic-gate 
11950Sstevel@tonic-gate SSL_CIPHER *SSL_get_current_cipher(SSL *s);
11960Sstevel@tonic-gate int	SSL_CIPHER_get_bits(SSL_CIPHER *c,int *alg_bits);
11970Sstevel@tonic-gate char *	SSL_CIPHER_get_version(SSL_CIPHER *c);
11980Sstevel@tonic-gate const char *	SSL_CIPHER_get_name(SSL_CIPHER *c);
11990Sstevel@tonic-gate 
12000Sstevel@tonic-gate int	SSL_get_fd(SSL *s);
12010Sstevel@tonic-gate int	SSL_get_rfd(SSL *s);
12020Sstevel@tonic-gate int	SSL_get_wfd(SSL *s);
12030Sstevel@tonic-gate const char  * SSL_get_cipher_list(SSL *s,int n);
12040Sstevel@tonic-gate char *	SSL_get_shared_ciphers(SSL *s, char *buf, int len);
12050Sstevel@tonic-gate int	SSL_get_read_ahead(SSL * s);
12060Sstevel@tonic-gate int	SSL_pending(SSL *s);
12070Sstevel@tonic-gate #ifndef OPENSSL_NO_SOCK
12080Sstevel@tonic-gate int	SSL_set_fd(SSL *s, int fd);
12090Sstevel@tonic-gate int	SSL_set_rfd(SSL *s, int fd);
12100Sstevel@tonic-gate int	SSL_set_wfd(SSL *s, int fd);
12110Sstevel@tonic-gate #endif
12120Sstevel@tonic-gate #ifndef OPENSSL_NO_BIO
12130Sstevel@tonic-gate void	SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio);
12140Sstevel@tonic-gate BIO *	SSL_get_rbio(SSL *s);
12150Sstevel@tonic-gate BIO *	SSL_get_wbio(SSL *s);
12160Sstevel@tonic-gate #endif
12170Sstevel@tonic-gate int	SSL_set_cipher_list(SSL *s, const char *str);
12180Sstevel@tonic-gate void	SSL_set_read_ahead(SSL *s, int yes);
12190Sstevel@tonic-gate int	SSL_get_verify_mode(SSL *s);
12200Sstevel@tonic-gate int	SSL_get_verify_depth(SSL *s);
12210Sstevel@tonic-gate int	(*SSL_get_verify_callback(SSL *s))(int,X509_STORE_CTX *);
12220Sstevel@tonic-gate void	SSL_set_verify(SSL *s, int mode,
12230Sstevel@tonic-gate 		       int (*callback)(int ok,X509_STORE_CTX *ctx));
12240Sstevel@tonic-gate void	SSL_set_verify_depth(SSL *s, int depth);
12250Sstevel@tonic-gate #ifndef OPENSSL_NO_RSA
12260Sstevel@tonic-gate int	SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);
12270Sstevel@tonic-gate #endif
12280Sstevel@tonic-gate int	SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len);
12290Sstevel@tonic-gate int	SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey);
12300Sstevel@tonic-gate int	SSL_use_PrivateKey_ASN1(int pk,SSL *ssl, unsigned char *d, long len);
12310Sstevel@tonic-gate int	SSL_use_certificate(SSL *ssl, X509 *x);
12320Sstevel@tonic-gate int	SSL_use_certificate_ASN1(SSL *ssl, unsigned char *d, int len);
12330Sstevel@tonic-gate 
12340Sstevel@tonic-gate #ifndef OPENSSL_NO_STDIO
12350Sstevel@tonic-gate int	SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type);
12360Sstevel@tonic-gate int	SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type);
12370Sstevel@tonic-gate int	SSL_use_certificate_file(SSL *ssl, const char *file, int type);
12380Sstevel@tonic-gate int	SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type);
12390Sstevel@tonic-gate int	SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type);
12400Sstevel@tonic-gate int	SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type);
12410Sstevel@tonic-gate int	SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); /* PEM type */
12420Sstevel@tonic-gate STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);
12430Sstevel@tonic-gate int	SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
12440Sstevel@tonic-gate 					    const char *file);
12450Sstevel@tonic-gate #ifndef OPENSSL_SYS_VMS
12460Sstevel@tonic-gate #ifndef OPENSSL_SYS_MACINTOSH_CLASSIC /* XXXXX: Better scheme needed! [was: #ifndef MAC_OS_pre_X] */
12470Sstevel@tonic-gate int	SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
12480Sstevel@tonic-gate 					   const char *dir);
12490Sstevel@tonic-gate #endif
12500Sstevel@tonic-gate #endif
12510Sstevel@tonic-gate 
12520Sstevel@tonic-gate #endif
12530Sstevel@tonic-gate 
12540Sstevel@tonic-gate void	SSL_load_error_strings(void );
12550Sstevel@tonic-gate const char *SSL_state_string(const SSL *s);
12560Sstevel@tonic-gate const char *SSL_rstate_string(const SSL *s);
12570Sstevel@tonic-gate const char *SSL_state_string_long(const SSL *s);
12580Sstevel@tonic-gate const char *SSL_rstate_string_long(const SSL *s);
12590Sstevel@tonic-gate long	SSL_SESSION_get_time(SSL_SESSION *s);
12600Sstevel@tonic-gate long	SSL_SESSION_set_time(SSL_SESSION *s, long t);
12610Sstevel@tonic-gate long	SSL_SESSION_get_timeout(SSL_SESSION *s);
12620Sstevel@tonic-gate long	SSL_SESSION_set_timeout(SSL_SESSION *s, long t);
12630Sstevel@tonic-gate void	SSL_copy_session_id(SSL *to,SSL *from);
12640Sstevel@tonic-gate 
12650Sstevel@tonic-gate SSL_SESSION *SSL_SESSION_new(void);
12660Sstevel@tonic-gate unsigned long SSL_SESSION_hash(SSL_SESSION *a);
12670Sstevel@tonic-gate int	SSL_SESSION_cmp(SSL_SESSION *a,SSL_SESSION *b);
12680Sstevel@tonic-gate #ifndef OPENSSL_NO_FP_API
12690Sstevel@tonic-gate int	SSL_SESSION_print_fp(FILE *fp,SSL_SESSION *ses);
12700Sstevel@tonic-gate #endif
12710Sstevel@tonic-gate #ifndef OPENSSL_NO_BIO
12720Sstevel@tonic-gate int	SSL_SESSION_print(BIO *fp,SSL_SESSION *ses);
12730Sstevel@tonic-gate #endif
12740Sstevel@tonic-gate void	SSL_SESSION_free(SSL_SESSION *ses);
12750Sstevel@tonic-gate int	i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp);
12760Sstevel@tonic-gate int	SSL_set_session(SSL *to, SSL_SESSION *session);
12770Sstevel@tonic-gate int	SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c);
12780Sstevel@tonic-gate int	SSL_CTX_remove_session(SSL_CTX *,SSL_SESSION *c);
12790Sstevel@tonic-gate int	SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB);
12800Sstevel@tonic-gate int	SSL_set_generate_session_id(SSL *, GEN_SESSION_CB);
12810Sstevel@tonic-gate int	SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,
12820Sstevel@tonic-gate 					unsigned int id_len);
12830Sstevel@tonic-gate SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,unsigned char **pp,long length);
12840Sstevel@tonic-gate 
12850Sstevel@tonic-gate #ifdef HEADER_X509_H
12860Sstevel@tonic-gate X509 *	SSL_get_peer_certificate(SSL *s);
12870Sstevel@tonic-gate #endif
12880Sstevel@tonic-gate 
12890Sstevel@tonic-gate STACK_OF(X509) *SSL_get_peer_cert_chain(SSL *s);
12900Sstevel@tonic-gate 
12910Sstevel@tonic-gate int SSL_CTX_get_verify_mode(SSL_CTX *ctx);
12920Sstevel@tonic-gate int SSL_CTX_get_verify_depth(SSL_CTX *ctx);
12930Sstevel@tonic-gate int (*SSL_CTX_get_verify_callback(SSL_CTX *ctx))(int,X509_STORE_CTX *);
12940Sstevel@tonic-gate void SSL_CTX_set_verify(SSL_CTX *ctx,int mode,
12950Sstevel@tonic-gate 			int (*callback)(int, X509_STORE_CTX *));
12960Sstevel@tonic-gate void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth);
12970Sstevel@tonic-gate void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*cb)(X509_STORE_CTX *,void *), void *arg);
12980Sstevel@tonic-gate #ifndef OPENSSL_NO_RSA
12990Sstevel@tonic-gate int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);
13000Sstevel@tonic-gate #endif
13010Sstevel@tonic-gate int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, unsigned char *d, long len);
13020Sstevel@tonic-gate int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);
13030Sstevel@tonic-gate int SSL_CTX_use_PrivateKey_ASN1(int pk,SSL_CTX *ctx,
13040Sstevel@tonic-gate 	unsigned char *d, long len);
13050Sstevel@tonic-gate int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x);
13060Sstevel@tonic-gate int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, unsigned char *d);
13070Sstevel@tonic-gate 
13080Sstevel@tonic-gate void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb);
13090Sstevel@tonic-gate void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u);
13100Sstevel@tonic-gate 
13110Sstevel@tonic-gate int SSL_CTX_check_private_key(SSL_CTX *ctx);
13120Sstevel@tonic-gate int SSL_check_private_key(SSL *ctx);
13130Sstevel@tonic-gate 
13140Sstevel@tonic-gate int	SSL_CTX_set_session_id_context(SSL_CTX *ctx,const unsigned char *sid_ctx,
13150Sstevel@tonic-gate 				       unsigned int sid_ctx_len);
13160Sstevel@tonic-gate 
13170Sstevel@tonic-gate SSL *	SSL_new(SSL_CTX *ctx);
13180Sstevel@tonic-gate int	SSL_set_session_id_context(SSL *ssl,const unsigned char *sid_ctx,
13190Sstevel@tonic-gate 				   unsigned int sid_ctx_len);
13200Sstevel@tonic-gate 
13210Sstevel@tonic-gate int SSL_CTX_set_purpose(SSL_CTX *s, int purpose);
13220Sstevel@tonic-gate int SSL_set_purpose(SSL *s, int purpose);
13230Sstevel@tonic-gate int SSL_CTX_set_trust(SSL_CTX *s, int trust);
13240Sstevel@tonic-gate int SSL_set_trust(SSL *s, int trust);
13250Sstevel@tonic-gate 
13260Sstevel@tonic-gate void	SSL_free(SSL *ssl);
13270Sstevel@tonic-gate int 	SSL_accept(SSL *ssl);
13280Sstevel@tonic-gate int 	SSL_connect(SSL *ssl);
13290Sstevel@tonic-gate int 	SSL_read(SSL *ssl,void *buf,int num);
13300Sstevel@tonic-gate int 	SSL_peek(SSL *ssl,void *buf,int num);
13310Sstevel@tonic-gate int 	SSL_write(SSL *ssl,const void *buf,int num);
13320Sstevel@tonic-gate long	SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg);
13330Sstevel@tonic-gate long	SSL_callback_ctrl(SSL *, int, void (*)());
13340Sstevel@tonic-gate long	SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg);
13350Sstevel@tonic-gate long	SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)());
13360Sstevel@tonic-gate 
13370Sstevel@tonic-gate int	SSL_get_error(SSL *s,int ret_code);
13380Sstevel@tonic-gate const char *SSL_get_version(SSL *s);
13390Sstevel@tonic-gate 
13400Sstevel@tonic-gate /* This sets the 'default' SSL version that SSL_new() will create */
13410Sstevel@tonic-gate int SSL_CTX_set_ssl_version(SSL_CTX *ctx,SSL_METHOD *meth);
13420Sstevel@tonic-gate 
13430Sstevel@tonic-gate SSL_METHOD *SSLv2_method(void);		/* SSLv2 */
13440Sstevel@tonic-gate SSL_METHOD *SSLv2_server_method(void);	/* SSLv2 */
13450Sstevel@tonic-gate SSL_METHOD *SSLv2_client_method(void);	/* SSLv2 */
13460Sstevel@tonic-gate 
13470Sstevel@tonic-gate SSL_METHOD *SSLv3_method(void);		/* SSLv3 */
13480Sstevel@tonic-gate SSL_METHOD *SSLv3_server_method(void);	/* SSLv3 */
13490Sstevel@tonic-gate SSL_METHOD *SSLv3_client_method(void);	/* SSLv3 */
13500Sstevel@tonic-gate 
13510Sstevel@tonic-gate SSL_METHOD *SSLv23_method(void);	/* SSLv3 but can rollback to v2 */
13520Sstevel@tonic-gate SSL_METHOD *SSLv23_server_method(void);	/* SSLv3 but can rollback to v2 */
13530Sstevel@tonic-gate SSL_METHOD *SSLv23_client_method(void);	/* SSLv3 but can rollback to v2 */
13540Sstevel@tonic-gate 
13550Sstevel@tonic-gate SSL_METHOD *TLSv1_method(void);		/* TLSv1.0 */
13560Sstevel@tonic-gate SSL_METHOD *TLSv1_server_method(void);	/* TLSv1.0 */
13570Sstevel@tonic-gate SSL_METHOD *TLSv1_client_method(void);	/* TLSv1.0 */
13580Sstevel@tonic-gate 
13590Sstevel@tonic-gate STACK_OF(SSL_CIPHER) *SSL_get_ciphers(SSL *s);
13600Sstevel@tonic-gate 
13610Sstevel@tonic-gate int SSL_do_handshake(SSL *s);
13620Sstevel@tonic-gate int SSL_renegotiate(SSL *s);
13630Sstevel@tonic-gate int SSL_renegotiate_pending(SSL *s);
13640Sstevel@tonic-gate int SSL_shutdown(SSL *s);
13650Sstevel@tonic-gate 
13660Sstevel@tonic-gate SSL_METHOD *SSL_get_ssl_method(SSL *s);
13670Sstevel@tonic-gate int SSL_set_ssl_method(SSL *s,SSL_METHOD *method);
13680Sstevel@tonic-gate const char *SSL_alert_type_string_long(int value);
13690Sstevel@tonic-gate const char *SSL_alert_type_string(int value);
13700Sstevel@tonic-gate const char *SSL_alert_desc_string_long(int value);
13710Sstevel@tonic-gate const char *SSL_alert_desc_string(int value);
13720Sstevel@tonic-gate 
13730Sstevel@tonic-gate void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list);
13740Sstevel@tonic-gate void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list);
13750Sstevel@tonic-gate STACK_OF(X509_NAME) *SSL_get_client_CA_list(SSL *s);
13760Sstevel@tonic-gate STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(SSL_CTX *s);
13770Sstevel@tonic-gate int SSL_add_client_CA(SSL *ssl,X509 *x);
13780Sstevel@tonic-gate int SSL_CTX_add_client_CA(SSL_CTX *ctx,X509 *x);
13790Sstevel@tonic-gate 
13800Sstevel@tonic-gate void SSL_set_connect_state(SSL *s);
13810Sstevel@tonic-gate void SSL_set_accept_state(SSL *s);
13820Sstevel@tonic-gate 
13830Sstevel@tonic-gate long SSL_get_default_timeout(SSL *s);
13840Sstevel@tonic-gate 
13850Sstevel@tonic-gate int SSL_library_init(void );
13860Sstevel@tonic-gate 
13870Sstevel@tonic-gate char *SSL_CIPHER_description(SSL_CIPHER *,char *buf,int size);
13880Sstevel@tonic-gate STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk);
13890Sstevel@tonic-gate 
13900Sstevel@tonic-gate SSL *SSL_dup(SSL *ssl);
13910Sstevel@tonic-gate 
13920Sstevel@tonic-gate X509 *SSL_get_certificate(SSL *ssl);
13930Sstevel@tonic-gate /* EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(SSL *ssl);
13940Sstevel@tonic-gate 
13950Sstevel@tonic-gate void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx,int mode);
13960Sstevel@tonic-gate int SSL_CTX_get_quiet_shutdown(SSL_CTX *ctx);
13970Sstevel@tonic-gate void SSL_set_quiet_shutdown(SSL *ssl,int mode);
13980Sstevel@tonic-gate int SSL_get_quiet_shutdown(SSL *ssl);
13990Sstevel@tonic-gate void SSL_set_shutdown(SSL *ssl,int mode);
14000Sstevel@tonic-gate int SSL_get_shutdown(SSL *ssl);
14010Sstevel@tonic-gate int SSL_version(SSL *ssl);
14020Sstevel@tonic-gate int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx);
14030Sstevel@tonic-gate int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
14040Sstevel@tonic-gate 	const char *CApath);
14050Sstevel@tonic-gate #define SSL_get0_session SSL_get_session /* just peek at pointer */
14060Sstevel@tonic-gate SSL_SESSION *SSL_get_session(SSL *ssl);
14070Sstevel@tonic-gate SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */
14080Sstevel@tonic-gate SSL_CTX *SSL_get_SSL_CTX(SSL *ssl);
14090Sstevel@tonic-gate void SSL_set_info_callback(SSL *ssl,
14100Sstevel@tonic-gate 			   void (*cb)(const SSL *ssl,int type,int val));
14110Sstevel@tonic-gate void (*SSL_get_info_callback(SSL *ssl))(const SSL *ssl,int type,int val);
14120Sstevel@tonic-gate int SSL_state(SSL *ssl);
14130Sstevel@tonic-gate 
14140Sstevel@tonic-gate void SSL_set_verify_result(SSL *ssl,long v);
14150Sstevel@tonic-gate long SSL_get_verify_result(SSL *ssl);
14160Sstevel@tonic-gate 
14170Sstevel@tonic-gate int SSL_set_ex_data(SSL *ssl,int idx,void *data);
14180Sstevel@tonic-gate void *SSL_get_ex_data(SSL *ssl,int idx);
14190Sstevel@tonic-gate int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
14200Sstevel@tonic-gate 	CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
14210Sstevel@tonic-gate 
14220Sstevel@tonic-gate int SSL_SESSION_set_ex_data(SSL_SESSION *ss,int idx,void *data);
14230Sstevel@tonic-gate void *SSL_SESSION_get_ex_data(SSL_SESSION *ss,int idx);
14240Sstevel@tonic-gate int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
14250Sstevel@tonic-gate 	CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
14260Sstevel@tonic-gate 
14270Sstevel@tonic-gate int SSL_CTX_set_ex_data(SSL_CTX *ssl,int idx,void *data);
14280Sstevel@tonic-gate void *SSL_CTX_get_ex_data(SSL_CTX *ssl,int idx);
14290Sstevel@tonic-gate int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
14300Sstevel@tonic-gate 	CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
14310Sstevel@tonic-gate 
14320Sstevel@tonic-gate int SSL_get_ex_data_X509_STORE_CTX_idx(void );
14330Sstevel@tonic-gate 
14340Sstevel@tonic-gate #define SSL_CTX_sess_set_cache_size(ctx,t) \
14350Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL)
14360Sstevel@tonic-gate #define SSL_CTX_sess_get_cache_size(ctx) \
14370Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL)
14380Sstevel@tonic-gate #define SSL_CTX_set_session_cache_mode(ctx,m) \
14390Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL)
14400Sstevel@tonic-gate #define SSL_CTX_get_session_cache_mode(ctx) \
14410Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL)
14420Sstevel@tonic-gate 
14430Sstevel@tonic-gate #define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx)
14440Sstevel@tonic-gate #define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m)
14450Sstevel@tonic-gate #define SSL_CTX_get_read_ahead(ctx) \
14460Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL)
14470Sstevel@tonic-gate #define SSL_CTX_set_read_ahead(ctx,m) \
14480Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL)
14490Sstevel@tonic-gate #define SSL_CTX_get_max_cert_list(ctx) \
14500Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)
14510Sstevel@tonic-gate #define SSL_CTX_set_max_cert_list(ctx,m) \
14520Sstevel@tonic-gate 	SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)
14530Sstevel@tonic-gate #define SSL_get_max_cert_list(ssl) \
14540Sstevel@tonic-gate 	SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)
14550Sstevel@tonic-gate #define SSL_set_max_cert_list(ssl,m) \
14560Sstevel@tonic-gate 	SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)
14570Sstevel@tonic-gate 
14580Sstevel@tonic-gate      /* NB: the keylength is only applicable when is_export is true */
14590Sstevel@tonic-gate #ifndef OPENSSL_NO_RSA
14600Sstevel@tonic-gate void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,
14610Sstevel@tonic-gate 				  RSA *(*cb)(SSL *ssl,int is_export,
14620Sstevel@tonic-gate 					     int keylength));
14630Sstevel@tonic-gate 
14640Sstevel@tonic-gate void SSL_set_tmp_rsa_callback(SSL *ssl,
14650Sstevel@tonic-gate 				  RSA *(*cb)(SSL *ssl,int is_export,
14660Sstevel@tonic-gate 					     int keylength));
14670Sstevel@tonic-gate #endif
14680Sstevel@tonic-gate #ifndef OPENSSL_NO_DH
14690Sstevel@tonic-gate void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,
14700Sstevel@tonic-gate 				 DH *(*dh)(SSL *ssl,int is_export,
14710Sstevel@tonic-gate 					   int keylength));
14720Sstevel@tonic-gate void SSL_set_tmp_dh_callback(SSL *ssl,
14730Sstevel@tonic-gate 				 DH *(*dh)(SSL *ssl,int is_export,
14740Sstevel@tonic-gate 					   int keylength));
14750Sstevel@tonic-gate #endif
14760Sstevel@tonic-gate 
14770Sstevel@tonic-gate #ifndef OPENSSL_NO_COMP
14780Sstevel@tonic-gate int SSL_COMP_add_compression_method(int id,COMP_METHOD *cm);
14790Sstevel@tonic-gate #else
14800Sstevel@tonic-gate int SSL_COMP_add_compression_method(int id,char *cm);
14810Sstevel@tonic-gate #endif
14820Sstevel@tonic-gate 
14830Sstevel@tonic-gate /* BEGIN ERROR CODES */
14840Sstevel@tonic-gate /* The following lines are auto generated by the script mkerr.pl. Any changes
14850Sstevel@tonic-gate  * made after this point may be overwritten when the script is next run.
14860Sstevel@tonic-gate  */
14870Sstevel@tonic-gate void ERR_load_SSL_strings(void);
14880Sstevel@tonic-gate 
14890Sstevel@tonic-gate /* Error codes for the SSL functions. */
14900Sstevel@tonic-gate 
14910Sstevel@tonic-gate /* Function codes. */
14920Sstevel@tonic-gate #define SSL_F_CLIENT_CERTIFICATE			 100
14930Sstevel@tonic-gate #define SSL_F_CLIENT_FINISHED				 238
14940Sstevel@tonic-gate #define SSL_F_CLIENT_HELLO				 101
14950Sstevel@tonic-gate #define SSL_F_CLIENT_MASTER_KEY				 102
14960Sstevel@tonic-gate #define SSL_F_D2I_SSL_SESSION				 103
14970Sstevel@tonic-gate #define SSL_F_DO_SSL3_WRITE				 104
14980Sstevel@tonic-gate #define SSL_F_GET_CLIENT_FINISHED			 105
14990Sstevel@tonic-gate #define SSL_F_GET_CLIENT_HELLO				 106
15000Sstevel@tonic-gate #define SSL_F_GET_CLIENT_MASTER_KEY			 107
15010Sstevel@tonic-gate #define SSL_F_GET_SERVER_FINISHED			 108
15020Sstevel@tonic-gate #define SSL_F_GET_SERVER_HELLO				 109
15030Sstevel@tonic-gate #define SSL_F_GET_SERVER_VERIFY				 110
15040Sstevel@tonic-gate #define SSL_F_I2D_SSL_SESSION				 111
15050Sstevel@tonic-gate #define SSL_F_READ_N					 112
15060Sstevel@tonic-gate #define SSL_F_REQUEST_CERTIFICATE			 113
15070Sstevel@tonic-gate #define SSL_F_SERVER_FINISH				 239
15080Sstevel@tonic-gate #define SSL_F_SERVER_HELLO				 114
15090Sstevel@tonic-gate #define SSL_F_SERVER_VERIFY				 240
15100Sstevel@tonic-gate #define SSL_F_SSL23_ACCEPT				 115
15110Sstevel@tonic-gate #define SSL_F_SSL23_CLIENT_HELLO			 116
15120Sstevel@tonic-gate #define SSL_F_SSL23_CONNECT				 117
15130Sstevel@tonic-gate #define SSL_F_SSL23_GET_CLIENT_HELLO			 118
15140Sstevel@tonic-gate #define SSL_F_SSL23_GET_SERVER_HELLO			 119
15150Sstevel@tonic-gate #define SSL_F_SSL23_PEEK				 237
15160Sstevel@tonic-gate #define SSL_F_SSL23_READ				 120
15170Sstevel@tonic-gate #define SSL_F_SSL23_WRITE				 121
15180Sstevel@tonic-gate #define SSL_F_SSL2_ACCEPT				 122
15190Sstevel@tonic-gate #define SSL_F_SSL2_CONNECT				 123
15200Sstevel@tonic-gate #define SSL_F_SSL2_ENC_INIT				 124
15210Sstevel@tonic-gate #define SSL_F_SSL2_GENERATE_KEY_MATERIAL		 241
15220Sstevel@tonic-gate #define SSL_F_SSL2_PEEK					 234
15230Sstevel@tonic-gate #define SSL_F_SSL2_READ					 125
15240Sstevel@tonic-gate #define SSL_F_SSL2_READ_INTERNAL			 236
15250Sstevel@tonic-gate #define SSL_F_SSL2_SET_CERTIFICATE			 126
15260Sstevel@tonic-gate #define SSL_F_SSL2_WRITE				 127
15270Sstevel@tonic-gate #define SSL_F_SSL3_ACCEPT				 128
15280Sstevel@tonic-gate #define SSL_F_SSL3_CALLBACK_CTRL			 233
15290Sstevel@tonic-gate #define SSL_F_SSL3_CHANGE_CIPHER_STATE			 129
15300Sstevel@tonic-gate #define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM		 130
15310Sstevel@tonic-gate #define SSL_F_SSL3_CLIENT_HELLO				 131
15320Sstevel@tonic-gate #define SSL_F_SSL3_CONNECT				 132
15330Sstevel@tonic-gate #define SSL_F_SSL3_CTRL					 213
15340Sstevel@tonic-gate #define SSL_F_SSL3_CTX_CTRL				 133
15350Sstevel@tonic-gate #define SSL_F_SSL3_ENC					 134
15360Sstevel@tonic-gate #define SSL_F_SSL3_GENERATE_KEY_BLOCK			 238
15370Sstevel@tonic-gate #define SSL_F_SSL3_GET_CERTIFICATE_REQUEST		 135
15380Sstevel@tonic-gate #define SSL_F_SSL3_GET_CERT_VERIFY			 136
15390Sstevel@tonic-gate #define SSL_F_SSL3_GET_CLIENT_CERTIFICATE		 137
15400Sstevel@tonic-gate #define SSL_F_SSL3_GET_CLIENT_HELLO			 138
15410Sstevel@tonic-gate #define SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE		 139
15420Sstevel@tonic-gate #define SSL_F_SSL3_GET_FINISHED				 140
15430Sstevel@tonic-gate #define SSL_F_SSL3_GET_KEY_EXCHANGE			 141
15440Sstevel@tonic-gate #define SSL_F_SSL3_GET_MESSAGE				 142
15450Sstevel@tonic-gate #define SSL_F_SSL3_GET_RECORD				 143
15460Sstevel@tonic-gate #define SSL_F_SSL3_GET_SERVER_CERTIFICATE		 144
15470Sstevel@tonic-gate #define SSL_F_SSL3_GET_SERVER_DONE			 145
15480Sstevel@tonic-gate #define SSL_F_SSL3_GET_SERVER_HELLO			 146
15490Sstevel@tonic-gate #define SSL_F_SSL3_OUTPUT_CERT_CHAIN			 147
15500Sstevel@tonic-gate #define SSL_F_SSL3_PEEK					 235
15510Sstevel@tonic-gate #define SSL_F_SSL3_READ_BYTES				 148
15520Sstevel@tonic-gate #define SSL_F_SSL3_READ_N				 149
15530Sstevel@tonic-gate #define SSL_F_SSL3_SEND_CERTIFICATE_REQUEST		 150
15540Sstevel@tonic-gate #define SSL_F_SSL3_SEND_CLIENT_CERTIFICATE		 151
15550Sstevel@tonic-gate #define SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE		 152
15560Sstevel@tonic-gate #define SSL_F_SSL3_SEND_CLIENT_VERIFY			 153
15570Sstevel@tonic-gate #define SSL_F_SSL3_SEND_SERVER_CERTIFICATE		 154
15580Sstevel@tonic-gate #define SSL_F_SSL3_SEND_SERVER_HELLO			 242
15590Sstevel@tonic-gate #define SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE		 155
15600Sstevel@tonic-gate #define SSL_F_SSL3_SETUP_BUFFERS			 156
15610Sstevel@tonic-gate #define SSL_F_SSL3_SETUP_KEY_BLOCK			 157
15620Sstevel@tonic-gate #define SSL_F_SSL3_WRITE_BYTES				 158
15630Sstevel@tonic-gate #define SSL_F_SSL3_WRITE_PENDING			 159
15640Sstevel@tonic-gate #define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK	 215
15650Sstevel@tonic-gate #define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK	 216
15660Sstevel@tonic-gate #define SSL_F_SSL_BAD_METHOD				 160
15670Sstevel@tonic-gate #define SSL_F_SSL_BYTES_TO_CIPHER_LIST			 161
15680Sstevel@tonic-gate #define SSL_F_SSL_CERT_DUP				 221
15690Sstevel@tonic-gate #define SSL_F_SSL_CERT_INST				 222
15700Sstevel@tonic-gate #define SSL_F_SSL_CERT_INSTANTIATE			 214
15710Sstevel@tonic-gate #define SSL_F_SSL_CERT_NEW				 162
15720Sstevel@tonic-gate #define SSL_F_SSL_CHECK_PRIVATE_KEY			 163
15730Sstevel@tonic-gate #define SSL_F_SSL_CIPHER_PROCESS_RULESTR		 230
15740Sstevel@tonic-gate #define SSL_F_SSL_CIPHER_STRENGTH_SORT			 231
15750Sstevel@tonic-gate #define SSL_F_SSL_CLEAR					 164
15760Sstevel@tonic-gate #define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD		 165
15770Sstevel@tonic-gate #define SSL_F_SSL_CREATE_CIPHER_LIST			 166
15780Sstevel@tonic-gate #define SSL_F_SSL_CTRL					 232
15790Sstevel@tonic-gate #define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY			 168
15800Sstevel@tonic-gate #define SSL_F_SSL_CTX_NEW				 169
15810Sstevel@tonic-gate #define SSL_F_SSL_CTX_SET_PURPOSE			 226
15820Sstevel@tonic-gate #define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT		 219
15830Sstevel@tonic-gate #define SSL_F_SSL_CTX_SET_SSL_VERSION			 170
15840Sstevel@tonic-gate #define SSL_F_SSL_CTX_SET_TRUST				 229
15850Sstevel@tonic-gate #define SSL_F_SSL_CTX_USE_CERTIFICATE			 171
15860Sstevel@tonic-gate #define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1		 172
15870Sstevel@tonic-gate #define SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE	 220
15880Sstevel@tonic-gate #define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE		 173
15890Sstevel@tonic-gate #define SSL_F_SSL_CTX_USE_PRIVATEKEY			 174
15900Sstevel@tonic-gate #define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1		 175
15910Sstevel@tonic-gate #define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE		 176
15920Sstevel@tonic-gate #define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY			 177
15930Sstevel@tonic-gate #define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1		 178
15940Sstevel@tonic-gate #define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE		 179
15950Sstevel@tonic-gate #define SSL_F_SSL_DO_HANDSHAKE				 180
15960Sstevel@tonic-gate #define SSL_F_SSL_GET_NEW_SESSION			 181
15970Sstevel@tonic-gate #define SSL_F_SSL_GET_PREV_SESSION			 217
15980Sstevel@tonic-gate #define SSL_F_SSL_GET_SERVER_SEND_CERT			 182
15990Sstevel@tonic-gate #define SSL_F_SSL_GET_SIGN_PKEY				 183
16000Sstevel@tonic-gate #define SSL_F_SSL_INIT_WBIO_BUFFER			 184
16010Sstevel@tonic-gate #define SSL_F_SSL_LOAD_CLIENT_CA_FILE			 185
16020Sstevel@tonic-gate #define SSL_F_SSL_NEW					 186
16030Sstevel@tonic-gate #define SSL_F_SSL_READ					 223
16040Sstevel@tonic-gate #define SSL_F_SSL_RSA_PRIVATE_DECRYPT			 187
16050Sstevel@tonic-gate #define SSL_F_SSL_RSA_PUBLIC_ENCRYPT			 188
16060Sstevel@tonic-gate #define SSL_F_SSL_SESSION_NEW				 189
16070Sstevel@tonic-gate #define SSL_F_SSL_SESSION_PRINT_FP			 190
16080Sstevel@tonic-gate #define SSL_F_SSL_SESS_CERT_NEW				 225
16090Sstevel@tonic-gate #define SSL_F_SSL_SET_CERT				 191
16100Sstevel@tonic-gate #define SSL_F_SSL_SET_FD				 192
16110Sstevel@tonic-gate #define SSL_F_SSL_SET_PKEY				 193
16120Sstevel@tonic-gate #define SSL_F_SSL_SET_PURPOSE				 227
16130Sstevel@tonic-gate #define SSL_F_SSL_SET_RFD				 194
16140Sstevel@tonic-gate #define SSL_F_SSL_SET_SESSION				 195
16150Sstevel@tonic-gate #define SSL_F_SSL_SET_SESSION_ID_CONTEXT		 218
16160Sstevel@tonic-gate #define SSL_F_SSL_SET_TRUST				 228
16170Sstevel@tonic-gate #define SSL_F_SSL_SET_WFD				 196
16180Sstevel@tonic-gate #define SSL_F_SSL_SHUTDOWN				 224
16190Sstevel@tonic-gate #define SSL_F_SSL_UNDEFINED_FUNCTION			 197
16200Sstevel@tonic-gate #define SSL_F_SSL_USE_CERTIFICATE			 198
16210Sstevel@tonic-gate #define SSL_F_SSL_USE_CERTIFICATE_ASN1			 199
16220Sstevel@tonic-gate #define SSL_F_SSL_USE_CERTIFICATE_FILE			 200
16230Sstevel@tonic-gate #define SSL_F_SSL_USE_PRIVATEKEY			 201
16240Sstevel@tonic-gate #define SSL_F_SSL_USE_PRIVATEKEY_ASN1			 202
16250Sstevel@tonic-gate #define SSL_F_SSL_USE_PRIVATEKEY_FILE			 203
16260Sstevel@tonic-gate #define SSL_F_SSL_USE_RSAPRIVATEKEY			 204
16270Sstevel@tonic-gate #define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1		 205
16280Sstevel@tonic-gate #define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE		 206
16290Sstevel@tonic-gate #define SSL_F_SSL_VERIFY_CERT_CHAIN			 207
16300Sstevel@tonic-gate #define SSL_F_SSL_WRITE					 208
16310Sstevel@tonic-gate #define SSL_F_TLS1_CHANGE_CIPHER_STATE			 209
16320Sstevel@tonic-gate #define SSL_F_TLS1_ENC					 210
16330Sstevel@tonic-gate #define SSL_F_TLS1_SETUP_KEY_BLOCK			 211
16340Sstevel@tonic-gate #define SSL_F_WRITE_PENDING				 212
16350Sstevel@tonic-gate 
16360Sstevel@tonic-gate /* Reason codes. */
16370Sstevel@tonic-gate #define SSL_R_APP_DATA_IN_HANDSHAKE			 100
16380Sstevel@tonic-gate #define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272
16390Sstevel@tonic-gate #define SSL_R_BAD_ALERT_RECORD				 101
16400Sstevel@tonic-gate #define SSL_R_BAD_AUTHENTICATION_TYPE			 102
16410Sstevel@tonic-gate #define SSL_R_BAD_CHANGE_CIPHER_SPEC			 103
16420Sstevel@tonic-gate #define SSL_R_BAD_CHECKSUM				 104
16430Sstevel@tonic-gate #define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK		 106
16440Sstevel@tonic-gate #define SSL_R_BAD_DECOMPRESSION				 107
16450Sstevel@tonic-gate #define SSL_R_BAD_DH_G_LENGTH				 108
16460Sstevel@tonic-gate #define SSL_R_BAD_DH_PUB_KEY_LENGTH			 109
16470Sstevel@tonic-gate #define SSL_R_BAD_DH_P_LENGTH				 110
16480Sstevel@tonic-gate #define SSL_R_BAD_DIGEST_LENGTH				 111
16490Sstevel@tonic-gate #define SSL_R_BAD_DSA_SIGNATURE				 112
16500Sstevel@tonic-gate #define SSL_R_BAD_HELLO_REQUEST				 105
16510Sstevel@tonic-gate #define SSL_R_BAD_LENGTH				 271
16520Sstevel@tonic-gate #define SSL_R_BAD_MAC_DECODE				 113
16530Sstevel@tonic-gate #define SSL_R_BAD_MESSAGE_TYPE				 114
16540Sstevel@tonic-gate #define SSL_R_BAD_PACKET_LENGTH				 115
16550Sstevel@tonic-gate #define SSL_R_BAD_PROTOCOL_VERSION_NUMBER		 116
16560Sstevel@tonic-gate #define SSL_R_BAD_RESPONSE_ARGUMENT			 117
16570Sstevel@tonic-gate #define SSL_R_BAD_RSA_DECRYPT				 118
16580Sstevel@tonic-gate #define SSL_R_BAD_RSA_ENCRYPT				 119
16590Sstevel@tonic-gate #define SSL_R_BAD_RSA_E_LENGTH				 120
16600Sstevel@tonic-gate #define SSL_R_BAD_RSA_MODULUS_LENGTH			 121
16610Sstevel@tonic-gate #define SSL_R_BAD_RSA_SIGNATURE				 122
16620Sstevel@tonic-gate #define SSL_R_BAD_SIGNATURE				 123
16630Sstevel@tonic-gate #define SSL_R_BAD_SSL_FILETYPE				 124
16640Sstevel@tonic-gate #define SSL_R_BAD_SSL_SESSION_ID_LENGTH			 125
16650Sstevel@tonic-gate #define SSL_R_BAD_STATE					 126
16660Sstevel@tonic-gate #define SSL_R_BAD_WRITE_RETRY				 127
16670Sstevel@tonic-gate #define SSL_R_BIO_NOT_SET				 128
16680Sstevel@tonic-gate #define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG			 129
16690Sstevel@tonic-gate #define SSL_R_BN_LIB					 130
16700Sstevel@tonic-gate #define SSL_R_CA_DN_LENGTH_MISMATCH			 131
16710Sstevel@tonic-gate #define SSL_R_CA_DN_TOO_LONG				 132
16720Sstevel@tonic-gate #define SSL_R_CCS_RECEIVED_EARLY			 133
16730Sstevel@tonic-gate #define SSL_R_CERTIFICATE_VERIFY_FAILED			 134
16740Sstevel@tonic-gate #define SSL_R_CERT_LENGTH_MISMATCH			 135
16750Sstevel@tonic-gate #define SSL_R_CHALLENGE_IS_DIFFERENT			 136
16760Sstevel@tonic-gate #define SSL_R_CIPHER_CODE_WRONG_LENGTH			 137
16770Sstevel@tonic-gate #define SSL_R_CIPHER_OR_HASH_UNAVAILABLE		 138
16780Sstevel@tonic-gate #define SSL_R_CIPHER_TABLE_SRC_ERROR			 139
16790Sstevel@tonic-gate #define SSL_R_COMPRESSED_LENGTH_TOO_LONG		 140
16800Sstevel@tonic-gate #define SSL_R_COMPRESSION_FAILURE			 141
16810Sstevel@tonic-gate #define SSL_R_COMPRESSION_LIBRARY_ERROR			 142
16820Sstevel@tonic-gate #define SSL_R_CONNECTION_ID_IS_DIFFERENT		 143
16830Sstevel@tonic-gate #define SSL_R_CONNECTION_TYPE_NOT_SET			 144
16840Sstevel@tonic-gate #define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED		 145
16850Sstevel@tonic-gate #define SSL_R_DATA_LENGTH_TOO_LONG			 146
16860Sstevel@tonic-gate #define SSL_R_DECRYPTION_FAILED				 147
16870Sstevel@tonic-gate #define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC	 1109
16880Sstevel@tonic-gate #define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG		 148
16890Sstevel@tonic-gate #define SSL_R_DIGEST_CHECK_FAILED			 149
16900Sstevel@tonic-gate #define SSL_R_ENCRYPTED_LENGTH_TOO_LONG			 150
16910Sstevel@tonic-gate #define SSL_R_ERROR_GENERATING_TMP_RSA_KEY		 1092
16920Sstevel@tonic-gate #define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST		 151
16930Sstevel@tonic-gate #define SSL_R_EXCESSIVE_MESSAGE_SIZE			 152
16940Sstevel@tonic-gate #define SSL_R_EXTRA_DATA_IN_MESSAGE			 153
16950Sstevel@tonic-gate #define SSL_R_GOT_A_FIN_BEFORE_A_CCS			 154
16960Sstevel@tonic-gate #define SSL_R_HTTPS_PROXY_REQUEST			 155
16970Sstevel@tonic-gate #define SSL_R_HTTP_REQUEST				 156
16980Sstevel@tonic-gate #define SSL_R_ILLEGAL_PADDING				 1110
16990Sstevel@tonic-gate #define SSL_R_INVALID_CHALLENGE_LENGTH			 158
17000Sstevel@tonic-gate #define SSL_R_INVALID_COMMAND				 280
17010Sstevel@tonic-gate #define SSL_R_INVALID_PURPOSE				 278
17020Sstevel@tonic-gate #define SSL_R_INVALID_TRUST				 279
17030Sstevel@tonic-gate #define SSL_R_KEY_ARG_TOO_LONG				 1112
17040Sstevel@tonic-gate #define SSL_R_KRB5					 1104
17050Sstevel@tonic-gate #define SSL_R_KRB5_C_CC_PRINC				 1094
17060Sstevel@tonic-gate #define SSL_R_KRB5_C_GET_CRED				 1095
17070Sstevel@tonic-gate #define SSL_R_KRB5_C_INIT				 1096
17080Sstevel@tonic-gate #define SSL_R_KRB5_C_MK_REQ				 1097
17090Sstevel@tonic-gate #define SSL_R_KRB5_S_BAD_TICKET				 1098
17100Sstevel@tonic-gate #define SSL_R_KRB5_S_INIT				 1099
17110Sstevel@tonic-gate #define SSL_R_KRB5_S_RD_REQ				 1108
17120Sstevel@tonic-gate #define SSL_R_KRB5_S_TKT_EXPIRED			 1105
17130Sstevel@tonic-gate #define SSL_R_KRB5_S_TKT_NYV				 1106
17140Sstevel@tonic-gate #define SSL_R_KRB5_S_TKT_SKEW				 1107
17150Sstevel@tonic-gate #define SSL_R_LENGTH_MISMATCH				 159
17160Sstevel@tonic-gate #define SSL_R_LENGTH_TOO_SHORT				 160
17170Sstevel@tonic-gate #define SSL_R_LIBRARY_BUG				 274
17180Sstevel@tonic-gate #define SSL_R_LIBRARY_HAS_NO_CIPHERS			 161
17190Sstevel@tonic-gate #define SSL_R_MASTER_KEY_TOO_LONG			 1112
17200Sstevel@tonic-gate #define SSL_R_MESSAGE_TOO_LONG				 1111
17210Sstevel@tonic-gate #define SSL_R_MISSING_DH_DSA_CERT			 162
17220Sstevel@tonic-gate #define SSL_R_MISSING_DH_KEY				 163
17230Sstevel@tonic-gate #define SSL_R_MISSING_DH_RSA_CERT			 164
17240Sstevel@tonic-gate #define SSL_R_MISSING_DSA_SIGNING_CERT			 165
17250Sstevel@tonic-gate #define SSL_R_MISSING_EXPORT_TMP_DH_KEY			 166
17260Sstevel@tonic-gate #define SSL_R_MISSING_EXPORT_TMP_RSA_KEY		 167
17270Sstevel@tonic-gate #define SSL_R_MISSING_RSA_CERTIFICATE			 168
17280Sstevel@tonic-gate #define SSL_R_MISSING_RSA_ENCRYPTING_CERT		 169
17290Sstevel@tonic-gate #define SSL_R_MISSING_RSA_SIGNING_CERT			 170
17300Sstevel@tonic-gate #define SSL_R_MISSING_TMP_DH_KEY			 171
17310Sstevel@tonic-gate #define SSL_R_MISSING_TMP_RSA_KEY			 172
17320Sstevel@tonic-gate #define SSL_R_MISSING_TMP_RSA_PKEY			 173
17330Sstevel@tonic-gate #define SSL_R_MISSING_VERIFY_MESSAGE			 174
17340Sstevel@tonic-gate #define SSL_R_NON_SSLV2_INITIAL_PACKET			 175
17350Sstevel@tonic-gate #define SSL_R_NO_CERTIFICATES_RETURNED			 176
17360Sstevel@tonic-gate #define SSL_R_NO_CERTIFICATE_ASSIGNED			 177
17370Sstevel@tonic-gate #define SSL_R_NO_CERTIFICATE_RETURNED			 178
17380Sstevel@tonic-gate #define SSL_R_NO_CERTIFICATE_SET			 179
17390Sstevel@tonic-gate #define SSL_R_NO_CERTIFICATE_SPECIFIED			 180
17400Sstevel@tonic-gate #define SSL_R_NO_CIPHERS_AVAILABLE			 181
17410Sstevel@tonic-gate #define SSL_R_NO_CIPHERS_PASSED				 182
17420Sstevel@tonic-gate #define SSL_R_NO_CIPHERS_SPECIFIED			 183
17430Sstevel@tonic-gate #define SSL_R_NO_CIPHER_LIST				 184
17440Sstevel@tonic-gate #define SSL_R_NO_CIPHER_MATCH				 185
17450Sstevel@tonic-gate #define SSL_R_NO_CLIENT_CERT_RECEIVED			 186
17460Sstevel@tonic-gate #define SSL_R_NO_COMPRESSION_SPECIFIED			 187
17470Sstevel@tonic-gate #define SSL_R_NO_METHOD_SPECIFIED			 188
17480Sstevel@tonic-gate #define SSL_R_NO_PRIVATEKEY				 189
17490Sstevel@tonic-gate #define SSL_R_NO_PRIVATE_KEY_ASSIGNED			 190
17500Sstevel@tonic-gate #define SSL_R_NO_PROTOCOLS_AVAILABLE			 191
17510Sstevel@tonic-gate #define SSL_R_NO_PUBLICKEY				 192
17520Sstevel@tonic-gate #define SSL_R_NO_SHARED_CIPHER				 193
17530Sstevel@tonic-gate #define SSL_R_NO_VERIFY_CALLBACK			 194
17540Sstevel@tonic-gate #define SSL_R_NULL_SSL_CTX				 195
17550Sstevel@tonic-gate #define SSL_R_NULL_SSL_METHOD_PASSED			 196
17560Sstevel@tonic-gate #define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED		 197
17570Sstevel@tonic-gate #define SSL_R_PACKET_LENGTH_TOO_LONG			 198
17580Sstevel@tonic-gate #define SSL_R_PATH_TOO_LONG				 270
17590Sstevel@tonic-gate #define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE		 199
17600Sstevel@tonic-gate #define SSL_R_PEER_ERROR				 200
17610Sstevel@tonic-gate #define SSL_R_PEER_ERROR_CERTIFICATE			 201
17620Sstevel@tonic-gate #define SSL_R_PEER_ERROR_NO_CERTIFICATE			 202
17630Sstevel@tonic-gate #define SSL_R_PEER_ERROR_NO_CIPHER			 203
17640Sstevel@tonic-gate #define SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE	 204
17650Sstevel@tonic-gate #define SSL_R_PRE_MAC_LENGTH_TOO_LONG			 205
17660Sstevel@tonic-gate #define SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS		 206
17670Sstevel@tonic-gate #define SSL_R_PROTOCOL_IS_SHUTDOWN			 207
17680Sstevel@tonic-gate #define SSL_R_PUBLIC_KEY_ENCRYPT_ERROR			 208
17690Sstevel@tonic-gate #define SSL_R_PUBLIC_KEY_IS_NOT_RSA			 209
17700Sstevel@tonic-gate #define SSL_R_PUBLIC_KEY_NOT_RSA			 210
17710Sstevel@tonic-gate #define SSL_R_READ_BIO_NOT_SET				 211
17720Sstevel@tonic-gate #define SSL_R_READ_WRONG_PACKET_TYPE			 212
17730Sstevel@tonic-gate #define SSL_R_RECORD_LENGTH_MISMATCH			 213
17740Sstevel@tonic-gate #define SSL_R_RECORD_TOO_LARGE				 214
17750Sstevel@tonic-gate #define SSL_R_RECORD_TOO_SMALL				 1093
17760Sstevel@tonic-gate #define SSL_R_REQUIRED_CIPHER_MISSING			 215
17770Sstevel@tonic-gate #define SSL_R_REUSE_CERT_LENGTH_NOT_ZERO		 216
17780Sstevel@tonic-gate #define SSL_R_REUSE_CERT_TYPE_NOT_ZERO			 217
17790Sstevel@tonic-gate #define SSL_R_REUSE_CIPHER_LIST_NOT_ZERO		 218
17800Sstevel@tonic-gate #define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED		 277
17810Sstevel@tonic-gate #define SSL_R_SHORT_READ				 219
17820Sstevel@tonic-gate #define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE	 220
17830Sstevel@tonic-gate #define SSL_R_SSL23_DOING_SESSION_ID_REUSE		 221
17840Sstevel@tonic-gate #define SSL_R_SSL2_CONNECTION_ID_TOO_LONG		 1114
17850Sstevel@tonic-gate #define SSL_R_SSL3_SESSION_ID_TOO_LONG			 1113
17860Sstevel@tonic-gate #define SSL_R_SSL3_SESSION_ID_TOO_SHORT			 222
17870Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE		 1042
17880Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC		 1020
17890Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED		 1045
17900Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED		 1044
17910Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN		 1046
17920Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE		 1030
17930Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE		 1040
17940Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER		 1047
17950Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_NO_CERTIFICATE		 1041
17960Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_PEER_ERROR_CERTIFICATE	 223
17970Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_PEER_ERROR_NO_CERTIFICATE	 224
17980Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_PEER_ERROR_NO_CIPHER		 225
17990Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE 226
18000Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE		 1010
18010Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_UNKNOWN_REMOTE_ERROR_TYPE	 227
18020Sstevel@tonic-gate #define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE	 1043
18030Sstevel@tonic-gate #define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION	 228
18040Sstevel@tonic-gate #define SSL_R_SSL_HANDSHAKE_FAILURE			 229
18050Sstevel@tonic-gate #define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS		 230
18060Sstevel@tonic-gate #define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED		 1102
18070Sstevel@tonic-gate #define SSL_R_SSL_SESSION_ID_CONFLICT			 1103
18080Sstevel@tonic-gate #define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG		 273
18090Sstevel@tonic-gate #define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH		 1101
18100Sstevel@tonic-gate #define SSL_R_SSL_SESSION_ID_IS_DIFFERENT		 231
18110Sstevel@tonic-gate #define SSL_R_TLSV1_ALERT_ACCESS_DENIED			 1049
18120Sstevel@tonic-gate #define SSL_R_TLSV1_ALERT_DECODE_ERROR			 1050
18130Sstevel@tonic-gate #define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED		 1021
18140Sstevel@tonic-gate #define SSL_R_TLSV1_ALERT_DECRYPT_ERROR			 1051
18150Sstevel@tonic-gate #define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION		 1060
18160Sstevel@tonic-gate #define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY		 1071
18170Sstevel@tonic-gate #define SSL_R_TLSV1_ALERT_INTERNAL_ERROR		 1080
18180Sstevel@tonic-gate #define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION		 1100
18190Sstevel@tonic-gate #define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION		 1070
18200Sstevel@tonic-gate #define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW		 1022
18210Sstevel@tonic-gate #define SSL_R_TLSV1_ALERT_UNKNOWN_CA			 1048
18220Sstevel@tonic-gate #define SSL_R_TLSV1_ALERT_USER_CANCELLED		 1090
18230Sstevel@tonic-gate #define SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER	 232
18240Sstevel@tonic-gate #define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233
18250Sstevel@tonic-gate #define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG	 234
18260Sstevel@tonic-gate #define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER		 235
18270Sstevel@tonic-gate #define SSL_R_UNABLE_TO_DECODE_DH_CERTS			 236
18280Sstevel@tonic-gate #define SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY		 237
18290Sstevel@tonic-gate #define SSL_R_UNABLE_TO_FIND_DH_PARAMETERS		 238
18300Sstevel@tonic-gate #define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS	 239
18310Sstevel@tonic-gate #define SSL_R_UNABLE_TO_FIND_SSL_METHOD			 240
18320Sstevel@tonic-gate #define SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES		 241
18330Sstevel@tonic-gate #define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES		 242
18340Sstevel@tonic-gate #define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES		 243
18350Sstevel@tonic-gate #define SSL_R_UNEXPECTED_MESSAGE			 244
18360Sstevel@tonic-gate #define SSL_R_UNEXPECTED_RECORD				 245
18370Sstevel@tonic-gate #define SSL_R_UNINITIALIZED				 276
18380Sstevel@tonic-gate #define SSL_R_UNKNOWN_ALERT_TYPE			 246
18390Sstevel@tonic-gate #define SSL_R_UNKNOWN_CERTIFICATE_TYPE			 247
18400Sstevel@tonic-gate #define SSL_R_UNKNOWN_CIPHER_RETURNED			 248
18410Sstevel@tonic-gate #define SSL_R_UNKNOWN_CIPHER_TYPE			 249
18420Sstevel@tonic-gate #define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE			 250
18430Sstevel@tonic-gate #define SSL_R_UNKNOWN_PKEY_TYPE				 251
18440Sstevel@tonic-gate #define SSL_R_UNKNOWN_PROTOCOL				 252
18450Sstevel@tonic-gate #define SSL_R_UNKNOWN_REMOTE_ERROR_TYPE			 253
18460Sstevel@tonic-gate #define SSL_R_UNKNOWN_SSL_VERSION			 254
18470Sstevel@tonic-gate #define SSL_R_UNKNOWN_STATE				 255
18480Sstevel@tonic-gate #define SSL_R_UNSUPPORTED_CIPHER			 256
18490Sstevel@tonic-gate #define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM		 257
18500Sstevel@tonic-gate #define SSL_R_UNSUPPORTED_OPTION			 1091
18510Sstevel@tonic-gate #define SSL_R_UNSUPPORTED_PROTOCOL			 258
18520Sstevel@tonic-gate #define SSL_R_UNSUPPORTED_SSL_VERSION			 259
18530Sstevel@tonic-gate #define SSL_R_WRITE_BIO_NOT_SET				 260
18540Sstevel@tonic-gate #define SSL_R_WRONG_CIPHER_RETURNED			 261
18550Sstevel@tonic-gate #define SSL_R_WRONG_MESSAGE_TYPE			 262
18560Sstevel@tonic-gate #define SSL_R_WRONG_NUMBER_OF_KEY_BITS			 263
18570Sstevel@tonic-gate #define SSL_R_WRONG_SIGNATURE_LENGTH			 264
18580Sstevel@tonic-gate #define SSL_R_WRONG_SIGNATURE_SIZE			 265
18590Sstevel@tonic-gate #define SSL_R_WRONG_SSL_VERSION				 266
18600Sstevel@tonic-gate #define SSL_R_WRONG_VERSION_NUMBER			 267
18610Sstevel@tonic-gate #define SSL_R_X509_LIB					 268
18620Sstevel@tonic-gate #define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS		 269
18630Sstevel@tonic-gate 
18640Sstevel@tonic-gate #ifdef  __cplusplus
18650Sstevel@tonic-gate }
18660Sstevel@tonic-gate #endif
18670Sstevel@tonic-gate #endif
1868