summaryrefslogtreecommitdiffstats
path: root/crypto/err
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-11-09 11:27:14 +0100
committerHugo Landau <hlandau@openssl.org>2023-12-21 09:12:06 +0100
commit5304d563359648ae2910cad4f9badc5dd1fc0210 (patch)
treebf57ba116384c798ef88ecd897b627097b4fff15 /crypto/err
parentQUIC PORT: Formalise states of a port (diff)
downloadopenssl-5304d563359648ae2910cad4f9badc5dd1fc0210.tar.xz
openssl-5304d563359648ae2910cad4f9badc5dd1fc0210.zip
ERR: Add ERR_pop()
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22674)
Diffstat (limited to 'crypto/err')
-rw-r--r--crypto/err/err_mark.c13
1 files changed, 13 insertions, 0 deletions
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;