xref: /onnv-gate/usr/src/common/openssl/doc/crypto/ERR_error_string.pod (revision 2175:b0b2f052a486)
1*2175Sjp161948=pod
2*2175Sjp161948
3*2175Sjp161948=head1 NAME
4*2175Sjp161948
5*2175Sjp161948ERR_error_string, ERR_error_string_n, ERR_lib_error_string,
6*2175Sjp161948ERR_func_error_string, ERR_reason_error_string - obtain human-readable
7*2175Sjp161948error message
8*2175Sjp161948
9*2175Sjp161948=head1 SYNOPSIS
10*2175Sjp161948
11*2175Sjp161948 #include <openssl/err.h>
12*2175Sjp161948
13*2175Sjp161948 char *ERR_error_string(unsigned long e, char *buf);
14*2175Sjp161948 void ERR_error_string_n(unsigned long e, char *buf, size_t len);
15*2175Sjp161948
16*2175Sjp161948 const char *ERR_lib_error_string(unsigned long e);
17*2175Sjp161948 const char *ERR_func_error_string(unsigned long e);
18*2175Sjp161948 const char *ERR_reason_error_string(unsigned long e);
19*2175Sjp161948
20*2175Sjp161948=head1 DESCRIPTION
21*2175Sjp161948
22*2175Sjp161948ERR_error_string() generates a human-readable string representing the
23*2175Sjp161948error code I<e>, and places it at I<buf>. I<buf> must be at least 120
24*2175Sjp161948bytes long. If I<buf> is B<NULL>, the error string is placed in a
25*2175Sjp161948static buffer.
26*2175Sjp161948ERR_error_string_n() is a variant of ERR_error_string() that writes
27*2175Sjp161948at most I<len> characters (including the terminating 0)
28*2175Sjp161948and truncates the string if necessary.
29*2175Sjp161948For ERR_error_string_n(), I<buf> may not be B<NULL>.
30*2175Sjp161948
31*2175Sjp161948The string will have the following format:
32*2175Sjp161948
33*2175Sjp161948 error:[error code]:[library name]:[function name]:[reason string]
34*2175Sjp161948
35*2175Sjp161948I<error code> is an 8 digit hexadecimal number, I<library name>,
36*2175Sjp161948I<function name> and I<reason string> are ASCII text.
37*2175Sjp161948
38*2175Sjp161948ERR_lib_error_string(), ERR_func_error_string() and
39*2175Sjp161948ERR_reason_error_string() return the library name, function
40*2175Sjp161948name and reason string respectively.
41*2175Sjp161948
42*2175Sjp161948The OpenSSL error strings should be loaded by calling
43*2175Sjp161948L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)> or, for SSL
44*2175Sjp161948applications, L<SSL_load_error_strings(3)|SSL_load_error_strings(3)>
45*2175Sjp161948first.
46*2175Sjp161948If there is no text string registered for the given error code,
47*2175Sjp161948the error string will contain the numeric code.
48*2175Sjp161948
49*2175Sjp161948L<ERR_print_errors(3)|ERR_print_errors(3)> can be used to print
50*2175Sjp161948all error codes currently in the queue.
51*2175Sjp161948
52*2175Sjp161948=head1 RETURN VALUES
53*2175Sjp161948
54*2175Sjp161948ERR_error_string() returns a pointer to a static buffer containing the
55*2175Sjp161948string if I<buf> B<== NULL>, I<buf> otherwise.
56*2175Sjp161948
57*2175Sjp161948ERR_lib_error_string(), ERR_func_error_string() and
58*2175Sjp161948ERR_reason_error_string() return the strings, and B<NULL> if
59*2175Sjp161948none is registered for the error code.
60*2175Sjp161948
61*2175Sjp161948=head1 SEE ALSO
62*2175Sjp161948
63*2175Sjp161948L<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)>,
64*2175Sjp161948L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>,
65*2175Sjp161948L<SSL_load_error_strings(3)|SSL_load_error_strings(3)>
66*2175Sjp161948L<ERR_print_errors(3)|ERR_print_errors(3)>
67*2175Sjp161948
68*2175Sjp161948=head1 HISTORY
69*2175Sjp161948
70*2175Sjp161948ERR_error_string() is available in all versions of SSLeay and OpenSSL.
71*2175Sjp161948ERR_error_string_n() was added in OpenSSL 0.9.6.
72*2175Sjp161948
73*2175Sjp161948=cut
74