os/ossrv/ssl/libcrypto/inc/include/openssl/ssl3.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/* ssl/ssl3.h */
sl@0
     2
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
sl@0
     3
 * All rights reserved.
sl@0
     4
 *
sl@0
     5
 * This package is an SSL implementation written
sl@0
     6
 * by Eric Young (eay@cryptsoft.com).
sl@0
     7
 * The implementation was written so as to conform with Netscapes SSL.
sl@0
     8
 * 
sl@0
     9
 * This library is free for commercial and non-commercial use as long as
sl@0
    10
 * the following conditions are aheared to.  The following conditions
sl@0
    11
 * apply to all code found in this distribution, be it the RC4, RSA,
sl@0
    12
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
sl@0
    13
 * included with this distribution is covered by the same copyright terms
sl@0
    14
 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
sl@0
    15
 * 
sl@0
    16
 * Copyright remains Eric Young's, and as such any Copyright notices in
sl@0
    17
 * the code are not to be removed.
sl@0
    18
 * If this package is used in a product, Eric Young should be given attribution
sl@0
    19
 * as the author of the parts of the library used.
sl@0
    20
 * This can be in the form of a textual message at program startup or
sl@0
    21
 * in documentation (online or textual) provided with the package.
sl@0
    22
 * 
sl@0
    23
 * Redistribution and use in source and binary forms, with or without
sl@0
    24
 * modification, are permitted provided that the following conditions
sl@0
    25
 * are met:
sl@0
    26
 * 1. Redistributions of source code must retain the copyright
sl@0
    27
 *    notice, this list of conditions and the following disclaimer.
sl@0
    28
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    29
 *    notice, this list of conditions and the following disclaimer in the
sl@0
    30
 *    documentation and/or other materials provided with the distribution.
sl@0
    31
 * 3. All advertising materials mentioning features or use of this software
sl@0
    32
 *    must display the following acknowledgement:
sl@0
    33
 *    "This product includes cryptographic software written by
sl@0
    34
 *     Eric Young (eay@cryptsoft.com)"
sl@0
    35
 *    The word 'cryptographic' can be left out if the rouines from the library
sl@0
    36
 *    being used are not cryptographic related :-).
sl@0
    37
 * 4. If you include any Windows specific code (or a derivative thereof) from 
sl@0
    38
 *    the apps directory (application code) you must include an acknowledgement:
sl@0
    39
 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
sl@0
    40
 * 
sl@0
    41
 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
sl@0
    42
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0
    43
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0
    44
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
sl@0
    45
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sl@0
    46
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sl@0
    47
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    48
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
sl@0
    49
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
sl@0
    50
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
sl@0
    51
 * SUCH DAMAGE.
sl@0
    52
 * 
sl@0
    53
 * The licence and distribution terms for any publically available version or
sl@0
    54
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
sl@0
    55
 * copied and put under another distribution licence
sl@0
    56
 * [including the GNU Public Licence.]
sl@0
    57
 */
sl@0
    58
/* ====================================================================
sl@0
    59
 * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
sl@0
    60
 *
sl@0
    61
 * Redistribution and use in source and binary forms, with or without
sl@0
    62
 * modification, are permitted provided that the following conditions
sl@0
    63
 * are met:
sl@0
    64
 *
sl@0
    65
 * 1. Redistributions of source code must retain the above copyright
sl@0
    66
 *    notice, this list of conditions and the following disclaimer. 
sl@0
    67
 *
sl@0
    68
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    69
 *    notice, this list of conditions and the following disclaimer in
sl@0
    70
 *    the documentation and/or other materials provided with the
sl@0
    71
 *    distribution.
sl@0
    72
 *
sl@0
    73
 * 3. All advertising materials mentioning features or use of this
sl@0
    74
 *    software must display the following acknowledgment:
sl@0
    75
 *    "This product includes software developed by the OpenSSL Project
sl@0
    76
 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
sl@0
    77
 *
sl@0
    78
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
sl@0
    79
 *    endorse or promote products derived from this software without
sl@0
    80
 *    prior written permission. For written permission, please contact
sl@0
    81
 *    openssl-core@openssl.org.
sl@0
    82
 *
sl@0
    83
 * 5. Products derived from this software may not be called "OpenSSL"
sl@0
    84
 *    nor may "OpenSSL" appear in their names without prior written
sl@0
    85
 *    permission of the OpenSSL Project.
sl@0
    86
 *
sl@0
    87
 * 6. Redistributions of any form whatsoever must retain the following
sl@0
    88
 *    acknowledgment:
sl@0
    89
 *    "This product includes software developed by the OpenSSL Project
sl@0
    90
 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
sl@0
    91
 *
sl@0
    92
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
sl@0
    93
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0
    94
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
sl@0
    95
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
sl@0
    96
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
sl@0
    97
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
sl@0
    98
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
sl@0
    99
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
   100
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
sl@0
   101
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
sl@0
   102
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
sl@0
   103
 * OF THE POSSIBILITY OF SUCH DAMAGE.
sl@0
   104
 * ====================================================================
sl@0
   105
 *
sl@0
   106
 * This product includes cryptographic software written by Eric Young
sl@0
   107
 * (eay@cryptsoft.com).  This product includes software written by Tim
sl@0
   108
 * Hudson (tjh@cryptsoft.com).
sl@0
   109
 *
sl@0
   110
 */
