1ebfedea0SLionel Sambuc /* ssl/ssl3.h */ 2ebfedea0SLionel Sambuc /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3ebfedea0SLionel Sambuc * All rights reserved. 4ebfedea0SLionel Sambuc * 5ebfedea0SLionel Sambuc * This package is an SSL implementation written 6ebfedea0SLionel Sambuc * by Eric Young (eay@cryptsoft.com). 7ebfedea0SLionel Sambuc * The implementation was written so as to conform with Netscapes SSL. 8ebfedea0SLionel Sambuc * 9ebfedea0SLionel Sambuc * This library is free for commercial and non-commercial use as long as 10ebfedea0SLionel Sambuc * the following conditions are aheared to. The following conditions 11ebfedea0SLionel Sambuc * apply to all code found in this distribution, be it the RC4, RSA, 12ebfedea0SLionel Sambuc * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13ebfedea0SLionel Sambuc * included with this distribution is covered by the same copyright terms 14ebfedea0SLionel Sambuc * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15ebfedea0SLionel Sambuc * 16ebfedea0SLionel Sambuc * Copyright remains Eric Young's, and as such any Copyright notices in 17ebfedea0SLionel Sambuc * the code are not to be removed. 18ebfedea0SLionel Sambuc * If this package is used in a product, Eric Young should be given attribution 19ebfedea0SLionel Sambuc * as the author of the parts of the library used. 20ebfedea0SLionel Sambuc * This can be in the form of a textual message at program startup or 21ebfedea0SLionel Sambuc * in documentation (online or textual) provided with the package. 22ebfedea0SLionel Sambuc * 23ebfedea0SLionel Sambuc * Redistribution and use in source and binary forms, with or without 24ebfedea0SLionel Sambuc * modification, are permitted provided that the following conditions 25ebfedea0SLionel Sambuc * are met: 26ebfedea0SLionel Sambuc * 1. Redistributions of source code must retain the copyright 27ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer. 28ebfedea0SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 29ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer in the 30ebfedea0SLionel Sambuc * documentation and/or other materials provided with the distribution. 31ebfedea0SLionel Sambuc * 3. All advertising materials mentioning features or use of this software 32ebfedea0SLionel Sambuc * must display the following acknowledgement: 33ebfedea0SLionel Sambuc * "This product includes cryptographic software written by 34ebfedea0SLionel Sambuc * Eric Young (eay@cryptsoft.com)" 35ebfedea0SLionel Sambuc * The word 'cryptographic' can be left out if the rouines from the library 36ebfedea0SLionel Sambuc * being used are not cryptographic related :-). 37ebfedea0SLionel Sambuc * 4. If you include any Windows specific code (or a derivative thereof) from 38ebfedea0SLionel Sambuc * the apps directory (application code) you must include an acknowledgement: 39ebfedea0SLionel Sambuc * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40ebfedea0SLionel Sambuc * 41ebfedea0SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42ebfedea0SLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43ebfedea0SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44ebfedea0SLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45ebfedea0SLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46ebfedea0SLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47ebfedea0SLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48ebfedea0SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49ebfedea0SLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50ebfedea0SLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51ebfedea0SLionel Sambuc * SUCH DAMAGE. 52ebfedea0SLionel Sambuc * 53ebfedea0SLionel Sambuc * The licence and distribution terms for any publically available version or 54ebfedea0SLionel Sambuc * derivative of this code cannot be changed. i.e. this code cannot simply be 55ebfedea0SLionel Sambuc * copied and put under another distribution licence 56ebfedea0SLionel Sambuc * [including the GNU Public Licence.] 57ebfedea0SLionel Sambuc */ 58ebfedea0SLionel Sambuc /* ==================================================================== 59ebfedea0SLionel Sambuc * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 60ebfedea0SLionel Sambuc * 61ebfedea0SLionel Sambuc * Redistribution and use in source and binary forms, with or without 62ebfedea0SLionel Sambuc * modification, are permitted provided that the following conditions 63ebfedea0SLionel Sambuc * are met: 64ebfedea0SLionel Sambuc * 65ebfedea0SLionel Sambuc * 1. Redistributions of source code must retain the above copyright 66ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer. 67ebfedea0SLionel Sambuc * 68ebfedea0SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 69ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer in 70ebfedea0SLionel Sambuc * the documentation and/or other materials provided with the 71ebfedea0SLionel Sambuc * distribution. 72ebfedea0SLionel Sambuc * 73ebfedea0SLionel Sambuc * 3. All advertising materials mentioning features or use of this 74ebfedea0SLionel Sambuc * software must display the following acknowledgment: 75ebfedea0SLionel Sambuc * "This product includes software developed by the OpenSSL Project 76ebfedea0SLionel Sambuc * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 77ebfedea0SLionel Sambuc * 78ebfedea0SLionel Sambuc * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 79ebfedea0SLionel Sambuc * endorse or promote products derived from this software without 80ebfedea0SLionel Sambuc * prior written permission. For written permission, please contact 81ebfedea0SLionel Sambuc * openssl-core@openssl.org. 82ebfedea0SLionel Sambuc * 83ebfedea0SLionel Sambuc * 5. Products derived from this software may not be called "OpenSSL" 84ebfedea0SLionel Sambuc * nor may "OpenSSL" appear in their names without prior written 85ebfedea0SLionel Sambuc * permission of the OpenSSL Project. 86ebfedea0SLionel Sambuc * 87ebfedea0SLionel Sambuc * 6. Redistributions of any form whatsoever must retain the following 88ebfedea0SLionel Sambuc * acknowledgment: 89ebfedea0SLionel Sambuc * "This product includes software developed by the OpenSSL Project 90ebfedea0SLionel Sambuc * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 91ebfedea0SLionel Sambuc * 92ebfedea0SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 93ebfedea0SLionel Sambuc * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 94ebfedea0SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 95ebfedea0SLionel Sambuc * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 96ebfedea0SLionel Sambuc * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 97ebfedea0SLionel Sambuc * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 98ebfedea0SLionel Sambuc * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 99ebfedea0SLionel Sambuc * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 100ebfedea0SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 101ebfedea0SLionel Sambuc * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 102ebfedea0SLionel Sambuc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 103ebfedea0SLionel Sambuc * OF THE POSSIBILITY OF SUCH DAMAGE. 104ebfedea0SLionel Sambuc * ==================================================================== 105ebfedea0SLionel Sambuc * 106ebfedea0SLionel Sambuc * This product includes cryptographic software written by Eric Young 107ebfedea0SLionel Sambuc * (eay@cryptsoft.com). This product includes software written by Tim 108ebfedea0SLionel Sambuc * Hudson (tjh@cryptsoft.com). 109ebfedea0SLionel Sambuc * 110ebfedea0SLionel Sambuc */ 111ebfedea0SLionel Sambuc /* ==================================================================== 112ebfedea0SLionel Sambuc * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 113ebfedea0SLionel Sambuc * ECC cipher suite support in OpenSSL originally developed by 114ebfedea0SLionel Sambuc * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. 115ebfedea0SLionel Sambuc */ 116ebfedea0SLionel Sambuc 117ebfedea0SLionel Sambuc #ifndef HEADER_SSL3_H 118ebfedea0SLionel Sambuc # define HEADER_SSL3_H 119ebfedea0SLionel Sambuc 120ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_COMP 121ebfedea0SLionel Sambuc # include <openssl/comp.h> 122ebfedea0SLionel Sambuc # endif 123ebfedea0SLionel Sambuc # include <openssl/buffer.h> 124ebfedea0SLionel Sambuc # include <openssl/evp.h> 125ebfedea0SLionel Sambuc # include <openssl/ssl.h> 126ebfedea0SLionel Sambuc 127ebfedea0SLionel Sambuc #ifdef __cplusplus 128ebfedea0SLionel Sambuc extern "C" { 129ebfedea0SLionel Sambuc #endif 130ebfedea0SLionel Sambuc 131*0a6a1f1dSLionel Sambuc /* 132*0a6a1f1dSLionel Sambuc * Signalling cipher suite value from RFC 5746 133*0a6a1f1dSLionel Sambuc * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV) 134*0a6a1f1dSLionel Sambuc */ 135ebfedea0SLionel Sambuc # define SSL3_CK_SCSV 0x030000FF 136ebfedea0SLionel Sambuc 137*0a6a1f1dSLionel Sambuc /* 138*0a6a1f1dSLionel Sambuc * Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00 139*0a6a1f1dSLionel Sambuc * (TLS_FALLBACK_SCSV) 140*0a6a1f1dSLionel Sambuc */ 141*0a6a1f1dSLionel Sambuc # define SSL3_CK_FALLBACK_SCSV 0x03005600 142*0a6a1f1dSLionel Sambuc 143ebfedea0SLionel Sambuc # define SSL3_CK_RSA_NULL_MD5 0x03000001 144ebfedea0SLionel Sambuc # define SSL3_CK_RSA_NULL_SHA 0x03000002 145ebfedea0SLionel Sambuc # define SSL3_CK_RSA_RC4_40_MD5 0x03000003 146ebfedea0SLionel Sambuc # define SSL3_CK_RSA_RC4_128_MD5 0x03000004 147ebfedea0SLionel Sambuc # define SSL3_CK_RSA_RC4_128_SHA 0x03000005 148ebfedea0SLionel Sambuc # define SSL3_CK_RSA_RC2_40_MD5 0x03000006 149ebfedea0SLionel Sambuc # define SSL3_CK_RSA_IDEA_128_SHA 0x03000007 150ebfedea0SLionel Sambuc # define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008 151ebfedea0SLionel Sambuc # define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009 152ebfedea0SLionel Sambuc # define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A 153ebfedea0SLionel Sambuc 154ebfedea0SLionel Sambuc # define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B 155ebfedea0SLionel Sambuc # define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C 156ebfedea0SLionel Sambuc # define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D 157ebfedea0SLionel Sambuc # define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E 158ebfedea0SLionel Sambuc # define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F 159ebfedea0SLionel Sambuc # define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 160ebfedea0SLionel Sambuc 161ebfedea0SLionel Sambuc # define SSL3_CK_EDH_DSS_DES_40_CBC_SHA 0x03000011 162ebfedea0SLionel Sambuc # define SSL3_CK_EDH_DSS_DES_64_CBC_SHA 0x03000012 163ebfedea0SLionel Sambuc # define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA 0x03000013 164ebfedea0SLionel Sambuc # define SSL3_CK_EDH_RSA_DES_40_CBC_SHA 0x03000014 165ebfedea0SLionel Sambuc # define SSL3_CK_EDH_RSA_DES_64_CBC_SHA 0x03000015 166ebfedea0SLionel Sambuc # define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA 0x03000016 167ebfedea0SLionel Sambuc 168ebfedea0SLionel Sambuc # define SSL3_CK_ADH_RC4_40_MD5 0x03000017 169ebfedea0SLionel Sambuc # define SSL3_CK_ADH_RC4_128_MD5 0x03000018 170ebfedea0SLionel Sambuc # define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019 171ebfedea0SLionel Sambuc # define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A 172ebfedea0SLionel Sambuc # define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B 173ebfedea0SLionel Sambuc 174ebfedea0SLionel Sambuc # if 0 175ebfedea0SLionel Sambuc # define SSL3_CK_FZA_DMS_NULL_SHA 0x0300001C 176ebfedea0SLionel Sambuc # define SSL3_CK_FZA_DMS_FZA_SHA 0x0300001D 177*0a6a1f1dSLionel Sambuc # if 0 /* Because it clashes with KRB5, is never 178*0a6a1f1dSLionel Sambuc * used any more, and is safe to remove 179*0a6a1f1dSLionel Sambuc * according to David Hopwood 180*0a6a1f1dSLionel Sambuc * <david.hopwood@zetnet.co.uk> of the 181*0a6a1f1dSLionel Sambuc * ietf-tls list */ 182ebfedea0SLionel Sambuc # define SSL3_CK_FZA_DMS_RC4_SHA 0x0300001E 183ebfedea0SLionel Sambuc # endif 184ebfedea0SLionel Sambuc # endif 185ebfedea0SLionel Sambuc 186*0a6a1f1dSLionel Sambuc /* 187*0a6a1f1dSLionel Sambuc * VRS Additional Kerberos5 entries 188ebfedea0SLionel Sambuc */ 189ebfedea0SLionel Sambuc # define SSL3_CK_KRB5_DES_64_CBC_SHA 0x0300001E 190ebfedea0SLionel Sambuc # define SSL3_CK_KRB5_DES_192_CBC3_SHA 0x0300001F 191ebfedea0SLionel Sambuc # define SSL3_CK_KRB5_RC4_128_SHA 0x03000020 192ebfedea0SLionel Sambuc # define SSL3_CK_KRB5_IDEA_128_CBC_SHA 0x03000021 193ebfedea0SLionel Sambuc # define SSL3_CK_KRB5_DES_64_CBC_MD5 0x03000022 194ebfedea0SLionel Sambuc # define SSL3_CK_KRB5_DES_192_CBC3_MD5 0x03000023 195ebfedea0SLionel Sambuc # define SSL3_CK_KRB5_RC4_128_MD5 0x03000024 196ebfedea0SLionel Sambuc # define SSL3_CK_KRB5_IDEA_128_CBC_MD5 0x03000025 197ebfedea0SLionel Sambuc 198ebfedea0SLionel Sambuc # define SSL3_CK_KRB5_DES_40_CBC_SHA 0x03000026 199ebfedea0SLionel Sambuc # define SSL3_CK_KRB5_RC2_40_CBC_SHA 0x03000027 200ebfedea0SLionel Sambuc # define SSL3_CK_KRB5_RC4_40_SHA 0x03000028 201ebfedea0SLionel Sambuc # define SSL3_CK_KRB5_DES_40_CBC_MD5 0x03000029 202ebfedea0SLionel Sambuc # define SSL3_CK_KRB5_RC2_40_CBC_MD5 0x0300002A 203ebfedea0SLionel Sambuc # define SSL3_CK_KRB5_RC4_40_MD5 0x0300002B 204ebfedea0SLionel Sambuc 205ebfedea0SLionel Sambuc # define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" 206ebfedea0SLionel Sambuc # define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" 207ebfedea0SLionel Sambuc # define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" 208ebfedea0SLionel Sambuc # define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" 209ebfedea0SLionel Sambuc # define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" 210ebfedea0SLionel Sambuc # define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" 211ebfedea0SLionel Sambuc # define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA" 212ebfedea0SLionel Sambuc # define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA" 213ebfedea0SLionel Sambuc # define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA" 214ebfedea0SLionel Sambuc # define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA" 215ebfedea0SLionel Sambuc 216ebfedea0SLionel Sambuc # define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" 217ebfedea0SLionel Sambuc # define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" 218ebfedea0SLionel Sambuc # define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" 219ebfedea0SLionel Sambuc # define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" 220ebfedea0SLionel Sambuc # define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" 221ebfedea0SLionel Sambuc # define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" 222ebfedea0SLionel Sambuc 223ebfedea0SLionel Sambuc # define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" 224ebfedea0SLionel Sambuc # define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" 225ebfedea0SLionel Sambuc # define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA" 226ebfedea0SLionel Sambuc # define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA" 227ebfedea0SLionel Sambuc # define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA" 228ebfedea0SLionel Sambuc # define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA" 229ebfedea0SLionel Sambuc 230ebfedea0SLionel Sambuc # define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5" 231ebfedea0SLionel Sambuc # define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5" 232ebfedea0SLionel Sambuc # define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA" 233ebfedea0SLionel Sambuc # define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA" 234ebfedea0SLionel Sambuc # define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" 235ebfedea0SLionel Sambuc 236ebfedea0SLionel Sambuc # if 0 237ebfedea0SLionel Sambuc # define SSL3_TXT_FZA_DMS_NULL_SHA "FZA-NULL-SHA" 238ebfedea0SLionel Sambuc # define SSL3_TXT_FZA_DMS_FZA_SHA "FZA-FZA-CBC-SHA" 239ebfedea0SLionel Sambuc # define SSL3_TXT_FZA_DMS_RC4_SHA "FZA-RC4-SHA" 240ebfedea0SLionel Sambuc # endif 241ebfedea0SLionel Sambuc 242ebfedea0SLionel Sambuc # define SSL3_TXT_KRB5_DES_64_CBC_SHA "KRB5-DES-CBC-SHA" 243ebfedea0SLionel Sambuc # define SSL3_TXT_KRB5_DES_192_CBC3_SHA "KRB5-DES-CBC3-SHA" 244ebfedea0SLionel Sambuc # define SSL3_TXT_KRB5_RC4_128_SHA "KRB5-RC4-SHA" 245ebfedea0SLionel Sambuc # define SSL3_TXT_KRB5_IDEA_128_CBC_SHA "KRB5-IDEA-CBC-SHA" 246ebfedea0SLionel Sambuc # define SSL3_TXT_KRB5_DES_64_CBC_MD5 "KRB5-DES-CBC-MD5" 247ebfedea0SLionel Sambuc # define SSL3_TXT_KRB5_DES_192_CBC3_MD5 "KRB5-DES-CBC3-MD5" 248ebfedea0SLionel Sambuc # define SSL3_TXT_KRB5_RC4_128_MD5 "KRB5-RC4-MD5" 249ebfedea0SLionel Sambuc # define SSL3_TXT_KRB5_IDEA_128_CBC_MD5 "KRB5-IDEA-CBC-MD5" 250ebfedea0SLionel Sambuc 251ebfedea0SLionel Sambuc # define SSL3_TXT_KRB5_DES_40_CBC_SHA "EXP-KRB5-DES-CBC-SHA" 252ebfedea0SLionel Sambuc # define SSL3_TXT_KRB5_RC2_40_CBC_SHA "EXP-KRB5-RC2-CBC-SHA" 253ebfedea0SLionel Sambuc # define SSL3_TXT_KRB5_RC4_40_SHA "EXP-KRB5-RC4-SHA" 254ebfedea0SLionel Sambuc # define SSL3_TXT_KRB5_DES_40_CBC_MD5 "EXP-KRB5-DES-CBC-MD5" 255ebfedea0SLionel Sambuc # define SSL3_TXT_KRB5_RC2_40_CBC_MD5 "EXP-KRB5-RC2-CBC-MD5" 256ebfedea0SLionel Sambuc # define SSL3_TXT_KRB5_RC4_40_MD5 "EXP-KRB5-RC4-MD5" 257ebfedea0SLionel Sambuc 258ebfedea0SLionel Sambuc # define SSL3_SSL_SESSION_ID_LENGTH 32 259ebfedea0SLionel Sambuc # define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 260ebfedea0SLionel Sambuc 261ebfedea0SLionel Sambuc # define SSL3_MASTER_SECRET_SIZE 48 262ebfedea0SLionel Sambuc # define SSL3_RANDOM_SIZE 32 263ebfedea0SLionel Sambuc # define SSL3_SESSION_ID_SIZE 32 264ebfedea0SLionel Sambuc # define SSL3_RT_HEADER_LENGTH 5 265ebfedea0SLionel Sambuc 266ebfedea0SLionel Sambuc # ifndef SSL3_ALIGN_PAYLOAD 267*0a6a1f1dSLionel Sambuc /* 268*0a6a1f1dSLionel Sambuc * Some will argue that this increases memory footprint, but it's not 269*0a6a1f1dSLionel Sambuc * actually true. Point is that malloc has to return at least 64-bit aligned 270*0a6a1f1dSLionel Sambuc * pointers, meaning that allocating 5 bytes wastes 3 bytes in either case. 271*0a6a1f1dSLionel Sambuc * Suggested pre-gaping simply moves these wasted bytes from the end of 272*0a6a1f1dSLionel Sambuc * allocated region to its front, but makes data payload aligned, which 273*0a6a1f1dSLionel Sambuc * improves performance:-) 274*0a6a1f1dSLionel Sambuc */ 275ebfedea0SLionel Sambuc # define SSL3_ALIGN_PAYLOAD 8 276ebfedea0SLionel Sambuc # else 277ebfedea0SLionel Sambuc # if (SSL3_ALIGN_PAYLOAD&(SSL3_ALIGN_PAYLOAD-1))!=0 278ebfedea0SLionel Sambuc # error "insane SSL3_ALIGN_PAYLOAD" 279ebfedea0SLionel Sambuc # undef SSL3_ALIGN_PAYLOAD 280ebfedea0SLionel Sambuc # endif 281ebfedea0SLionel Sambuc # endif 282ebfedea0SLionel Sambuc 283*0a6a1f1dSLionel Sambuc /* 284*0a6a1f1dSLionel Sambuc * This is the maximum MAC (digest) size used by the SSL library. Currently 285*0a6a1f1dSLionel Sambuc * maximum of 20 is used by SHA1, but we reserve for future extension for 286*0a6a1f1dSLionel Sambuc * 512-bit hashes. 287ebfedea0SLionel Sambuc */ 288ebfedea0SLionel Sambuc 289ebfedea0SLionel Sambuc # define SSL3_RT_MAX_MD_SIZE 64 290ebfedea0SLionel Sambuc 291*0a6a1f1dSLionel Sambuc /* 292*0a6a1f1dSLionel Sambuc * Maximum block size used in all ciphersuites. Currently 16 for AES. 293ebfedea0SLionel Sambuc */ 294ebfedea0SLionel Sambuc 295ebfedea0SLionel Sambuc # define SSL_RT_MAX_CIPHER_BLOCK_SIZE 16 296ebfedea0SLionel Sambuc 297ebfedea0SLionel Sambuc # define SSL3_RT_MAX_EXTRA (16384) 298ebfedea0SLionel Sambuc 299ebfedea0SLionel Sambuc /* Maximum plaintext length: defined by SSL/TLS standards */ 300ebfedea0SLionel Sambuc # define SSL3_RT_MAX_PLAIN_LENGTH 16384 301ebfedea0SLionel Sambuc /* Maximum compression overhead: defined by SSL/TLS standards */ 302ebfedea0SLionel Sambuc # define SSL3_RT_MAX_COMPRESSED_OVERHEAD 1024 303ebfedea0SLionel Sambuc 304*0a6a1f1dSLionel Sambuc /* 305*0a6a1f1dSLionel Sambuc * The standards give a maximum encryption overhead of 1024 bytes. In 306*0a6a1f1dSLionel Sambuc * practice the value is lower than this. The overhead is the maximum number 307*0a6a1f1dSLionel Sambuc * of padding bytes (256) plus the mac size. 308ebfedea0SLionel Sambuc */ 309ebfedea0SLionel Sambuc # define SSL3_RT_MAX_ENCRYPTED_OVERHEAD (256 + SSL3_RT_MAX_MD_SIZE) 310ebfedea0SLionel Sambuc 311*0a6a1f1dSLionel Sambuc /* 312*0a6a1f1dSLionel Sambuc * OpenSSL currently only uses a padding length of at most one block so the 313*0a6a1f1dSLionel Sambuc * send overhead is smaller. 314ebfedea0SLionel Sambuc */ 315ebfedea0SLionel Sambuc 316ebfedea0SLionel Sambuc # define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \ 317ebfedea0SLionel Sambuc (SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE) 318ebfedea0SLionel Sambuc 319ebfedea0SLionel Sambuc /* If compression isn't used don't include the compression overhead */ 320ebfedea0SLionel Sambuc 321ebfedea0SLionel Sambuc # ifdef OPENSSL_NO_COMP 322ebfedea0SLionel Sambuc # define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH 323ebfedea0SLionel Sambuc # else 324ebfedea0SLionel Sambuc # define SSL3_RT_MAX_COMPRESSED_LENGTH \ 325ebfedea0SLionel Sambuc (SSL3_RT_MAX_PLAIN_LENGTH+SSL3_RT_MAX_COMPRESSED_OVERHEAD) 326ebfedea0SLionel Sambuc # endif 327ebfedea0SLionel Sambuc # define SSL3_RT_MAX_ENCRYPTED_LENGTH \ 328ebfedea0SLionel Sambuc (SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH) 329ebfedea0SLionel Sambuc # define SSL3_RT_MAX_PACKET_SIZE \ 330ebfedea0SLionel Sambuc (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH) 331ebfedea0SLionel Sambuc 332ebfedea0SLionel Sambuc # define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54" 333ebfedea0SLionel Sambuc # define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52" 334ebfedea0SLionel Sambuc 335ebfedea0SLionel Sambuc # define SSL3_VERSION 0x0300 336ebfedea0SLionel Sambuc # define SSL3_VERSION_MAJOR 0x03 337ebfedea0SLionel Sambuc # define SSL3_VERSION_MINOR 0x00 338ebfedea0SLionel Sambuc 339ebfedea0SLionel Sambuc # define SSL3_RT_CHANGE_CIPHER_SPEC 20 340ebfedea0SLionel Sambuc # define SSL3_RT_ALERT 21 341ebfedea0SLionel Sambuc # define SSL3_RT_HANDSHAKE 22 342ebfedea0SLionel Sambuc # define SSL3_RT_APPLICATION_DATA 23 343ebfedea0SLionel Sambuc # define TLS1_RT_HEARTBEAT 24 344ebfedea0SLionel Sambuc 345ebfedea0SLionel Sambuc # define SSL3_AL_WARNING 1 346ebfedea0SLionel Sambuc # define SSL3_AL_FATAL 2 347ebfedea0SLionel Sambuc 348ebfedea0SLionel Sambuc # define SSL3_AD_CLOSE_NOTIFY 0 349ebfedea0SLionel Sambuc # define SSL3_AD_UNEXPECTED_MESSAGE 10/* fatal */ 350ebfedea0SLionel Sambuc # define SSL3_AD_BAD_RECORD_MAC 20/* fatal */ 351ebfedea0SLionel Sambuc # define SSL3_AD_DECOMPRESSION_FAILURE 30/* fatal */ 352ebfedea0SLionel Sambuc # define SSL3_AD_HANDSHAKE_FAILURE 40/* fatal */ 353ebfedea0SLionel Sambuc # define SSL3_AD_NO_CERTIFICATE 41 354ebfedea0SLionel Sambuc # define SSL3_AD_BAD_CERTIFICATE 42 355ebfedea0SLionel Sambuc # define SSL3_AD_UNSUPPORTED_CERTIFICATE 43 356ebfedea0SLionel Sambuc # define SSL3_AD_CERTIFICATE_REVOKED 44 357ebfedea0SLionel Sambuc # define SSL3_AD_CERTIFICATE_EXPIRED 45 358ebfedea0SLionel Sambuc # define SSL3_AD_CERTIFICATE_UNKNOWN 46 359ebfedea0SLionel Sambuc # define SSL3_AD_ILLEGAL_PARAMETER 47/* fatal */ 360ebfedea0SLionel Sambuc 361ebfedea0SLionel Sambuc # define TLS1_HB_REQUEST 1 362ebfedea0SLionel Sambuc # define TLS1_HB_RESPONSE 2 363ebfedea0SLionel Sambuc 364ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_SSL_INTERN 365ebfedea0SLionel Sambuc 366*0a6a1f1dSLionel Sambuc typedef struct ssl3_record_st { 367*0a6a1f1dSLionel Sambuc /* type of record */ 368*0a6a1f1dSLionel Sambuc /* 369*0a6a1f1dSLionel Sambuc * r 370*0a6a1f1dSLionel Sambuc */ int type; 371*0a6a1f1dSLionel Sambuc /* How many bytes available */ 372*0a6a1f1dSLionel Sambuc /* 373*0a6a1f1dSLionel Sambuc * rw 374*0a6a1f1dSLionel Sambuc */ unsigned int length; 375*0a6a1f1dSLionel Sambuc /* read/write offset into 'buf' */ 376*0a6a1f1dSLionel Sambuc /* 377*0a6a1f1dSLionel Sambuc * r 378*0a6a1f1dSLionel Sambuc */ unsigned int off; 379*0a6a1f1dSLionel Sambuc /* pointer to the record data */ 380*0a6a1f1dSLionel Sambuc /* 381*0a6a1f1dSLionel Sambuc * rw 382*0a6a1f1dSLionel Sambuc */ unsigned char *data; 383*0a6a1f1dSLionel Sambuc /* where the decode bytes are */ 384*0a6a1f1dSLionel Sambuc /* 385*0a6a1f1dSLionel Sambuc * rw 386*0a6a1f1dSLionel Sambuc */ unsigned char *input; 387*0a6a1f1dSLionel Sambuc /* only used with decompression - malloc()ed */ 388*0a6a1f1dSLionel Sambuc /* 389*0a6a1f1dSLionel Sambuc * r 390*0a6a1f1dSLionel Sambuc */ unsigned char *comp; 391*0a6a1f1dSLionel Sambuc /* epoch number, needed by DTLS1 */ 392*0a6a1f1dSLionel Sambuc /* 393*0a6a1f1dSLionel Sambuc * r 394*0a6a1f1dSLionel Sambuc */ unsigned long epoch; 395*0a6a1f1dSLionel Sambuc /* sequence number, needed by DTLS1 */ 396*0a6a1f1dSLionel Sambuc /* 397*0a6a1f1dSLionel Sambuc * r 398*0a6a1f1dSLionel Sambuc */ unsigned char seq_num[8]; 399ebfedea0SLionel Sambuc } SSL3_RECORD; 400ebfedea0SLionel Sambuc 401*0a6a1f1dSLionel Sambuc typedef struct ssl3_buffer_st { 402*0a6a1f1dSLionel Sambuc /* at least SSL3_RT_MAX_PACKET_SIZE bytes, see ssl3_setup_buffers() */ 403*0a6a1f1dSLionel Sambuc unsigned char *buf; 404*0a6a1f1dSLionel Sambuc /* buffer size */ 405*0a6a1f1dSLionel Sambuc size_t len; 406*0a6a1f1dSLionel Sambuc /* where to 'copy from' */ 407*0a6a1f1dSLionel Sambuc int offset; 408*0a6a1f1dSLionel Sambuc /* how many bytes left */ 409*0a6a1f1dSLionel Sambuc int left; 410ebfedea0SLionel Sambuc } SSL3_BUFFER; 411ebfedea0SLionel Sambuc 412ebfedea0SLionel Sambuc # endif 413ebfedea0SLionel Sambuc 414ebfedea0SLionel Sambuc # define SSL3_CT_RSA_SIGN 1 415ebfedea0SLionel Sambuc # define SSL3_CT_DSS_SIGN 2 416ebfedea0SLionel Sambuc # define SSL3_CT_RSA_FIXED_DH 3 417ebfedea0SLionel Sambuc # define SSL3_CT_DSS_FIXED_DH 4 418ebfedea0SLionel Sambuc # define SSL3_CT_RSA_EPHEMERAL_DH 5 419ebfedea0SLionel Sambuc # define SSL3_CT_DSS_EPHEMERAL_DH 6 420ebfedea0SLionel Sambuc # define SSL3_CT_FORTEZZA_DMS 20 421*0a6a1f1dSLionel Sambuc /* 422*0a6a1f1dSLionel Sambuc * SSL3_CT_NUMBER is used to size arrays and it must be large enough to 423*0a6a1f1dSLionel Sambuc * contain all of the cert types defined either for SSLv3 and TLSv1. 424ebfedea0SLionel Sambuc */ 425ebfedea0SLionel Sambuc # define SSL3_CT_NUMBER 9 426ebfedea0SLionel Sambuc 427ebfedea0SLionel Sambuc # define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001 428ebfedea0SLionel Sambuc # define SSL3_FLAGS_DELAY_CLIENT_FINISHED 0x0002 429ebfedea0SLionel Sambuc # define SSL3_FLAGS_POP_BUFFER 0x0004 430ebfedea0SLionel Sambuc # define TLS1_FLAGS_TLS_PADDING_BUG 0x0008 431ebfedea0SLionel Sambuc # define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 432ebfedea0SLionel Sambuc # define TLS1_FLAGS_KEEP_HANDSHAKE 0x0020 433*0a6a1f1dSLionel Sambuc /* 434*0a6a1f1dSLionel Sambuc * Set when the handshake is ready to process peer's ChangeCipherSpec message. 435*0a6a1f1dSLionel Sambuc * Cleared after the message has been processed. 436*0a6a1f1dSLionel Sambuc */ 437*0a6a1f1dSLionel Sambuc # define SSL3_FLAGS_CCS_OK 0x0080 438ebfedea0SLionel Sambuc 439*0a6a1f1dSLionel Sambuc /* 440*0a6a1f1dSLionel Sambuc * SSL3_FLAGS_SGC_RESTART_DONE is set when we restart a handshake because of 441*0a6a1f1dSLionel Sambuc * MS SGC and so prevents us from restarting the handshake in a loop. It's 442*0a6a1f1dSLionel Sambuc * reset on a renegotiation, so effectively limits the client to one restart 443*0a6a1f1dSLionel Sambuc * per negotiation. This limits the possibility of a DDoS attack where the 444*0a6a1f1dSLionel Sambuc * client handshakes in a loop using SGC to restart. Servers which permit 445*0a6a1f1dSLionel Sambuc * renegotiation can still be effected, but we can't prevent that. 446ebfedea0SLionel Sambuc */ 447ebfedea0SLionel Sambuc # define SSL3_FLAGS_SGC_RESTART_DONE 0x0040 448ebfedea0SLionel Sambuc 449ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_SSL_INTERN 450ebfedea0SLionel Sambuc 451*0a6a1f1dSLionel Sambuc typedef struct ssl3_state_st { 452ebfedea0SLionel Sambuc long flags; 453ebfedea0SLionel Sambuc int delay_buf_pop_ret; 454ebfedea0SLionel Sambuc unsigned char read_sequence[8]; 455ebfedea0SLionel Sambuc int read_mac_secret_size; 456ebfedea0SLionel Sambuc unsigned char read_mac_secret[EVP_MAX_MD_SIZE]; 457ebfedea0SLionel Sambuc unsigned char write_sequence[8]; 458ebfedea0SLionel Sambuc int write_mac_secret_size; 459ebfedea0SLionel Sambuc unsigned char write_mac_secret[EVP_MAX_MD_SIZE]; 460ebfedea0SLionel Sambuc unsigned char server_random[SSL3_RANDOM_SIZE]; 461ebfedea0SLionel Sambuc unsigned char client_random[SSL3_RANDOM_SIZE]; 462ebfedea0SLionel Sambuc /* flags for countermeasure against known-IV weakness */ 463ebfedea0SLionel Sambuc int need_empty_fragments; 464ebfedea0SLionel Sambuc int empty_fragment_done; 465ebfedea0SLionel Sambuc /* The value of 'extra' when the buffers were initialized */ 466ebfedea0SLionel Sambuc int init_extra; 467ebfedea0SLionel Sambuc SSL3_BUFFER rbuf; /* read IO goes into here */ 468ebfedea0SLionel Sambuc SSL3_BUFFER wbuf; /* write IO goes into here */ 469ebfedea0SLionel Sambuc SSL3_RECORD rrec; /* each decoded record goes in here */ 470ebfedea0SLionel Sambuc SSL3_RECORD wrec; /* goes out from here */ 471*0a6a1f1dSLionel Sambuc /* 472*0a6a1f1dSLionel Sambuc * storage for Alert/Handshake protocol data received but not yet 473*0a6a1f1dSLionel Sambuc * processed by ssl3_read_bytes: 474*0a6a1f1dSLionel Sambuc */ 475ebfedea0SLionel Sambuc unsigned char alert_fragment[2]; 476ebfedea0SLionel Sambuc unsigned int alert_fragment_len; 477ebfedea0SLionel Sambuc unsigned char handshake_fragment[4]; 478ebfedea0SLionel Sambuc unsigned int handshake_fragment_len; 479ebfedea0SLionel Sambuc /* partial write - check the numbers match */ 480ebfedea0SLionel Sambuc unsigned int wnum; /* number of bytes sent so far */ 481ebfedea0SLionel Sambuc int wpend_tot; /* number bytes written */ 482ebfedea0SLionel Sambuc int wpend_type; 483ebfedea0SLionel Sambuc int wpend_ret; /* number of bytes submitted */ 484ebfedea0SLionel Sambuc const unsigned char *wpend_buf; 485ebfedea0SLionel Sambuc /* used during startup, digest all incoming/outgoing packets */ 486ebfedea0SLionel Sambuc BIO *handshake_buffer; 487*0a6a1f1dSLionel Sambuc /* 488*0a6a1f1dSLionel Sambuc * When set of handshake digests is determined, buffer is hashed and 489*0a6a1f1dSLionel Sambuc * freed and MD_CTX-es for all required digests are stored in this array 490*0a6a1f1dSLionel Sambuc */ 491ebfedea0SLionel Sambuc EVP_MD_CTX **handshake_dgst; 492*0a6a1f1dSLionel Sambuc /* 493*0a6a1f1dSLionel Sambuc * Set whenever an expected ChangeCipherSpec message is processed. 494*0a6a1f1dSLionel Sambuc * Unset when the peer's Finished message is received. 495*0a6a1f1dSLionel Sambuc * Unexpected ChangeCipherSpec messages trigger a fatal alert. 496*0a6a1f1dSLionel Sambuc */ 497ebfedea0SLionel Sambuc int change_cipher_spec; 498ebfedea0SLionel Sambuc int warn_alert; 499ebfedea0SLionel Sambuc int fatal_alert; 500*0a6a1f1dSLionel Sambuc /* 501*0a6a1f1dSLionel Sambuc * we allow one fatal and one warning alert to be outstanding, send close 502*0a6a1f1dSLionel Sambuc * alert via the warning alert 503*0a6a1f1dSLionel Sambuc */ 504ebfedea0SLionel Sambuc int alert_dispatch; 505ebfedea0SLionel Sambuc unsigned char send_alert[2]; 506*0a6a1f1dSLionel Sambuc /* 507*0a6a1f1dSLionel Sambuc * This flag is set when we should renegotiate ASAP, basically when there 508*0a6a1f1dSLionel Sambuc * is no more data in the read or write buffers 509*0a6a1f1dSLionel Sambuc */ 510ebfedea0SLionel Sambuc int renegotiate; 511ebfedea0SLionel Sambuc int total_renegotiations; 512ebfedea0SLionel Sambuc int num_renegotiations; 513ebfedea0SLionel Sambuc int in_read_app_data; 514*0a6a1f1dSLionel Sambuc /* 515*0a6a1f1dSLionel Sambuc * Opaque PRF input as used for the current handshake. These fields are 516*0a6a1f1dSLionel Sambuc * used only if TLSEXT_TYPE_opaque_prf_input is defined (otherwise, they 517*0a6a1f1dSLionel Sambuc * are merely present to improve binary compatibility) 518*0a6a1f1dSLionel Sambuc */ 519ebfedea0SLionel Sambuc void *client_opaque_prf_input; 520ebfedea0SLionel Sambuc size_t client_opaque_prf_input_len; 521ebfedea0SLionel Sambuc void *server_opaque_prf_input; 522ebfedea0SLionel Sambuc size_t server_opaque_prf_input_len; 523ebfedea0SLionel Sambuc struct { 524ebfedea0SLionel Sambuc /* actually only needs to be 16+20 */ 525ebfedea0SLionel Sambuc unsigned char cert_verify_md[EVP_MAX_MD_SIZE * 2]; 526ebfedea0SLionel Sambuc /* actually only need to be 16+20 for SSLv3 and 12 for TLS */ 527ebfedea0SLionel Sambuc unsigned char finish_md[EVP_MAX_MD_SIZE * 2]; 528ebfedea0SLionel Sambuc int finish_md_len; 529ebfedea0SLionel Sambuc unsigned char peer_finish_md[EVP_MAX_MD_SIZE * 2]; 530ebfedea0SLionel Sambuc int peer_finish_md_len; 531ebfedea0SLionel Sambuc unsigned long message_size; 532ebfedea0SLionel Sambuc int message_type; 533ebfedea0SLionel Sambuc /* used to hold the new cipher we are going to use */ 534ebfedea0SLionel Sambuc const SSL_CIPHER *new_cipher; 535ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_DH 536ebfedea0SLionel Sambuc DH *dh; 537ebfedea0SLionel Sambuc # endif 538ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_ECDH 539ebfedea0SLionel Sambuc EC_KEY *ecdh; /* holds short lived ECDH key */ 540ebfedea0SLionel Sambuc # endif 541ebfedea0SLionel Sambuc /* used when SSL_ST_FLUSH_DATA is entered */ 542ebfedea0SLionel Sambuc int next_state; 543ebfedea0SLionel Sambuc int reuse_message; 544ebfedea0SLionel Sambuc /* used for certificate requests */ 545ebfedea0SLionel Sambuc int cert_req; 546ebfedea0SLionel Sambuc int ctype_num; 547ebfedea0SLionel Sambuc char ctype[SSL3_CT_NUMBER]; 548ebfedea0SLionel Sambuc STACK_OF(X509_NAME) *ca_names; 549ebfedea0SLionel Sambuc int use_rsa_tmp; 550ebfedea0SLionel Sambuc int key_block_length; 551ebfedea0SLionel Sambuc unsigned char *key_block; 552ebfedea0SLionel Sambuc const EVP_CIPHER *new_sym_enc; 553ebfedea0SLionel Sambuc const EVP_MD *new_hash; 554ebfedea0SLionel Sambuc int new_mac_pkey_type; 555ebfedea0SLionel Sambuc int new_mac_secret_size; 556ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_COMP 557ebfedea0SLionel Sambuc const SSL_COMP *new_compression; 558ebfedea0SLionel Sambuc # else 559ebfedea0SLionel Sambuc char *new_compression; 560ebfedea0SLionel Sambuc # endif 561ebfedea0SLionel Sambuc int cert_request; 562ebfedea0SLionel Sambuc } tmp; 563ebfedea0SLionel Sambuc 564ebfedea0SLionel Sambuc /* Connection binding to prevent renegotiation attacks */ 565ebfedea0SLionel Sambuc unsigned char previous_client_finished[EVP_MAX_MD_SIZE]; 566ebfedea0SLionel Sambuc unsigned char previous_client_finished_len; 567ebfedea0SLionel Sambuc unsigned char previous_server_finished[EVP_MAX_MD_SIZE]; 568ebfedea0SLionel Sambuc unsigned char previous_server_finished_len; 569ebfedea0SLionel Sambuc int send_connection_binding; /* TODOEKR */ 570ebfedea0SLionel Sambuc 571ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_NEXTPROTONEG 572*0a6a1f1dSLionel Sambuc /* 573*0a6a1f1dSLionel Sambuc * Set if we saw the Next Protocol Negotiation extension from our peer. 574*0a6a1f1dSLionel Sambuc */ 575ebfedea0SLionel Sambuc int next_proto_neg_seen; 576ebfedea0SLionel Sambuc # endif 577*0a6a1f1dSLionel Sambuc 578*0a6a1f1dSLionel Sambuc # ifndef OPENSSL_NO_TLSEXT 579*0a6a1f1dSLionel Sambuc # ifndef OPENSSL_NO_EC 580*0a6a1f1dSLionel Sambuc /* 581*0a6a1f1dSLionel Sambuc * This is set to true if we believe that this is a version of Safari 582*0a6a1f1dSLionel Sambuc * running on OS X 10.6 or newer. We wish to know this because Safari on 583*0a6a1f1dSLionel Sambuc * 10.8 .. 10.8.3 has broken ECDHE-ECDSA support. 584*0a6a1f1dSLionel Sambuc */ 585*0a6a1f1dSLionel Sambuc char is_probably_safari; 586*0a6a1f1dSLionel Sambuc # endif /* !OPENSSL_NO_EC */ 587*0a6a1f1dSLionel Sambuc # endif /* !OPENSSL_NO_TLSEXT */ 588ebfedea0SLionel Sambuc } SSL3_STATE; 589ebfedea0SLionel Sambuc 590ebfedea0SLionel Sambuc # endif 591ebfedea0SLionel Sambuc 592ebfedea0SLionel Sambuc /* SSLv3 */ 593*0a6a1f1dSLionel Sambuc /* 594*0a6a1f1dSLionel Sambuc * client 595*0a6a1f1dSLionel Sambuc */ 596ebfedea0SLionel Sambuc /* extra state */ 597ebfedea0SLionel Sambuc # define SSL3_ST_CW_FLUSH (0x100|SSL_ST_CONNECT) 598ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_SCTP 599ebfedea0SLionel Sambuc # define DTLS1_SCTP_ST_CW_WRITE_SOCK (0x310|SSL_ST_CONNECT) 600ebfedea0SLionel Sambuc # define DTLS1_SCTP_ST_CR_READ_SOCK (0x320|SSL_ST_CONNECT) 601ebfedea0SLionel Sambuc # endif 602ebfedea0SLionel Sambuc /* write to server */ 603ebfedea0SLionel Sambuc # define SSL3_ST_CW_CLNT_HELLO_A (0x110|SSL_ST_CONNECT) 604ebfedea0SLionel Sambuc # define SSL3_ST_CW_CLNT_HELLO_B (0x111|SSL_ST_CONNECT) 605ebfedea0SLionel Sambuc /* read from server */ 606ebfedea0SLionel Sambuc # define SSL3_ST_CR_SRVR_HELLO_A (0x120|SSL_ST_CONNECT) 607ebfedea0SLionel Sambuc # define SSL3_ST_CR_SRVR_HELLO_B (0x121|SSL_ST_CONNECT) 608ebfedea0SLionel Sambuc # define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A (0x126|SSL_ST_CONNECT) 609ebfedea0SLionel Sambuc # define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B (0x127|SSL_ST_CONNECT) 610ebfedea0SLionel Sambuc # define SSL3_ST_CR_CERT_A (0x130|SSL_ST_CONNECT) 611ebfedea0SLionel Sambuc # define SSL3_ST_CR_CERT_B (0x131|SSL_ST_CONNECT) 612ebfedea0SLionel Sambuc # define SSL3_ST_CR_KEY_EXCH_A (0x140|SSL_ST_CONNECT) 613ebfedea0SLionel Sambuc # define SSL3_ST_CR_KEY_EXCH_B (0x141|SSL_ST_CONNECT) 614ebfedea0SLionel Sambuc # define SSL3_ST_CR_CERT_REQ_A (0x150|SSL_ST_CONNECT) 615ebfedea0SLionel Sambuc # define SSL3_ST_CR_CERT_REQ_B (0x151|SSL_ST_CONNECT) 616ebfedea0SLionel Sambuc # define SSL3_ST_CR_SRVR_DONE_A (0x160|SSL_ST_CONNECT) 617ebfedea0SLionel Sambuc # define SSL3_ST_CR_SRVR_DONE_B (0x161|SSL_ST_CONNECT) 618ebfedea0SLionel Sambuc /* write to server */ 619ebfedea0SLionel Sambuc # define SSL3_ST_CW_CERT_A (0x170|SSL_ST_CONNECT) 620ebfedea0SLionel Sambuc # define SSL3_ST_CW_CERT_B (0x171|SSL_ST_CONNECT) 621ebfedea0SLionel Sambuc # define SSL3_ST_CW_CERT_C (0x172|SSL_ST_CONNECT) 622ebfedea0SLionel Sambuc # define SSL3_ST_CW_CERT_D (0x173|SSL_ST_CONNECT) 623ebfedea0SLionel Sambuc # define SSL3_ST_CW_KEY_EXCH_A (0x180|SSL_ST_CONNECT) 624ebfedea0SLionel Sambuc # define SSL3_ST_CW_KEY_EXCH_B (0x181|SSL_ST_CONNECT) 625ebfedea0SLionel Sambuc # define SSL3_ST_CW_CERT_VRFY_A (0x190|SSL_ST_CONNECT) 626ebfedea0SLionel Sambuc # define SSL3_ST_CW_CERT_VRFY_B (0x191|SSL_ST_CONNECT) 627ebfedea0SLionel Sambuc # define SSL3_ST_CW_CHANGE_A (0x1A0|SSL_ST_CONNECT) 628ebfedea0SLionel Sambuc # define SSL3_ST_CW_CHANGE_B (0x1A1|SSL_ST_CONNECT) 629ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_NEXTPROTONEG 630ebfedea0SLionel Sambuc # define SSL3_ST_CW_NEXT_PROTO_A (0x200|SSL_ST_CONNECT) 631ebfedea0SLionel Sambuc # define SSL3_ST_CW_NEXT_PROTO_B (0x201|SSL_ST_CONNECT) 632ebfedea0SLionel Sambuc # endif 633ebfedea0SLionel Sambuc # define SSL3_ST_CW_FINISHED_A (0x1B0|SSL_ST_CONNECT) 634ebfedea0SLionel Sambuc # define SSL3_ST_CW_FINISHED_B (0x1B1|SSL_ST_CONNECT) 635ebfedea0SLionel Sambuc /* read from server */ 636ebfedea0SLionel Sambuc # define SSL3_ST_CR_CHANGE_A (0x1C0|SSL_ST_CONNECT) 637ebfedea0SLionel Sambuc # define SSL3_ST_CR_CHANGE_B (0x1C1|SSL_ST_CONNECT) 638ebfedea0SLionel Sambuc # define SSL3_ST_CR_FINISHED_A (0x1D0|SSL_ST_CONNECT) 639ebfedea0SLionel Sambuc # define SSL3_ST_CR_FINISHED_B (0x1D1|SSL_ST_CONNECT) 640ebfedea0SLionel Sambuc # define SSL3_ST_CR_SESSION_TICKET_A (0x1E0|SSL_ST_CONNECT) 641ebfedea0SLionel Sambuc # define SSL3_ST_CR_SESSION_TICKET_B (0x1E1|SSL_ST_CONNECT) 642ebfedea0SLionel Sambuc # define SSL3_ST_CR_CERT_STATUS_A (0x1F0|SSL_ST_CONNECT) 643ebfedea0SLionel Sambuc # define SSL3_ST_CR_CERT_STATUS_B (0x1F1|SSL_ST_CONNECT) 644ebfedea0SLionel Sambuc 645ebfedea0SLionel Sambuc /* server */ 646ebfedea0SLionel Sambuc /* extra state */ 647ebfedea0SLionel Sambuc # define SSL3_ST_SW_FLUSH (0x100|SSL_ST_ACCEPT) 648ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_SCTP 649ebfedea0SLionel Sambuc # define DTLS1_SCTP_ST_SW_WRITE_SOCK (0x310|SSL_ST_ACCEPT) 650ebfedea0SLionel Sambuc # define DTLS1_SCTP_ST_SR_READ_SOCK (0x320|SSL_ST_ACCEPT) 651ebfedea0SLionel Sambuc # endif 652ebfedea0SLionel Sambuc /* read from client */ 653ebfedea0SLionel Sambuc /* Do not change the number values, they do matter */ 654ebfedea0SLionel Sambuc # define SSL3_ST_SR_CLNT_HELLO_A (0x110|SSL_ST_ACCEPT) 655ebfedea0SLionel Sambuc # define SSL3_ST_SR_CLNT_HELLO_B (0x111|SSL_ST_ACCEPT) 656ebfedea0SLionel Sambuc # define SSL3_ST_SR_CLNT_HELLO_C (0x112|SSL_ST_ACCEPT) 657ebfedea0SLionel Sambuc /* write to client */ 658ebfedea0SLionel Sambuc # define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A (0x113|SSL_ST_ACCEPT) 659ebfedea0SLionel Sambuc # define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B (0x114|SSL_ST_ACCEPT) 660ebfedea0SLionel Sambuc # define SSL3_ST_SW_HELLO_REQ_A (0x120|SSL_ST_ACCEPT) 661ebfedea0SLionel Sambuc # define SSL3_ST_SW_HELLO_REQ_B (0x121|SSL_ST_ACCEPT) 662ebfedea0SLionel Sambuc # define SSL3_ST_SW_HELLO_REQ_C (0x122|SSL_ST_ACCEPT) 663ebfedea0SLionel Sambuc # define SSL3_ST_SW_SRVR_HELLO_A (0x130|SSL_ST_ACCEPT) 664ebfedea0SLionel Sambuc # define SSL3_ST_SW_SRVR_HELLO_B (0x131|SSL_ST_ACCEPT) 665ebfedea0SLionel Sambuc # define SSL3_ST_SW_CERT_A (0x140|SSL_ST_ACCEPT) 666ebfedea0SLionel Sambuc # define SSL3_ST_SW_CERT_B (0x141|SSL_ST_ACCEPT) 667ebfedea0SLionel Sambuc # define SSL3_ST_SW_KEY_EXCH_A (0x150|SSL_ST_ACCEPT) 668ebfedea0SLionel Sambuc # define SSL3_ST_SW_KEY_EXCH_B (0x151|SSL_ST_ACCEPT) 669ebfedea0SLionel Sambuc # define SSL3_ST_SW_CERT_REQ_A (0x160|SSL_ST_ACCEPT) 670ebfedea0SLionel Sambuc # define SSL3_ST_SW_CERT_REQ_B (0x161|SSL_ST_ACCEPT) 671ebfedea0SLionel Sambuc # define SSL3_ST_SW_SRVR_DONE_A (0x170|SSL_ST_ACCEPT) 672ebfedea0SLionel Sambuc # define SSL3_ST_SW_SRVR_DONE_B (0x171|SSL_ST_ACCEPT) 673ebfedea0SLionel Sambuc /* read from client */ 674ebfedea0SLionel Sambuc # define SSL3_ST_SR_CERT_A (0x180|SSL_ST_ACCEPT) 675ebfedea0SLionel Sambuc # define SSL3_ST_SR_CERT_B (0x181|SSL_ST_ACCEPT) 676ebfedea0SLionel Sambuc # define SSL3_ST_SR_KEY_EXCH_A (0x190|SSL_ST_ACCEPT) 677ebfedea0SLionel Sambuc # define SSL3_ST_SR_KEY_EXCH_B (0x191|SSL_ST_ACCEPT) 678ebfedea0SLionel Sambuc # define SSL3_ST_SR_CERT_VRFY_A (0x1A0|SSL_ST_ACCEPT) 679ebfedea0SLionel Sambuc # define SSL3_ST_SR_CERT_VRFY_B (0x1A1|SSL_ST_ACCEPT) 680ebfedea0SLionel Sambuc # define SSL3_ST_SR_CHANGE_A (0x1B0|SSL_ST_ACCEPT) 681ebfedea0SLionel Sambuc # define SSL3_ST_SR_CHANGE_B (0x1B1|SSL_ST_ACCEPT) 682ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_NEXTPROTONEG 683ebfedea0SLionel Sambuc # define SSL3_ST_SR_NEXT_PROTO_A (0x210|SSL_ST_ACCEPT) 684ebfedea0SLionel Sambuc # define SSL3_ST_SR_NEXT_PROTO_B (0x211|SSL_ST_ACCEPT) 685ebfedea0SLionel Sambuc # endif 686ebfedea0SLionel Sambuc # define SSL3_ST_SR_FINISHED_A (0x1C0|SSL_ST_ACCEPT) 687ebfedea0SLionel Sambuc # define SSL3_ST_SR_FINISHED_B (0x1C1|SSL_ST_ACCEPT) 688ebfedea0SLionel Sambuc /* write to client */ 689ebfedea0SLionel Sambuc # define SSL3_ST_SW_CHANGE_A (0x1D0|SSL_ST_ACCEPT) 690ebfedea0SLionel Sambuc # define SSL3_ST_SW_CHANGE_B (0x1D1|SSL_ST_ACCEPT) 691ebfedea0SLionel Sambuc # define SSL3_ST_SW_FINISHED_A (0x1E0|SSL_ST_ACCEPT) 692ebfedea0SLionel Sambuc # define SSL3_ST_SW_FINISHED_B (0x1E1|SSL_ST_ACCEPT) 693ebfedea0SLionel Sambuc # define SSL3_ST_SW_SESSION_TICKET_A (0x1F0|SSL_ST_ACCEPT) 694ebfedea0SLionel Sambuc # define SSL3_ST_SW_SESSION_TICKET_B (0x1F1|SSL_ST_ACCEPT) 695ebfedea0SLionel Sambuc # define SSL3_ST_SW_CERT_STATUS_A (0x200|SSL_ST_ACCEPT) 696ebfedea0SLionel Sambuc # define SSL3_ST_SW_CERT_STATUS_B (0x201|SSL_ST_ACCEPT) 697ebfedea0SLionel Sambuc 698ebfedea0SLionel Sambuc # define SSL3_MT_HELLO_REQUEST 0 699ebfedea0SLionel Sambuc # define SSL3_MT_CLIENT_HELLO 1 700ebfedea0SLionel Sambuc # define SSL3_MT_SERVER_HELLO 2 701ebfedea0SLionel Sambuc # define SSL3_MT_NEWSESSION_TICKET 4 702ebfedea0SLionel Sambuc # define SSL3_MT_CERTIFICATE 11 703ebfedea0SLionel Sambuc # define SSL3_MT_SERVER_KEY_EXCHANGE 12 704ebfedea0SLionel Sambuc # define SSL3_MT_CERTIFICATE_REQUEST 13 705ebfedea0SLionel Sambuc # define SSL3_MT_SERVER_DONE 14 706ebfedea0SLionel Sambuc # define SSL3_MT_CERTIFICATE_VERIFY 15 707ebfedea0SLionel Sambuc # define SSL3_MT_CLIENT_KEY_EXCHANGE 16 708ebfedea0SLionel Sambuc # define SSL3_MT_FINISHED 20 709ebfedea0SLionel Sambuc # define SSL3_MT_CERTIFICATE_STATUS 22 710ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_NEXTPROTONEG 711ebfedea0SLionel Sambuc # define SSL3_MT_NEXT_PROTO 67 712ebfedea0SLionel Sambuc # endif 713ebfedea0SLionel Sambuc # define DTLS1_MT_HELLO_VERIFY_REQUEST 3 714ebfedea0SLionel Sambuc 715ebfedea0SLionel Sambuc # define SSL3_MT_CCS 1 716ebfedea0SLionel Sambuc 717ebfedea0SLionel Sambuc /* These are used when changing over to a new cipher */ 718ebfedea0SLionel Sambuc # define SSL3_CC_READ 0x01 719ebfedea0SLionel Sambuc # define SSL3_CC_WRITE 0x02 720ebfedea0SLionel Sambuc # define SSL3_CC_CLIENT 0x10 721ebfedea0SLionel Sambuc # define SSL3_CC_SERVER 0x20 722ebfedea0SLionel Sambuc # define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE) 723ebfedea0SLionel Sambuc # define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER|SSL3_CC_READ) 724ebfedea0SLionel Sambuc # define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT|SSL3_CC_READ) 725ebfedea0SLionel Sambuc # define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE) 726ebfedea0SLionel Sambuc 727ebfedea0SLionel Sambuc #ifdef __cplusplus 728ebfedea0SLionel Sambuc } 729ebfedea0SLionel Sambuc #endif 730ebfedea0SLionel Sambuc #endif 731