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