Avoid clobbering the error code when sending an alert
authortb <tb@openbsd.org>
Wed, 7 Apr 2021 21:48:23 +0000 (21:48 +0000)
committertb <tb@openbsd.org>
Wed, 7 Apr 2021 21:48:23 +0000 (21:48 +0000)
commitcaffe9b53bbba8abff2fd1c0df83b8e76a6ef282
tree988a67e4ab3e7287b3d4abb67dcf3082c9f40c7f
parente4b8c6e7a52a605ce661337bb64560dbccb7b911
Avoid clobbering the error code when sending an alert

In order to fail gracefully on encountering a self-signed cert, curl looks
at the top-most error on the stack and needs specific SSL_R_ error codes.
This mechanism was broken when the tls13_alert_sent_cb() was added after
people complained about unhelpful unknown errors. Fix this by only setting
the error code from a fatal alert if no error has been set previously.

Issue reported by Christopher Reid

ok jsing
lib/libssl/tls13_lib.c