diff options
Diffstat (limited to 'src')
23 files changed, 963 insertions, 705 deletions
diff --git a/src/lib/libcrypto/doc/ERR.pod b/src/lib/libcrypto/doc/ERR.pod deleted file mode 100644 index 343a9b84c2..0000000000 --- a/src/lib/libcrypto/doc/ERR.pod +++ /dev/null | |||
| @@ -1,185 +0,0 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | ERR - error codes | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/err.h> | ||
| 10 | |||
| 11 | unsigned long ERR_get_error(void); | ||
| 12 | unsigned long ERR_peek_error(void); | ||
| 13 | unsigned long ERR_get_error_line(const char **file, int *line); | ||
| 14 | unsigned long ERR_peek_error_line(const char **file, int *line); | ||
| 15 | unsigned long ERR_get_error_line_data(const char **file, int *line, | ||
| 16 | const char **data, int *flags); | ||
| 17 | unsigned long ERR_peek_error_line_data(const char **file, int *line, | ||
| 18 | const char **data, int *flags); | ||
| 19 | |||
| 20 | int ERR_GET_LIB(unsigned long e); | ||
| 21 | int ERR_GET_FUNC(unsigned long e); | ||
| 22 | int ERR_GET_REASON(unsigned long e); | ||
| 23 | |||
| 24 | void ERR_clear_error(void); | ||
| 25 | |||
| 26 | char *ERR_error_string(unsigned long e, char *buf); | ||
| 27 | const char *ERR_lib_error_string(unsigned long e); | ||
| 28 | const char *ERR_func_error_string(unsigned long e); | ||
| 29 | const char *ERR_reason_error_string(unsigned long e); | ||
| 30 | |||
| 31 | void ERR_print_errors(BIO *bp); | ||
| 32 | void ERR_print_errors_fp(FILE *fp); | ||
| 33 | |||
| 34 | void ERR_load_crypto_strings(void); | ||
| 35 | void ERR_free_strings(void); | ||
| 36 | |||
| 37 | void ERR_remove_state(unsigned long pid); | ||
| 38 | |||
| 39 | void ERR_put_error(int lib, int func, int reason, const char *file, | ||
| 40 | int line); | ||
| 41 | void ERR_add_error_data(int num, ...); | ||
| 42 | |||
| 43 | void ERR_load_strings(int lib,ERR_STRING_DATA str[]); | ||
| 44 | unsigned long ERR_PACK(int lib, int func, int reason); | ||
| 45 | int ERR_get_next_error_library(void); | ||
| 46 | |||
| 47 | =head1 DESCRIPTION | ||
| 48 | |||
| 49 | When a call to the OpenSSL library fails, this is usually signalled | ||
| 50 | by the return value, and an error code is stored in an error queue | ||
| 51 | associated with the current thread. The B<err> library provides | ||
| 52 | functions to obtain these error codes and textual error messages. | ||
| 53 | |||
| 54 | The L<ERR_get_error(3)|ERR_get_error(3)> manpage describes how to | ||
| 55 | access error codes. | ||
| 56 | |||
| 57 | Error codes contain information about where the error occurred, and | ||
| 58 | what went wrong. L<ERR_GET_LIB(3)|ERR_GET_LIB(3)> describes how to | ||
| 59 | extract this information. A method to obtain human-readable error | ||
| 60 | messages is described in L<ERR_error_string(3)|ERR_error_string(3)>. | ||
| 61 | |||
| 62 | L<ERR_clear_error(3)|ERR_clear_error(3)> can be used to clear the | ||
| 63 | error queue. | ||
| 64 | |||
| 65 | Note that L<ERR_remove_state(3)|ERR_remove_state(3)> should be used to | ||
| 66 | avoid memory leaks when threads are terminated. | ||
| 67 | |||
| 68 | =head1 ADDING NEW ERROR CODES TO OPENSSL | ||
| 69 | |||
| 70 | See L<ERR_put_error(3)> if you want to record error codes in the | ||
| 71 | OpenSSL error system from within your application. | ||
| 72 | |||
| 73 | The remainder of this section is of interest only if you want to add | ||
| 74 | new error codes to OpenSSL or add error codes from external libraries. | ||
| 75 | |||
| 76 | =head2 Reporting errors | ||
| 77 | |||
| 78 | Each sub-library has a specific macro XXXerr() that is used to report | ||
| 79 | errors. Its first argument is a function code B<XXX_F_...>, the second | ||
| 80 | argument is a reason code B<XXX_R_...>. Function codes are derived | ||
| 81 | from the function names; reason codes consist of textual error | ||
| 82 | descriptions. For example, the function ssl23_read() reports a | ||
| 83 | "handshake failure" as follows: | ||
| 84 | |||
| 85 | SSLerr(SSL_F_SSL23_READ, SSL_R_SSL_HANDSHAKE_FAILURE); | ||
| 86 | |||
| 87 | Function and reason codes should consist of upper case characters, | ||
| 88 | numbers and underscores only. The error file generation script translates | ||
| 89 | function codes into function names by looking in the header files | ||
| 90 | for an appropriate function name, if none is found it just uses | ||
| 91 | the capitalized form such as "SSL23_READ" in the above example. | ||
| 92 | |||
| 93 | The trailing section of a reason code (after the "_R_") is translated | ||
| 94 | into lower case and underscores changed to spaces. | ||
| 95 | |||
| 96 | When you are using new function or reason codes, run B<make errors>. | ||
| 97 | The necessary B<#define>s will then automatically be added to the | ||
| 98 | sub-library's header file. | ||
| 99 | |||
| 100 | Although a library will normally report errors using its own specific | ||
| 101 | XXXerr macro, another library's macro can be used. This is normally | ||
| 102 | only done when a library wants to include ASN1 code which must use | ||
| 103 | the ASN1err() macro. | ||
| 104 | |||
| 105 | =head2 Adding new libraries | ||
| 106 | |||
| 107 | When adding a new sub-library to OpenSSL, assign it a library number | ||
| 108 | B<ERR_LIB_XXX>, define a macro XXXerr() (both in B<err.h>), add its | ||
| 109 | name to B<ERR_str_libraries[]> (in B<crypto/err/err.c>), and add | ||
| 110 | C<ERR_load_XXX_strings()> to the ERR_load_crypto_strings() function | ||
| 111 | (in B<crypto/err/err_all.c>). Finally, add an entry | ||
| 112 | |||
| 113 | L XXX xxx.h xxx_err.c | ||
| 114 | |||
| 115 | to B<crypto/err/openssl.ec>, and add B<xxx_err.c> to the Makefile. | ||
| 116 | Running B<make errors> will then generate a file B<xxx_err.c>, and | ||
| 117 | add all error codes used in the library to B<xxx.h>. | ||
| 118 | |||
| 119 | Additionally the library include file must have a certain form. | ||
| 120 | Typically it will initially look like this: | ||
| 121 | |||
| 122 | #ifndef HEADER_XXX_H | ||
| 123 | #define HEADER_XXX_H | ||
| 124 | |||
| 125 | #ifdef __cplusplus | ||
| 126 | extern "C" { | ||
| 127 | #endif | ||
| 128 | |||
| 129 | /* Include files */ | ||
| 130 | |||
| 131 | #include <openssl/bio.h> | ||
| 132 | #include <openssl/x509.h> | ||
| 133 | |||
| 134 | /* Macros, structures and function prototypes */ | ||
| 135 | |||
| 136 | |||
| 137 | /* BEGIN ERROR CODES */ | ||
| 138 | |||
| 139 | The B<BEGIN ERROR CODES> sequence is used by the error code | ||
| 140 | generation script as the point to place new error codes, any text | ||
| 141 | after this point will be overwritten when B<make errors> is run. | ||
| 142 | The closing #endif etc will be automatically added by the script. | ||
| 143 | |||
| 144 | The generated C error code file B<xxx_err.c> will load the header | ||
| 145 | files B<stdio.h>, B<openssl/err.h> and B<openssl/xxx.h> so the | ||
| 146 | header file must load any additional header files containing any | ||
| 147 | definitions it uses. | ||
| 148 | |||
| 149 | =head1 USING ERROR CODES IN EXTERNAL LIBRARIES | ||
| 150 | |||
| 151 | It is also possible to use OpenSSL's error code scheme in external | ||
| 152 | libraries. The library needs to load its own codes and call the OpenSSL | ||
| 153 | error code insertion script B<mkerr.pl> explicitly to add codes to | ||
| 154 | the header file and generate the C error code file. This will normally | ||
| 155 | be done if the external library needs to generate new ASN1 structures | ||
| 156 | but it can also be used to add more general purpose error code handling. | ||
| 157 | |||
| 158 | =head1 INTERNALS | ||
| 159 | |||
| 160 | The error queues are stored in a hash table with one B<ERR_STATE> | ||
| 161 | entry for each pid. ERR_get_state() returns the current thread's | ||
| 162 | B<ERR_STATE>. An B<ERR_STATE> can hold up to B<ERR_NUM_ERRORS> error | ||
| 163 | codes. When more error codes are added, the old ones are overwritten, | ||
| 164 | on the assumption that the most recent errors are most important. | ||
| 165 | |||
| 166 | Error strings are also stored in hash table. The hash tables can | ||
| 167 | be obtained by calling ERR_get_err_state_table(void) and | ||
| 168 | ERR_get_string_table(void) respectively. | ||
| 169 | |||
| 170 | =head1 SEE ALSO | ||
| 171 | |||
| 172 | L<CRYPTO_set_id_callback(3)|CRYPTO_set_id_callback(3)>, | ||
| 173 | L<CRYPTO_set_locking_callback(3)|CRYPTO_set_locking_callback(3)>, | ||
| 174 | L<ERR_get_error(3)|ERR_get_error(3)>, | ||
| 175 | L<ERR_GET_LIB(3)|ERR_GET_LIB(3)>, | ||
| 176 | L<ERR_clear_error(3)|ERR_clear_error(3)>, | ||
| 177 | L<ERR_error_string(3)|ERR_error_string(3)>, | ||
| 178 | L<ERR_print_errors(3)|ERR_print_errors(3)>, | ||
| 179 | L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>, | ||
| 180 | L<ERR_remove_state(3)|ERR_remove_state(3)>, | ||
| 181 | L<ERR_put_error(3)|ERR_put_error(3)>, | ||
| 182 | L<ERR_load_strings(3)|ERR_load_strings(3)>, | ||
| 183 | L<SSL_get_error(3)|SSL_get_error(3)> | ||
| 184 | |||
| 185 | =cut | ||
diff --git a/src/lib/libcrypto/doc/ERR_GET_LIB.pod b/src/lib/libcrypto/doc/ERR_GET_LIB.pod deleted file mode 100644 index 2a129da036..0000000000 --- a/src/lib/libcrypto/doc/ERR_GET_LIB.pod +++ /dev/null | |||
| @@ -1,51 +0,0 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | ERR_GET_LIB, ERR_GET_FUNC, ERR_GET_REASON - get library, function and | ||
| 6 | reason code | ||
| 7 | |||
| 8 | =head1 SYNOPSIS | ||
| 9 | |||
| 10 | #include <openssl/err.h> | ||
| 11 | |||
| 12 | int ERR_GET_LIB(unsigned long e); | ||
| 13 | |||
| 14 | int ERR_GET_FUNC(unsigned long e); | ||
| 15 | |||
| 16 | int ERR_GET_REASON(unsigned long e); | ||
| 17 | |||
| 18 | =head1 DESCRIPTION | ||
| 19 | |||
| 20 | The error code returned by ERR_get_error() consists of a library | ||
| 21 | number, function code and reason code. ERR_GET_LIB(), ERR_GET_FUNC() | ||
| 22 | and ERR_GET_REASON() can be used to extract these. | ||
| 23 | |||
| 24 | The library number and function code describe where the error | ||
| 25 | occurred, the reason code is the information about what went wrong. | ||
| 26 | |||
| 27 | Each sub-library of OpenSSL has a unique library number; function and | ||
| 28 | reason codes are unique within each sub-library. Note that different | ||
| 29 | libraries may use the same value to signal different functions and | ||
| 30 | reasons. | ||
| 31 | |||
| 32 | B<ERR_R_...> reason codes such as B<ERR_R_MALLOC_FAILURE> are globally | ||
| 33 | unique. However, when checking for sub-library specific reason codes, | ||
| 34 | be sure to also compare the library number. | ||
| 35 | |||
| 36 | ERR_GET_LIB(), ERR_GET_FUNC() and ERR_GET_REASON() are macros. | ||
| 37 | |||
| 38 | =head1 RETURN VALUES | ||
| 39 | |||
| 40 | The library number, function code and reason code respectively. | ||
| 41 | |||
| 42 | =head1 SEE ALSO | ||
| 43 | |||
| 44 | L<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)> | ||
| 45 | |||
| 46 | =head1 HISTORY | ||
| 47 | |||
| 48 | ERR_GET_LIB(), ERR_GET_FUNC() and ERR_GET_REASON() are available in | ||
| 49 | all versions of SSLeay and OpenSSL. | ||
| 50 | |||
| 51 | =cut | ||
diff --git a/src/lib/libcrypto/doc/ERR_clear_error.pod b/src/lib/libcrypto/doc/ERR_clear_error.pod deleted file mode 100644 index 566e1f4e31..0000000000 --- a/src/lib/libcrypto/doc/ERR_clear_error.pod +++ /dev/null | |||
| @@ -1,29 +0,0 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | ERR_clear_error - clear the error queue | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/err.h> | ||
| 10 | |||
| 11 | void ERR_clear_error(void); | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | ERR_clear_error() empties the current thread's error queue. | ||
| 16 | |||
| 17 | =head1 RETURN VALUES | ||
| 18 | |||
| 19 | ERR_clear_error() has no return value. | ||
| 20 | |||
| 21 | =head1 SEE ALSO | ||
| 22 | |||
| 23 | L<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)> | ||
| 24 | |||
| 25 | =head1 HISTORY | ||
| 26 | |||
| 27 | ERR_clear_error() is available in all versions of SSLeay and OpenSSL. | ||
| 28 | |||
| 29 | =cut | ||
diff --git a/src/lib/libcrypto/doc/ERR_error_string.pod b/src/lib/libcrypto/doc/ERR_error_string.pod deleted file mode 100644 index cdfa7fe1fe..0000000000 --- a/src/lib/libcrypto/doc/ERR_error_string.pod +++ /dev/null | |||
| @@ -1,73 +0,0 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | ERR_error_string, ERR_error_string_n, ERR_lib_error_string, | ||
| 6 | ERR_func_error_string, ERR_reason_error_string - obtain human-readable | ||
| 7 | error 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_func_error_string(unsigned long e); | ||
| 18 | const char *ERR_reason_error_string(unsigned long e); | ||
| 19 | |||
| 20 | =head1 DESCRIPTION | ||
| 21 | |||
| 22 | ERR_error_string() generates a human-readable string representing the | ||
| 23 | error code I<e>, and places it at I<buf>. I<buf> must be at least 120 | ||
| 24 | bytes long. If I<buf> is B<NULL>, the error string is placed in a | ||
| 25 | static buffer. | ||
| 26 | ERR_error_string_n() is a variant of ERR_error_string() that writes | ||
| 27 | at most I<len> characters (including the terminating 0) | ||
| 28 | and truncates the string if necessary. | ||
| 29 | For ERR_error_string_n(), I<buf> may not be B<NULL>. | ||
| 30 | |||
| 31 | The string will have the following format: | ||
| 32 | |||
| 33 | error:[error code]:[library name]:[function name]:[reason string] | ||
| 34 | |||
| 35 | I<error code> is an 8 digit hexadecimal number, I<library name>, | ||
| 36 | I<function name> and I<reason string> are ASCII text. | ||
| 37 | |||
| 38 | ERR_lib_error_string(), ERR_func_error_string() and | ||
| 39 | ERR_reason_error_string() return the library name, function | ||
| 40 | name and reason string respectively. | ||
| 41 | |||
| 42 | The OpenSSL error strings should be loaded by calling | ||
| 43 | L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)> or, for SSL | ||
| 44 | applications, L<SSL_load_error_strings(3)|SSL_load_error_strings(3)> | ||
| 45 | first. | ||
| 46 | If there is no text string registered for the given error code, | ||
| 47 | the error string will contain the numeric code. | ||
| 48 | |||
| 49 | L<ERR_print_errors(3)|ERR_print_errors(3)> can be used to print | ||
| 50 | all error codes currently in the queue. | ||
| 51 | |||
| 52 | =head1 RETURN VALUES | ||
| 53 | |||
| 54 | ERR_error_string() returns a pointer to a static buffer containing the | ||
| 55 | string if I<buf> B<== NULL>, I<buf> otherwise. | ||
| 56 | |||
| 57 | ERR_lib_error_string(), ERR_func_error_string() and | ||
| 58 | ERR_reason_error_string() return the strings, and B<NULL> if | ||
| 59 | none is registered for the error code. | ||
| 60 | |||
| 61 | =head1 SEE ALSO | ||
| 62 | |||
| 63 | L<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, | ||
| 64 | L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>, | ||
| 65 | L<SSL_load_error_strings(3)|SSL_load_error_strings(3)> | ||
| 66 | L<ERR_print_errors(3)|ERR_print_errors(3)> | ||
| 67 | |||
| 68 | =head1 HISTORY | ||
| 69 | |||
| 70 | ERR_error_string() is available in all versions of SSLeay and OpenSSL. | ||
| 71 | ERR_error_string_n() was added in OpenSSL 0.9.6. | ||
| 72 | |||
| 73 | =cut | ||
diff --git a/src/lib/libcrypto/doc/ERR_get_error.pod b/src/lib/libcrypto/doc/ERR_get_error.pod deleted file mode 100644 index 460a79f3f6..0000000000 --- a/src/lib/libcrypto/doc/ERR_get_error.pod +++ /dev/null | |||
| @@ -1,79 +0,0 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | ERR_get_error, ERR_peek_error, ERR_peek_last_error, | ||
| 6 | ERR_get_error_line, ERR_peek_error_line, ERR_peek_last_error_line, | ||
| 7 | ERR_get_error_line_data, ERR_peek_error_line_data, | ||
| 8 | ERR_peek_last_error_line_data - obtain error code and data | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | #include <openssl/err.h> | ||
| 13 | |||
| 14 | unsigned long ERR_get_error(void); | ||
| 15 | unsigned long ERR_peek_error(void); | ||
| 16 | unsigned long ERR_peek_last_error(void); | ||
| 17 | |||
| 18 | unsigned long ERR_get_error_line(const char **file, int *line); | ||
| 19 | unsigned long ERR_peek_error_line(const char **file, int *line); | ||
| 20 | unsigned long ERR_peek_last_error_line(const char **file, int *line); | ||
| 21 | |||
| 22 | unsigned long ERR_get_error_line_data(const char **file, int *line, | ||
| 23 | const char **data, int *flags); | ||
| 24 | unsigned long ERR_peek_error_line_data(const char **file, int *line, | ||
| 25 | const char **data, int *flags); | ||
| 26 | unsigned long ERR_peek_last_error_line_data(const char **file, int *line, | ||
| 27 | const char **data, int *flags); | ||
| 28 | |||
| 29 | =head1 DESCRIPTION | ||
| 30 | |||
| 31 | ERR_get_error() returns the earliest error code from the thread's error | ||
| 32 | queue and removes the entry. This function can be called repeatedly | ||
| 33 | until there are no more error codes to return. | ||
| 34 | |||
| 35 | ERR_peek_error() returns the earliest error code from the thread's | ||
| 36 | error queue without modifying it. | ||
| 37 | |||
| 38 | ERR_peek_last_error() returns the latest error code from the thread's | ||
| 39 | error queue without modifying it. | ||
| 40 | |||
| 41 | See L<ERR_GET_LIB(3)|ERR_GET_LIB(3)> for obtaining information about | ||
| 42 | location and reason of the error, and | ||
| 43 | L<ERR_error_string(3)|ERR_error_string(3)> for human-readable error | ||
| 44 | messages. | ||
| 45 | |||
| 46 | ERR_get_error_line(), ERR_peek_error_line() and | ||
| 47 | ERR_peek_last_error_line() are the same as the above, but they | ||
| 48 | additionally store the file name and line number where | ||
| 49 | the error occurred in *B<file> and *B<line>, unless these are B<NULL>. | ||
| 50 | |||
| 51 | ERR_get_error_line_data(), ERR_peek_error_line_data() and | ||
| 52 | ERR_peek_last_error_line_data() store additional data and flags | ||
| 53 | associated with the error code in *B<data> | ||
| 54 | and *B<flags>, unless these are B<NULL>. *B<data> contains a string | ||
| 55 | if *B<flags>&B<ERR_TXT_STRING> is true. | ||
| 56 | |||
| 57 | An application B<MUST NOT> free the *B<data> pointer (or any other pointers | ||
| 58 | returned by these functions) with free() as freeing is handled | ||
| 59 | automatically by the error library. | ||
| 60 | |||
| 61 | =head1 RETURN VALUES | ||
| 62 | |||
| 63 | The error code, or 0 if there is no error in the queue. | ||
| 64 | |||
| 65 | =head1 SEE ALSO | ||
| 66 | |||
| 67 | L<err(3)|err(3)>, L<ERR_error_string(3)|ERR_error_string(3)>, | ||
| 68 | L<ERR_GET_LIB(3)|ERR_GET_LIB(3)> | ||
| 69 | |||
| 70 | =head1 HISTORY | ||
| 71 | |||
| 72 | ERR_get_error(), ERR_peek_error(), ERR_get_error_line() and | ||
| 73 | ERR_peek_error_line() are available in all versions of SSLeay and | ||
| 74 | OpenSSL. ERR_get_error_line_data() and ERR_peek_error_line_data() | ||
| 75 | were added in SSLeay 0.9.0. | ||
| 76 | ERR_peek_last_error(), ERR_peek_last_error_line() and | ||
| 77 | ERR_peek_last_error_line_data() were added in OpenSSL 0.9.7. | ||
| 78 | |||
| 79 | =cut | ||
diff --git a/src/lib/libcrypto/doc/ERR_load_crypto_strings.pod b/src/lib/libcrypto/doc/ERR_load_crypto_strings.pod deleted file mode 100644 index 9bdec75a46..0000000000 --- a/src/lib/libcrypto/doc/ERR_load_crypto_strings.pod +++ /dev/null | |||
| @@ -1,46 +0,0 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | ERR_load_crypto_strings, SSL_load_error_strings, ERR_free_strings - | ||
| 6 | load and free error strings | ||
| 7 | |||
| 8 | =head1 SYNOPSIS | ||
| 9 | |||
| 10 | #include <openssl/err.h> | ||
| 11 | |||
| 12 | void ERR_load_crypto_strings(void); | ||
| 13 | void ERR_free_strings(void); | ||
| 14 | |||
| 15 | #include <openssl/ssl.h> | ||
| 16 | |||
| 17 | void SSL_load_error_strings(void); | ||
| 18 | |||
| 19 | =head1 DESCRIPTION | ||
| 20 | |||
| 21 | ERR_load_crypto_strings() registers the error strings for all | ||
| 22 | B<libcrypto> functions. SSL_load_error_strings() does the same, | ||
| 23 | but also registers the B<libssl> error strings. | ||
| 24 | |||
| 25 | One of these functions should be called before generating | ||
| 26 | textual error messages. However, this is not required when memory | ||
| 27 | usage is an issue. | ||
| 28 | |||
| 29 | ERR_free_strings() frees all previously loaded error strings. | ||
| 30 | |||
| 31 | =head1 RETURN VALUES | ||
| 32 | |||
| 33 | ERR_load_crypto_strings(), SSL_load_error_strings() and | ||
| 34 | ERR_free_strings() return no values. | ||
| 35 | |||
| 36 | =head1 SEE ALSO | ||
| 37 | |||
| 38 | L<err(3)|err(3)>, L<ERR_error_string(3)|ERR_error_string(3)> | ||
| 39 | |||
| 40 | =head1 HISTORY | ||
| 41 | |||
| 42 | ERR_load_error_strings(), SSL_load_error_strings() and | ||
| 43 | ERR_free_strings() are available in all versions of SSLeay and | ||
| 44 | OpenSSL. | ||
| 45 | |||
| 46 | =cut | ||
diff --git a/src/lib/libcrypto/doc/ERR_load_strings.pod b/src/lib/libcrypto/doc/ERR_load_strings.pod deleted file mode 100644 index e9c5cf0fc5..0000000000 --- a/src/lib/libcrypto/doc/ERR_load_strings.pod +++ /dev/null | |||
| @@ -1,54 +0,0 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | ERR_load_strings, ERR_PACK, ERR_get_next_error_library - load | ||
| 6 | arbitrary error strings | ||
| 7 | |||
| 8 | =head1 SYNOPSIS | ||
| 9 | |||
| 10 | #include <openssl/err.h> | ||
| 11 | |||
| 12 | void ERR_load_strings(int lib, ERR_STRING_DATA str[]); | ||
| 13 | |||
| 14 | int ERR_get_next_error_library(void); | ||
| 15 | |||
| 16 | unsigned long ERR_PACK(int lib, int func, int reason); | ||
| 17 | |||
| 18 | =head1 DESCRIPTION | ||
| 19 | |||
| 20 | ERR_load_strings() registers error strings for library number B<lib>. | ||
| 21 | |||
| 22 | B<str> is an array of error string data: | ||
| 23 | |||
| 24 | typedef struct ERR_string_data_st | ||
| 25 | { | ||
| 26 | unsigned long error; | ||
| 27 | char *string; | ||
| 28 | } ERR_STRING_DATA; | ||
| 29 | |||
| 30 | The error code is generated from the library number and a function and | ||
| 31 | reason code: B<error> = ERR_PACK(B<lib>, B<func>, B<reason>). | ||
| 32 | ERR_PACK() is a macro. | ||
| 33 | |||
| 34 | The last entry in the array is {0,0}. | ||
| 35 | |||
| 36 | ERR_get_next_error_library() can be used to assign library numbers | ||
| 37 | to user libraries at runtime. | ||
| 38 | |||
| 39 | =head1 RETURN VALUE | ||
| 40 | |||
| 41 | ERR_PACK() return the error code. | ||
| 42 | ERR_get_next_error_library() returns a new library number. | ||
| 43 | |||
| 44 | =head1 SEE ALSO | ||
| 45 | |||
| 46 | L<err(3)|err(3)>, L<ERR_load_strings(3)|ERR_load_strings(3)> | ||
| 47 | |||
| 48 | =head1 HISTORY | ||
| 49 | |||
| 50 | ERR_load_error_strings() and ERR_PACK() are available in all versions | ||
| 51 | of SSLeay and OpenSSL. ERR_get_next_error_library() was added in | ||
| 52 | SSLeay 0.9.0. | ||
| 53 | |||
| 54 | =cut | ||
diff --git a/src/lib/libcrypto/doc/ERR_print_errors.pod b/src/lib/libcrypto/doc/ERR_print_errors.pod deleted file mode 100644 index b100a5fa2b..0000000000 --- a/src/lib/libcrypto/doc/ERR_print_errors.pod +++ /dev/null | |||
| @@ -1,51 +0,0 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | ERR_print_errors, ERR_print_errors_fp - print error messages | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/err.h> | ||
| 10 | |||
| 11 | void ERR_print_errors(BIO *bp); | ||
| 12 | void ERR_print_errors_fp(FILE *fp); | ||
| 13 | |||
| 14 | =head1 DESCRIPTION | ||
| 15 | |||
| 16 | ERR_print_errors() is a convenience function that prints the error | ||
| 17 | strings for all errors that OpenSSL has recorded to B<bp>, thus | ||
| 18 | emptying the error queue. | ||
| 19 | |||
| 20 | ERR_print_errors_fp() is the same, except that the output goes to a | ||
| 21 | B<FILE>. | ||
| 22 | |||
| 23 | |||
| 24 | The error strings will have the following format: | ||
| 25 | |||
| 26 | [pid]:error:[error code]:[library name]:[function name]:[reason string]:[file name]:[line]:[optional text message] | ||
| 27 | |||
| 28 | I<error code> is an 8 digit hexadecimal number. I<library name>, | ||
| 29 | I<function name> and I<reason string> are ASCII text, as is I<optional | ||
| 30 | text message> if one was set for the respective error code. | ||
| 31 | |||
| 32 | If there is no text string registered for the given error code, | ||
| 33 | the error string will contain the numeric code. | ||
| 34 | |||
| 35 | =head1 RETURN VALUES | ||
| 36 | |||
| 37 | ERR_print_errors() and ERR_print_errors_fp() return no values. | ||
| 38 | |||
| 39 | =head1 SEE ALSO | ||
| 40 | |||
| 41 | L<err(3)|err(3)>, L<ERR_error_string(3)|ERR_error_string(3)>, | ||
| 42 | L<ERR_get_error(3)|ERR_get_error(3)>, | ||
| 43 | L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>, | ||
| 44 | L<SSL_load_error_strings(3)|SSL_load_error_strings(3)> | ||
| 45 | |||
| 46 | =head1 HISTORY | ||
| 47 | |||
| 48 | ERR_print_errors() and ERR_print_errors_fp() | ||
| 49 | are available in all versions of SSLeay and OpenSSL. | ||
| 50 | |||
| 51 | =cut | ||
diff --git a/src/lib/libcrypto/doc/ERR_put_error.pod b/src/lib/libcrypto/doc/ERR_put_error.pod deleted file mode 100644 index acd241fbe4..0000000000 --- a/src/lib/libcrypto/doc/ERR_put_error.pod +++ /dev/null | |||
| @@ -1,44 +0,0 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | ERR_put_error, ERR_add_error_data - record an error | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/err.h> | ||
| 10 | |||
| 11 | void ERR_put_error(int lib, int func, int reason, const char *file, | ||
| 12 | int line); | ||
| 13 | |||
| 14 | void ERR_add_error_data(int num, ...); | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | ERR_put_error() adds an error code to the thread's error queue. It | ||
| 19 | signals that the error of reason code B<reason> occurred in function | ||
| 20 | B<func> of library B<lib>, in line number B<line> of B<file>. | ||
| 21 | This function is usually called by a macro. | ||
| 22 | |||
| 23 | ERR_add_error_data() associates the concatenation of its B<num> string | ||
| 24 | arguments with the error code added last. | ||
| 25 | |||
| 26 | L<ERR_load_strings(3)|ERR_load_strings(3)> can be used to register | ||
| 27 | error strings so that the application can a generate human-readable | ||
| 28 | error messages for the error code. | ||
| 29 | |||
| 30 | =head1 RETURN VALUES | ||
| 31 | |||
| 32 | ERR_put_error() and ERR_add_error_data() return | ||
| 33 | no values. | ||
| 34 | |||
| 35 | =head1 SEE ALSO | ||
| 36 | |||
| 37 | L<err(3)|err(3)>, L<ERR_load_strings(3)|ERR_load_strings(3)> | ||
| 38 | |||
| 39 | =head1 HISTORY | ||
| 40 | |||
| 41 | ERR_put_error() is available in all versions of SSLeay and OpenSSL. | ||
| 42 | ERR_add_error_data() was added in SSLeay 0.9.0. | ||
| 43 | |||
| 44 | =cut | ||
diff --git a/src/lib/libcrypto/doc/ERR_remove_state.pod b/src/lib/libcrypto/doc/ERR_remove_state.pod deleted file mode 100644 index a4d38c17fd..0000000000 --- a/src/lib/libcrypto/doc/ERR_remove_state.pod +++ /dev/null | |||
| @@ -1,45 +0,0 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | ERR_remove_thread_state, ERR_remove_state - free a thread's error queue | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/err.h> | ||
| 10 | |||
| 11 | void ERR_remove_thread_state(const CRYPTO_THREADID *tid); | ||
| 12 | |||
| 13 | Deprecated: | ||
| 14 | |||
| 15 | void ERR_remove_state(unsigned long pid); | ||
| 16 | |||
| 17 | =head1 DESCRIPTION | ||
| 18 | |||
| 19 | ERR_remove_thread_state() frees the error queue associated with thread B<tid>. | ||
| 20 | If B<tid> == B<NULL>, the current thread will have its error queue removed. | ||
| 21 | |||
| 22 | Since error queue data structures are allocated automatically for new | ||
| 23 | threads, they must be freed when threads are terminated in order to | ||
| 24 | avoid memory leaks. | ||
| 25 | |||
| 26 | ERR_remove_state is deprecated and has been replaced by | ||
| 27 | ERR_remove_thread_state. Since threads in OpenSSL are no longer identified | ||
| 28 | by unsigned long values any argument to this function is ignored. Calling | ||
| 29 | ERR_remove_state is equivalent to B<ERR_remove_thread_state(NULL)>. | ||
| 30 | |||
| 31 | =head1 RETURN VALUE | ||
| 32 | |||
| 33 | ERR_remove_thread_state and ERR_remove_state() return no value. | ||
| 34 | |||
| 35 | =head1 SEE ALSO | ||
| 36 | |||
| 37 | L<err(3)|err(3)> | ||
| 38 | |||
| 39 | =head1 HISTORY | ||
| 40 | |||
| 41 | ERR_remove_state() is available in all versions of SSLeay and OpenSSL. It | ||
| 42 | was deprecated in OpenSSL 1.0.0 when ERR_remove_thread_state was introduced | ||
| 43 | and thread IDs were introduced to identify threads instead of 'unsigned long'. | ||
| 44 | |||
| 45 | =cut | ||
diff --git a/src/lib/libcrypto/doc/ERR_set_mark.pod b/src/lib/libcrypto/doc/ERR_set_mark.pod deleted file mode 100644 index d3ca4f2e77..0000000000 --- a/src/lib/libcrypto/doc/ERR_set_mark.pod +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | ERR_set_mark, ERR_pop_to_mark - set marks and pop errors until mark | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/err.h> | ||
| 10 | |||
| 11 | int ERR_set_mark(void); | ||
| 12 | |||
| 13 | int ERR_pop_to_mark(void); | ||
| 14 | |||
| 15 | =head1 DESCRIPTION | ||
| 16 | |||
| 17 | ERR_set_mark() sets a mark on the current topmost error record if there | ||
| 18 | is one. | ||
| 19 | |||
| 20 | ERR_pop_to_mark() will pop the top of the error stack until a mark is found. | ||
| 21 | The mark is then removed. If there is no mark, the whole stack is removed. | ||
| 22 | |||
| 23 | =head1 RETURN VALUES | ||
| 24 | |||
| 25 | ERR_set_mark() returns 0 if the error stack is empty, otherwise 1. | ||
| 26 | |||
| 27 | ERR_pop_to_mark() returns 0 if there was no mark in the error stack, which | ||
| 28 | implies that the stack became empty, otherwise 1. | ||
| 29 | |||
| 30 | =head1 SEE ALSO | ||
| 31 | |||
| 32 | L<err(3)|err(3)> | ||
| 33 | |||
| 34 | =head1 HISTORY | ||
| 35 | |||
| 36 | ERR_set_mark() and ERR_pop_to_mark() were added in OpenSSL 0.9.8. | ||
| 37 | |||
| 38 | =cut | ||
diff --git a/src/lib/libcrypto/man/ERR.3 b/src/lib/libcrypto/man/ERR.3 new file mode 100644 index 0000000000..2c9a4479f7 --- /dev/null +++ b/src/lib/libcrypto/man/ERR.3 | |||
| @@ -0,0 +1,297 @@ | |||
| 1 | .Dd $Mdocdate: November 2 2016 $ | ||
| 2 | .Dt ERR 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm ERR | ||
| 6 | .Nd OpenSSL error codes | ||
| 7 | .Sh SYNOPSIS | ||
| 8 | .In openssl/err.h | ||
| 9 | .Ft unsigned long | ||
| 10 | .Fn ERR_get_error void | ||
| 11 | .Ft unsigned long | ||
| 12 | .Fn ERR_peek_error void | ||
| 13 | .Ft unsigned long | ||
| 14 | .Fo ERR_get_error_line | ||
| 15 | .Fa "const char **file" | ||
| 16 | .Fa "int *line" | ||
| 17 | .Fc | ||
| 18 | .Ft unsigned long | ||
| 19 | .Fo ERR_peek_error_line | ||
| 20 | .Fa "const char **file" | ||
| 21 | .Fa "int *line" | ||
| 22 | .Fc | ||
| 23 | .Ft unsigned long | ||
| 24 | .Fo ERR_get_error_line_data | ||
| 25 | .Fa "const char **file" | ||
| 26 | .Fa "int *line" | ||
| 27 | .Fa "const char **data" | ||
| 28 | .Fa "int *flags" | ||
| 29 | .Fc | ||
| 30 | .Ft unsigned long | ||
| 31 | .Fo ERR_peek_error_line_data | ||
| 32 | .Fa "const char **file" | ||
| 33 | .Fa "int *line" | ||
| 34 | .Fa "const char **data" | ||
| 35 | .Fa "int *flags" | ||
| 36 | .Fc | ||
| 37 | .Ft int | ||
| 38 | .Fo ERR_GET_LIB | ||
| 39 | .Fa "unsigned long e" | ||
| 40 | .Fc | ||
| 41 | .Ft int | ||
| 42 | .Fo ERR_GET_FUNC | ||
| 43 | .Fa "unsigned long e" | ||
| 44 | .Fc | ||
| 45 | .Ft int | ||
| 46 | .Fo ERR_GET_REASON | ||
| 47 | .Fa "unsigned long e" | ||
| 48 | .Fc | ||
| 49 | .Ft void | ||
| 50 | .Fn ERR_clear_error void | ||
| 51 | .Ft char * | ||
| 52 | .Fo ERR_error_string | ||
| 53 | .Fa "unsigned long e" | ||
| 54 | .Fa "char *buf" | ||
| 55 | .Fc | ||
| 56 | .Ft const char * | ||
| 57 | .Fo ERR_lib_error_string | ||
| 58 | .Fa "unsigned long e" | ||
| 59 | .Fc | ||
| 60 | .Ft const char * | ||
| 61 | .Fo ERR_func_error_string | ||
| 62 | .Fa "unsigned long e" | ||
| 63 | .Fc | ||
| 64 | .Ft const char * | ||
| 65 | .Fo ERR_reason_error_string | ||
| 66 | .Fa "unsigned long e" | ||
| 67 | .Fc | ||
| 68 | .Ft void | ||
| 69 | .Fo ERR_print_errors | ||
| 70 | .Fa "BIO *bp" | ||
| 71 | .Fc | ||
| 72 | .Ft void | ||
| 73 | .Fo ERR_print_errors_fp | ||
| 74 | .Fa "FILE *fp" | ||
| 75 | .Fc | ||
| 76 | .Ft void | ||
| 77 | .Fn ERR_load_crypto_strings void | ||
| 78 | .Ft void | ||
| 79 | .Fn ERR_free_strings void | ||
| 80 | .Ft void | ||
| 81 | .Fo ERR_remove_state | ||
| 82 | .Fa "unsigned long pid" | ||
| 83 | .Fc | ||
| 84 | .Ft void | ||
| 85 | .Fo ERR_put_error | ||
| 86 | .Fa "int lib" | ||
| 87 | .Fa "int func" | ||
| 88 | .Fa "int reason" | ||
| 89 | .Fa "const char *file" | ||
| 90 | .Fa "int line" | ||
| 91 | .Fc | ||
| 92 | .Ft void | ||
| 93 | .Fo ERR_add_error_data | ||
| 94 | .Fa "int num" | ||
| 95 | .Fa ... | ||
| 96 | .Fc | ||
| 97 | .Ft void | ||
| 98 | .Fo ERR_load_strings | ||
| 99 | .Fa "int lib" | ||
| 100 | .Fa "ERR_STRING_DATA str[]" | ||
| 101 | .Fc | ||
| 102 | .Ft unsigned long | ||
| 103 | .Fo ERR_PACK | ||
| 104 | .Fa "int lib" | ||
| 105 | .Fa "int func" | ||
| 106 | .Fa "int reason" | ||
| 107 | .Fc | ||
| 108 | .Ft int | ||
| 109 | .Fn ERR_get_next_error_library void | ||
| 110 | .Sh DESCRIPTION | ||
| 111 | When a call to the OpenSSL library fails, this is usually signalled by | ||
| 112 | the return value, and an error code is stored in an error queue | ||
| 113 | associated with the current thread. | ||
| 114 | The | ||
| 115 | .Nm | ||
| 116 | library provides functions to obtain these error codes and textual error | ||
| 117 | messages. | ||
| 118 | The | ||
| 119 | .Xr ERR_get_error 3 | ||
| 120 | manpage describes how to access error codes. | ||
| 121 | .Pp | ||
| 122 | Error codes contain information about where the error occurred, and what | ||
| 123 | went wrong. | ||
| 124 | .Xr ERR_GET_LIB 3 | ||
| 125 | describes how to extract this information. | ||
| 126 | A method to obtain human-readable error messages is described in | ||
| 127 | .Xr ERR_error_string 3 . | ||
| 128 | .Pp | ||
| 129 | .Xr ERR_clear_error 3 | ||
| 130 | can be used to clear the error queue. | ||
| 131 | .Pp | ||
| 132 | Note that | ||
| 133 | .Xr ERR_remove_state 3 | ||
| 134 | should be used to avoid memory leaks when threads are terminated. | ||
| 135 | .Sh ADDING NEW ERROR CODES TO OPENSSL | ||
| 136 | See | ||
| 137 | .Xr ERR_put_error 3 | ||
| 138 | if you want to record error codes in the OpenSSL error system from | ||
| 139 | within your application. | ||
| 140 | .Pp | ||
| 141 | The remainder of this section is of interest only if you want to add new | ||
| 142 | error codes to OpenSSL or add error codes from external libraries. | ||
| 143 | .Ss Reporting errors | ||
| 144 | Each sub-library has a specific macro | ||
| 145 | .Fn XXXerr f r | ||
| 146 | that is used to report errors. | ||
| 147 | Its first argument is a function code | ||
| 148 | .Dv XXX_F_* , | ||
| 149 | the second argument is a reason code | ||
| 150 | .Dv XXX_R_* . | ||
| 151 | Function codes are derived from the function names; reason codes consist | ||
| 152 | of textual error descriptions. | ||
| 153 | For example, the function | ||
| 154 | .Fn ssl23_read | ||
| 155 | reports a "handshake failure" as follows: | ||
| 156 | .Pp | ||
| 157 | .Dl SSLerr(SSL_F_SSL23_READ, SSL_R_SSL_HANDSHAKE_FAILURE); | ||
| 158 | .Pp | ||
| 159 | Function and reason codes should consist of upper case characters, | ||
| 160 | numbers and underscores only. | ||
| 161 | The error file generation script translates function codes into function | ||
| 162 | names by looking in the header files for an appropriate function name, | ||
| 163 | if none is found it just uses the capitalized form such as "SSL23_READ" | ||
| 164 | in the above example. | ||
| 165 | .Pp | ||
| 166 | The trailing section of a reason code (after the "_R_") is translated | ||
| 167 | into lower case and underscores changed to spaces. | ||
| 168 | .Pp | ||
| 169 | When you are using new function or reason codes, run | ||
| 170 | .Sy make errors . | ||
| 171 | The necessary | ||
| 172 | .Sy #define Ns s | ||
| 173 | will then automatically be added to the sub-library's header file. | ||
| 174 | .Pp | ||
| 175 | Although a library will normally report errors using its own specific | ||
| 176 | .Fn XXXerr | ||
| 177 | macro, another library's macro can be used. | ||
| 178 | This is normally only done when a library wants to include ASN1 code | ||
| 179 | which must use the | ||
| 180 | .Fn ASN1err | ||
| 181 | macro. | ||
| 182 | .Ss Adding new libraries | ||
| 183 | When adding a new sub-library to OpenSSL, assign it a library number | ||
| 184 | .Dv ERR_LIB_XXX , | ||
| 185 | define a macro | ||
| 186 | .Fn XXXerr | ||
| 187 | (both in | ||
| 188 | .In openssl/err.h ) , | ||
| 189 | add its name to | ||
| 190 | .Va ERR_str_libraries[] | ||
| 191 | (in | ||
| 192 | .Pa /usr/src/lib/libcrypto/err/err.c ) , | ||
| 193 | and add | ||
| 194 | .Fn ERR_load_XXX_strings | ||
| 195 | to the | ||
| 196 | .Fn ERR_load_crypto_strings | ||
| 197 | function (in | ||
| 198 | .Sy /usr/src/lib/libcrypto/err/err_all.c ) . | ||
| 199 | Finally, add an entry | ||
| 200 | .Pp | ||
| 201 | .Dl L XXX xxx.h xxx_err.c | ||
| 202 | .Pp | ||
| 203 | to | ||
| 204 | .Sy /usr/src/lib/libcrypto/err/openssl.ec , | ||
| 205 | and add | ||
| 206 | .Pa xxx_err.c | ||
| 207 | to the | ||
| 208 | .Pa Makefile . | ||
| 209 | Running | ||
| 210 | .Sy make errors | ||
| 211 | will then generate a file | ||
| 212 | .Pa xxx_err.c , | ||
| 213 | and add all error codes used in the library to | ||
| 214 | .Pa xxx.h . | ||
| 215 | .Pp | ||
| 216 | Additionally the library include file must have a certain form. | ||
| 217 | Typically it will initially look like this: | ||
| 218 | .Bd -literal -offset indent | ||
| 219 | #ifndef HEADER_XXX_H | ||
| 220 | #define HEADER_XXX_H | ||
| 221 | |||
| 222 | #ifdef __cplusplus | ||
| 223 | extern "C" { | ||
| 224 | #endif | ||
| 225 | |||
| 226 | /* Include files */ | ||
| 227 | |||
| 228 | #include <openssl/bio.h> | ||
| 229 | #include <openssl/x509.h> | ||
| 230 | |||
| 231 | /* Macros, structures and function prototypes */ | ||
| 232 | |||
| 233 | /* BEGIN ERROR CODES */ | ||
| 234 | .Ed | ||
| 235 | .Pp | ||
| 236 | The | ||
| 237 | .Sy BEGIN ERROR CODES | ||
| 238 | sequence is used by the error code generation script as the point to | ||
| 239 | place new error codes, any text after this point will be overwritten | ||
| 240 | when | ||
| 241 | .Sy make errors | ||
| 242 | is run. | ||
| 243 | The closing #endif etc. will be automatically added by the script. | ||
| 244 | .Pp | ||
| 245 | The generated C error code file | ||
| 246 | .Pa xxx_err.c | ||
| 247 | will load the header files | ||
| 248 | .In stdio.h , | ||
| 249 | .In openssl/err.h | ||
| 250 | and | ||
| 251 | .In openssl/xxx.h | ||
| 252 | so the header file must load any additional header files containing any | ||
| 253 | definitions it uses. | ||
| 254 | .Sh USING ERROR CODES IN EXTERNAL LIBRARIES | ||
| 255 | It is also possible to use OpenSSL's error code scheme in external | ||
| 256 | libraries. | ||
| 257 | The library needs to load its own codes and call the OpenSSL error code | ||
| 258 | insertion script | ||
| 259 | .Pa mkerr.pl | ||
| 260 | explicitly to add codes to the header file and generate the C error code | ||
| 261 | file. | ||
| 262 | This will normally be done if the external library needs to generate new | ||
| 263 | ASN1 structures but it can also be used to add more general purpose | ||
| 264 | error code handling. | ||
| 265 | .Sh INTERNALS | ||
| 266 | The error queues are stored in a hash table with one | ||
| 267 | .Vt ERR_STATE | ||
| 268 | entry for each pid. | ||
| 269 | .Fn ERR_get_state | ||
| 270 | returns the current thread's | ||
| 271 | .Vt ERR_STATE . | ||
| 272 | An | ||
| 273 | .Vt ERR_STATE | ||
| 274 | can hold up to | ||
| 275 | .Dv ERR_NUM_ERRORS | ||
| 276 | error codes. | ||
| 277 | When more error codes are added, the old ones are overwritten, on the | ||
| 278 | assumption that the most recent errors are most important. | ||
| 279 | .Pp | ||
| 280 | Error strings are also stored in hash table. | ||
| 281 | The hash tables can be obtained by calling | ||
| 282 | .Fn ERR_get_err_state_table | ||
| 283 | and | ||
| 284 | .Fn ERR_get_string_table . | ||
| 285 | .Sh SEE ALSO | ||
| 286 | .Xr CRYPTO_set_id_callback 3 , | ||
| 287 | .Xr CRYPTO_set_locking_callback 3 , | ||
| 288 | .Xr ERR_clear_error 3 , | ||
| 289 | .Xr ERR_error_string 3 , | ||
| 290 | .Xr ERR_get_error 3 , | ||
| 291 | .Xr ERR_GET_LIB 3 , | ||
| 292 | .Xr ERR_load_crypto_strings 3 , | ||
| 293 | .Xr ERR_load_strings 3 , | ||
| 294 | .Xr ERR_print_errors 3 , | ||
| 295 | .Xr ERR_put_error 3 , | ||
| 296 | .Xr ERR_remove_state 3 , | ||
| 297 | .Xr SSL_get_error 3 | ||
diff --git a/src/lib/libcrypto/man/ERR_GET_LIB.3 b/src/lib/libcrypto/man/ERR_GET_LIB.3 new file mode 100644 index 0000000000..9b50ce39e6 --- /dev/null +++ b/src/lib/libcrypto/man/ERR_GET_LIB.3 | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | .Dd $Mdocdate: November 2 2016 $ | ||
| 2 | .Dt ERR_GET_LIB 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm ERR_GET_LIB , | ||
| 6 | .Nm ERR_GET_FUNC , | ||
| 7 | .Nm ERR_GET_REASON | ||
| 8 | .Nd get library, function and reason codes for OpenSSL errors | ||
| 9 | .Sh SYNOPSIS | ||
| 10 | .In openssl/err.h | ||
| 11 | .Ft int | ||
| 12 | .Fo ERR_GET_LIB | ||
| 13 | .Fa "unsigned long e" | ||
| 14 | .Fc | ||
| 15 | .Ft int | ||
| 16 | .Fo ERR_GET_FUNC | ||
| 17 | .Fa "unsigned long e" | ||
| 18 | .Fc | ||
| 19 | .Ft int | ||
| 20 | .Fo ERR_GET_REASON | ||
| 21 | .Fa "unsigned long e" | ||
| 22 | .Fc | ||
| 23 | .Sh DESCRIPTION | ||
| 24 | The error code returned by | ||
| 25 | .Xr ERR_get_error 3 | ||
| 26 | consists of a library number, function code, and reason code. | ||
| 27 | .Fn ERR_GET_LIB , | ||
| 28 | .Fn ERR_GET_FUNC , | ||
| 29 | and | ||
| 30 | .Fn ERR_GET_REASON | ||
| 31 | can be used to extract these. | ||
| 32 | .Pp | ||
| 33 | The library number and function code describe where the error occurred, | ||
| 34 | the reason code is the information about what went wrong. | ||
| 35 | .Pp | ||
| 36 | Each sub-library of OpenSSL has a unique library number; function and | ||
| 37 | reason codes are unique within each sub-library. | ||
| 38 | Note that different libraries may use the same value to signal different | ||
| 39 | functions and reasons. | ||
| 40 | .Pp | ||
| 41 | .Dv ERR_R_* | ||
| 42 | reason codes such as | ||
| 43 | .Dv ERR_R_MALLOC_FAILURE | ||
| 44 | are globally unique. | ||
| 45 | However, when checking for sub-library specific reason codes, be sure to | ||
| 46 | also compare the library number. | ||
| 47 | .Pp | ||
| 48 | .Fn ERR_GET_LIB , | ||
| 49 | .Fn ERR_GET_FUNC , | ||
| 50 | and | ||
| 51 | .Fn ERR_GET_REASON | ||
| 52 | are macros. | ||
| 53 | .Sh RETURN VALUES | ||
| 54 | The library number, function code, and reason code, respectively. | ||
| 55 | .Sh SEE ALSO | ||
| 56 | .Xr ERR 3 , | ||
| 57 | .Xr ERR_get_error 3 | ||
| 58 | .Sh HISTORY | ||
| 59 | .Fn ERR_GET_LIB , | ||
| 60 | .Fn ERR_GET_FUNC , | ||
| 61 | and | ||
| 62 | .Fn ERR_GET_REASON | ||
| 63 | are available in all versions of SSLeay and OpenSSL. | ||
diff --git a/src/lib/libcrypto/man/ERR_clear_error.3 b/src/lib/libcrypto/man/ERR_clear_error.3 new file mode 100644 index 0000000000..f5beb14b10 --- /dev/null +++ b/src/lib/libcrypto/man/ERR_clear_error.3 | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | .Dd $Mdocdate: November 2 2016 $ | ||
| 2 | .Dt ERR_CLEAR_ERROR 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm ERR_clear_error | ||
| 6 | .Nd clear the OpenSSL error queue | ||
| 7 | .Sh SYNOPSIS | ||
| 8 | .In openssl/err.h | ||
| 9 | .Ft void | ||
| 10 | .Fn ERR_clear_error void | ||
| 11 | .Sh DESCRIPTION | ||
| 12 | .Fn ERR_clear_error | ||
| 13 | empties the current thread's error queue. | ||
| 14 | .Sh RETURN VALUES | ||
| 15 | .Fn ERR_clear_error | ||
| 16 | has no return value. | ||
| 17 | .Sh SEE ALSO | ||
| 18 | .Xr ERR 3 , | ||
| 19 | .Xr ERR_get_error 3 | ||
| 20 | .Sh HISTORY | ||
| 21 | .Fn ERR_clear_error | ||
| 22 | is available in all versions of SSLeay and OpenSSL. | ||
diff --git a/src/lib/libcrypto/man/ERR_error_string.3 b/src/lib/libcrypto/man/ERR_error_string.3 new file mode 100644 index 0000000000..75878d233e --- /dev/null +++ b/src/lib/libcrypto/man/ERR_error_string.3 | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | .Dd $Mdocdate: November 2 2016 $ | ||
| 2 | .Dt ERR_ERROR_STRING 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm ERR_error_string , | ||
| 6 | .Nm ERR_error_string_n , | ||
| 7 | .Nm ERR_lib_error_string , | ||
| 8 | .Nm ERR_func_error_string , | ||
| 9 | .Nm ERR_reason_error_string | ||
| 10 | .Nd obtain human-readable OpenSSL error messages | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/err.h | ||
| 13 | .Ft char * | ||
| 14 | .Fo ERR_error_string | ||
| 15 | .Fa "unsigned long e" | ||
| 16 | .Fa "char *buf" | ||
| 17 | .Fc | ||
| 18 | .Ft void | ||
| 19 | .Fo ERR_error_string_n | ||
| 20 | .Fa "unsigned long e" | ||
| 21 | .Fa "char *buf" | ||
| 22 | .Fa "size_t len" | ||
| 23 | .Fc | ||
| 24 | .Ft const char * | ||
| 25 | .Fo ERR_lib_error_string | ||
| 26 | .Fa "unsigned long e" | ||
| 27 | .Fc | ||
| 28 | .Ft const char * | ||
| 29 | .Fo ERR_func_error_string | ||
| 30 | .Fa "unsigned long e" | ||
| 31 | .Fc | ||
| 32 | .Ft const char * | ||
| 33 | .Fo ERR_reason_error_string | ||
| 34 | .Fa "unsigned long e" | ||
| 35 | .Fc | ||
| 36 | .Sh DESCRIPTION | ||
| 37 | .Fn ERR_error_string | ||
| 38 | generates a human-readable string representing the error code | ||
| 39 | .Fa e | ||
| 40 | and places it in | ||
| 41 | .Fa buf . | ||
| 42 | .Fa buf | ||
| 43 | must be at least 120 bytes long. | ||
| 44 | If | ||
| 45 | .Fa buf | ||
| 46 | is | ||
| 47 | .Dv NULL , | ||
| 48 | the error string is placed in a static buffer. | ||
| 49 | .Fn ERR_error_string_n | ||
| 50 | is a variant of | ||
| 51 | .Fn ERR_error_string | ||
| 52 | that writes at most | ||
| 53 | .Fa len | ||
| 54 | characters (including the terminating NUL) and truncates the string | ||
| 55 | if necessary. | ||
| 56 | For | ||
| 57 | .Fn ERR_error_string_n , | ||
| 58 | .Fa buf | ||
| 59 | may not be | ||
| 60 | .Dv NULL . | ||
| 61 | .Pp | ||
| 62 | The string will have the following format: | ||
| 63 | .Pp | ||
| 64 | .Dl error:[error code]:[library name]:[function name]:[reason string] | ||
| 65 | .Pp | ||
| 66 | The error code is an 8 digit hexadecimal number. | ||
| 67 | The library name, the function name, and the reason string are ASCII | ||
| 68 | text. | ||
| 69 | .Pp | ||
| 70 | .Fn ERR_lib_error_string , | ||
| 71 | .Fn ERR_func_error_string , | ||
| 72 | and | ||
| 73 | .Fn ERR_reason_error_string | ||
| 74 | return the library name, the function name, and the reason string, | ||
| 75 | respectively. | ||
| 76 | .Pp | ||
| 77 | The OpenSSL error strings should be loaded by calling | ||
| 78 | .Xr ERR_load_crypto_strings 3 | ||
| 79 | or, for SSL applications, | ||
| 80 | .Xr SSL_load_error_strings 3 | ||
| 81 | first. | ||
| 82 | If there is no text string registered for the given error code, the | ||
| 83 | error string will contain the numeric code. | ||
| 84 | .Pp | ||
| 85 | .Xr ERR_print_errors 3 | ||
| 86 | can be used to print all error codes currently in the queue. | ||
| 87 | .Sh RETURN VALUES | ||
| 88 | .Fn ERR_error_string | ||
| 89 | returns a pointer to a static buffer containing the string if | ||
| 90 | .Fa buf | ||
| 91 | is | ||
| 92 | .Dv NULL , | ||
| 93 | or | ||
| 94 | .Fa buf | ||
| 95 | otherwise. | ||
| 96 | .Pp | ||
| 97 | .Fn ERR_lib_error_string , | ||
| 98 | .Fn ERR_func_error_string , | ||
| 99 | and | ||
| 100 | .Fn ERR_reason_error_string | ||
| 101 | return the strings, or | ||
| 102 | .Dv NULL | ||
| 103 | if none is registered for the error code. | ||
| 104 | .Sh SEE ALSO | ||
| 105 | .Xr ERR 3 , | ||
| 106 | .Xr ERR_get_error 3 , | ||
| 107 | .Xr ERR_load_crypto_strings 3 , | ||
| 108 | .Xr ERR_print_errors 3 , | ||
| 109 | .Xr SSL_load_error_strings 3 | ||
| 110 | .Sh HISTORY | ||
| 111 | .Fn ERR_error_string | ||
| 112 | is available in all versions of SSLeay and OpenSSL. | ||
| 113 | .Fn ERR_error_string_n | ||
| 114 | was added in OpenSSL 0.9.6. | ||
diff --git a/src/lib/libcrypto/man/ERR_get_error.3 b/src/lib/libcrypto/man/ERR_get_error.3 new file mode 100644 index 0000000000..8b11f792c1 --- /dev/null +++ b/src/lib/libcrypto/man/ERR_get_error.3 | |||
| @@ -0,0 +1,135 @@ | |||
| 1 | .Dd $Mdocdate: November 2 2016 $ | ||
| 2 | .Dt ERR_GET_ERROR 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm ERR_get_error , | ||
| 6 | .Nm ERR_peek_error , | ||
| 7 | .Nm ERR_peek_last_error , | ||
| 8 | .Nm ERR_get_error_line , | ||
| 9 | .Nm ERR_peek_error_line , | ||
| 10 | .Nm ERR_peek_last_error_line , | ||
| 11 | .Nm ERR_get_error_line_data , | ||
| 12 | .Nm ERR_peek_error_line_data , | ||
| 13 | .Nm ERR_peek_last_error_line_data | ||
| 14 | .Nd obtain OpenSSL error code and data | ||
| 15 | .Sh SYNOPSIS | ||
| 16 | .In openssl/err.h | ||
| 17 | .Ft unsigned long | ||
| 18 | .Fn ERR_get_error void | ||
| 19 | .Ft unsigned long | ||
| 20 | .Fn ERR_peek_error void | ||
| 21 | .Ft unsigned long | ||
| 22 | .Fn ERR_peek_last_error void | ||
| 23 | .Ft unsigned long | ||
| 24 | .Fo ERR_get_error_line | ||
| 25 | .Fa "const char **file" | ||
| 26 | .Fa "int *line" | ||
| 27 | .Fc | ||
| 28 | .Ft unsigned long | ||
| 29 | .Fo ERR_peek_error_line | ||
| 30 | .Fa "const char **file" | ||
| 31 | .Fa "int *line" | ||
| 32 | .Fc | ||
| 33 | .Ft unsigned long | ||
| 34 | .Fo ERR_peek_last_error_line | ||
| 35 | .Fa "const char **file" | ||
| 36 | .Fa "int *line" | ||
| 37 | .Fc | ||
| 38 | .Ft unsigned long | ||
| 39 | .Fo ERR_get_error_line_data | ||
| 40 | .Fa "const char **file" | ||
| 41 | .Fa "int *line" | ||
| 42 | .Fa "const char **data" | ||
| 43 | .Fa "int *flags" | ||
| 44 | .Fc | ||
| 45 | .Ft unsigned long | ||
| 46 | .Fo ERR_peek_error_line_data | ||
| 47 | .Fa "const char **file" | ||
| 48 | .Fa "int *line" | ||
| 49 | .Fa "const char **data" | ||
| 50 | .Fa "int *flags" | ||
| 51 | .Fc | ||
| 52 | .Ft unsigned long | ||
| 53 | .Fo ERR_peek_last_error_line_data | ||
| 54 | .Fa "const char **file" | ||
| 55 | .Fa "int *line" | ||
| 56 | .Fa "const char **data" | ||
| 57 | .Fa "int *flags" | ||
| 58 | .Fc | ||
| 59 | .Sh DESCRIPTION | ||
| 60 | .Fn ERR_get_error | ||
| 61 | returns the earliest error code from the thread's error queue and | ||
| 62 | removes the entry. | ||
| 63 | This function can be called repeatedly until there are no more error | ||
| 64 | codes to return. | ||
| 65 | .Pp | ||
| 66 | .Fn ERR_peek_error | ||
| 67 | returns the earliest error code from the thread's error queue without | ||
| 68 | modifying it. | ||
| 69 | .Pp | ||
| 70 | .Fn ERR_peek_last_error | ||
| 71 | returns the latest error code from the thread's error queue without | ||
| 72 | modifying it. | ||
| 73 | .Pp | ||
| 74 | See | ||
| 75 | .Xr ERR_GET_LIB 3 | ||
| 76 | for obtaining information about location and reason of the error, and | ||
| 77 | .Xr ERR_error_string 3 | ||
| 78 | for human-readable error messages. | ||
| 79 | .Pp | ||
| 80 | .Fn ERR_get_error_line , | ||
| 81 | .Fn ERR_peek_error_line , | ||
| 82 | and | ||
| 83 | .Fn ERR_peek_last_error_line | ||
| 84 | are the same as the above, but they additionally store the file name and | ||
| 85 | line number where the error occurred in | ||
| 86 | .Pf * Fa file | ||
| 87 | and | ||
| 88 | .Pf * Fa line , | ||
| 89 | unless these are | ||
| 90 | .Dv NULL . | ||
| 91 | .Pp | ||
| 92 | .Fn ERR_get_error_line_data , | ||
| 93 | .Fn ERR_peek_error_line_data , | ||
| 94 | and | ||
| 95 | .Fn ERR_peek_last_error_line_data | ||
| 96 | store additional data and flags associated with the error code in | ||
| 97 | .Pf * Fa data | ||
| 98 | and | ||
| 99 | .Pf * Fa flags , | ||
| 100 | unless these are | ||
| 101 | .Dv NULL . | ||
| 102 | .Pf * Fa data | ||
| 103 | contains a string if | ||
| 104 | .Pf * Fa flags Ns & Ns Dv ERR_TXT_STRING | ||
| 105 | is true. | ||
| 106 | .Pp | ||
| 107 | An application | ||
| 108 | .Sy MUST NOT | ||
| 109 | free the | ||
| 110 | .Pf * Fa data | ||
| 111 | pointer (or any other pointers returned by these functions) with | ||
| 112 | .Xr free 3 | ||
| 113 | as freeing is handled automatically by the error library. | ||
| 114 | .Sh RETURN VALUES | ||
| 115 | The error code, or 0 if there is no error in the queue. | ||
| 116 | .Sh SEE ALSO | ||
| 117 | .Xr ERR 3 , | ||
| 118 | .Xr ERR_error_string 3 , | ||
| 119 | .Xr ERR_GET_LIB 3 | ||
| 120 | .Sh HISTORY | ||
| 121 | .Fn ERR_get_error , | ||
| 122 | .Fn ERR_peek_error , | ||
| 123 | .Fn ERR_get_error_line , | ||
| 124 | and | ||
| 125 | .Fn ERR_peek_error_line | ||
| 126 | are available in all versions of SSLeay and OpenSSL. | ||
| 127 | .Fn ERR_get_error_line_data | ||
| 128 | and | ||
| 129 | .Fn ERR_peek_error_line_data | ||
| 130 | were added in SSLeay 0.9.0. | ||
| 131 | .Fn ERR_peek_last_error , | ||
| 132 | .Fn ERR_peek_last_error_line , | ||
| 133 | and | ||
| 134 | .Fn ERR_peek_last_error_line_data | ||
| 135 | were added in OpenSSL 0.9.7. | ||
diff --git a/src/lib/libcrypto/man/ERR_load_crypto_strings.3 b/src/lib/libcrypto/man/ERR_load_crypto_strings.3 new file mode 100644 index 0000000000..7d14b1e572 --- /dev/null +++ b/src/lib/libcrypto/man/ERR_load_crypto_strings.3 | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | .Dd $Mdocdate: November 2 2016 $ | ||
| 2 | .Dt ERR_LOAD_CRYPTO_STRINGS 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm ERR_load_crypto_strings , | ||
| 6 | .Nm SSL_load_error_strings , | ||
| 7 | .Nm ERR_free_strings | ||
| 8 | .Nd load and free OpenSSL error strings | ||
| 9 | .Sh SYNOPSIS | ||
| 10 | .In openssl/err.h | ||
| 11 | .Ft void | ||
| 12 | .Fn ERR_load_crypto_strings void | ||
| 13 | .Ft void | ||
| 14 | .Fn ERR_free_strings void | ||
| 15 | .In openssl/ssl.h | ||
| 16 | .Ft void | ||
| 17 | .Fn SSL_load_error_strings void | ||
| 18 | .Sh DESCRIPTION | ||
| 19 | .Fn ERR_load_crypto_strings | ||
| 20 | registers the error strings for all | ||
| 21 | .Xr crypto 3 | ||
| 22 | functions. | ||
| 23 | .Fn SSL_load_error_strings | ||
| 24 | does the same, but also registers the | ||
| 25 | .Xr ssl 3 | ||
| 26 | error strings. | ||
| 27 | .Pp | ||
| 28 | One of these functions should be called before generating textual error | ||
| 29 | messages. | ||
| 30 | However, this is not required when memory usage is an issue. | ||
| 31 | .Pp | ||
| 32 | .Fn ERR_free_strings | ||
| 33 | frees all previously loaded error strings. | ||
| 34 | .Sh RETURN VALUES | ||
| 35 | .Fn ERR_load_crypto_strings , | ||
| 36 | .Fn SSL_load_error_strings , | ||
| 37 | and | ||
| 38 | .Fn ERR_free_strings | ||
| 39 | return no values. | ||
| 40 | .Sh SEE ALSO | ||
| 41 | .Xr ERR 3 , | ||
| 42 | .Xr ERR_error_string 3 | ||
| 43 | .Sh HISTORY | ||
| 44 | .Xr ERR_load_error_strings 3 , | ||
| 45 | .Fn SSL_load_error_strings , | ||
| 46 | and | ||
| 47 | .Fn ERR_free_strings | ||
| 48 | are available in all versions of SSLeay and OpenSSL. | ||
diff --git a/src/lib/libcrypto/man/ERR_load_strings.3 b/src/lib/libcrypto/man/ERR_load_strings.3 new file mode 100644 index 0000000000..691a4067d3 --- /dev/null +++ b/src/lib/libcrypto/man/ERR_load_strings.3 | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | .Dd $Mdocdate: November 2 2016 $ | ||
| 2 | .Dt ERR_LOAD_STRINGS 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm ERR_load_strings , | ||
| 6 | .Nm ERR_PACK , | ||
| 7 | .Nm ERR_get_next_error_library | ||
| 8 | .Nd load arbitrary OpenSSL error strings | ||
| 9 | .Sh SYNOPSIS | ||
| 10 | .In openssl/err.h | ||
| 11 | .Ft void | ||
| 12 | .Fo ERR_load_strings | ||
| 13 | .Fa "int lib" | ||
| 14 | .Fa "ERR_STRING_DATA str[]" | ||
| 15 | .Fc | ||
| 16 | .Ft int | ||
| 17 | .Fn ERR_get_next_error_library void | ||
| 18 | .Ft unsigned long | ||
| 19 | .Fo ERR_PACK | ||
| 20 | .Fa "int lib" | ||
| 21 | .Fa "int func" | ||
| 22 | .Fa "int reason" | ||
| 23 | .Fc | ||
| 24 | .Sh DESCRIPTION | ||
| 25 | .Fn ERR_load_strings | ||
| 26 | registers error strings for library number | ||
| 27 | .Fa lib . | ||
| 28 | .Pp | ||
| 29 | .Fa str | ||
| 30 | is an array of error string data: | ||
| 31 | .Bd -literal -offset indent | ||
| 32 | typedef struct ERR_string_data_st | ||
| 33 | { | ||
| 34 | unsigned long error; | ||
| 35 | char *string; | ||
| 36 | } ERR_STRING_DATA; | ||
| 37 | .Ed | ||
| 38 | .Pp | ||
| 39 | The error code is generated from the library number and a function and | ||
| 40 | reason code: | ||
| 41 | .Pp | ||
| 42 | .Dl error = ERR_PACK(lib, func, reason) | ||
| 43 | .Pp | ||
| 44 | .Fn ERR_PACK | ||
| 45 | is a macro. | ||
| 46 | .Pp | ||
| 47 | The last entry in the array is | ||
| 48 | .Brq 0 , Dv NULL . | ||
| 49 | .Pp | ||
| 50 | .Fn ERR_get_next_error_library | ||
| 51 | can be used to assign library numbers to user libraries at runtime. | ||
| 52 | .Sh RETURN VALUE | ||
| 53 | .Fn ERR_PACK | ||
| 54 | returns the error code. | ||
| 55 | .Fn ERR_get_next_error_library | ||
| 56 | returns a new library number. | ||
| 57 | .Sh SEE ALSO | ||
| 58 | .Xr ERR 3 , | ||
| 59 | .Xr ERR_load_strings 3 | ||
| 60 | .Sh HISTORY | ||
| 61 | .Xr ERR_load_error_strings 3 | ||
| 62 | and | ||
| 63 | .Fn ERR_PACK | ||
| 64 | are available in all versions of SSLeay and OpenSSL. | ||
| 65 | .Fn ERR_get_next_error_library | ||
| 66 | was added in SSLeay 0.9.0. | ||
diff --git a/src/lib/libcrypto/man/ERR_print_errors.3 b/src/lib/libcrypto/man/ERR_print_errors.3 new file mode 100644 index 0000000000..1fc80d93f7 --- /dev/null +++ b/src/lib/libcrypto/man/ERR_print_errors.3 | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | .Dd $Mdocdate: November 2 2016 $ | ||
| 2 | .Dt ERR_PRINT_ERRORS 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm ERR_print_errors , | ||
| 6 | .Nm ERR_print_errors_fp | ||
| 7 | .Nd print OpenSSL error messages | ||
| 8 | .Sh SYNOPSIS | ||
| 9 | .In openssl/err.h | ||
| 10 | .Ft void | ||
| 11 | .Fo ERR_print_errors | ||
| 12 | .Fa "BIO *bp" | ||
| 13 | .Fc | ||
| 14 | .Ft void | ||
| 15 | .Fo ERR_print_errors_fp | ||
| 16 | .Fa "FILE *fp" | ||
| 17 | .Fc | ||
| 18 | .Sh DESCRIPTION | ||
| 19 | .Fn ERR_print_errors | ||
| 20 | is a convenience function that prints the error strings for all errors | ||
| 21 | that OpenSSL has recorded to | ||
| 22 | .Fa bp , | ||
| 23 | thus emptying the error queue. | ||
| 24 | .Pp | ||
| 25 | .Fn ERR_print_errors_fp | ||
| 26 | is the same, except that the output goes to a | ||
| 27 | .Vt FILE . | ||
| 28 | .Pp | ||
| 29 | The error strings have the following format: | ||
| 30 | .Bd -literal | ||
| 31 | [pid]:error:[error code]:[library name]:[function name]:[reason string]: | ||
| 32 | [file name]:[line]:[optional text message] | ||
| 33 | .Ed | ||
| 34 | .Pp | ||
| 35 | The error code is an 8 digit hexadecimal number. | ||
| 36 | The library name, the function name, and the reason string are ASCII | ||
| 37 | text, as is the optional text message if one was set for the | ||
| 38 | respective error code. | ||
| 39 | .Pp | ||
| 40 | If there is no text string registered for the given error code, the | ||
| 41 | error string will contain the numeric code. | ||
| 42 | .Sh RETURN VALUES | ||
| 43 | .Fn ERR_print_errors | ||
| 44 | and | ||
| 45 | .Fn ERR_print_errors_fp | ||
| 46 | return no values. | ||
| 47 | .Sh SEE ALSO | ||
| 48 | .Xr ERR 3 , | ||
| 49 | .Xr ERR_error_string 3 , | ||
| 50 | .Xr ERR_get_error 3 , | ||
| 51 | .Xr ERR_load_crypto_strings 3 , | ||
| 52 | .Xr SSL_load_error_strings 3 | ||
| 53 | .Sh HISTORY | ||
| 54 | .Fn ERR_print_errors | ||
| 55 | and | ||
| 56 | .Fn ERR_print_errors_fp | ||
| 57 | are available in all versions of SSLeay and OpenSSL. | ||
diff --git a/src/lib/libcrypto/man/ERR_put_error.3 b/src/lib/libcrypto/man/ERR_put_error.3 new file mode 100644 index 0000000000..703b74d713 --- /dev/null +++ b/src/lib/libcrypto/man/ERR_put_error.3 | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | .Dd $Mdocdate: November 2 2016 $ | ||
| 2 | .Dt ERR_PUT_ERROR 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm ERR_put_error , | ||
| 6 | .Nm ERR_add_error_data | ||
| 7 | .Nd record an OpenSSL error | ||
| 8 | .Sh SYNOPSIS | ||
| 9 | .In openssl/err.h | ||
| 10 | .Ft void | ||
| 11 | .Fo ERR_put_error | ||
| 12 | .Fa "int lib" | ||
| 13 | .Fa "int func" | ||
| 14 | .Fa "int reason" | ||
| 15 | .Fa "const char *file" | ||
| 16 | .Fa "int line" | ||
| 17 | .Fc | ||
| 18 | .Ft void | ||
| 19 | .Fo ERR_add_error_data | ||
| 20 | .Fa "int num" | ||
| 21 | .Fa ... | ||
| 22 | .Fc | ||
| 23 | .Sh DESCRIPTION | ||
| 24 | .Fn ERR_put_error | ||
| 25 | adds an error code to the thread's error queue. | ||
| 26 | It signals that the error of reason code | ||
| 27 | .Fa reason | ||
| 28 | occurred in function | ||
| 29 | .Fa func | ||
| 30 | of library | ||
| 31 | .Fa lib , | ||
| 32 | in line number | ||
| 33 | .Fa line | ||
| 34 | of | ||
| 35 | .Fa file . | ||
| 36 | This function is usually called by a macro. | ||
| 37 | .Pp | ||
| 38 | .Fn ERR_add_error_data | ||
| 39 | associates the concatenation of its | ||
| 40 | .Fa num | ||
| 41 | string arguments with the error code added last. | ||
| 42 | .Pp | ||
| 43 | .Xr ERR_load_strings 3 | ||
| 44 | can be used to register error strings so that the application can a | ||
| 45 | generate human-readable error messages for the error code. | ||
| 46 | .Sh RETURN VALUES | ||
| 47 | .Fn ERR_put_error | ||
| 48 | and | ||
| 49 | .Fn ERR_add_error_data | ||
| 50 | return no values. | ||
| 51 | .Sh SEE ALSO | ||
| 52 | .Xr ERR 3 , | ||
| 53 | .Xr ERR_load_strings 3 | ||
| 54 | .Sh HISTORY | ||
| 55 | .Fn ERR_put_error | ||
| 56 | is available in all versions of SSLeay and OpenSSL. | ||
| 57 | .Fn ERR_add_error_data | ||
| 58 | was added in SSLeay 0.9.0. | ||
diff --git a/src/lib/libcrypto/man/ERR_remove_state.3 b/src/lib/libcrypto/man/ERR_remove_state.3 new file mode 100644 index 0000000000..c15779edfc --- /dev/null +++ b/src/lib/libcrypto/man/ERR_remove_state.3 | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | .Dd $Mdocdate: November 2 2016 $ | ||
| 2 | .Dt ERR_REMOVE_STATE 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm ERR_remove_thread_state , | ||
| 6 | .Nm ERR_remove_state | ||
| 7 | .Nd free a thread's OpenSSL error queue | ||
| 8 | .Sh SYNOPSIS | ||
| 9 | .In openssl/err.h | ||
| 10 | .Ft void | ||
| 11 | .Fo ERR_remove_thread_state | ||
| 12 | .Fa "const CRYPTO_THREADID *tid" | ||
| 13 | .Fc | ||
| 14 | .Pp | ||
| 15 | Deprecated: | ||
| 16 | .Pp | ||
| 17 | .Ft void | ||
| 18 | .Fo ERR_remove_state | ||
| 19 | .Fa "unsigned long pid" | ||
| 20 | .Fc | ||
| 21 | .Sh DESCRIPTION | ||
| 22 | .Fn ERR_remove_thread_state | ||
| 23 | frees the error queue associated with thread | ||
| 24 | .Fa tid . | ||
| 25 | If | ||
| 26 | .Fa tid | ||
| 27 | is | ||
| 28 | .Dv NULL , | ||
| 29 | the current thread will have its error queue removed. | ||
| 30 | .Pp | ||
| 31 | Since error queue data structures are allocated automatically for new | ||
| 32 | threads, they must be freed when threads are terminated in order to | ||
| 33 | avoid memory leaks. | ||
| 34 | .Pp | ||
| 35 | .Fn ERR_remove_state | ||
| 36 | is deprecated and has been replaced by | ||
| 37 | .Fn ERR_remove_thread_state . | ||
| 38 | Since threads in OpenSSL are no longer identified by unsigned long | ||
| 39 | values, any argument to this function is ignored. | ||
| 40 | Calling | ||
| 41 | .Fn ERR_remove_state | ||
| 42 | is equivalent to | ||
| 43 | .Fn ERR_remove_thread_state NULL . | ||
| 44 | .Sh RETURN VALUE | ||
| 45 | .Fn ERR_remove_thread_state | ||
| 46 | and | ||
| 47 | .Fn ERR_remove_state | ||
| 48 | return no value. | ||
| 49 | .Sh SEE ALSO | ||
| 50 | .Xr ERR 3 | ||
| 51 | .Sh HISTORY | ||
| 52 | .Fn ERR_remove_state | ||
| 53 | is available in all versions of SSLeay and OpenSSL. | ||
| 54 | It was deprecated in OpenSSL 1.0.0 when | ||
| 55 | .Fn ERR_remove_thread_state | ||
| 56 | was introduced and thread IDs were introduced to identify threads | ||
| 57 | instead of | ||
| 58 | .Vt unsigned long . | ||
diff --git a/src/lib/libcrypto/man/ERR_set_mark.3 b/src/lib/libcrypto/man/ERR_set_mark.3 new file mode 100644 index 0000000000..e268271418 --- /dev/null +++ b/src/lib/libcrypto/man/ERR_set_mark.3 | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | .Dd $Mdocdate: November 2 2016 $ | ||
| 2 | .Dt ERR_SET_MARK 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm ERR_set_mark , | ||
| 6 | .Nm ERR_pop_to_mark | ||
| 7 | .Nd set marks and pop OpenSSL errors until mark | ||
| 8 | .Sh SYNOPSIS | ||
| 9 | .In openssl/err.h | ||
| 10 | .Ft int | ||
| 11 | .Fn ERR_set_mark void | ||
| 12 | .Ft int | ||
| 13 | .Fn ERR_pop_to_mark void | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn ERR_set_mark | ||
| 16 | sets a mark on the current topmost error record if there is one. | ||
| 17 | .Pp | ||
| 18 | .Fn ERR_pop_to_mark | ||
| 19 | will pop the top of the error stack until a mark is found. | ||
| 20 | The mark is then removed. | ||
| 21 | If there is no mark, the whole stack is removed. | ||
| 22 | .Sh RETURN VALUES | ||
| 23 | .Fn ERR_set_mark | ||
| 24 | returns 0 if the error stack is empty, otherwise 1. | ||
| 25 | .Pp | ||
| 26 | .Fn ERR_pop_to_mark | ||
| 27 | returns 0 if there was no mark in the error stack, which implies that | ||
| 28 | the stack became empty, otherwise 1. | ||
| 29 | .Sh SEE ALSO | ||
| 30 | .Xr ERR 3 | ||
| 31 | .Sh HISTORY | ||
| 32 | .Fn ERR_set_mark | ||
| 33 | and | ||
| 34 | .Fn ERR_pop_to_mark | ||
| 35 | were added in OpenSSL 0.9.8. | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index f676472ff6..5d19e023ab 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.36 2016/11/02 11:57:56 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.37 2016/11/02 15:23:41 schwarze Exp $ |
| 2 | 2 | ||
| 3 | .include <bsd.own.mk> # for NOMAN | 3 | .include <bsd.own.mk> # for NOMAN |
| 4 | 4 | ||
| @@ -80,15 +80,6 @@ MAN= \ | |||
| 80 | EC_POINT_add.3 \ | 80 | EC_POINT_add.3 \ |
| 81 | EC_POINT_new.3 \ | 81 | EC_POINT_new.3 \ |
| 82 | ECDSA_SIG_new.3 \ | 82 | ECDSA_SIG_new.3 \ |
| 83 | EVP_AEAD_CTX_init.3 \ | ||
| 84 | UI_new.3 \ | ||
| 85 | bn_dump.3 \ | ||
| 86 | crypto.3 \ | ||
| 87 | d2i_PKCS8PrivateKey_bio.3 \ | ||
| 88 | des_read_pw.3 \ | ||
| 89 | lh_new.3 \ | ||
| 90 | |||
| 91 | GENMAN= \ | ||
| 92 | ERR.3 \ | 83 | ERR.3 \ |
| 93 | ERR_GET_LIB.3 \ | 84 | ERR_GET_LIB.3 \ |
| 94 | ERR_clear_error.3 \ | 85 | ERR_clear_error.3 \ |
| @@ -100,6 +91,15 @@ GENMAN= \ | |||
| 100 | ERR_put_error.3 \ | 91 | ERR_put_error.3 \ |
| 101 | ERR_remove_state.3 \ | 92 | ERR_remove_state.3 \ |
| 102 | ERR_set_mark.3 \ | 93 | ERR_set_mark.3 \ |
| 94 | EVP_AEAD_CTX_init.3 \ | ||
| 95 | UI_new.3 \ | ||
| 96 | bn_dump.3 \ | ||
| 97 | crypto.3 \ | ||
| 98 | d2i_PKCS8PrivateKey_bio.3 \ | ||
| 99 | des_read_pw.3 \ | ||
| 100 | lh_new.3 \ | ||
| 101 | |||
| 102 | GENMAN= \ | ||
| 103 | EVP_BytesToKey.3 \ | 103 | EVP_BytesToKey.3 \ |
| 104 | EVP_DigestInit.3 \ | 104 | EVP_DigestInit.3 \ |
| 105 | EVP_DigestSignInit.3 \ | 105 | EVP_DigestSignInit.3 \ |
