Add 'on demand self test' and status test to providers master
authorShane Lontis <shane.lontis@oracle.com>
Sun, 9 Aug 2020 08:06:52 +0000 (18:06 +1000)
committerShane Lontis <shane.lontis@oracle.com>
Sun, 9 Aug 2020 08:06:52 +0000 (18:06 +1000)
commit04cb5ec0b74896fe806625ac4d87e3396890f246
tree558c92ddf1b1fb2421d9f3f9aae3c82595a94830
parentdda4e259e51aeaf05a2417ef577accf778c9f6f6
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)
22 files changed:
crypto/evp/evp_fetch.c
crypto/property/property.c
crypto/provider.c
crypto/provider_core.c
crypto/sparse_array.c
doc/man3/OSSL_PROVIDER.pod
doc/man7/provider-base.pod
include/crypto/evp.h
include/internal/property.h
include/internal/provider.h
include/openssl/core_dispatch.h
include/openssl/core_names.h
include/openssl/provider.h
providers/defltprov.c
providers/fips/fipsprov.c
providers/fips/self_test.c
providers/fips/self_test.h
providers/legacyprov.c
test/build.info
test/provider_status_test.c [new file with mode: 0644]
test/recipes/30-test_provider_status.t [new file with mode: 0644]
util/libcrypto.num