113 #ifndef OPENSSL_NO_SSL2
120 static const SSL_METHOD *ssl2_get_client_method(
int ver);
121 static int get_server_finished(
SSL *s);
122 static int get_server_verify(
SSL *s);
123 static int get_server_hello(
SSL *s);
124 static int client_hello(
SSL *s);
125 static int client_master_key(
SSL *s);
126 static int client_finished(
SSL *s);
127 static int client_certificate(
SSL *s);
128 static int ssl_rsa_public_encrypt(
SESS_CERT *sc,
int len,
unsigned char *from,
129 unsigned char *to,
int padding);
132 static const SSL_METHOD *ssl2_get_client_method(
int ver)
143 ssl2_get_client_method)
147 unsigned long l=(
unsigned long)time(NULL);
157 if (s->info_callback != NULL)
159 else if (s->ctx->info_callback != NULL)
160 cb=s->ctx->info_callback;
184 if ((buf == NULL) && ((buf=
BUF_MEM_new()) == NULL))
192 if (buf == s->init_buf)
201 s->ctx->stats.sess_connect++;
209 if (ret <= 0)
goto end;
216 ret=get_server_hello(s);
217 if (ret <= 0)
goto end;
232 ret=client_master_key(s);
233 if (ret <= 0)
goto end;
252 ret=client_finished(s);
253 if (ret <= 0)
goto end;
260 ret=get_server_verify(s);
261 if (ret <= 0)
goto end;
268 ret=get_server_finished(s);
269 if (ret <= 0)
goto end;
277 ret=client_certificate(s);
278 if (ret <= 0)
goto end;
284 if (s->init_buf != NULL)
299 if (s->hit) s->ctx->stats.sess_hit++;
303 s->ctx->stats.sess_connect_good++;
315 if ((
cb != NULL) && (s->state != state))
332 static int get_server_hello(
SSL *s)
365 s->
hit=(i=*(p++))?1:0;
371 if (i < s->version) s->
version=i;
421 SSL_MAX_SSL_SESSION_ID_LENGTH_IN_BYTES);
459 sk=ssl_bytes_to_cipher_list(s,p,s->
s2->
tmp.
csl,
472 cl=SSL_get_ciphers(s);
543 static int client_hello(
SSL *s)
611 static int client_master_key(
SSL *s)
615 int clear,
enc,karg,i;
684 memcpy(d,sess->
master_key,(
unsigned int)clear);
687 enc=ssl_rsa_public_encrypt(sess->
sess_cert,enc,
705 if (karg > (
int)
sizeof(sess->
key_arg))
711 memcpy(d,sess->
key_arg,(
unsigned int)karg);
723 static int client_finished(
SSL *s)
746 static int client_certificate(
SSL *s)
753 unsigned char *cert_ch;
779 if ((s->
cert == NULL) ||
816 if ((i == 1) && (pkey != NULL) && (x509 != NULL))
829 if (x509 != NULL) X509_free(x509);
897 static int get_server_verify(
SSL *s)
949 static int get_server_finished(
SSL *s)
1034 x509=d2i_X509(NULL,&data,(
long)len);
1093 static int ssl_rsa_public_encrypt(
SESS_CERT *sc,
int len,
unsigned char *from,
1094 unsigned char *to,
int padding)
1122 static void *dummy=&dummy;