summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_pkt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/ssl_pkt.c')
-rw-r--r--src/lib/libssl/ssl_pkt.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/lib/libssl/ssl_pkt.c b/src/lib/libssl/ssl_pkt.c
index 049a7df3c3..8a5f97e5c7 100644
--- a/src/lib/libssl/ssl_pkt.c
+++ b/src/lib/libssl/ssl_pkt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_pkt.c,v 1.50 2021/08/30 19:25:43 jsing Exp $ */ 1/* $OpenBSD: ssl_pkt.c,v 1.51 2021/10/25 10:09:28 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -127,14 +127,15 @@ static int ssl3_get_record(SSL *s);
127 * Force a WANT_READ return for certain error conditions where 127 * Force a WANT_READ return for certain error conditions where
128 * we don't want to spin internally. 128 * we don't want to spin internally.
129 */ 129 */
130static void 130void
131ssl_force_want_read(SSL *s) 131ssl_force_want_read(SSL *s)
132{ 132{
133 BIO * bio; 133 BIO *bio;
134 134
135 bio = SSL_get_rbio(s); 135 bio = SSL_get_rbio(s);
136 BIO_clear_retry_flags(bio); 136 BIO_clear_retry_flags(bio);
137 BIO_set_retry_read(bio); 137 BIO_set_retry_read(bio);
138
138 s->internal->rwstate = SSL_READING; 139 s->internal->rwstate = SSL_READING;
139} 140}
140 141
@@ -931,11 +932,6 @@ ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
931 932
932 if (!(s->internal->mode & SSL_MODE_AUTO_RETRY)) { 933 if (!(s->internal->mode & SSL_MODE_AUTO_RETRY)) {
933 if (S3I(s)->rbuf.left == 0) { 934 if (S3I(s)->rbuf.left == 0) {
934 /* no read-ahead left? */
935 /* In the case where we try to read application data,
936 * but we trigger an SSL handshake, we return -1 with
937 * the retry option set. Otherwise renegotiation may
938 * cause nasty problems in the blocking world */
939 ssl_force_want_read(s); 935 ssl_force_want_read(s);
940 return (-1); 936 return (-1);
941 } 937 }
@@ -1079,11 +1075,7 @@ ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
1079 } 1075 }
1080 1076
1081 if (!(s->internal->mode & SSL_MODE_AUTO_RETRY)) { 1077 if (!(s->internal->mode & SSL_MODE_AUTO_RETRY)) {
1082 if (S3I(s)->rbuf.left == 0) { /* no read-ahead left? */ 1078 if (S3I(s)->rbuf.left == 0) {
1083 /* In the case where we try to read application data,
1084 * but we trigger an SSL handshake, we return -1 with
1085 * the retry option set. Otherwise renegotiation may
1086 * cause nasty problems in the blocking world */
1087 ssl_force_want_read(s); 1079 ssl_force_want_read(s);
1088 return (-1); 1080 return (-1);
1089 } 1081 }