Skip to content

Commit c75e5cb

Browse files
Revert guard, impl. SSL_MODE_AUTO_RETRY
1 parent cfd2dde commit c75e5cb

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

include/openssl/ssl.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,9 @@ OPENSSL_EXPORT uint32_t SSL_get_options(const SSL *ssl);
869869
// session resumption is used for a given SSL*.
870870
#define SSL_MODE_NO_SESSION_CREATION 0x00000200L
871871

872+
// TODO [childw]
873+
#define SSL_MODE_AUTO_RETRY 0x00000004L
874+
872875
// SSL_MODE_SEND_FALLBACK_SCSV sends TLS_FALLBACK_SCSV in the ClientHello.
873876
// To be set only by applications that reconnect with a downgraded protocol
874877
// version; see RFC 7507 for details.
@@ -5275,7 +5278,6 @@ DEFINE_STACK_OF(SSL_COMP)
52755278

52765279
// The following flags do nothing and are included only to make it easier to
52775280
// compile code with BoringSSL.
5278-
#define SSL_MODE_AUTO_RETRY 0
52795281
#define SSL_MODE_RELEASE_BUFFERS 0
52805282
#define SSL_MODE_SEND_CLIENTHELLO_TIME 0
52815283
#define SSL_MODE_SEND_SERVERHELLO_TIME 0

ssl/ssl_lib.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,10 @@ static int ssl_read_impl(SSL *ssl) {
10271027
&alert, ssl->s3->read_buffer.span());
10281028
bool retry;
10291029
int bio_ret = ssl_handle_open_record(ssl, &retry, ret, consumed, alert);
1030-
if (bio_ret <= 0) {
1030+
1031+
if (bio_ret == 0 && retry && (ssl->ctx->mode & SSL_MODE_AUTO_RETRY)) {
1032+
continue;
1033+
} else if (bio_ret <= 0) {
10311034
return bio_ret;
10321035
}
10331036
if (!retry) {
@@ -1388,11 +1391,8 @@ int SSL_get_error(const SSL *ssl, int ret_code) {
13881391
}
13891392
// An EOF was observed which violates the protocol, and the underlying
13901393
// transport does not participate in the error queue. Bubble up to the
1391-
// caller. Do not consider retryable |rwstate| EOF.
1392-
if (ssl->s3->rwstate != SSL_ERROR_WANT_READ
1393-
&& ssl->s3->rwstate != SSL_ERROR_WANT_WRITE) {
1394-
return SSL_ERROR_SYSCALL;
1395-
}
1394+
// caller.
1395+
return SSL_ERROR_SYSCALL;
13961396
}
13971397

13981398
switch (ssl->s3->rwstate) {

ssl/ssl_test.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10507,6 +10507,10 @@ TEST(SSLTest, IntermittentEmptyRead) {
1050710507
ret = SSL_read(client.get(), buf, sizeof(buf));
1050810508
EXPECT_EQ(ret, (int) sizeof(buf));
1050910509
EXPECT_EQ(SSL_get_error(client.get(), ret), SSL_ERROR_NONE);
10510+
10511+
ret = SSL_read(client.get(), buf, sizeof(buf));
10512+
EXPECT_LE(ret, 0);
10513+
EXPECT_EQ(SSL_get_error(client.get(), ret), SSL_ERROR_SSL);
1051010514
}
1051110515

1051210516
// Test that |SSL_shutdown|, when quiet shutdown is enabled, simulates receiving

0 commit comments

Comments
 (0)