]>
git.ipfire.org Git - thirdparty/openssl.git/blob - crypto/err/err_mark.c
2 * Copyright 2003-2023 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
]++;
33 es
= ossl_err_get_state_int();
34 if (es
== NULL
|| es
->bottom
== es
->top
)
37 err_clear(es
, es
->top
, 0);
38 es
->top
= es
->top
> 0 ? es
->top
- 1 : ERR_NUM_ERRORS
- 1;
42 int ERR_pop_to_mark(void)
46 es
= ossl_err_get_state_int();
50 while (es
->bottom
!= es
->top
51 && es
->err_marks
[es
->top
] == 0) {
52 err_clear(es
, es
->top
, 0);
53 es
->top
= es
->top
> 0 ? es
->top
- 1 : ERR_NUM_ERRORS
- 1;
56 if (es
->bottom
== es
->top
)
58 es
->err_marks
[es
->top
]--;
62 int ERR_count_to_mark(void)
67 es
= ossl_err_get_state_int();
72 while (es
->bottom
!= top
73 && es
->err_marks
[top
] == 0) {
75 top
= top
> 0 ? top
- 1 : ERR_NUM_ERRORS
- 1;
81 int ERR_clear_last_mark(void)
86 es
= ossl_err_get_state_int();
91 while (es
->bottom
!= top
92 && es
->err_marks
[top
] == 0) {
93 top
= top
> 0 ? top
- 1 : ERR_NUM_ERRORS
- 1;
96 if (es
->bottom
== top
)