1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5*b077aed3SPierre ProncheryERR_GET_LIB, ERR_GET_REASON, ERR_FATAL_ERROR 6e71b7053SJung-uk Kim- get information from error codes 7e71b7053SJung-uk Kim 8e71b7053SJung-uk Kim=head1 SYNOPSIS 9e71b7053SJung-uk Kim 10e71b7053SJung-uk Kim #include <openssl/err.h> 11e71b7053SJung-uk Kim 12e71b7053SJung-uk Kim int ERR_GET_LIB(unsigned long e); 13e71b7053SJung-uk Kim 14e71b7053SJung-uk Kim int ERR_GET_REASON(unsigned long e); 15e71b7053SJung-uk Kim 16e71b7053SJung-uk Kim int ERR_FATAL_ERROR(unsigned long e); 17e71b7053SJung-uk Kim 18e71b7053SJung-uk Kim=head1 DESCRIPTION 19e71b7053SJung-uk Kim 20e71b7053SJung-uk KimThe error code returned by ERR_get_error() consists of a library 21*b077aed3SPierre Proncherynumber and reason code. ERR_GET_LIB() 22e71b7053SJung-uk Kimand ERR_GET_REASON() can be used to extract these. 23e71b7053SJung-uk Kim 24e71b7053SJung-uk KimERR_FATAL_ERROR() indicates whether a given error code is a fatal error. 25e71b7053SJung-uk Kim 26*b077aed3SPierre ProncheryThe library number describes where the error 27e71b7053SJung-uk Kimoccurred, the reason code is the information about what went wrong. 28e71b7053SJung-uk Kim 29*b077aed3SPierre ProncheryEach sub-library of OpenSSL has a unique library number; the 30*b077aed3SPierre Proncheryreason code is unique within each sub-library. Note that different 31*b077aed3SPierre Proncherylibraries may use the same value to signal different reasons. 32e71b7053SJung-uk Kim 33e71b7053SJung-uk KimB<ERR_R_...> reason codes such as B<ERR_R_MALLOC_FAILURE> are globally 34e71b7053SJung-uk Kimunique. However, when checking for sub-library specific reason codes, 35e71b7053SJung-uk Kimbe sure to also compare the library number. 36e71b7053SJung-uk Kim 37*b077aed3SPierre ProncheryERR_GET_LIB(), ERR_GET_REASON(), and ERR_FATAL_ERROR() are macros. 38e71b7053SJung-uk Kim 39e71b7053SJung-uk Kim=head1 RETURN VALUES 40e71b7053SJung-uk Kim 41*b077aed3SPierre ProncheryThe library number, reason code, and whether the error 42e71b7053SJung-uk Kimis fatal, respectively. 43*b077aed3SPierre ProncheryStarting with OpenSSL 3.0.0, the function code is always set to zero. 44*b077aed3SPierre Pronchery 45*b077aed3SPierre Pronchery=head1 NOTES 46*b077aed3SPierre Pronchery 47*b077aed3SPierre ProncheryApplications should not make control flow decisions based on specific error 48*b077aed3SPierre Proncherycodes. Error codes are subject to change at any time (even in patch releases of 49*b077aed3SPierre ProncheryOpenSSL). A particular error code can only be considered meaningful for control 50*b077aed3SPierre Proncheryflow decisions if it is explicitly documented as such. New failure codes may 51*b077aed3SPierre Proncherystill appear at any time. 52e71b7053SJung-uk Kim 53e71b7053SJung-uk Kim=head1 SEE ALSO 54e71b7053SJung-uk Kim 55e71b7053SJung-uk KimL<ERR_get_error(3)> 56e71b7053SJung-uk Kim 57e71b7053SJung-uk Kim=head1 HISTORY 58e71b7053SJung-uk Kim 59*b077aed3SPierre ProncheryERR_GET_LIB() and ERR_GET_REASON() are available in all versions of OpenSSL. 60*b077aed3SPierre Pronchery 61*b077aed3SPierre ProncheryERR_GET_FUNC() was removed in OpenSSL 3.0. 62e71b7053SJung-uk Kim 63e71b7053SJung-uk Kim=head1 COPYRIGHT 64e71b7053SJung-uk Kim 65*b077aed3SPierre ProncheryCopyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved. 66e71b7053SJung-uk Kim 67*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 68e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 69e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 70e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 71e71b7053SJung-uk Kim 72e71b7053SJung-uk Kim=cut 73