summaryrefslogtreecommitdiffstats
path: root/test/evp_test.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2019-04-11 20:27:59 +1000
committerShane Lontis <shane.lontis@oracle.com>2019-06-04 12:09:50 +1000
commitd5e5e2ffafc7dbc861f7d285508cf129c5e8f5ac (patch)
tree3920b0febd6d2716940fb022b57894fe2ebf565d /test/evp_test.c
parentbf5b04ea25d6ac7d31e388b4e87d3eb5cd1e1e2b (diff)
Move digests to providers
Move digest code into the relevant providers (fips, default, legacy). The headers are temporarily moved to be internal, and will be moved into providers after all external references are resolved. The deprecated digest code can not be removed until EVP_PKEY (signing) is supported by providers. EVP_MD data can also not yet be cleaned up for the same reasons. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8763)
Diffstat (limited to 'test/evp_test.c')
-rw-r--r--test/evp_test.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/test/evp_test.c b/test/evp_test.c
index fa9cde8289..6fc9f03797 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -14,6 +14,7 @@
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/err.h>
+#include <openssl/provider.h>
#include <openssl/x509v3.h>
#include <openssl/pkcs12.h>
#include <openssl/kdf.h>
@@ -75,6 +76,9 @@ static int find_key(EVP_PKEY **ppk, const char *name, KEY_LIST *lst);
static int parse_bin(const char *value, unsigned char **buf, size_t *buflen);
+static OSSL_PROVIDER *defltprov = NULL;
+static OSSL_PROVIDER *legacyprov = NULL;
+
/*
* Compare two memory regions for equality, returning zero if they differ.
* However, if there is expected to be an error and the actual error
@@ -370,6 +374,11 @@ static int digest_test_parse(EVP_TEST *t,
return evp_test_buffer_set_count(value, mdata->input);
if (strcmp(keyword, "Ncopy") == 0)
return evp_test_buffer_ncopy(value, mdata->input);
+ if (strcmp(keyword, "Legacy") == 0) {
+ if (legacyprov == NULL)
+ t->skip = 1;
+ return 1;
+ }
return 0;
}
@@ -3053,8 +3062,10 @@ static int run_file_tests(int i)
while (!BIO_eof(t->s.fp)) {
c = parse(t);
- if (t->skip)
+ if (t->skip) {
+ t->s.numskip++;
continue;
+ }
if (c == 0 || !run_test(t)) {
t->s.errors++;
break;
@@ -3080,6 +3091,21 @@ int setup_tests(void)
if (n == 0)
return 0;
+ defltprov = OSSL_PROVIDER_load(NULL, "default");
+ if (!TEST_ptr(defltprov))
+ return 0;
+#ifndef NO_LEGACY_MODULE
+ legacyprov = OSSL_PROVIDER_load(NULL, "legacy");
+ if (!TEST_ptr(legacyprov))
+ return 0;
+#endif /* NO_LEGACY_MODULE */
+
ADD_ALL_TESTS(run_file_tests, n);
return 1;
}
+
+void cleanup_tests(void)
+{
+ OSSL_PROVIDER_unload(legacyprov);
+ OSSL_PROVIDER_unload(defltprov);
+}