Document SSL_R_UNEXPECTED_EOF_WHILE_READING
authorMatt Caswell <matt@openssl.org>
Mon, 15 Jan 2024 08:55:48 +0000 (08:55 +0000)
committerTomas Mraz <tomas@openssl.org>
Fri, 19 Jan 2024 13:01:52 +0000 (14:01 +0100)
Also document that it is ok to use this for control flow decisions.

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23327)

doc/man3/SSL_get_error.pod
ssl/record/rec_layer_s3.c

index a90b22d98474451b2fff95929931934625ca2dc5..e60902a85c1d9c3011f6149a85f8aa80e804e9b2 100644 (file)
@@ -32,7 +32,9 @@ 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 (see the man page for
+L<ERR_GET_REASON(3)> for further details on this).
 
 =head1 RETURN VALUES
 
index 3baf820761a6cc9fc7e23cd2ee40c42e5c8341be..b3be80e341f7fa2fde96361a4f1294b9558434b2 100644 (file)
@@ -300,6 +300,10 @@ int ssl3_read_n(SSL *s, size_t n, size_t max, int extend, int clearold,
                     SSL_set_shutdown(s, SSL_RECEIVED_SHUTDOWN);
                     s->s3.warn_alert = SSL_AD_CLOSE_NOTIFY;
                 } else {
+                    /*
+                     * This reason code is part of the API and may be used by
+                     * applications for control flow decisions.
+                     */
                     SSLfatal(s, SSL_AD_DECODE_ERROR,
                              SSL_R_UNEXPECTED_EOF_WHILE_READING);
                 }