Report unexpected EOF as SSL_ERROR_SSL for OpenSSL 3.x parity - #3484
Open
prasden wants to merge 3 commits into
Open
Report unexpected EOF as SSL_ERROR_SSL for OpenSSL 3.x parity#3484prasden wants to merge 3 commits into
SSL_ERROR_SSL for OpenSSL 3.x parity#3484prasden wants to merge 3 commits into
Conversation
prasden
enabled auto-merge (squash)
September 4, 2026 01:51
prasden
force-pushed
the
unexpected-eof-ossl3-parity
branch
5 times, most recently
from
September 4, 2026 03:49
e83cca8 to
0b6d11d
Compare
Report an unexpected transport EOF (peer closing without close_notify) as SSL_ERROR_SSL with SSL_R_UNEXPECTED_EOF_WHILE_READING, matching OpenSSL 3.x, unless SSL_OP_IGNORE_UNEXPECTED_EOF is set. Add SSLTest.UnexpectedEOF covering the default error path.
prasden
force-pushed
the
unexpected-eof-ossl3-parity
branch
from
September 4, 2026 03:51
0b6d11d to
7218eff
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3484 +/- ##
==========================================
- Coverage 78.37% 78.18% -0.20%
==========================================
Files 700 700
Lines 125744 125770 +26
Branches 17388 17386 -2
==========================================
- Hits 98553 98327 -226
- Misses 26318 26573 +255
+ Partials 873 870 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
justsmth
reviewed
Sep 4, 2026
justsmth
left a comment
Contributor
There was a problem hiding this comment.
Also:
include/openssl/ssl.h:642-- stale doc comment. The default is nowSSL_ERROR_SSL, notSSL_ERROR_SYSCALL:
// ... When set, |SSL_read| reports
// |SSL_ERROR_ZERO_RETURN| instead of the default |SSL_ERROR_SSL| /
// |SSL_R_UNEXPECTED_EOF_WHILE_READING|.ssl/ssl_misc_test.cc:342and:384-- stale comments in the pre-existingIgnoreUnexpectedEOFtest. Both still contrast the option againstSSL_ERROR_SYSCALL; since the default changed, update them to reference the new defaultSSL_ERROR_SSL.
justsmth
reviewed
Sep 4, 2026
justsmth
reviewed
Sep 4, 2026
Contributor
|
Additional point from the second pass:
|
prasden
force-pushed
the
unexpected-eof-ossl3-parity
branch
2 times, most recently
from
September 4, 2026 21:38
1e655aa to
1e68494
Compare
prasden
force-pushed
the
unexpected-eof-ossl3-parity
branch
from
September 4, 2026 21:46
1e68494 to
bc6fc0b
Compare
prasden
force-pushed
the
unexpected-eof-ossl3-parity
branch
from
September 8, 2026 16:42
bc6fc0b to
5619e00
Compare
justsmth
approved these changes
Sep 8, 2026
Contributor
|
🔒 Security Review — View Report Please review before merging. |
prasden
requested review from
samuel40791765
and removed request for
nhatnghiho
September 10, 2026 17:18
samuel40791765
approved these changes
Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context and motivation
Before OpenSSL 3.0, an unexpected transport EOF during
SSL_read(the peer closing the connection without sending aclose_notifyalert) surfaced asSSL_ERROR_SYSCALLwith an empty error stack anderrno == 0.OpenSSL 3.0 changed the default as this behavior now raises
SSL_ERROR_SSLwithSSL_R_UNEXPECTED_EOF_WHILE_READINGon the stack. AWS-LC should match OSSL 3.x's behavior on this case to provide parity for consumers.Description of changes
When the peer closes without
close_notify,SSL_readnow returns-1andSSL_get_errorreportsSSL_ERROR_SSLwithSSL_R_UNEXPECTED_EOF_WHILE_READINGon the stack, matching OpenSSL 3.x.Adds the
SSL_R_UNEXPECTED_EOF_WHILE_READINGreason code with the code 509, different from OpenSSL's 294, because 294 already belongs toSSL_R_UNKNOWN_CERT_COMPRESSION_ALGin AWS-LC. Consumers match on the macro name.Call-outs
Previously passing tests that relied on the old behavior have been updated by setting
SSL_OP_IGNORE_UNEXPECTED_EOF: Support SSL_OP_IGNORE_UNEXPECTED_EOF option #3294rust-opensslintegration test skips one test as it connects to a live server that closes without aclose_notify, and the upstream test doesn't setSSL_OP_IGNORE_UNEXPECTED_EOFOpenSSL 3.x parity is limited to post-handshake reads because this change preserves the
!SSL_in_init(ssl)guardTesting
SSLTest.UnexpectedEOFto test an unexpected EOF fails the read and matches ossl's behavior.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.