xref: /freebsd-src/crypto/openssl/doc/man3/ERR_error_string.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
5e71b7053SJung-uk KimERR_error_string, ERR_error_string_n, ERR_lib_error_string,
6e71b7053SJung-uk KimERR_func_error_string, ERR_reason_error_string - obtain human-readable
7e71b7053SJung-uk Kimerror message
8e71b7053SJung-uk Kim
9e71b7053SJung-uk Kim=head1 SYNOPSIS
10e71b7053SJung-uk Kim
11e71b7053SJung-uk Kim #include <openssl/err.h>
12e71b7053SJung-uk Kim
13e71b7053SJung-uk Kim char *ERR_error_string(unsigned long e, char *buf);
14e71b7053SJung-uk Kim void ERR_error_string_n(unsigned long e, char *buf, size_t len);
15e71b7053SJung-uk Kim
16e71b7053SJung-uk Kim const char *ERR_lib_error_string(unsigned long e);
17e71b7053SJung-uk Kim const char *ERR_reason_error_string(unsigned long e);
18e71b7053SJung-uk Kim
19*b077aed3SPierre ProncheryDeprecated in OpenSSL 3.0:
20*b077aed3SPierre Pronchery
21*b077aed3SPierre Pronchery const char *ERR_func_error_string(unsigned long e);
22*b077aed3SPierre Pronchery
23e71b7053SJung-uk Kim=head1 DESCRIPTION
24e71b7053SJung-uk Kim
25e71b7053SJung-uk KimERR_error_string() generates a human-readable string representing the
26e71b7053SJung-uk Kimerror code I<e>, and places it at I<buf>. I<buf> must be at least 256
27e71b7053SJung-uk Kimbytes long. If I<buf> is B<NULL>, the error string is placed in a
28e71b7053SJung-uk Kimstatic buffer.
29e71b7053SJung-uk KimNote that this function is not thread-safe and does no checks on the size
30e71b7053SJung-uk Kimof the buffer; use ERR_error_string_n() instead.
31e71b7053SJung-uk Kim
32e71b7053SJung-uk KimERR_error_string_n() is a variant of ERR_error_string() that writes
33e71b7053SJung-uk Kimat most I<len> characters (including the terminating 0)
34e71b7053SJung-uk Kimand truncates the string if necessary.
35e71b7053SJung-uk KimFor ERR_error_string_n(), I<buf> may not be B<NULL>.
36e71b7053SJung-uk Kim
37e71b7053SJung-uk KimThe string will have the following format:
38e71b7053SJung-uk Kim
39*b077aed3SPierre Pronchery error:[error code]:[library name]::[reason string]
40e71b7053SJung-uk Kim
41*b077aed3SPierre ProncheryI<error code> is an 8 digit hexadecimal number, I<library name> and
42*b077aed3SPierre ProncheryI<reason string> are ASCII text.
43e71b7053SJung-uk Kim
44*b077aed3SPierre ProncheryERR_lib_error_string() and ERR_reason_error_string() return the library
45e71b7053SJung-uk Kimname and reason string respectively.
46e71b7053SJung-uk Kim
47e71b7053SJung-uk KimIf there is no text string registered for the given error code,
48e71b7053SJung-uk Kimthe error string will contain the numeric code.
49e71b7053SJung-uk Kim
50e71b7053SJung-uk KimL<ERR_print_errors(3)> can be used to print
51e71b7053SJung-uk Kimall error codes currently in the queue.
52e71b7053SJung-uk Kim
53e71b7053SJung-uk Kim=head1 RETURN VALUES
54e71b7053SJung-uk Kim
55e71b7053SJung-uk KimERR_error_string() returns a pointer to a static buffer containing the
56e71b7053SJung-uk Kimstring if I<buf> B<== NULL>, I<buf> otherwise.
57e71b7053SJung-uk Kim
58*b077aed3SPierre ProncheryERR_lib_error_string() and ERR_reason_error_string() return the strings,
59*b077aed3SPierre Proncheryand B<NULL> if none is registered for the error code.
60*b077aed3SPierre Pronchery
61*b077aed3SPierre ProncheryERR_func_error_string() returns NULL.
62e71b7053SJung-uk Kim
63e71b7053SJung-uk Kim=head1 SEE ALSO
64e71b7053SJung-uk Kim
65e71b7053SJung-uk KimL<ERR_get_error(3)>,
66e71b7053SJung-uk KimL<ERR_print_errors(3)>
67e71b7053SJung-uk Kim
68*b077aed3SPierre Pronchery=head1 HISTORY
69*b077aed3SPierre Pronchery
70*b077aed3SPierre ProncheryERR_func_error_string() became deprecated in OpenSSL 3.0.
71*b077aed3SPierre Pronchery
72e71b7053SJung-uk Kim=head1 COPYRIGHT
73e71b7053SJung-uk Kim
74e71b7053SJung-uk KimCopyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
75e71b7053SJung-uk Kim
76*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
77e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
78e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
79e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
80e71b7053SJung-uk Kim
81e71b7053SJung-uk Kim=cut
82