summaryrefslogtreecommitdiffstats
path: root/crypto/property/property.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-05-02 06:17:54 +0200
committerShane Lontis <shane.lontis@oracle.com>2020-05-02 06:17:54 +0200
commite0624f0d702b57e23ecaf5236ce1bafdd85ec649 (patch)
treeefb58c3011ac51de4fdcf093380e76df083941fa /crypto/property/property.c
parentmake update for SSL_new_session_ticket (diff)
downloadopenssl-e0624f0d702b57e23ecaf5236ce1bafdd85ec649.tar.xz
openssl-e0624f0d702b57e23ecaf5236ce1bafdd85ec649.zip
Add default property API's to enable and test for fips
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11239)
Diffstat (limited to 'crypto/property/property.c')
-rw-r--r--crypto/property/property.c63
1 files changed, 60 insertions, 3 deletions
diff --git a/crypto/property/property.c b/crypto/property/property.c
index 2bcbc85813..93df1bb679 100644
--- a/crypto/property/property.c
+++ b/crypto/property/property.c
@@ -362,8 +362,24 @@ fin:
return ret;
}
+int ossl_method_store_global_property_is_enabled(OSSL_METHOD_STORE *store,
+ const char *prop_name)
+{
+ int ret = 0;
+
+ if (store == NULL)
+ return 0;
+
+ ossl_property_read_lock(store);
+ ret = ossl_property_is_enabled(store->ctx, prop_name,
+ store->global_properties);
+ ossl_property_unlock(store);
+ return ret;
+}
+
int ossl_method_store_set_global_properties(OSSL_METHOD_STORE *store,
- const char *prop_query) {
+ const char *prop_query)
+{
int ret = 0;
if (store == NULL)
@@ -371,9 +387,11 @@ int ossl_method_store_set_global_properties(OSSL_METHOD_STORE *store,
ossl_property_write_lock(store);
ossl_method_cache_flush_all(store);
+
+ ossl_property_free(store->global_properties);
+ store->global_properties = NULL;
+
if (prop_query == NULL) {
- ossl_property_free(store->global_properties);
- store->global_properties = NULL;
ossl_property_unlock(store);
return 1;
}
@@ -383,6 +401,45 @@ int ossl_method_store_set_global_properties(OSSL_METHOD_STORE *store,
return ret;
}
+int ossl_method_store_merge_global_properties(OSSL_METHOD_STORE *store,
+ const char *prop_query)
+{
+ int ret = 0;
+ OSSL_PROPERTY_LIST *prop = NULL, *global;
+
+ if (store == NULL)
+ return 1;
+
+ ossl_property_write_lock(store);
+ ossl_method_cache_flush_all(store);
+ if (prop_query == NULL) {
+ ossl_property_free(store->global_properties);
+ store->global_properties = NULL;
+ goto success;
+ }
+ prop = ossl_parse_query(store->ctx, prop_query);
+ if (prop == NULL)
+ goto end;
+
+ if (store->global_properties == NULL) {
+ store->global_properties = prop;
+ prop = NULL;
+ goto success;
+ }
+ global = ossl_property_merge(prop, store->global_properties);
+ if (global == NULL)
+ goto end;
+ ossl_property_free(store->global_properties);
+ store->global_properties = global;
+ success:
+ ret = 1;
+ end:
+ ossl_property_unlock(store);
+ ossl_property_free(prop);
+ return ret;
+}
+
+
static void impl_cache_flush_alg(ossl_uintmax_t idx, ALGORITHM *alg)
{
lh_QUERY_doall(alg->cache, &impl_cache_free);