Commit 3c6c533c71 for openssl.org
commit 3c6c533c71f56b31c2f836a2f457876167e3a204
Author: Neil Horman <nhorman@openssl.org>
Date: Tue Mar 3 10:04:04 2026 -0500
Fixup property test to have enough of a real provider struct
Now that ossl_method_store_cache_[set|get] query the provider name, we
need to make our property test account for that, by defining the
property query to be identical to what the internal definiton is.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
MergeDate: Tue Mar 24 16:23:11 2026
(Merged from https://github.com/openssl/openssl/pull/30254)
diff --git a/test/property_test.c b/test/property_test.c
index eea1f28a19..8c75711132 100644
--- a/test/property_test.c
+++ b/test/property_test.c
@@ -13,6 +13,7 @@
#include "testutil.h"
#include "internal/nelem.h"
#include "internal/property.h"
+#include "internal/refcount.h"
#include "../crypto/property/property_local.h"
/*
@@ -22,7 +23,18 @@
* passed around, and used as a tag of sorts.
*/
struct ossl_provider_st {
- int x;
+ /* Flag bits */
+ unsigned int flag_initialized : 1;
+ unsigned int flag_activated : 1;
+
+ /* Getting and setting the flags require synchronization */
+ CRYPTO_RWLOCK *flag_lock;
+
+ /* OpenSSL library side data */
+ CRYPTO_REF_COUNT refcnt;
+ CRYPTO_RWLOCK *activatecnt_lock; /* For the activatecnt counter */
+ int activatecnt;
+ char *name;
};
static int add_property_names(const char *n, ...)
@@ -419,8 +431,16 @@ err:
static int test_property(void)
{
- static OSSL_PROVIDER fake_provider1 = { 1 };
- static OSSL_PROVIDER fake_provider2 = { 2 };
+ static OSSL_PROVIDER fake_provider1 = {
+ .flag_initialized = 1,
+ .flag_activated = 1,
+ .name = "fake-provider1"
+ };
+ static OSSL_PROVIDER fake_provider2 = {
+ .flag_initialized = 1,
+ .flag_activated = 1,
+ .name = "fake-provider2"
+ };
static const OSSL_PROVIDER *fake_prov1 = &fake_provider1;
static const OSSL_PROVIDER *fake_prov2 = &fake_provider2;
static const struct {
@@ -568,7 +588,11 @@ static int test_query_cache_stochastic(void)
void *result;
int errors = 0;
int v[10001];
- OSSL_PROVIDER prov = { 1 };
+ OSSL_PROVIDER prov = {
+ .flag_initialized = 1,
+ .flag_activated = 1,
+ .name = "dummy-test-provider"
+ };
if (!TEST_ptr(store = ossl_method_store_new(NULL))
|| !add_property_names("n", NULL))