ERR_error_string.3ossl 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "ERR_ERROR_STRING 3ossl"
  58. .TH ERR_ERROR_STRING 3ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. ERR_error_string, ERR_error_string_n, ERR_lib_error_string,
  65. ERR_func_error_string, ERR_reason_error_string \- obtain human\-readable
  66. error message
  67. .SH SYNOPSIS
  68. .IX Header "SYNOPSIS"
  69. .Vb 1
  70. \& #include <openssl/err.h>
  71. \&
  72. \& char *ERR_error_string(unsigned long e, char *buf);
  73. \& void ERR_error_string_n(unsigned long e, char *buf, size_t len);
  74. \&
  75. \& const char *ERR_lib_error_string(unsigned long e);
  76. \& const char *ERR_reason_error_string(unsigned long e);
  77. .Ve
  78. .PP
  79. Deprecated in OpenSSL 3.0:
  80. .PP
  81. .Vb 1
  82. \& const char *ERR_func_error_string(unsigned long e);
  83. .Ve
  84. .SH DESCRIPTION
  85. .IX Header "DESCRIPTION"
  86. \&\fBERR_error_string()\fR generates a human-readable string representing the
  87. error code \fIe\fR, and places it at \fIbuf\fR. \fIbuf\fR must be at least 256
  88. bytes long. If \fIbuf\fR is \fBNULL\fR, the error string is placed in a
  89. static buffer.
  90. Note that this function is not thread-safe and does no checks on the size
  91. of the buffer; use \fBERR_error_string_n()\fR instead.
  92. .PP
  93. \&\fBERR_error_string_n()\fR is a variant of \fBERR_error_string()\fR that writes
  94. at most \fIlen\fR characters (including the terminating 0)
  95. and truncates the string if necessary.
  96. For \fBERR_error_string_n()\fR, \fIbuf\fR may not be \fBNULL\fR.
  97. .PP
  98. The string will have the following format:
  99. .PP
  100. .Vb 1
  101. \& error:[error code]:[library name]::[reason string]
  102. .Ve
  103. .PP
  104. \&\fIerror code\fR is an 8 digit hexadecimal number, \fIlibrary name\fR and
  105. \&\fIreason string\fR are ASCII text.
  106. .PP
  107. \&\fBERR_lib_error_string()\fR and \fBERR_reason_error_string()\fR return the library
  108. name and reason string respectively.
  109. .PP
  110. If there is no text string registered for the given error code,
  111. the error string will contain the numeric code.
  112. .PP
  113. \&\fBERR_print_errors\fR\|(3) can be used to print
  114. all error codes currently in the queue.
  115. .SH "RETURN VALUES"
  116. .IX Header "RETURN VALUES"
  117. \&\fBERR_error_string()\fR returns a pointer to a static buffer containing the
  118. string if \fIbuf\fR \fB== NULL\fR, \fIbuf\fR otherwise.
  119. .PP
  120. \&\fBERR_lib_error_string()\fR and \fBERR_reason_error_string()\fR return the strings,
  121. and \fBNULL\fR if none is registered for the error code.
  122. .PP
  123. \&\fBERR_func_error_string()\fR returns NULL.
  124. .SH "SEE ALSO"
  125. .IX Header "SEE ALSO"
  126. \&\fBERR_get_error\fR\|(3),
  127. \&\fBERR_print_errors\fR\|(3)
  128. .SH HISTORY
  129. .IX Header "HISTORY"
  130. \&\fBERR_func_error_string()\fR became deprecated in OpenSSL 3.0.
  131. .SH COPYRIGHT
  132. .IX Header "COPYRIGHT"
  133. Copyright 2000\-2017 The OpenSSL Project Authors. All Rights Reserved.
  134. .PP
  135. Licensed under the Apache License 2.0 (the "License"). You may not use
  136. this file except in compliance with the License. You can obtain a copy
  137. in the file LICENSE in the source distribution or at
  138. <https://www.openssl.org/source/license.html>.