Skip to content

Commit

Permalink
Document SSL_R_UNEXPECTED_EOF_WHILE_READING
Browse files Browse the repository at this point in the history
Also document that it is ok to use this for control flow decisions.
  • Loading branch information
mattcaswell committed Jan 15, 2024
1 parent df04e81 commit d6653ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/man3/SSL_get_error.pod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ Some TLS implementations do not send a close_notify alert on shutdown.
On an unexpected EOF, versions before OpenSSL 3.0 returned
B<SSL_ERROR_SYSCALL>, nothing was added to the error stack, and errno was 0.
Since OpenSSL 3.0 the returned error is B<SSL_ERROR_SSL> with a meaningful
error on the error stack.
error on the error stack (SSL_R_UNEXPECTED_EOF_WHILE_READING). This error reason
code may be used for control flow decisions.

=head1 RETURN VALUES

Expand Down
4 changes: 4 additions & 0 deletions ssl/record/rec_layer_s3.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,10 @@ int ossl_tls_handle_rlayer_return(SSL_CONNECTION *s, int writing, int ret,
} else {
ERR_new();
ERR_set_debug(file, line, 0);
/*
* This reason code is part of the API and may be used by
* applications for control flow decisions.
*/
ossl_statem_fatal(s, SSL_AD_DECODE_ERROR,
SSL_R_UNEXPECTED_EOF_WHILE_READING, NULL);
}
Expand Down

0 comments on commit d6653ac

Please sign in to comment.