Modify ossl_method_store_add() to accept an OSSL_PROVIDER and check for it
If ossl_method_store_add() gets called with a method that already exists (i.e. the store has one with matching provider, nid and properties), that method should not be stored. We do this check inside ossl_method_store_add() because it has all the locking required to do so safely. Fixes #9561 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9650)
This commit is contained in:
parent
b1d40ddfe2
commit
c1d56231ef
7 changed files with 47 additions and 29 deletions
|
@ -240,8 +240,9 @@ static int test_register_deregister(void)
|
|||
goto err;
|
||||
|
||||
for (i = 0; i < OSSL_NELEM(impls); i++)
|
||||
if (!TEST_true(ossl_method_store_add(store, impls[i].nid, impls[i].prop,
|
||||
impls[i].impl, NULL, NULL))) {
|
||||
if (!TEST_true(ossl_method_store_add(store, NULL, impls[i].nid,
|
||||
impls[i].prop, impls[i].impl,
|
||||
NULL, NULL))) {
|
||||
TEST_note("iteration %zd", i + 1);
|
||||
goto err;
|
||||
}
|
||||
|
@ -307,8 +308,9 @@ static int test_property(void)
|
|||
goto err;
|
||||
|
||||
for (i = 0; i < OSSL_NELEM(impls); i++)
|
||||
if (!TEST_true(ossl_method_store_add(store, impls[i].nid, impls[i].prop,
|
||||
impls[i].impl, NULL, NULL))) {
|
||||
if (!TEST_true(ossl_method_store_add(store, NULL, impls[i].nid,
|
||||
impls[i].prop, impls[i].impl,
|
||||
NULL, NULL))) {
|
||||
TEST_note("iteration %zd", i + 1);
|
||||
goto err;
|
||||
}
|
||||
|
@ -347,7 +349,8 @@ static int test_query_cache_stochastic(void)
|
|||
for (i = 1; i <= max; i++) {
|
||||
v[i] = 2 * i;
|
||||
BIO_snprintf(buf, sizeof(buf), "n=%d\n", i);
|
||||
if (!TEST_true(ossl_method_store_add(store, i, buf, "abc", NULL, NULL))
|
||||
if (!TEST_true(ossl_method_store_add(store, NULL, i, buf, "abc",
|
||||
NULL, NULL))
|
||||
|| !TEST_true(ossl_method_store_cache_set(store, i, buf, v + i))
|
||||
|| !TEST_true(ossl_method_store_cache_set(store, i, "n=1234",
|
||||
"miss"))) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue