ERR(3)
β¨ ERR β OpenSSL error codes β¨
okay bestie, this is the Library Functions Manual page for ERR(3), and we're about to make OpenSSL error codes make sense. no cap. π
π NAME π
ERR β OpenSSL error codes
π¦ SYNOPSIS π¦
#include <openssl/err.h>
π DESCRIPTION π
so when a call to the OpenSSL library fails, it's usually signaled by the return value, and an error code gets stored in an error queue that's associated with the current thread. the ERR library gives you functions to obtain those error codes and textual error messages. the ERR_get_error(3) manpage describes how to access error codes. β¨
error codes contain info about where the error occurred and what went wrong. ERR_GET_LIB(3) describes how to extract that info. a method to obtain human-readable error messages is described in ERR_error_string(3). π«Ά
ERR_clear_error(3) can be used to clear the error queue. icon behavior.
note bestie: ERR_remove_state(3) should be used to avoid memory leaks when threads are terminated. don't skip this one. π
π₯ ADDING NEW ERROR CODES TO OPENSSL π₯
see ERR_put_error(3) if you want to record error codes in the OpenSSL error system from within your application.
the remainder of this section is of interest only if you want to add new error codes to OpenSSL or add error codes from external libraries.
when you're using new function or reason codes, run make errors. the necessary #defines will then automatically be added to the sub-library's header file. slay.
πΈ Adding new libraries πΈ
when adding a new sub-library to OpenSSL, assign it a library number ERR_LIB_XXX, define a macro XXXerr() (both in <openssl/err.h>), add its name to ERR_str_libraries[] (in /usr/src/lib/libcrypto/err/err.c), and add ERR_load_XXX_strings() to the ERR_load_crypto_strings() function (in /usr/src/lib/libcrypto/err/err_all.c). finally, add xxx_err.c to the Makefile.
π USING ERROR CODES IN EXTERNAL LIBRARIES π
it is also possible to use OpenSSL's error code scheme in external libraries. cute.
π INTERNALS π
the error queues are stored in a hash table with one ERR_STATE entry for each PID. ERR_get_state() returns the current thread's ERR_STATE. an ERR_STATE can hold up to ERR_NUM_ERRORS error codes. when more error codes are added, the old ones are overwritten, on the assumption that the most recent errors are most important. periodt.
error strings are also stored in a hash table.
π¦ SEE ALSO π¦
crypto(3)ERR_asprintf_error_data(3)ERR_clear_error(3)ERR_error_string(3)ERR_get_error(3)ERR_GET_LIB(3)ERR_load_crypto_strings(3)ERR_load_strings(3)ERR_print_errors(3)ERR_put_error(3)ERR_remove_state(3)ERR_set_mark(3)SSL_get_error(3)
and that's the whole vibe, bestie π signing off from the Debian edition, dated July 26, 2023 β this was ERR(3). π
π¦ where this page comes from
- opensuse-leap 16.0: libressl-devel-doc 4.1.0-bp160.1.1 Β· OpenSSL
- Copyright (c) 2000, 2015 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms