/********************************************************/
-void ERR_put_func_error(int lib, const char *func, int reason,
- const char *file, int line)
-{
- ERR_put_error(lib, 0, reason, file, line);
- ERR_add_error_data(2, "calling function ", func);
-}
-
-void ERR_put_error(int lib, int func, int reason, const char *file, int line)
-{
- ERR_STATE *es;
-
-#ifdef _OSD_POSIX
- /*
- * In the BS2000-OSD POSIX subsystem, the compiler generates path names
- * in the form "*POSIX(/etc/passwd)". This dirty hack strips them to
- * something sensible. @@@ We shouldn't modify a const string, though.
- */
- if (strncmp(file, "*POSIX(", sizeof("*POSIX(") - 1) == 0) {
- char *end;
-
- /* Skip the "*POSIX(" prefix */
- file += sizeof("*POSIX(") - 1;
- end = &file[strlen(file) - 1];
- if (*end == ')')
- *end = '\0';
- /* Optional: use the basename of the path only. */
- if ((end = strrchr(file, '/')) != NULL)
- file = &end[1];
- }
-#endif
- es = ERR_get_state();
- if (es == NULL)
- return;
-
- err_get_slot(es);
- err_clear(es, es->top, 0);
-}
-
void ERR_clear_error(void)
{
int i;
=head1 NAME
ERR_raise, ERR_raise_data,
-ERR_put_error, ERR_put_func_error,
-ERR_add_error_data, ERR_add_error_vdata - record an error
+ERR_put_error, ERR_add_error_data, ERR_add_error_vdata
+- record an error
=head1 SYNOPSIS
void ERR_raise(int lib, int reason);
void ERR_raise_data(int lib, int reason, const char *fmt, ...);
- void ERR_put_error(int lib, int func, int reason, const char *file, int line);
- void ERR_put_func_error(int lib, const char *func, int reason,
- const char *file, int line);
-
void ERR_add_error_data(int num, ...);
void ERR_add_error_vdata(int num, va_list arg);
+Deprecated since OpenSSL 3.0:
+
+ void ERR_put_error(int lib, int func, int reason, const char *file, int line);
+
=head1 DESCRIPTION
ERR_raise() adds a new error to the thread's error queue. The
B<func> of library B<lib>, in line number B<line> of B<file>.
This function is usually called by a macro.
-ERR_put_func_err() is similar except that the B<func> is a string naming
-a function external to OpenSSL, usually provided by the platform on which
-OpenSSL and the application is running.
-
ERR_add_error_data() associates the concatenation of its B<num> string
arguments with the error code added last.
ERR_add_error_vdata() is similar except the argument is a B<va_list>.
=head2 Reporting errors
+=for comment TODO(3.0) should this be internal documentation?
+
Each sub-library has a specific macro XXXerr() that is used to report
errors. Its first argument is a function code B<XXX_F_...>, the second
argument is a reason code B<XXX_R_...>. Function codes are derived
=head1 RETURN VALUES
-ERR_raise(), ERR_put_error() and ERR_add_error_data()
-return no values.
+ERR_raise(), ERR_put_error(), ERR_add_error_data() and
+ERR_add_error_vdata() return no values.
=head1 NOTES
-ERR_raise() is implemented as a macro.
+ERR_raise() and ERR_put_error() are implemented as macros.
=head1 SEE ALSO
ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC), \
ERR_set_error)
-void ERR_put_error(int lib, int func, int reason, const char *file, int line);
-void ERR_put_func_error(int lib, const char *func, int reason,
- const char *file, int line);
+#if !OPENSSL_API_3
+/* Backward compatibility */
+#define ERR_put_error(lib, func, reason, file, line) \
+ (ERR_new(), \
+ ERR_set_debug((file), (line), NULL), \
+ ERR_set_error((lib), (reason), NULL))
+#endif
+
void ERR_set_error_data(char *data, int flags);
unsigned long ERR_get_error(void);
/* Test that setting a platform error sets the right values. */
static int platform_error(void)
{
- const char *file = __FILE__, *f, *data;
- const int line = __LINE__;
+ const char *file, *f, *data;
+ int line;
int l;
unsigned long e;
- ERR_put_func_error(ERR_LIB_SYS, "exit", ERR_R_INTERNAL_ERROR, file, line);
+ file = __FILE__;
+ line = __LINE__ + 1; /* The error is generated on the next line */
+ FUNCerr("exit", ERR_R_INTERNAL_ERROR);
if (!TEST_ulong_ne(e = ERR_get_error_line_data(&f, &l, &data, NULL), 0)
|| !TEST_int_eq(ERR_GET_REASON(e), ERR_R_INTERNAL_ERROR)
|| !TEST_int_eq(l, line)
EVP_md4 1024 3_0_0 EXIST::FUNCTION:MD4
X509_set_subject_name 1025 3_0_0 EXIST::FUNCTION:
i2d_PKCS8PrivateKey_nid_bio 1026 3_0_0 EXIST::FUNCTION:
-ERR_put_error 1027 3_0_0 EXIST::FUNCTION:
+ERR_put_error 1027 3_0_0 NOEXIST::FUNCTION:
ERR_add_error_data 1028 3_0_0 EXIST::FUNCTION:
X509_ALGORS_it 1029 3_0_0 EXIST::FUNCTION:
MD5_Update 1030 3_0_0 EXIST::FUNCTION:MD5
EVP_KEYMGMT_free 4796 3_0_0 EXIST::FUNCTION:
EVP_KEYMGMT_provider 4797 3_0_0 EXIST::FUNCTION:
X509_PUBKEY_dup 4798 3_0_0 EXIST::FUNCTION:
-ERR_put_func_error 4799 3_0_0 EXIST::FUNCTION:
+ERR_put_func_error 4799 3_0_0 NOEXIST::FUNCTION:
EVP_MD_name 4800 3_0_0 EXIST::FUNCTION:
EVP_CIPHER_name 4801 3_0_0 EXIST::FUNCTION:
EVP_MD_provider 4802 3_0_0 EXIST::FUNCTION:
ERR_GET_REASON define
ERR_PACK define
ERR_free_strings define deprecated 1.1.0
+ERR_put_error define deprecated 3.0
ERR_load_crypto_strings define deprecated 1.1.0
ERR_raise define
ERR_raise_data define