sl@0
   111
/* ====================================================================
sl@0
   112
 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
sl@0
   113
 * ECC cipher suite support in OpenSSL originally developed by 
sl@0
   114
 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
sl@0
   115
 */
sl@0
   116
sl@0
   117
#ifndef HEADER_SSL3_H 
sl@0
   118
#define HEADER_SSL3_H 
sl@0
   119
sl@0
   120
#ifndef OPENSSL_NO_COMP
sl@0
   121
#include <openssl/comp.h>
sl@0
   122
#endif
sl@0
   123
#include <openssl/buffer.h>
sl@0
   124
#include <openssl/evp.h>
sl@0
   125
#include <openssl/ssl.h>
sl@0
   126
#include <openssl/pq_compat.h>
sl@0
   127
sl@0
   128
#ifdef  __cplusplus
sl@0
   129
extern "C" {
sl@0
   130
#endif
sl@0
   131
sl@0
   132
#define SSL3_CK_RSA_NULL_MD5			0x03000001
sl@0
   133
#define SSL3_CK_RSA_NULL_SHA			0x03000002
sl@0
   134
#define SSL3_CK_RSA_RC4_40_MD5 			0x03000003
sl@0
   135
#define SSL3_CK_RSA_RC4_128_MD5			0x03000004
sl@0
   136
#define SSL3_CK_RSA_RC4_128_SHA			0x03000005
sl@0
   137
#define SSL3_CK_RSA_RC2_40_MD5			0x03000006
sl@0
   138
#define SSL3_CK_RSA_IDEA_128_SHA		0x03000007
sl@0
   139
#define SSL3_CK_RSA_DES_40_CBC_SHA		0x03000008
sl@0
   140
#define SSL3_CK_RSA_DES_64_CBC_SHA		0x03000009
sl@0
   141
#define SSL3_CK_RSA_DES_192_CBC3_SHA		0x0300000A
sl@0
   142
sl@0
   143
#define SSL3_CK_DH_DSS_DES_40_CBC_SHA		0x0300000B
sl@0
   144
#define SSL3_CK_DH_DSS_DES_64_CBC_SHA		0x0300000C
sl@0
   145
#define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 	0x0300000D
sl@0
   146
#define SSL3_CK_DH_RSA_DES_40_CBC_SHA		0x0300000E
sl@0
   147
#define SSL3_CK_DH_RSA_DES_64_CBC_SHA		0x0300000F
sl@0
   148
#define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 	0x03000010
sl@0
   149
sl@0
   150
#define SSL3_CK_EDH_DSS_DES_40_CBC_SHA		0x03000011
sl@0
   151
#define SSL3_CK_EDH_DSS_DES_64_CBC_SHA		0x03000012
sl@0
   152
#define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA	0x03000013
sl@0
   153
#define SSL3_CK_EDH_RSA_DES_40_CBC_SHA		0x03000014
sl@0
   154
#define SSL3_CK_EDH_RSA_DES_64_CBC_SHA		0x03000015
sl@0
   155
#define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA	0x03000016
sl@0
   156
sl@0
   157
#define SSL3_CK_ADH_RC4_40_MD5			0x03000017
sl@0
   158
#define SSL3_CK_ADH_RC4_128_MD5			0x03000018
sl@0
   159
#define SSL3_CK_ADH_DES_40_CBC_SHA		0x03000019
sl@0
   160
#define SSL3_CK_ADH_DES_64_CBC_SHA		0x0300001A
sl@0
   161
#define SSL3_CK_ADH_DES_192_CBC_SHA		0x0300001B
sl@0
   162
sl@0
   163
#define SSL3_CK_FZA_DMS_NULL_SHA		0x0300001C
sl@0
   164
#define SSL3_CK_FZA_DMS_FZA_SHA			0x0300001D
sl@0
   165
#if 0 /* Because it clashes with KRB5, is never used any more, and is safe
sl@0
   166
	 to remove according to David Hopwood <david.hopwood@zetnet.co.uk>
sl@0
   167
	 of the ietf-tls list */
sl@0
   168
#define SSL3_CK_FZA_DMS_RC4_SHA			0x0300001E
sl@0
   169
#endif
sl@0
   170
sl@0
   171
/*    VRS Additional Kerberos5 entries
sl@0
   172
 */
sl@0
   173
#define SSL3_CK_KRB5_DES_64_CBC_SHA		0x0300001E
sl@0
   174
#define SSL3_CK_KRB5_DES_192_CBC3_SHA		0x0300001F
sl@0
   175
#define SSL3_CK_KRB5_RC4_128_SHA		0x03000020
sl@0
   176
#define SSL3_CK_KRB5_IDEA_128_CBC_SHA	       	0x03000021
sl@0
   177
#define SSL3_CK_KRB5_DES_64_CBC_MD5       	0x03000022
sl@0
   178
#define SSL3_CK_KRB5_DES_192_CBC3_MD5       	0x03000023
sl@0
   179
#define SSL3_CK_KRB5_RC4_128_MD5	       	0x03000024
sl@0
   180
#define SSL3_CK_KRB5_IDEA_128_CBC_MD5 		0x03000025
sl@0
   181
sl@0
   182
#define SSL3_CK_KRB5_DES_40_CBC_SHA 		0x03000026
sl@0
   183
#define SSL3_CK_KRB5_RC2_40_CBC_SHA 		0x03000027
sl@0
   184
#define SSL3_CK_KRB5_RC4_40_SHA	 		0x03000028
sl@0
   185
#define SSL3_CK_KRB5_DES_40_CBC_MD5 		0x03000029
sl@0
   186
#define SSL3_CK_KRB5_RC2_40_CBC_MD5 		0x0300002A
sl@0
   187
#define SSL3_CK_KRB5_RC4_40_MD5	 		0x0300002B
sl@0
   188
sl@0
   189
#define SSL3_TXT_RSA_NULL_MD5			"NULL-MD5"
sl@0
   190
#define SSL3_TXT_RSA_NULL_SHA			"NULL-SHA"
sl@0
   191
#define SSL3_TXT_RSA_RC4_40_MD5 		"EXP-RC4-MD5"
sl@0
   192
#define SSL3_TXT_RSA_RC4_128_MD5		"RC4-MD5"
sl@0
   193
#define SSL3_TXT_RSA_RC4_128_SHA		"RC4-SHA"
sl@0
   194
#define SSL3_TXT_RSA_RC2_40_MD5			"EXP-RC2-CBC-MD5"
sl@0
   195
#define SSL3_TXT_RSA_IDEA_128_SHA		"IDEA-CBC-SHA"
sl@0
   196
#define SSL3_TXT_RSA_DES_40_CBC_SHA		"EXP-DES-CBC-SHA"
sl@0
   197
#define SSL3_TXT_RSA_DES_64_CBC_SHA		"DES-CBC-SHA"
sl@0
   198
#define SSL3_TXT_RSA_DES_192_CBC3_SHA		"DES-CBC3-SHA"
sl@0
   199
sl@0
   200
#define SSL3_TXT_DH_DSS_DES_40_CBC_SHA		"EXP-DH-DSS-DES-CBC-SHA"
sl@0
   201
#define SSL3_TXT_DH_DSS_DES_64_CBC_SHA		"DH-DSS-DES-CBC-SHA"
sl@0
   202
#define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA 	"DH-DSS-DES-CBC3-SHA"
sl@0
   203
#define SSL3_TXT_DH_RSA_DES_40_CBC_SHA		"EXP-DH-RSA-DES-CBC-SHA"
sl@0
   204
#define SSL3_TXT_DH_RSA_DES_64_CBC_SHA		"DH-RSA-DES-CBC-SHA"
sl@0
   205
#define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA 	"DH-RSA-DES-CBC3-SHA"
sl@0
   206
sl@0
   207
#define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA		"EXP-EDH-DSS-DES-CBC-SHA"
sl@0
   208
#define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA		"EDH-DSS-DES-CBC-SHA"
sl@0
   209
#define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA	"EDH-DSS-DES-CBC3-SHA"
sl@0
   210
#define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA		"EXP-EDH-RSA-DES-CBC-SHA"
sl@0
   211
#define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA		"EDH-RSA-DES-CBC-SHA"
sl@0
   212
#define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA	"EDH-RSA-DES-CBC3-SHA"
sl@0
   213
sl@0
   214
#define SSL3_TXT_ADH_RC4_40_MD5			"EXP-ADH-RC4-MD5"
sl@0
   215
#define SSL3_TXT_ADH_RC4_128_MD5		"ADH-RC4-MD5"
sl@0
   216
#define SSL3_TXT_ADH_DES_40_CBC_SHA		"EXP-ADH-DES-CBC-SHA"
sl@0
   217
#define SSL3_TXT_ADH_DES_64_CBC_SHA		"ADH-DES-CBC-SHA"
sl@0
   218
#define SSL3_TXT_ADH_DES_192_CBC_SHA		"ADH-DES-CBC3-SHA"
sl@0
   219
sl@0
   220
#define SSL3_TXT_FZA_DMS_NULL_SHA		"FZA-NULL-SHA"
sl@0
   221
#define SSL3_TXT_FZA_DMS_FZA_SHA		"FZA-FZA-CBC-SHA"
sl@0
   222
#define SSL3_TXT_FZA_DMS_RC4_SHA		"FZA-RC4-SHA"
sl@0
   223
sl@0
   224
#define SSL3_TXT_KRB5_DES_64_CBC_SHA		"KRB5-DES-CBC-SHA"
sl@0
   225
#define SSL3_TXT_KRB5_DES_192_CBC3_SHA		"KRB5-DES-CBC3-SHA"
sl@0
   226
#define SSL3_TXT_KRB5_RC4_128_SHA		"KRB5-RC4-SHA"
sl@0
   227
#define SSL3_TXT_KRB5_IDEA_128_CBC_SHA	       	"KRB5-IDEA-CBC-SHA"
sl@0
   228
#define SSL3_TXT_KRB5_DES_64_CBC_MD5       	"KRB5-DES-CBC-MD5"
sl@0
   229
#define SSL3_TXT_KRB5_DES_192_CBC3_MD5       	"KRB5-DES-CBC3-MD5"
sl@0
   230
#define SSL3_TXT_KRB5_RC4_128_MD5		"KRB5-RC4-MD5"
sl@0
   231
#define SSL3_TXT_KRB5_IDEA_128_CBC_MD5 		"KRB5-IDEA-CBC-MD5"
sl@0
   232
sl@0
   233
#define SSL3_TXT_KRB5_DES_40_CBC_SHA 		"EXP-KRB5-DES-CBC-SHA"
sl@0
   234
#define SSL3_TXT_KRB5_RC2_40_CBC_SHA 		"EXP-KRB5-RC2-CBC-SHA"
sl@0
   235
#define SSL3_TXT_KRB5_RC4_40_SHA	 	"EXP-KRB5-RC4-SHA"
sl@0
   236
#define SSL3_TXT_KRB5_DES_40_CBC_MD5 		"EXP-KRB5-DES-CBC-MD5"
sl@0
   237
#define SSL3_TXT_KRB5_RC2_40_CBC_MD5 		"EXP-KRB5-RC2-CBC-MD5"
sl@0
   238
#define SSL3_TXT_KRB5_RC4_40_MD5	 	"EXP-KRB5-RC4-MD5"
sl@0
   239
sl@0
   240
#define SSL3_SSL_SESSION_ID_LENGTH		32
sl@0
   241
#define SSL3_MAX_SSL_SESSION_ID_LENGTH		32
sl@0
   242
sl@0
   243
#define SSL3_MASTER_SECRET_SIZE			48
sl@0
   244
#define SSL3_RANDOM_SIZE			32
sl@0
   245
#define SSL3_SESSION_ID_SIZE			32
sl@0
   246
#define SSL3_RT_HEADER_LENGTH			5
sl@0
   247
sl@0
   248
/* Due to MS stuffing up, this can change.... */
sl@0
   249
#if defined(OPENSSL_SYS_WIN16) || \
sl@0
   250
	(defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32))
