summaryrefslogtreecommitdiffstats
path: root/ssl/statem/statem.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-11-04 14:36:38 +0100
committerRichard Levitte <levitte@openssl.org>2020-11-11 12:12:23 +0100
commite92519b5a6ad5fa1ca36316dd9256e65dcb2c6db (patch)
treeb1c957cbd9d23f548d97f92b8bbbb08d58f1db1b /ssl/statem/statem.c
parent6849b73ccc38ea95e4b9d50b01e1c94f5ce8bca7 (diff)
SSL: refactor ossl_statem_fatal() and SSLfatal()
ossl_statem_fatal() is refactored to be an extended ERR_set_error(), and SSLfatal() is refactored to work like ERR_raise(). We also add SSLfatal_data() to work like ERR_raise_data(). Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13316)
Diffstat (limited to 'ssl/statem/statem.c')
-rw-r--r--ssl/statem/statem.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/ssl/statem/statem.c b/ssl/statem/statem.c
index ac09e5f2eb..23f73b7c4b 100644
--- a/ssl/statem/statem.c
+++ b/ssl/statem/statem.c
@@ -112,14 +112,19 @@ void ossl_statem_set_renegotiate(SSL *s)
}
/*
- * Put the state machine into an error state and send an alert if appropriate.
+ * Error reporting building block that's used instead of ERR_set_error().
+ * In addition to what ERR_set_error() does, this puts the state machine
+ * into an error state and sends an alert if appropriate.
* This is a permanent error for the current connection.
*/
-void ossl_statem_fatal(SSL *s, int al, int func, int reason, const char *file,
- int line)
+void ossl_statem_fatal(SSL *s, int al, int reason, const char *fmt, ...)
{
- ERR_raise(ERR_LIB_SSL, reason);
- ERR_set_debug(file, line, NULL); /* Override what ERR_raise set */
+ va_list args;
+
+ va_start(args, fmt);
+ ERR_vset_error(ERR_LIB_SSL, reason, fmt, args);
+ va_end(args);
+
/* We shouldn't call SSLfatal() twice. Once is enough */
if (s->statem.in_init && s->statem.state == MSG_FLOW_ERROR)
return;