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