sl@0
   251
#define SSL3_RT_MAX_EXTRA			(14000)
sl@0
   252
#else
sl@0
   253
#define SSL3_RT_MAX_EXTRA			(16384)
sl@0
   254
#endif
sl@0
   255
sl@0
   256
#define SSL3_RT_MAX_PLAIN_LENGTH		16384
sl@0
   257
#ifdef OPENSSL_NO_COMP
sl@0
   258
#define SSL3_RT_MAX_COMPRESSED_LENGTH	SSL3_RT_MAX_PLAIN_LENGTH
sl@0
   259
#else
sl@0
   260
#define SSL3_RT_MAX_COMPRESSED_LENGTH	(1024+SSL3_RT_MAX_PLAIN_LENGTH)
sl@0
   261
#endif
sl@0
   262
#define SSL3_RT_MAX_ENCRYPTED_LENGTH	(1024+SSL3_RT_MAX_COMPRESSED_LENGTH)
sl@0
   263
#define SSL3_RT_MAX_PACKET_SIZE		(SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH)
sl@0
   264
#define SSL3_RT_MAX_DATA_SIZE			(1024*1024)
sl@0
   265
sl@0
   266
#define SSL3_MD_CLIENT_FINISHED_CONST	"\x43\x4C\x4E\x54"
sl@0
   267
