From 5304d563359648ae2910cad4f9badc5dd1fc0210 Mon Sep 17 00:00:00 2001 From: Hugo Landau Date: Thu, 9 Nov 2023 10:27:14 +0000 Subject: ERR: Add ERR_pop() Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/22674) --- crypto/err/err_mark.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'crypto/err') diff --git a/crypto/err/err_mark.c b/crypto/err/err_mark.c index 82dc4764c4..cb01a1f4f6 100644 --- a/crypto/err/err_mark.c +++ b/crypto/err/err_mark.c @@ -26,6 +26,19 @@ int ERR_set_mark(void) return 1; } +int ERR_pop(void) +{ + ERR_STATE *es; + + es = ossl_err_get_state_int(); + if (es == NULL || es->bottom == es->top) + return 0; + + err_clear(es, es->top, 0); + es->top = es->top > 0 ? es->top - 1 : ERR_NUM_ERRORS - 1; + return 1; +} + int ERR_pop_to_mark(void) { ERR_STATE *es; -- cgit v1.2.3