ERR(3)

πŸ“¦ version 4.1.0, in opensuse-leap 16.0

✨ 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 πŸ¦‹


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