#define SSL3_MD_SERVER_FINISHED_CONST	"\x53\x52\x56\x52"
sl@0
   268
sl@0
   269
#define SSL3_VERSION			0x0300
sl@0
   270
#define SSL3_VERSION_MAJOR		0x03
sl@0
   271
#define SSL3_VERSION_MINOR		0x00
sl@0
   272
sl@0
   273
#define SSL3_RT_CHANGE_CIPHER_SPEC	20
sl@0
   274
#define SSL3_RT_ALERT			21
sl@0
   275
#define SSL3_RT_HANDSHAKE		22
sl@0
   276
#define SSL3_RT_APPLICATION_DATA	23
sl@0
   277
sl@0
   278
#define SSL3_AL_WARNING			1
sl@0
   279
#define SSL3_AL_FATAL			2
sl@0
   280
sl@0
   281
#define SSL3_AD_CLOSE_NOTIFY		 0
sl@0
   282
#define SSL3_AD_UNEXPECTED_MESSAGE	10	/* fatal */
sl@0
   283
#define SSL3_AD_BAD_RECORD_MAC		20	/* fatal */
sl@0
   284
#define SSL3_AD_DECOMPRESSION_FAILURE	30	/* fatal */
sl@0
   285
#define SSL3_AD_HANDSHAKE_FAILURE	40	/* fatal */
sl@0
   286
#define SSL3_AD_NO_CERTIFICATE		41
sl@0
   287
