From 76157664c1eb0f8d9f4e50c4bff8c521f7318b44 Mon Sep 17 00:00:00 2001 From: Pauli Date: Fri, 4 Jun 2021 14:35:53 +1000 Subject: [PATCH] property: move additional query functions to property_query.c Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/15614) --- crypto/property/build.info | 1 - crypto/property/property_local.h | 2 ++ crypto/property/property_parse.c | 24 +----------------------- crypto/property/property_query.c | 22 ++++++++++++++++++++++ 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/crypto/property/build.info b/crypto/property/build.info index dac9ab7a3b..12a6b8c9de 100644 --- a/crypto/property/build.info +++ b/crypto/property/build.info @@ -2,4 +2,3 @@ LIBS=../../libcrypto $COMMON=property_string.c property_parse.c property_query.c property.c defn_cache.c SOURCE[../../libcrypto]=$COMMON property_err.c SOURCE[../../providers/libfips.a]=$COMMON -SOURCE[../../providers/liblegacy.a]=$COMMON diff --git a/crypto/property/property_local.h b/crypto/property/property_local.h index 5bb48a6f37..46c5dbe3cc 100644 --- a/crypto/property/property_local.h +++ b/crypto/property/property_local.h @@ -34,6 +34,8 @@ struct ossl_property_list_st { OSSL_PROPERTY_DEFINITION properties[1]; }; +extern OSSL_PROPERTY_IDX ossl_property_true, ossl_property_false; + /* Property string functions */ OSSL_PROPERTY_IDX ossl_property_name(OSSL_LIB_CTX *ctx, const char *s, int create); diff --git a/crypto/property/property_parse.c b/crypto/property/property_parse.c index 28822ec42c..21228b4a39 100644 --- a/crypto/property/property_parse.c +++ b/crypto/property/property_parse.c @@ -19,7 +19,7 @@ #include "property_local.h" #include "e_os.h" -static OSSL_PROPERTY_IDX ossl_property_true, ossl_property_false; +OSSL_PROPERTY_IDX ossl_property_true, ossl_property_false; DEFINE_STACK_OF(OSSL_PROPERTY_DEFINITION) @@ -422,28 +422,6 @@ err: return res; } -/* Does a property query have any optional clauses */ -int ossl_property_has_optional(const OSSL_PROPERTY_LIST *query) -{ - return query->has_optional ? 1 : 0; -} - -int ossl_property_is_enabled(OSSL_LIB_CTX *ctx, const char *property_name, - const OSSL_PROPERTY_LIST *prop_list) -{ - const OSSL_PROPERTY_DEFINITION *prop; - - prop = ossl_property_find_property(prop_list, ctx, property_name); - /* Do a separate check for override as it does not set type */ - if (prop == NULL || prop->optional || prop->oper == OSSL_PROPERTY_OVERRIDE) - return 0; - return (prop->type == OSSL_PROPERTY_TYPE_STRING - && ((prop->oper == OSSL_PROPERTY_OPER_EQ - && prop->v.str_val == ossl_property_true) - || (prop->oper == OSSL_PROPERTY_OPER_NE - && prop->v.str_val != ossl_property_true))); -} - /* * Compare a query against a definition. * Return the number of clauses matched or -1 if a mandatory clause is false. diff --git a/crypto/property/property_query.c b/crypto/property/property_query.c index c4c6b1a22f..1352bc009e 100644 --- a/crypto/property/property_query.c +++ b/crypto/property/property_query.c @@ -58,3 +58,25 @@ int64_t ossl_property_get_number_value(const OSSL_PROPERTY_DEFINITION *prop) return value; } +/* Does a property query have any optional clauses */ +int ossl_property_has_optional(const OSSL_PROPERTY_LIST *query) +{ + return query->has_optional ? 1 : 0; +} + +int ossl_property_is_enabled(OSSL_LIB_CTX *ctx, const char *property_name, + const OSSL_PROPERTY_LIST *prop_list) +{ + const OSSL_PROPERTY_DEFINITION *prop; + + prop = ossl_property_find_property(prop_list, ctx, property_name); + /* Do a separate check for override as it does not set type */ + if (prop == NULL || prop->optional || prop->oper == OSSL_PROPERTY_OVERRIDE) + return 0; + return (prop->type == OSSL_PROPERTY_TYPE_STRING + && ((prop->oper == OSSL_PROPERTY_OPER_EQ + && prop->v.str_val == ossl_property_true) + || (prop->oper == OSSL_PROPERTY_OPER_NE + && prop->v.str_val != ossl_property_true))); +} +