diff options
author | Richard Levitte <levitte@openssl.org> | 2019-08-21 10:08:44 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-08-22 01:50:30 +0200 |
commit | c1d56231ef6385b557ec72eec508e55ea26ca8b0 (patch) | |
tree | c813f45c7adc28816afbd199b5df4d972fc54019 /test/property_test.c | |
parent | Modify ossl_method_store_add() to handle reference counting (diff) | |
download | openssl-c1d56231ef6385b557ec72eec508e55ea26ca8b0.tar.xz openssl-c1d56231ef6385b557ec72eec508e55ea26ca8b0.zip |
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)
Diffstat (limited to 'test/property_test.c')
-rw-r--r-- | test/property_test.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/test/property_test.c b/test/property_test.c index a47dcfc09b..29e8ac3f51 100644 --- a/test/property_test.c +++ b/test/property_test.c @@ -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"))) { |