summaryrefslogtreecommitdiffstats
path: root/providers/legacyprov.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-08-09 18:06:52 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-08-09 18:06:52 +1000
commit04cb5ec0b74896fe806625ac4d87e3396890f246 (patch)
tree558c92ddf1b1fb2421d9f3f9aae3c82595a94830 /providers/legacyprov.c
parentdda4e259e51aeaf05a2417ef577accf778c9f6f6 (diff)
Add 'on demand self test' and status test to providers
The default and legacy providers currently return 1 for status and self test checks. Added test to show the 3 different stages the self test can be run (for installation, loading and on demand). For the fips provider: - If the on demand self test fails, then any subsequent fetches should also fail. To implement this the cached algorithms are flushed on failure. - getting the self test callback in the fips provider is a bit complicated since the callback hangs off the core libctx (as it is set by the application) not the actual fips library context. Also the callback can be set at any time not just during the OSSL_provider_init() so it is calculated each time before doing any self test. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11752)
Diffstat (limited to 'providers/legacyprov.c')
-rw-r--r--providers/legacyprov.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/providers/legacyprov.c b/providers/legacyprov.c
index 40d24873a2..549906a68a 100644
--- a/providers/legacyprov.c
+++ b/providers/legacyprov.c
@@ -61,7 +61,9 @@ static int legacy_get_params(void *provctx, OSSL_PARAM params[])
p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_BUILDINFO);
if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, OPENSSL_FULL_VERSION_STR))
return 0;
-
+ p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_STATUS);
+ if (p != NULL && !OSSL_PARAM_set_uint(p, 1))
+ return 0;
return 1;
}