#define SSL3_AD_BAD_CERTIFICATE		42
sl@0
   288
#define SSL3_AD_UNSUPPORTED_CERTIFICATE	43
sl@0
   289
#define SSL3_AD_CERTIFICATE_REVOKED	44
sl@0
   290
#define SSL3_AD_CERTIFICATE_EXPIRED	45
sl@0
   291
#define SSL3_AD_CERTIFICATE_UNKNOWN	46
sl@0
   292
#define SSL3_AD_ILLEGAL_PARAMETER	47	/* fatal */
sl@0
   293
sl@0
   294
typedef struct ssl3_record_st
sl@0
   295
	{
sl@0
   296
/*r */	int type;               /* type of record */
sl@0
   297
/*rw*/	unsigned int length;    /* How many bytes available */
sl@0
   298
/*r */	unsigned int off;       /* read/write offset into 'buf' */
sl@0
   299
/*rw*/	unsigned char *data;    /* pointer to the record data */
sl@0
   300
/*rw*/	unsigned char *input;   /* where the decode bytes are */
sl@0
   301
/*r */	unsigned char *comp;    /* only used with decompression - malloc()ed */
sl@0
   302
/*r */  unsigned long epoch;    /* epoch number, needed by DTLS1 */
sl@0
   303
/*r */  PQ_64BIT seq_num;       /* sequence number, needed by DTLS1 */
sl@0
   304
	} SSL3_RECORD;
sl@0
   305
sl@0
   306
typedef struct ssl3_buffer_st
sl@0
   307
	{
sl@0
   308
	unsigned char *buf;     /* at least SSL3_RT_MAX_PACKET_SIZE bytes,
sl@0
   309
	                         * see ssl3_setup_buffers() */
sl@0
   310
	size_t len;             /* buffer size */
sl@0
   311
	int offset;             /* where to 'copy from' */
sl@0
   312
	int left;               /* how many bytes left */
sl@0
   313
	} SSL3_BUFFER;
sl@0
   314
sl@0
   315
#define SSL3_CT_RSA_SIGN			1
sl@0
   316
#define SSL3_CT_DSS_SIGN			2
sl@0
   317
#define SSL3_CT_RSA_FIXED_DH			3
sl@0
   318
#define SSL3_CT_DSS_FIXED_DH			4
sl@0
   319
#define SSL3_CT_RSA_EPHEMERAL_DH		5
sl@0
   320
#define SSL3_CT_DSS_EPHEMERAL_DH		6
sl@0
   321
#define SSL3_CT_FORTEZZA_DMS			20
sl@0
   322
/* SSL3_CT_NUMBER is used to size arrays and it must be large
sl@0
   323
 * enough to contain all of the cert types defined either for
sl@0
   324
 * SSLv3 and TLSv1.
sl@0
   325
 */
sl@0
   326
#define SSL3_CT_NUMBER			7
sl@0
   327
sl@0
   328
sl@0
   329
#define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS	0x0001
sl@0
   330
#define SSL3_FLAGS_DELAY_CLIENT_FINISHED	0x0002
sl@0
   331
#define SSL3_FLAGS_POP_BUFFER			0x0004
sl@0
   332
#define TLS1_FLAGS_TLS_PADDING_BUG		0x0008
sl@0
   333
sl@0
   334
