ERR_GET_LIB(3ossl)
πΈ NAME: ERR_GET_LIB(3ossl) πΈ
Bestie, this is the OpenSSL manual for ERR_GET_LIB, ERR_GET_REASON, and ERR_FATAL_ERROR β the little trio that gets information from error codes. π
β¨ SYNOPSIS β¨
#include <openssl/err.h>
int ERR_GET_LIB(unsigned long e);
int ERR_GET_REASON(unsigned long e);
int ERR_FATAL_ERROR(unsigned long e);
π¦ DESCRIPTION π¦
Okay so ERR_get_error() returns an error code, and that code consists of a library number and a reason code. ERR_GET_LIB() and ERR_GET_REASON() are the extractors β use them to pull those parts out. π«Ά
ERR_FATAL_ERROR() tells you whether a given error code is a fatal error. It's giving vibe check for fatal-ness. π
The library number describes where the error happened. The reason code is the info about what went wrong. π
Every sub-library of OpenSSL has its own unique library number. The reason code is unique within each sub-library. But heads up: different libraries may use the same value to signal different reasons β so don't assume a number means the same thing everywhere, bestie. π
ERR_R_... reason codes like ERR_R_MALLOC_FAILURE are globally unique. Slay. But when you're checking for sub-library specific reason codes, be sure to also compare the library number. Periodt. π
Also, plot twist: ERR_GET_LIB(), ERR_GET_REASON(), and ERR_FATAL_ERROR() are macros. Not regular function calls, iykyk. β¨
π RETURN VALUES π
You get back the library number, the reason code, and whether the error is fatal β respectively. Starting with OpenSSL 3.0.0, the function code is always set to zero. π
β οΈ NOTES β οΈ
Bestie, listen: applications should not make control flow decisions based on specific error codes. Error codes are subject to change at any time β even in patch releases of OpenSSL. π A particular error code can only be considered meaningful for control flow decisions if it is explicitly documented as such. New failure codes may still appear at any time. So like... do not build your whole logic on one number, fr fr. π«Ά
π SEE ALSO π
ERR_get_error(3) β go read that one too, bestie. πΈ
π§ HISTORY π§
ERR_GET_LIB() and ERR_GET_REASON() are available in all versions of OpenSSL. Iconic. π
ERR_GET_FUNC() was removed in OpenSSL 3.0. RIP to that one. π
π COPYRIGHT π
Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
π that's the whole page, bestie β OpenSSL 3.5.0, dated 2026-09-25, signing off from ERR_GET_LIB(3ossl). mwah π
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms