summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2019-09-04 22:04:08 +0200
committerRichard Levitte <levitte@openssl.org>2019-09-12 17:59:52 +0200
commitb13342e933c507c4ce0eda0a0193339a111f27a5 (patch)
tree27251f00624c771cd42e0f649513ef8330659a40 /test
parent06ff79bd773d0b4214e4b6a8a1332a3355b17742 (diff)
Modernise the ERR functionality further (new functions and deprecations)
ERR_func_error_string() essentially returns NULL, and since all function codes are now removed for all intents and purposes, this function has fallen out of use and cannot be modified to suit the data, since its only function is to interpret an error code. To compensate for the loss of error code, we instead provide new functions that extracts the function name strings from an error record: - ERR_get_error_func() - ERR_peek_error_func() - ERR_peek_last_error_func() Similarly, the once all encompasing functions ERR_peek_last_error_line_data(), ERR_peek_error_line_data() and ERR_get_error_line_data() lack the capability of getting the function name string, so we deprecate those and add these functions to replace them: - ERR_get_error_all() - ERR_peek_error_all() - ERR_peek_last_error_all() Finally, we adjust a few lines of code that used the now deprecated functions. Fixes #9756 Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9756)
Diffstat (limited to 'test')
-rw-r--r--test/errtest.c4
-rw-r--r--test/evp_test.c4
2 files changed, 3 insertions, 5 deletions
diff --git a/test/errtest.c b/test/errtest.c
index ffe6532240..179c338c45 100644
--- a/test/errtest.c
+++ b/test/errtest.c
@@ -40,7 +40,7 @@ static int vdata_appends(void)
CRYPTOerr(0, ERR_R_MALLOC_FAILURE);
ERR_add_error_data(1, "hello ");
ERR_add_error_data(1, "world");
- ERR_get_error_line_data(NULL, NULL, &data, NULL);
+ ERR_peek_error_data(&data, NULL);
return TEST_str_eq(data, "hello world");
}
@@ -63,7 +63,7 @@ static int raised_error(void)
#endif
ERR_raise_data(ERR_LIB_SYS, ERR_R_INTERNAL_ERROR,
"calling exit()");
- if (!TEST_ulong_ne(e = ERR_get_error_line_data(&f, &l, &data, NULL), 0)
+ if (!TEST_ulong_ne(e = ERR_get_error_all(&f, &l, NULL, &data, NULL), 0)
|| !TEST_int_eq(ERR_GET_REASON(e), ERR_R_INTERNAL_ERROR)
#if !defined(OPENSSL_NO_FILENAMES) && !defined(OPENSSL_NO_ERR)
|| !TEST_int_eq(l, line)
diff --git a/test/evp_test.c b/test/evp_test.c
index b1194d2bc9..0b5fd5dae3 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -2799,7 +2799,6 @@ static void clear_test(EVP_TEST *t)
static int check_test_error(EVP_TEST *t)
{
unsigned long err;
- const char *func;
const char *reason;
if (t->err == NULL && t->expected_err == NULL)
@@ -2842,9 +2841,8 @@ static int check_test_error(EVP_TEST *t)
return 0;
}
- func = ERR_func_error_string(err);
reason = ERR_reason_error_string(err);
- if (func == NULL && reason == NULL) {
+ if (reason == NULL) {
TEST_info("%s:%d: Expected error \"%s\", no strings available."
" Assuming ok.",
t->s.test_file, t->s.start, t->reason);