From 45206340d3918de146864e43de83484cfb20691e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bodo=20M=C3=B6ller?= Date: Sun, 20 Feb 2000 23:35:31 +0000 Subject: [PATCH] ignore Client Hellos when we're in handshake anyway --- ssl/s3_both.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/ssl/s3_both.c b/ssl/s3_both.c index 6236b74572..4d8cafe2be 100644 --- a/ssl/s3_both.c +++ b/ssl/s3_both.c @@ -285,20 +285,34 @@ long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) if (s->state == st1) /* s->init_num < 4 */ { - while (s->init_num < 4) + int skip_message; + + do { - i=ssl3_read_bytes(s,SSL3_RT_HANDSHAKE,&p[s->init_num], - 4-s->init_num); - if (i <= 0) + while (s->init_num < 4) { - s->rwstate=SSL_READING; - *ok = 0; - return i; + i=ssl3_read_bytes(s,SSL3_RT_HANDSHAKE,&p[s->init_num], + 4-s->init_num); + if (i <= 0) + { + s->rwstate=SSL_READING; + *ok = 0; + return i; + } + s->init_num+=i; } - s->init_num+=i; + + skip_message = 0; + if (!s->server) + if (p[0] == SSL3_MT_HELLO_REQUEST) + /* The server may always send 'Hello Request' messages -- + * we are doing a handshake anyway now, so ignore them + * if their format is correct */ + if (p[1] == 0 && p[2] == 0 &&p[3] == 0) + skip_message = 1; } + while (skip_message); -/* XXX server may always send Hello Request */ if ((mt >= 0) && (*p != mt)) { al=SSL_AD_UNEXPECTED_MESSAGE; -- 2.25.1