113 #ifndef OPENSSL_NO_SSL2
118 static int read_n(
SSL *s,
unsigned int n,
unsigned int max,
unsigned int extend);
119 static int n_do_ssl_write(
SSL *s,
const unsigned char *buf,
unsigned int len);
120 static int write_pending(
SSL *s,
const unsigned char *buf,
unsigned int len);
121 static int ssl_mt_error(
int n);
127 static int ssl2_read_internal(
SSL *s,
void *buf,
int len,
int peek)
139 if (n < 0)
return(n);
149 if (len <= 0)
return(len);
180 if (n <= 0)
return(n);
183 if (!((p[0] & 0x80) && (
194 if (n <= 0)
return(n);
203 s->
s2->
rlength=(((
unsigned int)p[0])<<8)|((
unsigned int)p[1]);
225 i=read_n(s,(
unsigned int)n,(
unsigned int)n,1);
226 if (i <= 0)
return(i);
266 (s->
s2->
rlength >= (
unsigned int)mac_size))
273 (
unsigned int)mac_size) != 0) ||
295 goto ssl2_read_again;
311 return ssl2_read_internal(s, buf, len, 0);
316 return ssl2_read_internal(s, buf, len, 1);
319 static int read_n(
SSL *s,
unsigned int n,
unsigned int max,
356 (
unsigned int)newb+off);
374 while (newb < (
int)n)
389 if (s->
debug & 0x01) sleep(1);
420 const unsigned char *buf=_buf;
427 if (i < 0)
return(i);
444 if (len <= 0)
return(len);
452 i=n_do_ssl_write(s,&(buf[tot]),n);
469 static int write_pending(
SSL *s,
const unsigned char *buf,
unsigned int len)
501 if (s->
debug & 0x01) sleep(1);
516 static int n_do_ssl_write(
SSL *s,
const unsigned char *buf,
unsigned int len)
518 unsigned int j,
k,olen,
p,bs;
520 register unsigned char *
pp;
529 if (s->
s2->
wpend_len != 0)
return(write_pending(s,buf,len));
570 else if ((bs <= 1) && (!s->
s2->
escape))
654 return(write_pending(s,buf,olen));
682 SSLerr((
int)f,ssl_mt_error(j));
714 static int ssl_mt_error(
int n)
741 static void *dummy=&dummy;