err_get_error(3) - Linux man page

Name

ERR_get_error, ERR_peek_error, ERR_peek_last_error, ERR_get_error_line, ERR_peek_error_line, ERR_peek_last_error_line, ERR_get_error_line_data, ERR_peek_error_line_data, ERR_peek_last_error_line_data - obtain error code and data

Synopsis

#include <openssl/err.h>

unsigned long ERR_get_error(void);
unsigned long ERR_peek_error(void);
unsigned long ERR_peek_last_error(void);

unsigned long ERR_get_error_line(const char **file, int *line);
unsigned long ERR_peek_error_line(const char **file, int *line);
unsigned long ERR_peek_last_error_line(const char **file, int *line);

unsigned long ERR_get_error_line_data(const char **file, int *line,
        const char **data, int *flags);
unsigned long ERR_peek_error_line_data(const char **file, int *line,
        const char **data, int *flags);
unsigned long ERR_peek_last_error_line_data(const char **file, int *line,
        const char **data, int *flags);

Description

ERR_get_error() returns the earliest error code from the thread's error queue and removes the entry. This function can be called repeatedly until there are no more error codes to return.

ERR_peek_error() returns the earliest error code from the thread's error queue without modifying it.

ERR_peek_last_error() returns the latest error code from the thread's error queue without modifying it.

See ERR_GET_LIB (3) for obtaining information about location and reason of the error, and err_error_string(3) for human-readable error messages.

ERR_get_error_line(), ERR_peek_error_line() and ERR_peek_last_error_line() are the same as the above, but they additionally store the file name and line number where the error occurred in *file and *line, unless these are NULL .

ERR_get_error_line_data(), ERR_peek_error_line_data() and ERR_get_last_error_line_data() store additional data and flags associated with the error code in *data and *flags, unless these are NULL . *data contains a string if *flags& ERR_TXT_STRING . If it has been allocated by OPENSSL_malloc(), *flags& ERR_TXT_MALLOCED is true.

Return Values

The error code, or 0 if there is no error in the queue.

See Also

err(3), err_error_string(3), ERR_GET_LIB (3)

History

ERR_get_error(), ERR_peek_error(), ERR_get_error_line() and ERR_peek_error_line() are available in all versions of SSLeay and OpenSSL. ERR_get_error_line_data() and ERR_peek_error_line_data() were added in SSLeay 0.9.0. ERR_peek_last_error(), ERR_peek_last_error_line() and ERR_peek_last_error_line_data() were added in OpenSSL 0.9.7.

Referenced By

asn1_generate_v3(3), asn1_object_new(3), asn1_string_type(3), asn1_string_type_new(3), bn_add(3), bn_add_word(3), bn_bn2bin(3), bn_copy(3), bn_ctx_end(3), bn_ctx_new(3), bn_is_prime(3), bn_mod_inverse(3), bn_mod_mul_montgomery(3), bn_mod_mul_reciprocal(3), bn_new(3), bn_rand(3), bn_set_bit(3), crypto_set_ex_data(3), d2i_x509(3), dh_generate_key(3), dh_generate_parameters(3), dh_new(3), dh_set_method(3), dsa_do_sign(3), dsa_dup_dh(3), dsa_free(3), dsa_generate_key(3), dsa_generate_parameters(3), dsa_set_method(3), dsa_sig_new(3), dsa_sign(3), ecdsa(3), err_clear_error(3), err_get_reason(3), err_print_errors(3), evp_signinit(3), evp_verifyinit(3), obj_nid2obj(3), pkcs7_decrypt(3), pkcs7_encrypt(3), pkcs7_sign(3), pkcs7_verify(3), rand_bytes(3), rsa_check_key(3), rsa_generate_key(3), rsa_get_ex_new_index(3), rsa_new(3), rsa_new_method(3), rsa_padding_add_pkcs1_type_1(3), rsa_public_decrypt(3), rsa_public_encrypt(3), rsa_sign_asn1_octet_string(3), rsa_verify(3), smime_read_pkcs7(3), smime_write_pkcs7(3), x509_name_add_entry_by_nid(3), x509_name_entry_get_object(3), x509_name_get_text_by_obj(3), x509_new(3)