2 * Copyright 2003-2022 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #define OSSL_FORCE_ERR_STATE
12 #include <openssl/err.h>
13 #include "err_local.h"
15 int ERR_set_mark(void)
19 es = ossl_err_get_state_int();
23 if (es->bottom == es->top)
25 es->err_marks[es->top]++;
29 int ERR_pop_to_mark(void)
33 es = ossl_err_get_state_int();
37 while (es->bottom != es->top
38 && es->err_marks[es->top] == 0) {
39 err_clear(es, es->top, 0);
40 es->top = es->top > 0 ? es->top - 1 : ERR_NUM_ERRORS - 1;
43 if (es->bottom == es->top)
45 es->err_marks[es->top]--;
49 int ERR_clear_last_mark(void)
54 es = ossl_err_get_state_int();
59 while (es->bottom != top
60 && es->err_marks[top] == 0) {
61 top = top > 0 ? top - 1 : ERR_NUM_ERRORS - 1;
64 if (es->bottom == top)