diff options
author | Bodo Möller <bodo@openssl.org> | 2001-11-10 10:44:15 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2001-11-10 10:44:15 +0000 |
commit | 2b90b1f344b50451673f02ae5ba1291779db544a (patch) | |
tree | b457e3bb03b5129403ff40d5ac325b64d46dd619 /ssl | |
parent | 65123f8064934df6ab1149d3e0d60441a5699014 (diff) |
make code a little more similar to what it looked like before the fixes,
call ssl2_part_read again to parse error message
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/s2_clnt.c | 21 | ||||
-rw-r--r-- | ssl/s2_srvr.c | 11 |
2 files changed, 23 insertions, 9 deletions
diff --git a/ssl/s2_clnt.c b/ssl/s2_clnt.c index 3a990e42cc..868a975dc9 100644 --- a/ssl/s2_clnt.c +++ b/ssl/s2_clnt.c @@ -873,8 +873,8 @@ static int get_server_verify(SSL *s) p=(unsigned char *)s->init_buf->data; if (s->state == SSL2_ST_GET_SERVER_VERIFY_A) { - i=ssl2_read(s,(char *)&(p[s->init_num]),3-s->init_num); - if (i < (3-s->init_num)) + i=ssl2_read(s,(char *)&(p[s->init_num]),1-s->init_num); + if (i < (1-s->init_num)) return(ssl2_part_read(s,SSL_F_GET_SERVER_VERIFY,i)); s->init_num += i; @@ -888,8 +888,12 @@ static int get_server_verify(SSL *s) SSL_R_READ_WRONG_PACKET_TYPE); } else - SSLerr(SSL_F_GET_SERVER_VERIFY, - SSL_R_PEER_ERROR); + { + SSLerr(SSL_F_GET_SERVER_VERIFY,SSL_R_PEER_ERROR); + /* try to read the error message */ + i=ssl2_read(s,(char *)&(p[s->init_num]),3-s->init_num); + return ssl2_part_read(s,SSL_F_GET_SERVER_VERIFY,i); + } return(-1); } } @@ -923,8 +927,8 @@ static int get_server_finished(SSL *s) p=buf; if (s->state == SSL2_ST_GET_SERVER_FINISHED_A) { - i=ssl2_read(s,(char *)&(buf[s->init_num]),3-s->init_num); - if (i < (3-s->init_num)) + i=ssl2_read(s,(char *)&(buf[s->init_num]),1-s->init_num); + if (i < (1-s->init_num)) return(ssl2_part_read(s,SSL_F_GET_SERVER_FINISHED,i)); s->init_num += i; @@ -941,7 +945,12 @@ static int get_server_finished(SSL *s) SSLerr(SSL_F_GET_SERVER_FINISHED,SSL_R_READ_WRONG_PACKET_TYPE); } else + { SSLerr(SSL_F_GET_SERVER_FINISHED,SSL_R_PEER_ERROR); + /* try to read the error message */ + i=ssl2_read(s,(char *)&(p[s->init_num]),3-s->init_num); + return ssl2_part_read(s,SSL_F_GET_SERVER_VERIFY,i); + } return(-1); } s->state=SSL2_ST_GET_SERVER_FINISHED_B; diff --git a/ssl/s2_srvr.c b/ssl/s2_srvr.c index ea07852d1a..58ee38963a 100644 --- a/ssl/s2_srvr.c +++ b/ssl/s2_srvr.c @@ -801,10 +801,10 @@ static int get_client_finished(SSL *s) p=(unsigned char *)s->init_buf->data; if (s->state == SSL2_ST_GET_CLIENT_FINISHED_A) { - i=ssl2_read(s,(char *)&(p[s->init_num]),3-s->init_num); - if (i < 3-s->init_num) + i=ssl2_read(s,(char *)&(p[s->init_num]),1-s->init_num); + if (i < 1-s->init_num) return(ssl2_part_read(s,SSL_F_GET_CLIENT_FINISHED,i)); - s->init_num = 3; + s->init_num += i; if (*p != SSL2_MT_CLIENT_FINISHED) { @@ -814,7 +814,12 @@ static int get_client_finished(SSL *s) SSLerr(SSL_F_GET_CLIENT_FINISHED,SSL_R_READ_WRONG_PACKET_TYPE); } else + { SSLerr(SSL_F_GET_CLIENT_FINISHED,SSL_R_PEER_ERROR); + /* try to read the error message */ + i=ssl2_read(s,(char *)&(p[s->init_num]),3-s->init_num); + return ssl2_part_read(s,SSL_F_GET_SERVER_VERIFY,i); + } return(-1); } s->state=SSL2_ST_GET_CLIENT_FINISHED_B; |