Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the activate setting more intuitive #22906

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion crypto/provider_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,11 @@ static int provider_conf_load(OSSL_LIB_CTX *libctx, const char *name,
else if (strcmp(confname, "module") == 0)
path = confvalue;
else if (strcmp(confname, "activate") == 0)
activate = 1;
if ((strcmp(confvalue, "1") == 0)
|| (strcmp(confvalue, "yes") == 0)
|| (strcmp(confvalue, "true") == 0)
|| (strcmp(confvalue, "on") == 0))
activate = 1;
nhorman marked this conversation as resolved.
Show resolved Hide resolved
}

if (activate) {
Expand Down
6 changes: 4 additions & 2 deletions doc/man5/config.pod
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,10 @@ Specifies the pathname of the module (typically a shared library) to load.

=item B<activate>

If present, the module is activated. The value assigned to this name is not
significant.
If present and set to one of the values yes, on, true or 1, then the associated
provider will be activated. Omitting this item, or setting it to
any other value, will prevent the associated provider from being activated.
Note that the above activation values are case sensitive
mattcaswell marked this conversation as resolved.
Show resolved Hide resolved

=back

Expand Down
2 changes: 1 addition & 1 deletion test/default-and-fips.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ default = default_sect
fips = fips_sect

[default_sect]
activate = 1
activate = yes
6 changes: 5 additions & 1 deletion test/default.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ providers = provider_sect

[provider_sect]
default = default_sect
legacy = legacy_sect

[default_sect]
activate = 1
activate = true

[legacy_sect]
activate = false
nhorman marked this conversation as resolved.
Show resolved Hide resolved
22 changes: 22 additions & 0 deletions test/evp_fetch_prov_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down