diff options
Diffstat (limited to 'test/evp_fetch_prov_test.c')
-rw-r--r-- | test/evp_fetch_prov_test.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/test/evp_fetch_prov_test.c b/test/evp_fetch_prov_test.c index d237082bdcc0..876d6ccc0a3d 100644 --- a/test/evp_fetch_prov_test.c +++ b/test/evp_fetch_prov_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -121,6 +121,27 @@ static void unload_providers(OSSL_LIB_CTX **libctx, OSSL_PROVIDER *prov[]) } } +static int test_legacy_provider_unloaded(void) +{ + OSSL_LIB_CTX *ctx = NULL; + int rc = 0; + + ctx = OSSL_LIB_CTX_new(); + if (!TEST_ptr(ctx)) + goto err; + + if (!TEST_true(OSSL_LIB_CTX_load_config(ctx, config_file))) + goto err; + + if (!TEST_int_eq(OSSL_PROVIDER_available(ctx, "legacy"), 0)) + goto err; + + rc = 1; +err: + OSSL_LIB_CTX_free(ctx); + return rc; +} + static X509_ALGOR *make_algor(int nid) { X509_ALGOR *algor; @@ -212,7 +233,7 @@ static int test_explicit_EVP_MD_fetch_by_X509_ALGOR(int idx) int ret = 0; X509_ALGOR *algor = make_algor(NID_sha256); const ASN1_OBJECT *obj; - char id[OSSL_MAX_NAME_SIZE]; + char id[OSSL_MAX_NAME_SIZE] = { 0 }; if (algor == NULL) return 0; @@ -328,7 +349,7 @@ static int test_explicit_EVP_CIPHER_fetch_by_X509_ALGOR(int idx) int ret = 0; X509_ALGOR *algor = make_algor(NID_aes_128_cbc); const ASN1_OBJECT *obj; - char id[OSSL_MAX_NAME_SIZE]; + char id[OSSL_MAX_NAME_SIZE] = { 0 }; if (algor == NULL) return 0; @@ -379,6 +400,7 @@ int setup_tests(void) return 0; } } + ADD_TEST(test_legacy_provider_unloaded); if (strcmp(alg, "digest") == 0) { ADD_TEST(test_implicit_EVP_MD_fetch); ADD_TEST(test_explicit_EVP_MD_fetch_by_name); |