]>
git.ipfire.org Git - thirdparty/openssl.git/blob - crypto/err/err_local.h
2 * Copyright 1995-2019 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 #include <openssl/err.h>
11 #include <openssl/e_os2.h>
13 static ossl_inline
void err_get_slot(ERR_STATE
*es
)
15 es
->top
= (es
->top
+ 1) % ERR_NUM_ERRORS
;
16 if (es
->top
== es
->bottom
)
17 es
->bottom
= (es
->bottom
+ 1) % ERR_NUM_ERRORS
;
20 static ossl_inline
void err_clear_data(ERR_STATE
*es
, size_t i
, int deall
)
22 if (es
->err_data_flags
[i
] & ERR_TXT_MALLOCED
) {
24 OPENSSL_free(es
->err_data
[i
]);
25 es
->err_data
[i
] = NULL
;
26 es
->err_data_size
[i
] = 0;
27 es
->err_data_flags
[i
] = 0;
28 } else if (es
->err_data
[i
] != NULL
) {
29 es
->err_data
[i
][0] = '\0';
32 es
->err_data
[i
] = NULL
;
33 es
->err_data_size
[i
] = 0;
34 es
->err_data_flags
[i
] = 0;
38 static ossl_inline
void err_set_error(ERR_STATE
*es
, size_t i
,
41 es
->err_buffer
[i
] = ERR_PACK(lib
, 0, reason
);
44 static ossl_inline
void err_set_debug(ERR_STATE
*es
, size_t i
,
45 const char *file
, int line
,
48 es
->err_file
[i
] = file
;
49 es
->err_line
[i
] = line
;
53 static ossl_inline
void err_set_data(ERR_STATE
*es
, size_t i
,
54 void *data
, size_t datasz
, int flags
)
56 es
->err_data
[i
] = data
;
57 es
->err_data_size
[i
] = datasz
;
58 es
->err_data_flags
[i
] = flags
;
61 static ossl_inline
void err_clear(ERR_STATE
*es
, size_t i
, int deall
)
63 err_clear_data(es
, i
, (deall
));
65 es
->err_buffer
[i
] = 0;
66 es
->err_file
[i
] = NULL
;
70 ERR_STATE
*err_get_state_int(void);