summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2000-02-21 18:46:20 +0100
committerBodo Möller <bodo@openssl.org>2000-02-21 18:46:20 +0100
commit1b8a8088a5d55d5474fd7f89bc991326cc0430d7 (patch)
tree98cf810581276f012aeb9fea9d972d31d65ed715 /ssl
parentFix some bugs and document others (diff)
downloadopenssl-1b8a8088a5d55d5474fd7f89bc991326cc0430d7.tar.xz
openssl-1b8a8088a5d55d5474fd7f89bc991326cc0430d7.zip
Workarounds to make broken programs happy (such as s_client and s_server).
Diffstat (limited to 'ssl')
-rw-r--r--ssl/s3_pkt.c52
1 files changed, 29 insertions, 23 deletions
diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c
index 32eda4e657..fd344c4ceb 100644
--- a/ssl/s3_pkt.c
+++ b/ssl/s3_pkt.c
@@ -896,6 +896,21 @@ start:
SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE);
return(-1);
}
+
+ if (s->s3->rbuf.left == 0) /* no read-ahead left? */
+ {
+ BIO *bio;
+ /* In the case where we try to read application data
+ * the first time, but we trigger an SSL handshake, we
+ * return -1 with the retry option set. I do this
+ * otherwise renegotiation can cause nasty problems
+ * in the blocking world */ /* ? */
+ s->rwstate=SSL_READING;
+ bio=SSL_get_rbio(s);
+ BIO_clear_retry_flags(bio);
+ BIO_set_retry_read(bio);
+ return(-1);
+ }
}
}
/* we either finished a handshake or ignored the request,
@@ -1006,30 +1021,21 @@ start:
return(-1);
}
-#if 1 /* probably nonsense (does not work with readahead),
- * but keep it for now anyway ... s_server relies on this */
- {
- BIO *bio;
- /* In the case where we try to read application data
- * the first time, but we trigger an SSL handshake, we
- * return -1 with the retry option set. I do this
- * otherwise renegotiation can cause nasty problems
- * in the non-blocking world */ /* That's "non-non-blocking",
- * I guess? When receiving a
- * Hello Request, we have the
- * same problem (e.g. in s_client),
- * but it's really an application bug.
- */
-
- s->rwstate=SSL_READING;
- bio=SSL_get_rbio(s);
- BIO_clear_retry_flags(bio);
- BIO_set_retry_read(bio);
- return(-1);
- }
-#else
+ if (s->s3->rbuf.left == 0) /* no read-ahead left? */
+ {
+ BIO *bio;
+ /* In the case where we try to read application data
+ * the first time, but we trigger an SSL handshake, we
+ * return -1 with the retry option set. I do this
+ * otherwise renegotiation can cause nasty problems
+ * in the blocking world */ /* ? */
+ s->rwstate=SSL_READING;
+ bio=SSL_get_rbio(s);
+ BIO_clear_retry_flags(bio);
+ BIO_set_retry_read(bio);
+ return(-1);
+ }
goto start;
-#endif
}
switch (rr->type)