ERR_GET_LIB(3)
β¨ ERR_GET_LIB β¨
okay so bestie, this is the manual page for ERR_GET_LIB(3), and it's literally the group chat for OpenSSL error codes π
let me break it down for you.
πΈ NAME πΈ
ERR_GET_LIB, ERR_GET_FUNC, ERR_GET_REASON, ERR_FATAL_ERROR β get library, function, and reason codes for OpenSSL errors π
π¦ SYNOPSIS π¦
#include <openssl/err.h>
int
ERR_GET_LIB(unsigned long e);
int
ERR_GET_FUNC(unsigned long e);
int
ERR_GET_REASON(unsigned long e);
int
ERR_FATAL_ERROR(unsigned long e);
π DESCRIPTION π
okay so picture this: the error code that ERR_get_error(3) hands you is literally a little bundle of info β it's got a library number, a function code, and a reason code all packed inside. and ERR_GET_LIB(), ERR_GET_FUNC(), and ERR_GET_REASON() are the besties that unpack it for you π«Ά
the library number and function code are the "where did this happen" energy β they tell you where the error occurred. the reason code is the "what even went wrong" tea β β it's the actual info about what broke.
each sub-library of OpenSSL has its own unique library number, no cap. and function and reason codes are unique within each sub-library. so like... different libraries can absolutely use the same value to signal different functions and reasons π not confusing at all, i know.
the ERR_R_* reason codes β think ERR_R_MALLOC_FAILURE β are globally unique, slay. but bestie listen: when you're checking for sub-library specific reason codes, make sure you also compare the library number. don't skip that step, it's giving cautionary tale π
and ERR_FATAL_ERROR() tells you whether a given error code is a fatal error. iconic.
oh and also? these functions are implemented as macros. just so you know β¨
π₯ RETURN VALUES π₯
ERR_GET_LIB()returns the library number πERR_GET_FUNC()returns the function code πERR_GET_REASON()returns the reason code πΈERR_FATAL_ERROR()returns non-zero if the error is fatal, or0otherwise β
π SEE ALSO π
π HISTORY π
ERR_GET_LIB(), ERR_GET_FUNC(), ERR_GET_REASON(), and ERR_FATAL_ERROR() first appeared in SSLeay 0.4.4 and have been available since OpenBSD 2.4. so they're basically vintage royalty at this point, periodt π
this page came from Debian and it's dated March 27, 2018 β a lil throwback, but the info still eats π β¨
π¦ where this page comes from
- opensuse-leap 16.0: libressl-devel-doc 4.1.0-bp160.1.1 Β· OpenSSL
- Copyright (c) 2000 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