typedef struct ssl3_state_st
sl@0
   335
	{
sl@0
   336
	long flags;
sl@0
   337
	int delay_buf_pop_ret;
sl@0
   338
sl@0
   339
	unsigned char read_sequence[8];
sl@0
   340
	unsigned char read_mac_secret[EVP_MAX_MD_SIZE];
sl@0
   341
	unsigned char write_sequence[8];
sl@0
   342
	unsigned char write_mac_secret[EVP_MAX_MD_SIZE];
sl@0
   343
sl@0
   344
	unsigned char server_random[SSL3_RANDOM_SIZE];
sl@0
   345
	unsigned char client_random[SSL3_RANDOM_SIZE];
sl@0
   346
sl@0
   347
	/* flags for countermeasure against known-IV weakness */
sl@0
   348
	int need_empty_fragments;
sl@0
   349
	int empty_fragment_done;
sl@0
   350
sl@0
   351
	SSL3_BUFFER rbuf;	/* read IO goes into here */
sl@0
   352
	SSL3_BUFFER wbuf;	/* write IO goes into here */
sl@0
   353
sl@0
   354
	SSL3_RECORD rrec;	/* each decoded record goes in here */
sl@0
   355
	SSL3_RECORD wrec;	/* goes out from here */
sl@0
   356
sl@0
   357
	/* storage for Alert/Handshake protocol data received but not
sl@0
   358
	 * yet processed by ssl3_read_bytes: */
sl@0
   359
	unsigned char alert_fragment[2];
sl@0
   360
	unsigned int alert_fragment_len;
sl@0
   361
	unsigned char handshake_fragment[4];
sl@0
   362
	unsigned int handshake_fragment_len;
sl@0
   363
sl@0
   364
	/* partial write - check the numbers match */
sl@0
   365
	unsigned int wnum;	/* number of bytes sent so far */
sl@0
   366
	int wpend_tot;		/* number bytes written */
sl@0
   367
	int wpend_type;
sl@0
   368
	int wpend_ret;		/* number of bytes submitted */
sl@0
   369
	const unsigned char *wpend_buf;
sl@0
   370
sl@0
   371
	/* used during startup, digest all incoming/outgoing packets */
sl@0
   372
	EVP_MD_CTX finish_dgst1;
sl@0
   373
	EVP_MD_CTX finish_dgst2;
sl@0
   374
sl@0
   375
	/* this is set whenerver we see a change_cipher_spec message
sl@0
   376
	 * come in when we are not looking for one */
sl@0
   377
	int change_cipher_spec;
sl@0
   378
sl@0
   379
	int warn_alert;
sl@0
   380
	int fatal_alert;
sl@0
   381
	/* we allow one fatal and one warning alert to be outstanding,
sl@0
   382
	 * send close alert via the warning alert */
sl@0
   383
	int alert_dispatch;
sl@0
   384
	unsigned char send_alert[2];
sl@0
   385
sl@0
   386
	/* This flag is set when we should renegotiate ASAP, basically when
sl@0
   387
	 * there is no more data in the read or write buffers */
sl@0
   388
	int renegotiate;
sl@0
   389
	int total_renegotiations;
sl@0
   390
	int num_renegotiations;
sl@0
   391
sl@0
   392
	int in_read_app_data;
sl@0
   393
sl@0
   394
	struct	{
sl@0
   395
		/* actually only needs to be 16+20 */
sl@0
   396
		unsigned char cert_verify_md[EVP_MAX_MD_SIZE*2];
sl@0
   397
sl@0
   398
		/* actually only need to be 16+20 for SSLv3 and 12 for TLS */
sl@0
   399
		unsigned char finish_md[EVP_MAX_MD_SIZE*2];
sl@0
   400
		int finish_md_len;
sl@0
   401
		unsigned char peer_finish_md[EVP_MAX_MD_SIZE*2];
sl@0
   402
		int peer_finish_md_len;
sl@0
   403
		
sl@0
   404
		unsigned long message_size;
sl@0
   405
		int message_type;
sl@0
   406
sl@0
   407
		/* used to hold the new cipher we are going to use */
sl@0
   408
		SSL_CIPHER *new_cipher;
sl@0
   409
#ifndef OPENSSL_NO_DH
sl@0
   410
		DH *dh;
sl@0
   411
#endif
sl@0
   412
sl@0
   413
#ifndef OPENSSL_NO_ECDH
sl@0
   414
		EC_KEY *ecdh; /* holds short lived ECDH key */
sl@0
   415
#endif
sl@0
   416
sl@0
   417
		/* used when SSL_ST_FLUSH_DATA is entered */
sl@0
   418
		int next_state;			
sl@0
   419
sl@0
   420
		int reuse_message;
sl@0
   421
sl@0
   422
		/* used for certificate requests */
sl@0
   423
		int cert_req;
sl@0
   424
		int ctype_num;
sl@0
   425
		char ctype[SSL3_CT_NUMBER];
sl@0
   426
		STACK_OF(X509_NAME) *ca_names;
sl@0
   427
sl@0
   428
		int use_rsa_tmp;
sl@0
   429
sl@0
   430
		int key_block_length;
sl@0
   431
		unsigned char *key_block;
sl@0
   432
sl@0
   433
		const EVP_CIPHER *new_sym_enc;
sl@0
   434
		const EVP_MD *new_hash;
sl@0
   435
#ifndef OPENSSL_NO_COMP
sl@0
   436
		const SSL_COMP *new_compression;
sl@0
   437
#else
sl@0
   438
		char *new_compression;
sl@0
   439
#endif
sl@0
   440
		int cert_request;
sl@0
   441
		} tmp;
sl@0
   442
sl@0
   443
	} SSL3_STATE;
sl@0
   444
sl@0
   445
sl@0
   446
/* SSLv3 */
sl@0
   447
/*client */
sl@0
   448
/* extra state */
sl@0
   449
#define SSL3_ST_CW_FLUSH		(0x100|SSL_ST_CONNECT)
sl@0
   450
/* write to server */
sl@0
   451
#define SSL3_ST_CW_CLNT_HELLO_A		(0x110|SSL_ST_CONNECT)
sl@0
   452
#define SSL3_ST_CW_CLNT_HELLO_B		(0x111|SSL_ST_CONNECT)
sl@0
   453
/* read from server */
sl@0
   454
#define SSL3_ST_CR_SRVR_HELLO_A		(0x120|SSL_ST_CONNECT)
sl@0
   455
#define SSL3_ST_CR_SRVR_HELLO_B		(0x121|SSL_ST_CONNECT)
sl@0
   456
#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A (0x126|SSL_ST_CONNECT)
sl@0
   457
#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B (0x127|SSL_ST_CONNECT)
sl@0
   458
#define SSL3_ST_CR_CERT_A		(0x130|SSL_ST_CONNECT)
sl@0
   459
