ssl2.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 #ifndef HEADER_SSL2_H
00060 #define HEADER_SSL2_H
00061
00062 #ifdef __cplusplus
00063 extern "C" {
00064 #endif
00065
00066
00067 #define SSL2_VERSION 0x0002
00068 #define SSL2_VERSION_MAJOR 0x00
00069 #define SSL2_VERSION_MINOR 0x02
00070
00071
00072
00073
00074 #define SSL2_MT_ERROR 0
00075 #define SSL2_MT_CLIENT_HELLO 1
00076 #define SSL2_MT_CLIENT_MASTER_KEY 2
00077 #define SSL2_MT_CLIENT_FINISHED 3
00078 #define SSL2_MT_SERVER_HELLO 4
00079 #define SSL2_MT_SERVER_VERIFY 5
00080 #define SSL2_MT_SERVER_FINISHED 6
00081 #define SSL2_MT_REQUEST_CERTIFICATE 7
00082 #define SSL2_MT_CLIENT_CERTIFICATE 8
00083
00084
00085 #define SSL2_PE_UNDEFINED_ERROR 0x0000
00086 #define SSL2_PE_NO_CIPHER 0x0001
00087 #define SSL2_PE_NO_CERTIFICATE 0x0002
00088 #define SSL2_PE_BAD_CERTIFICATE 0x0004
00089 #define SSL2_PE_UNSUPPORTED_CERTIFICATE_TYPE 0x0006
00090
00091
00092 #define SSL2_CK_NULL_WITH_MD5 0x02000000
00093 #define SSL2_CK_RC4_128_WITH_MD5 0x02010080
00094 #define SSL2_CK_RC4_128_EXPORT40_WITH_MD5 0x02020080
00095 #define SSL2_CK_RC2_128_CBC_WITH_MD5 0x02030080
00096 #define SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5 0x02040080
00097 #define SSL2_CK_IDEA_128_CBC_WITH_MD5 0x02050080
00098 #define SSL2_CK_DES_64_CBC_WITH_MD5 0x02060040
00099 #define SSL2_CK_DES_64_CBC_WITH_SHA 0x02060140
00100 #define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5 0x020700c0
00101 #define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA 0x020701c0
00102 #define SSL2_CK_RC4_64_WITH_MD5 0x02080080
00103
00104 #define SSL2_CK_DES_64_CFB64_WITH_MD5_1 0x02ff0800
00105 #define SSL2_CK_NULL 0x02ff0810
00106
00107 #define SSL2_TXT_DES_64_CFB64_WITH_MD5_1 "DES-CFB-M1"
00108 #define SSL2_TXT_NULL_WITH_MD5 "NULL-MD5"
00109 #define SSL2_TXT_RC4_128_WITH_MD5 "RC4-MD5"
00110 #define SSL2_TXT_RC4_128_EXPORT40_WITH_MD5 "EXP-RC4-MD5"
00111 #define SSL2_TXT_RC2_128_CBC_WITH_MD5 "RC2-CBC-MD5"
00112 #define SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 "EXP-RC2-CBC-MD5"
00113 #define SSL2_TXT_IDEA_128_CBC_WITH_MD5 "IDEA-CBC-MD5"
00114 #define SSL2_TXT_DES_64_CBC_WITH_MD5 "DES-CBC-MD5"
00115 #define SSL2_TXT_DES_64_CBC_WITH_SHA "DES-CBC-SHA"
00116 #define SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5 "DES-CBC3-MD5"
00117 #define SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA "DES-CBC3-SHA"
00118 #define SSL2_TXT_RC4_64_WITH_MD5 "RC4-64-MD5"
00119
00120 #define SSL2_TXT_NULL "NULL"
00121
00122
00123 #define SSL2_CF_5_BYTE_ENC 0x01
00124 #define SSL2_CF_8_BYTE_ENC 0x02
00125
00126
00127 #define SSL2_CT_X509_CERTIFICATE 0x01
00128
00129
00130 #define SSL2_AT_MD5_WITH_RSA_ENCRYPTION 0x01
00131
00132 #define SSL2_MAX_SSL_SESSION_ID_LENGTH 32
00133
00134
00135 #define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS 256
00136 #ifdef OPENSSL_SYS_MPE
00137 #define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 29998u
00138 #else
00139 #define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 32767u
00140 #endif
00141 #define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER 16383
00142
00143 #define SSL2_CHALLENGE_LENGTH 16
00144
00145 #define SSL2_MIN_CHALLENGE_LENGTH 16
00146 #define SSL2_MAX_CHALLENGE_LENGTH 32
00147 #define SSL2_CONNECTION_ID_LENGTH 16
00148 #define SSL2_MAX_CONNECTION_ID_LENGTH 16
00149 #define SSL2_SSL_SESSION_ID_LENGTH 16
00150 #define SSL2_MAX_CERT_CHALLENGE_LENGTH 32
00151 #define SSL2_MIN_CERT_CHALLENGE_LENGTH 16
00152 #define SSL2_MAX_KEY_MATERIAL_LENGTH 24
00153
00154 #ifndef HEADER_SSL_LOCL_H
00155 #define CERT char
00156 #endif
00157
00158 typedef struct ssl2_state_st
00159 {
00160 int three_byte_header;
00161 int clear_text;
00162 int escape;
00163 int ssl2_rollback;
00164
00165
00166
00167 unsigned int wnum;
00168 int wpend_tot;
00169 const unsigned char *wpend_buf;
00170
00171 int wpend_off;
00172 int wpend_len;
00173 int wpend_ret;
00174
00175
00176 int rbuf_left;
00177 int rbuf_offs;
00178 unsigned char *rbuf;
00179 unsigned char *wbuf;
00180
00181 unsigned char *write_ptr;
00182
00183
00184 unsigned int padding;
00185 unsigned int rlength;
00186 int ract_data_length;
00187 unsigned int wlength;
00188 int wact_data_length;
00189 unsigned char *ract_data;
00190 unsigned char *wact_data;
00191 unsigned char *mac_data;
00192
00193 unsigned char *read_key;
00194 unsigned char *write_key;
00195
00196
00197 unsigned int challenge_length;
00198 unsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH];
00199 unsigned int conn_id_length;
00200 unsigned char conn_id[SSL2_MAX_CONNECTION_ID_LENGTH];
00201 unsigned int key_material_length;
00202 unsigned char key_material[SSL2_MAX_KEY_MATERIAL_LENGTH*2];
00203
00204 unsigned long read_sequence;
00205 unsigned long write_sequence;
00206
00207 struct {
00208 unsigned int conn_id_length;
00209 unsigned int cert_type;
00210 unsigned int cert_length;
00211 unsigned int csl;
00212 unsigned int clear;
00213 unsigned int enc;
00214 unsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH];
00215 unsigned int cipher_spec_length;
00216 unsigned int session_id_length;
00217 unsigned int clen;
00218 unsigned int rlen;
00219 } tmp;
00220 } SSL2_STATE;
00221
00222
00223
00224 #define SSL2_ST_SEND_CLIENT_HELLO_A (0x10|SSL_ST_CONNECT)
00225 #define SSL2_ST_SEND_CLIENT_HELLO_B (0x11|SSL_ST_CONNECT)
00226 #define SSL2_ST_GET_SERVER_HELLO_A (0x20|SSL_ST_CONNECT)
00227 #define SSL2_ST_GET_SERVER_HELLO_B (0x21|SSL_ST_CONNECT)
00228 #define SSL2_ST_SEND_CLIENT_MASTER_KEY_A (0x30|SSL_ST_CONNECT)
00229 #define SSL2_ST_SEND_CLIENT_MASTER_KEY_B (0x31|SSL_ST_CONNECT)
00230 #define SSL2_ST_SEND_CLIENT_FINISHED_A (0x40|SSL_ST_CONNECT)
00231 #define SSL2_ST_SEND_CLIENT_FINISHED_B (0x41|SSL_ST_CONNECT)
00232 #define SSL2_ST_SEND_CLIENT_CERTIFICATE_A (0x50|SSL_ST_CONNECT)
00233 #define SSL2_ST_SEND_CLIENT_CERTIFICATE_B (0x51|SSL_ST_CONNECT)
00234 #define SSL2_ST_SEND_CLIENT_CERTIFICATE_C (0x52|SSL_ST_CONNECT)
00235 #define SSL2_ST_SEND_CLIENT_CERTIFICATE_D (0x53|SSL_ST_CONNECT)
00236 #define SSL2_ST_GET_SERVER_VERIFY_A (0x60|SSL_ST_CONNECT)
00237 #define SSL2_ST_GET_SERVER_VERIFY_B (0x61|SSL_ST_CONNECT)
00238 #define SSL2_ST_GET_SERVER_FINISHED_A (0x70|SSL_ST_CONNECT)
00239 #define SSL2_ST_GET_SERVER_FINISHED_B (0x71|SSL_ST_CONNECT)
00240 #define SSL2_ST_CLIENT_START_ENCRYPTION (0x80|SSL_ST_CONNECT)
00241 #define SSL2_ST_X509_GET_CLIENT_CERTIFICATE (0x90|SSL_ST_CONNECT)
00242
00243 #define SSL2_ST_GET_CLIENT_HELLO_A (0x10|SSL_ST_ACCEPT)
00244 #define SSL2_ST_GET_CLIENT_HELLO_B (0x11|SSL_ST_ACCEPT)
00245 #define SSL2_ST_GET_CLIENT_HELLO_C (0x12|SSL_ST_ACCEPT)
00246 #define SSL2_ST_SEND_SERVER_HELLO_A (0x20|SSL_ST_ACCEPT)
00247 #define SSL2_ST_SEND_SERVER_HELLO_B (0x21|SSL_ST_ACCEPT)
00248 #define SSL2_ST_GET_CLIENT_MASTER_KEY_A (0x30|SSL_ST_ACCEPT)
00249 #define SSL2_ST_GET_CLIENT_MASTER_KEY_B (0x31|SSL_ST_ACCEPT)
00250 #define SSL2_ST_SEND_SERVER_VERIFY_A (0x40|SSL_ST_ACCEPT)
00251 #define SSL2_ST_SEND_SERVER_VERIFY_B (0x41|SSL_ST_ACCEPT)
00252 #define SSL2_ST_SEND_SERVER_VERIFY_C (0x42|SSL_ST_ACCEPT)
00253 #define SSL2_ST_GET_CLIENT_FINISHED_A (0x50|SSL_ST_ACCEPT)
00254 #define SSL2_ST_GET_CLIENT_FINISHED_B (0x51|SSL_ST_ACCEPT)
00255 #define SSL2_ST_SEND_SERVER_FINISHED_A (0x60|SSL_ST_ACCEPT)
00256 #define SSL2_ST_SEND_SERVER_FINISHED_B (0x61|SSL_ST_ACCEPT)
00257 #define SSL2_ST_SEND_REQUEST_CERTIFICATE_A (0x70|SSL_ST_ACCEPT)
00258 #define SSL2_ST_SEND_REQUEST_CERTIFICATE_B (0x71|SSL_ST_ACCEPT)
00259 #define SSL2_ST_SEND_REQUEST_CERTIFICATE_C (0x72|SSL_ST_ACCEPT)
00260 #define SSL2_ST_SEND_REQUEST_CERTIFICATE_D (0x73|SSL_ST_ACCEPT)
00261 #define SSL2_ST_SERVER_START_ENCRYPTION (0x80|SSL_ST_ACCEPT)
00262 #define SSL2_ST_X509_GET_SERVER_CERTIFICATE (0x90|SSL_ST_ACCEPT)
00263
00264 #ifdef __cplusplus
00265 }
00266 #endif
00267 #endif
00268