159191Skris=pod 259191Skris 359191Skris=head1 NAME 459191Skris 568651SkrisERR_error_string, ERR_error_string_n, ERR_lib_error_string, 668651SkrisERR_func_error_string, ERR_reason_error_string - obtain human-readable 768651Skriserror message 859191Skris 959191Skris=head1 SYNOPSIS 1059191Skris 1159191Skris #include <openssl/err.h> 1259191Skris 1359191Skris char *ERR_error_string(unsigned long e, char *buf); 14160814Ssimon void ERR_error_string_n(unsigned long e, char *buf, size_t len); 1559191Skris 1659191Skris const char *ERR_lib_error_string(unsigned long e); 1759191Skris const char *ERR_func_error_string(unsigned long e); 1859191Skris const char *ERR_reason_error_string(unsigned long e); 1959191Skris 2059191Skris=head1 DESCRIPTION 2159191Skris 2259191SkrisERR_error_string() generates a human-readable string representing the 2368651Skriserror code I<e>, and places it at I<buf>. I<buf> must be at least 120 2468651Skrisbytes long. If I<buf> is B<NULL>, the error string is placed in a 2559191Skrisstatic buffer. 2668651SkrisERR_error_string_n() is a variant of ERR_error_string() that writes 2768651Skrisat most I<len> characters (including the terminating 0) 2868651Skrisand truncates the string if necessary. 2968651SkrisFor ERR_error_string_n(), I<buf> may not be B<NULL>. 3059191Skris 3159191SkrisThe string will have the following format: 3259191Skris 3359191Skris error:[error code]:[library name]:[function name]:[reason string] 3459191Skris 3559191SkrisI<error code> is an 8 digit hexadecimal number, I<library name>, 3659191SkrisI<function name> and I<reason string> are ASCII text. 3759191Skris 3859191SkrisERR_lib_error_string(), ERR_func_error_string() and 3959191SkrisERR_reason_error_string() return the library name, function 4059191Skrisname and reason string respectively. 4159191Skris 4259191SkrisThe OpenSSL error strings should be loaded by calling 4359191SkrisL<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)> or, for SSL 4459191Skrisapplications, L<SSL_load_error_strings(3)|SSL_load_error_strings(3)> 4559191Skrisfirst. 4659191SkrisIf there is no text string registered for the given error code, 4759191Skristhe error string will contain the numeric code. 4859191Skris 4959191SkrisL<ERR_print_errors(3)|ERR_print_errors(3)> can be used to print 5059191Skrisall error codes currently in the queue. 5159191Skris 5259191Skris=head1 RETURN VALUES 5359191Skris 5459191SkrisERR_error_string() returns a pointer to a static buffer containing the 5568651Skrisstring if I<buf> B<== NULL>, I<buf> otherwise. 5659191Skris 5759191SkrisERR_lib_error_string(), ERR_func_error_string() and 5859191SkrisERR_reason_error_string() return the strings, and B<NULL> if 5959191Skrisnone is registered for the error code. 6059191Skris 6159191Skris=head1 SEE ALSO 6259191Skris 6359191SkrisL<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, 6459191SkrisL<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>, 6559191SkrisL<SSL_load_error_strings(3)|SSL_load_error_strings(3)> 6659191SkrisL<ERR_print_errors(3)|ERR_print_errors(3)> 6759191Skris 6859191Skris=head1 HISTORY 6959191Skris 7059191SkrisERR_error_string() is available in all versions of SSLeay and OpenSSL. 7168651SkrisERR_error_string_n() was added in OpenSSL 0.9.6. 7259191Skris 7359191Skris=cut 74