#define SSL3_ST_CR_CERT_B		(0x131|SSL_ST_CONNECT)
sl@0
   460
#define SSL3_ST_CR_KEY_EXCH_A		(0x140|SSL_ST_CONNECT)
sl@0
   461
#define SSL3_ST_CR_KEY_EXCH_B		(0x141|SSL_ST_CONNECT)
sl@0
   462
#define SSL3_ST_CR_CERT_REQ_A		(0x150|SSL_ST_CONNECT)
sl@0
   463
#define SSL3_ST_CR_CERT_REQ_B		(0x151|SSL_ST_CONNECT)
sl@0
   464
#define SSL3_ST_CR_SRVR_DONE_A		(0x160|SSL_ST_CONNECT)
sl@0
   465
#define SSL3_ST_CR_SRVR_DONE_B		(0x161|SSL_ST_CONNECT)
sl@0
   466
/* write to server */
sl@0
   467
#define SSL3_ST_CW_CERT_A		(0x170|SSL_ST_CONNECT)
sl@0
   468
#define SSL3_ST_CW_CERT_B		(0x171|SSL_ST_CONNECT)
sl@0
   469
#define SSL3_ST_CW_CERT_C		(0x172|SSL_ST_CONNECT)
sl@0
   470
#define SSL3_ST_CW_CERT_D		(0x173|SSL_ST_CONNECT)
sl@0
   471
#define SSL3_ST_CW_KEY_EXCH_A		(0x180|SSL_ST_CONNECT)
sl@0
   472
#define SSL3_ST_CW_KEY_EXCH_B		(0x181|SSL_ST_CONNECT)
sl@0
   473
#define SSL3_ST_CW_CERT_VRFY_A		(0x190|SSL_ST_CONNECT)
sl@0
   474
#define SSL3_ST_CW_CERT_VRFY_B		(0x191|SSL_ST_CONNECT)
sl@0
   475
#define SSL3_ST_CW_CHANGE_A		(0x1A0|SSL_ST_CONNECT)
sl@0
   476
#define SSL3_ST_CW_CHANGE_B		(0x1A1|SSL_ST_CONNECT)
sl@0
   477
#define SSL3_ST_CW_FINISHED_A		(0x1B0|SSL_ST_CONNECT)
sl@0
   478
#define SSL3_ST_CW_FINISHED_B		(0x1B1|SSL_ST_CONNECT)
sl@0
   479
/* read from server */
sl@0
   480
#define SSL3_ST_CR_CHANGE_A		(0x1C0|SSL_ST_CONNECT)
sl@0
   481
#define SSL3_ST_CR_CHANGE_B		(0x1C1|SSL_ST_CONNECT)
sl@0
   482
#define SSL3_ST_CR_FINISHED_A		(0x1D0|SSL_ST_CONNECT)
sl@0
   483
#define SSL3_ST_CR_FINISHED_B		(0x1D1|SSL_ST_CONNECT)
sl@0
   484
#define SSL3_ST_CR_SESSION_TICKET_A	(0x1E0|SSL_ST_CONNECT)
sl@0
   485
#define SSL3_ST_CR_SESSION_TICKET_B	(0x1E1|SSL_ST_CONNECT)
sl@0
   486
sl@0
   487
/* server */
sl@0
   488
/* extra state */
sl@0
   489
#define SSL3_ST_SW_FLUSH		(0x100|SSL_ST_ACCEPT)
sl@0
   490
/* read from client */
sl@0
   491
/* Do not change the number values, they do matter */
sl@0
   492
#define SSL3_ST_SR_CLNT_HELLO_A		(0x110|SSL_ST_ACCEPT)
sl@0
   493
#define SSL3_ST_SR_CLNT_HELLO_B		(0x111|SSL_ST_ACCEPT)
sl@0
   494
#define SSL3_ST_SR_CLNT_HELLO_C		(0x112|SSL_ST_ACCEPT)
sl@0
   495
/* write to client */
sl@0
   496
#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A (0x113|SSL_ST_ACCEPT)
sl@0
   497
#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B (0x114|SSL_ST_ACCEPT)
sl@0
   498
#define SSL3_ST_SW_HELLO_REQ_A		(0x120|SSL_ST_ACCEPT)
sl@0
   499
#define SSL3_ST_SW_HELLO_REQ_B		(0x121|SSL_ST_ACCEPT)
sl@0
   500
#define SSL3_ST_SW_HELLO_REQ_C		(0x122|SSL_ST_ACCEPT)
sl@0
   501
#define SSL3_ST_SW_SRVR_HELLO_A		(0x130|SSL_ST_ACCEPT)
sl@0
   502
#define SSL3_ST_SW_SRVR_HELLO_B		(0x131|SSL_ST_ACCEPT)
sl@0
   503
#define SSL3_ST_SW_CERT_A		(0x140|SSL_ST_ACCEPT)
sl@0
   504
#define SSL3_ST_SW_CERT_B		(0x141|SSL_ST_ACCEPT)
sl@0
   505
#define SSL3_ST_SW_KEY_EXCH_A		(0x150|SSL_ST_ACCEPT)
sl@0
   506
