xref: /dflybsd-src/crypto/libressl/include/openssl/ssl2.h (revision 72c3367655e64985522b7a48ddfab613e869dc68)
1*72c33676SMaxim Ag /* $OpenBSD: ssl2.h,v 1.12 2014/12/14 15:30:50 jsing Exp $ */
2f5b1c8a1SJohn Marino /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3f5b1c8a1SJohn Marino  * All rights reserved.
4f5b1c8a1SJohn Marino  *
5f5b1c8a1SJohn Marino  * This package is an SSL implementation written
6f5b1c8a1SJohn Marino  * by Eric Young (eay@cryptsoft.com).
7f5b1c8a1SJohn Marino  * The implementation was written so as to conform with Netscapes SSL.
8f5b1c8a1SJohn Marino  *
9f5b1c8a1SJohn Marino  * This library is free for commercial and non-commercial use as long as
10f5b1c8a1SJohn Marino  * the following conditions are aheared to.  The following conditions
11f5b1c8a1SJohn Marino  * apply to all code found in this distribution, be it the RC4, RSA,
12f5b1c8a1SJohn Marino  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
13f5b1c8a1SJohn Marino  * included with this distribution is covered by the same copyright terms
14f5b1c8a1SJohn Marino  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15f5b1c8a1SJohn Marino  *
16f5b1c8a1SJohn Marino  * Copyright remains Eric Young's, and as such any Copyright notices in
17f5b1c8a1SJohn Marino  * the code are not to be removed.
18f5b1c8a1SJohn Marino  * If this package is used in a product, Eric Young should be given attribution
19f5b1c8a1SJohn Marino  * as the author of the parts of the library used.
20f5b1c8a1SJohn Marino  * This can be in the form of a textual message at program startup or
21f5b1c8a1SJohn Marino  * in documentation (online or textual) provided with the package.
22f5b1c8a1SJohn Marino  *
23f5b1c8a1SJohn Marino  * Redistribution and use in source and binary forms, with or without
24f5b1c8a1SJohn Marino  * modification, are permitted provided that the following conditions
25f5b1c8a1SJohn Marino  * are met:
26f5b1c8a1SJohn Marino  * 1. Redistributions of source code must retain the copyright
27f5b1c8a1SJohn Marino  *    notice, this list of conditions and the following disclaimer.
28f5b1c8a1SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
29f5b1c8a1SJohn Marino  *    notice, this list of conditions and the following disclaimer in the
30f5b1c8a1SJohn Marino  *    documentation and/or other materials provided with the distribution.
31f5b1c8a1SJohn Marino  * 3. All advertising materials mentioning features or use of this software
32f5b1c8a1SJohn Marino  *    must display the following acknowledgement:
33f5b1c8a1SJohn Marino  *    "This product includes cryptographic software written by
34f5b1c8a1SJohn Marino  *     Eric Young (eay@cryptsoft.com)"
35f5b1c8a1SJohn Marino  *    The word 'cryptographic' can be left out if the rouines from the library
36f5b1c8a1SJohn Marino  *    being used are not cryptographic related :-).
37f5b1c8a1SJohn Marino  * 4. If you include any Windows specific code (or a derivative thereof) from
38f5b1c8a1SJohn Marino  *    the apps directory (application code) you must include an acknowledgement:
39f5b1c8a1SJohn Marino  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40f5b1c8a1SJohn Marino  *
41f5b1c8a1SJohn Marino  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42f5b1c8a1SJohn Marino  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43f5b1c8a1SJohn Marino  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44f5b1c8a1SJohn Marino  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45f5b1c8a1SJohn Marino  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46f5b1c8a1SJohn Marino  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47f5b1c8a1SJohn Marino  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48f5b1c8a1SJohn Marino  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49f5b1c8a1SJohn Marino  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50f5b1c8a1SJohn Marino  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51f5b1c8a1SJohn Marino  * SUCH DAMAGE.
52f5b1c8a1SJohn Marino  *
53f5b1c8a1SJohn Marino  * The licence and distribution terms for any publically available version or
54f5b1c8a1SJohn Marino  * derivative of this code cannot be changed.  i.e. this code cannot simply be
55f5b1c8a1SJohn Marino  * copied and put under another distribution licence
56f5b1c8a1SJohn Marino  * [including the GNU Public Licence.]
57f5b1c8a1SJohn Marino  */
58f5b1c8a1SJohn Marino 
59f5b1c8a1SJohn Marino #ifndef HEADER_SSL2_H
60f5b1c8a1SJohn Marino #define HEADER_SSL2_H
61f5b1c8a1SJohn Marino 
62f5b1c8a1SJohn Marino #ifdef  __cplusplus
63f5b1c8a1SJohn Marino extern "C" {
64f5b1c8a1SJohn Marino #endif
65f5b1c8a1SJohn Marino 
66f5b1c8a1SJohn Marino /* Protocol Version Codes */
67f5b1c8a1SJohn Marino #define SSL2_VERSION		0x0002
68f5b1c8a1SJohn Marino #define SSL2_VERSION_MAJOR	0x00
69f5b1c8a1SJohn Marino #define SSL2_VERSION_MINOR	0x02
70f5b1c8a1SJohn Marino /* #define SSL2_CLIENT_VERSION	0x0002 */
71f5b1c8a1SJohn Marino /* #define SSL2_SERVER_VERSION	0x0002 */
72f5b1c8a1SJohn Marino 
73f5b1c8a1SJohn Marino /* Protocol Message Codes */
74f5b1c8a1SJohn Marino #define SSL2_MT_ERROR			0
75f5b1c8a1SJohn Marino #define SSL2_MT_CLIENT_HELLO		1
76f5b1c8a1SJohn Marino #define SSL2_MT_CLIENT_MASTER_KEY	2
77f5b1c8a1SJohn Marino #define SSL2_MT_CLIENT_FINISHED		3
78f5b1c8a1SJohn Marino #define SSL2_MT_SERVER_HELLO		4
79f5b1c8a1SJohn Marino #define SSL2_MT_SERVER_VERIFY		5
80f5b1c8a1SJohn Marino #define SSL2_MT_SERVER_FINISHED		6
81f5b1c8a1SJohn Marino #define SSL2_MT_REQUEST_CERTIFICATE	7
82f5b1c8a1SJohn Marino #define SSL2_MT_CLIENT_CERTIFICATE	8
83f5b1c8a1SJohn Marino 
84f5b1c8a1SJohn Marino /* Error Message Codes */
85f5b1c8a1SJohn Marino #define SSL2_PE_UNDEFINED_ERROR		0x0000
86f5b1c8a1SJohn Marino #define SSL2_PE_NO_CIPHER		0x0001
87f5b1c8a1SJohn Marino #define SSL2_PE_NO_CERTIFICATE		0x0002
88f5b1c8a1SJohn Marino #define SSL2_PE_BAD_CERTIFICATE		0x0004
89f5b1c8a1SJohn Marino #define SSL2_PE_UNSUPPORTED_CERTIFICATE_TYPE 0x0006
90f5b1c8a1SJohn Marino 
91f5b1c8a1SJohn Marino /* Cipher Kind Values */
92f5b1c8a1SJohn Marino #define SSL2_CK_NULL_WITH_MD5			0x02000000 /* v3 */
93f5b1c8a1SJohn Marino #define SSL2_CK_RC4_128_WITH_MD5		0x02010080
94f5b1c8a1SJohn Marino #define SSL2_CK_RC4_128_EXPORT40_WITH_MD5	0x02020080
95f5b1c8a1SJohn Marino #define SSL2_CK_RC2_128_CBC_WITH_MD5		0x02030080
96f5b1c8a1SJohn Marino #define SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5	0x02040080
97f5b1c8a1SJohn Marino #define SSL2_CK_IDEA_128_CBC_WITH_MD5		0x02050080
98f5b1c8a1SJohn Marino #define SSL2_CK_DES_64_CBC_WITH_MD5		0x02060040
99f5b1c8a1SJohn Marino #define SSL2_CK_DES_64_CBC_WITH_SHA		0x02060140 /* v3 */
100f5b1c8a1SJohn Marino #define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5	0x020700c0
101f5b1c8a1SJohn Marino #define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA	0x020701c0 /* v3 */
102f5b1c8a1SJohn Marino #define SSL2_CK_RC4_64_WITH_MD5			0x02080080 /* MS hack */
103f5b1c8a1SJohn Marino 
104f5b1c8a1SJohn Marino #define SSL2_CK_DES_64_CFB64_WITH_MD5_1		0x02ff0800 /* SSLeay */
105f5b1c8a1SJohn Marino #define SSL2_CK_NULL				0x02ff0810 /* SSLeay */
106f5b1c8a1SJohn Marino 
107f5b1c8a1SJohn Marino #define SSL2_TXT_DES_64_CFB64_WITH_MD5_1	"DES-CFB-M1"
108f5b1c8a1SJohn Marino #define SSL2_TXT_NULL_WITH_MD5			"NULL-MD5"
109f5b1c8a1SJohn Marino #define SSL2_TXT_RC4_128_WITH_MD5		"RC4-MD5"
110f5b1c8a1SJohn Marino #define SSL2_TXT_RC4_128_EXPORT40_WITH_MD5	"EXP-RC4-MD5"
111f5b1c8a1SJohn Marino #define SSL2_TXT_RC2_128_CBC_WITH_MD5		"RC2-CBC-MD5"
112f5b1c8a1SJohn Marino #define SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5	"EXP-RC2-CBC-MD5"
113f5b1c8a1SJohn Marino #define SSL2_TXT_IDEA_128_CBC_WITH_MD5		"IDEA-CBC-MD5"
114f5b1c8a1SJohn Marino #define SSL2_TXT_DES_64_CBC_WITH_MD5		"DES-CBC-MD5"
115f5b1c8a1SJohn Marino #define SSL2_TXT_DES_64_CBC_WITH_SHA		"DES-CBC-SHA"
116f5b1c8a1SJohn Marino #define SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5	"DES-CBC3-MD5"
117f5b1c8a1SJohn Marino #define SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA	"DES-CBC3-SHA"
118f5b1c8a1SJohn Marino #define SSL2_TXT_RC4_64_WITH_MD5		"RC4-64-MD5"
119f5b1c8a1SJohn Marino 
120f5b1c8a1SJohn Marino #define SSL2_TXT_NULL				"NULL"
121f5b1c8a1SJohn Marino 
122f5b1c8a1SJohn Marino /* Flags for the SSL_CIPHER.algorithm2 field */
123f5b1c8a1SJohn Marino #define SSL2_CF_5_BYTE_ENC			0x01
124f5b1c8a1SJohn Marino #define SSL2_CF_8_BYTE_ENC			0x02
125f5b1c8a1SJohn Marino 
126f5b1c8a1SJohn Marino /* Certificate Type Codes */
127f5b1c8a1SJohn Marino #define SSL2_CT_X509_CERTIFICATE		0x01
128f5b1c8a1SJohn Marino 
129f5b1c8a1SJohn Marino /* Authentication Type Code */
130f5b1c8a1SJohn Marino #define SSL2_AT_MD5_WITH_RSA_ENCRYPTION		0x01
131f5b1c8a1SJohn Marino 
132f5b1c8a1SJohn Marino #define SSL2_MAX_SSL_SESSION_ID_LENGTH		32
133f5b1c8a1SJohn Marino 
134f5b1c8a1SJohn Marino /* Upper/Lower Bounds */
135f5b1c8a1SJohn Marino #define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS	256
136f5b1c8a1SJohn Marino #define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER	32767u	/* 2^15-1 */
137f5b1c8a1SJohn Marino #define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER	16383	/* 2^14-1 */
138f5b1c8a1SJohn Marino 
139f5b1c8a1SJohn Marino #define SSL2_CHALLENGE_LENGTH	16
140f5b1c8a1SJohn Marino /*#define SSL2_CHALLENGE_LENGTH	32 */
141f5b1c8a1SJohn Marino #define SSL2_MIN_CHALLENGE_LENGTH	16
142f5b1c8a1SJohn Marino #define SSL2_MAX_CHALLENGE_LENGTH	32
143f5b1c8a1SJohn Marino #define SSL2_CONNECTION_ID_LENGTH	16
144f5b1c8a1SJohn Marino #define SSL2_MAX_CONNECTION_ID_LENGTH	16
145f5b1c8a1SJohn Marino #define SSL2_SSL_SESSION_ID_LENGTH	16
146f5b1c8a1SJohn Marino #define SSL2_MAX_CERT_CHALLENGE_LENGTH	32
147f5b1c8a1SJohn Marino #define SSL2_MIN_CERT_CHALLENGE_LENGTH	16
148f5b1c8a1SJohn Marino #define SSL2_MAX_KEY_MATERIAL_LENGTH	24
149f5b1c8a1SJohn Marino 
150f5b1c8a1SJohn Marino #ifdef  __cplusplus
151f5b1c8a1SJohn Marino }
152f5b1c8a1SJohn Marino #endif
153f5b1c8a1SJohn Marino #endif
154