diff options
author | Pauli <pauli@openssl.org> | 2021-06-04 14:35:53 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-06-05 20:40:30 +1000 |
commit | 76157664c1eb0f8d9f4e50c4bff8c521f7318b44 (patch) | |
tree | db0db122165004ce16e6b2a740b21b9b740a00a6 | |
parent | fce102304a340ef1a90361a03c86bd2401f0b6c3 (diff) |
property: move additional query functions to property_query.c
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15614)
-rw-r--r-- | crypto/property/build.info | 1 | ||||
-rw-r--r-- | crypto/property/property_local.h | 2 | ||||
-rw-r--r-- | crypto/property/property_parse.c | 24 | ||||
-rw-r--r-- | 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))); +} + |