1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
.\" $OpenBSD: ERR_GET_LIB.3,v 1.2 2016/11/06 15:52:50 jmc Exp $
.\"
.Dd $Mdocdate: November 6 2016 $
.Dt ERR_GET_LIB 3
.Os
.Sh NAME
.Nm ERR_GET_LIB ,
.Nm ERR_GET_FUNC ,
.Nm ERR_GET_REASON
.Nd get library, function and reason codes for OpenSSL errors
.Sh SYNOPSIS
.In openssl/err.h
.Ft int
.Fo ERR_GET_LIB
.Fa "unsigned long e"
.Fc
.Ft int
.Fo ERR_GET_FUNC
.Fa "unsigned long e"
.Fc
.Ft int
.Fo ERR_GET_REASON
.Fa "unsigned long e"
.Fc
.Sh DESCRIPTION
The error code returned by
.Xr ERR_get_error 3
consists of a library number, function code, and reason code.
.Fn ERR_GET_LIB ,
.Fn ERR_GET_FUNC ,
and
.Fn ERR_GET_REASON
can be used to extract these.
.Pp
The library number and function code describe where the error occurred,
the reason code is the information about what went wrong.
.Pp
Each sub-library of OpenSSL has a unique library number; function and
reason codes are unique within each sub-library.
Note that different libraries may use the same value to signal different
functions and reasons.
.Pp
.Dv ERR_R_*
reason codes such as
.Dv ERR_R_MALLOC_FAILURE
are globally unique.
However, when checking for sub-library specific reason codes, be sure to
also compare the library number.
.Pp
.Fn ERR_GET_LIB ,
.Fn ERR_GET_FUNC ,
and
.Fn ERR_GET_REASON
are macros.
.Sh RETURN VALUES
The library number, function code, and reason code, respectively.
.Sh SEE ALSO
.Xr ERR 3 ,
.Xr ERR_get_error 3
.Sh HISTORY
.Fn ERR_GET_LIB ,
.Fn ERR_GET_FUNC ,
and
.Fn ERR_GET_REASON
are available in all versions of SSLeay and OpenSSL.
|