#define SSL3_ST_SW_KEY_EXCH_B		(0x151|SSL_ST_ACCEPT)
sl@0
   507
#define SSL3_ST_SW_CERT_REQ_A		(0x160|SSL_ST_ACCEPT)
sl@0
   508
#define SSL3_ST_SW_CERT_REQ_B		(0x161|SSL_ST_ACCEPT)
sl@0
   509
#define SSL3_ST_SW_SRVR_DONE_A		(0x170|SSL_ST_ACCEPT)
sl@0
   510
#define SSL3_ST_SW_SRVR_DONE_B		(0x171|SSL_ST_ACCEPT)
sl@0
   511
/* read from client */
sl@0
   512
#define SSL3_ST_SR_CERT_A		(0x180|SSL_ST_ACCEPT)
sl@0
   513
#define SSL3_ST_SR_CERT_B		(0x181|SSL_ST_ACCEPT)
sl@0
   514
#define SSL3_ST_SR_KEY_EXCH_A		(0x190|SSL_ST_ACCEPT)
sl@0
   515
#define SSL3_ST_SR_KEY_EXCH_B		(0x191|SSL_ST_ACCEPT)
sl@0
   516
#define SSL3_ST_SR_CERT_VRFY_A		(0x1A0|SSL_ST_ACCEPT)
sl@0
   517
#define SSL3_ST_SR_CERT_VRFY_B		(0x1A1|SSL_ST_ACCEPT)
sl@0
   518
#define SSL3_ST_SR_CHANGE_A		(0x1B0|SSL_ST_ACCEPT)
sl@0
   519
#define SSL3_ST_SR_CHANGE_B		(0x1B1|SSL_ST_ACCEPT)
sl@0
   520
#define SSL3_ST_SR_FINISHED_A		(0x1C0|SSL_ST_ACCEPT)
sl@0
   521
#define SSL3_ST_SR_FINISHED_B		(0x1C1|SSL_ST_ACCEPT)
sl@0
   522
/* write to client */
sl@0
   523
#define SSL3_ST_SW_CHANGE_A		(0x1D0|SSL_ST_ACCEPT)
sl@0
   524
#define SSL3_ST_SW_CHANGE_B		(0x1D1|SSL_ST_ACCEPT)
sl@0
   525
#define SSL3_ST_SW_FINISHED_A		(0x1E0|SSL_ST_ACCEPT)
sl@0
   526
#define SSL3_ST_SW_FINISHED_B		(0x1E1|SSL_ST_ACCEPT)
sl@0
   527
#define SSL3_ST_SW_SESSION_TICKET_A	(0x1F0|SSL_ST_ACCEPT)
sl@0
   528
#define SSL3_ST_SW_SESSION_TICKET_B	(0x1F1|SSL_ST_ACCEPT)
sl@0
   529
sl@0
   530
#define SSL3_MT_HELLO_REQUEST			0
sl@0
   531
#define SSL3_MT_CLIENT_HELLO			1
sl@0
   532
#define SSL3_MT_SERVER_HELLO			2
sl@0
   533
#define	SSL3_MT_NEWSESSION_TICKET		4
sl@0
   534
#define SSL3_MT_CERTIFICATE			11
sl@0
   535
#define SSL3_MT_SERVER_KEY_EXCHANGE		12
sl@0
   536
#define SSL3_MT_CERTIFICATE_REQUEST		13
sl@0
   537
#define SSL3_MT_SERVER_DONE			14
sl@0
   538
#define SSL3_MT_CERTIFICATE_VERIFY		15
sl@0
   539
#define SSL3_MT_CLIENT_KEY_EXCHANGE		16
sl@0
   540
#define SSL3_MT_FINISHED			20
sl@0
   541
#define DTLS1_MT_HELLO_VERIFY_REQUEST    3
sl@0
   542
sl@0
   543
sl@0
   544
#define SSL3_MT_CCS				1
sl@0
   545
sl@0
   546
/* These are used when changing over to a new cipher */
sl@0
   547
#define SSL3_CC_READ		0x01
sl@0
   548
#define SSL3_CC_WRITE		0x02
sl@0
   549
#define SSL3_CC_CLIENT		0x10
sl@0
   550
#define SSL3_CC_SERVER		0x20
sl@0
   551
#define SSL3_CHANGE_CIPHER_CLIENT_WRITE	(SSL3_CC_CLIENT|SSL3_CC_WRITE)	
sl@0
   552
#define SSL3_CHANGE_CIPHER_SERVER_READ	(SSL3_CC_SERVER|SSL3_CC_READ)
sl@0
   553
#define SSL3_CHANGE_CIPHER_CLIENT_READ	(SSL3_CC_CLIENT|SSL3_CC_READ)
sl@0
   554
#define SSL3_CHANGE_CIPHER_SERVER_WRITE	(SSL3_CC_SERVER|SSL3_CC_WRITE)
sl@0
   555
sl@0
   556
#ifdef  __cplusplus
sl@0
   557
}
sl@0
   558
#endif
sl@0
   559
#endif
sl@0
   560