-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Closed
Labels
branch: masterApplies to master branchApplies to master branchtriaged: bugThe issue/pr is/fixes a bugThe issue/pr is/fixes a bug
Milestone
Description
Once you've load a provider and used it, its not possible to then unload it again. At least this is true for the default provider, and I assume others. See this test program:
#include <stdio.h>
#include <openssl/provider.h>
#include <openssl/evp.h>
void print_availability(const char *label)
{
printf("%s\n", label);
printf("Default provider is %s\n\n",
OSSL_PROVIDER_available(NULL, "default") ? "loaded" : "not loaded");
}
int main(void)
{
OSSL_PROVIDER *defltprov = NULL;
OSSL_PROVIDER *nullprov = OSSL_PROVIDER_load(NULL, "null");
EVP_MD *sha256;
if (nullprov == NULL)
printf("Failed to load null provider\n");
print_availability("Before start");
defltprov = OSSL_PROVIDER_load(NULL, "default");
sha256 = EVP_MD_fetch(NULL, "SHA2-256", NULL);
if (sha256 == NULL)
printf("Failed to fetch SHA256\n");
EVP_MD_free(sha256);
print_availability("After load");
if (!OSSL_PROVIDER_unload(defltprov))
printf("Unload failure\n");
print_availability("After unload");
OSSL_PROVIDER_unload(nullprov);
return 0;
}
That produces this output:
$ ./defltprov
Before start
Default provider is not loaded
After load
Default provider is loaded
After unload
Default provider is loaded
I expected the final line to say "Default provider in not loaded"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
branch: masterApplies to master branchApplies to master branchtriaged: bugThe issue/pr is/fixes a bugThe issue/pr is/fixes a bug