113 #ifndef OPENSSL_NO_SSL2
120 static const SSL_METHOD *ssl2_get_server_method(
int ver);
121 static int get_client_master_key(
SSL *s);
122 static int get_client_hello(
SSL *s);
123 static int server_hello(
SSL *s);
124 static int get_client_finished(
SSL *s);
125 static int server_verify(
SSL *s);
126 static int server_finish(
SSL *s);
127 static int request_certificate(
SSL *s);
128 static int ssl_rsa_private_decrypt(
CERT *c,
int len,
unsigned char *from,
129 unsigned char *to,
int padding);
132 static const SSL_METHOD *ssl2_get_server_method(
int ver)
143 ssl2_get_server_method)
147 unsigned long l=(
unsigned long)time(NULL);
158 if (s->info_callback != NULL)
160 else if (s->ctx->info_callback != NULL)
161 cb=s->ctx->info_callback;
192 if ((buf == NULL) && ((buf=
BUF_MEM_new()) == NULL))
193 { ret= -1;
goto end; }
196 { ret= -1;
goto end; }
199 s->ctx->stats.sess_accept++;
208 ret=get_client_hello(s);
209 if (ret <= 0)
goto end;
217 if (ret <= 0)
goto end;
231 ret=get_client_master_key(s);
232 if (ret <= 0)
goto end;
242 { ret= -1;
goto end; }
249 ret=server_verify(s);
250 if (ret <= 0)
goto end;
274 if (num1 <= 0) { ret= -1;
goto end; }
286 ret=get_client_finished(s);
301 ((s->session->peer != NULL) &&
309 ret=request_certificate(s);
310 if (ret <= 0)
goto end;
318 ret=server_finish(s);
319 if (ret <= 0)
goto end;
333 s->ctx->stats.sess_accept_good++;
349 if ((
cb != NULL) && (s->state != state))
364 static int get_client_master_key(
SSL *s)
366 int is_export,i,n,keya,ek;
426 len = 10 + (
unsigned long)s->
s2->
tmp.
clear + (
unsigned long)s->
s2->
tmp.
enc + (
unsigned long)keya;
476 || (is_export && ((i != ek) || (s->
s2->
tmp.
clear+(
unsigned int)i !=
495 || (is_export && ((i != ek) || (s->
s2->
tmp.
clear+i !=
521 static int get_client_hello(
SSL *s)
559 if (i < s->version) s->
version=i;
642 if (cs == NULL)
goto mem_err;
644 cl=SSL_get_ciphers(s);
649 if (prio == NULL)
goto mem_err;
697 static int server_hello(
SSL *s)
708 *(p++)=(
unsigned char)hit;
811 static int get_client_finished(
SSL *s)
821 if (i < 1-s->init_num)
870 static int server_verify(
SSL *s)
893 static int server_finish(
SSL *s)
920 static int request_certificate(
SSL *s)
922 const unsigned char *cp;
923 unsigned char *
p,*p2,*buf2;
925 int i,j,ctype,ret= -1;
962 if (i < 3-s->init_num)
1080 if (pkey == NULL)
goto end;
1112 static int ssl_rsa_private_decrypt(
CERT *c,
int len,
unsigned char *from,
1113 unsigned char *to,
int padding)
1139 static void *dummy=&dummy;