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