Path: blob/main/crypto/openssl/include/internal/property.h
104668 views
/*1* Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.2* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.3*4* Licensed under the Apache License 2.0 (the "License"). You may not use5* this file except in compliance with the License. You can obtain a copy6* in the file LICENSE in the source distribution or at7* https://www.openssl.org/source/license.html8*/910#ifndef OSSL_INTERNAL_PROPERTY_H11#define OSSL_INTERNAL_PROPERTY_H12#pragma once1314#include "internal/cryptlib.h"1516typedef struct ossl_method_store_st OSSL_METHOD_STORE;17typedef struct ossl_property_list_st OSSL_PROPERTY_LIST;1819typedef enum {20OSSL_PROPERTY_TYPE_STRING,21OSSL_PROPERTY_TYPE_NUMBER,22OSSL_PROPERTY_TYPE_VALUE_UNDEFINED23} OSSL_PROPERTY_TYPE;24typedef struct ossl_property_definition_st OSSL_PROPERTY_DEFINITION;2526/* Initialisation */27int ossl_property_parse_init(OSSL_LIB_CTX *ctx);2829/* Property definition parser */30OSSL_PROPERTY_LIST *ossl_parse_property(OSSL_LIB_CTX *ctx, const char *defn);31/* Property query parser */32OSSL_PROPERTY_LIST *ossl_parse_query(OSSL_LIB_CTX *ctx, const char *s,33int create_values);34/* Property checker of query vs definition */35int ossl_property_match_count(const OSSL_PROPERTY_LIST *query,36const OSSL_PROPERTY_LIST *defn);37int ossl_property_is_enabled(OSSL_LIB_CTX *ctx, const char *property_name,38const OSSL_PROPERTY_LIST *prop_list);39/* Free a parsed property list */40void ossl_property_free(OSSL_PROPERTY_LIST *p);4142/* Get a property from a property list */43const OSSL_PROPERTY_DEFINITION *44ossl_property_find_property(const OSSL_PROPERTY_LIST *list,45OSSL_LIB_CTX *libctx, const char *name);46OSSL_PROPERTY_TYPE ossl_property_get_type(const OSSL_PROPERTY_DEFINITION *prop);47const char *ossl_property_get_string_value(OSSL_LIB_CTX *libctx,48const OSSL_PROPERTY_DEFINITION *prop);49int64_t ossl_property_get_number_value(const OSSL_PROPERTY_DEFINITION *prop);5051/* Implementation store functions */52OSSL_METHOD_STORE *ossl_method_store_new(OSSL_LIB_CTX *ctx);53void ossl_method_store_free(OSSL_METHOD_STORE *store);5455int ossl_method_lock_store(OSSL_METHOD_STORE *store);56int ossl_method_unlock_store(OSSL_METHOD_STORE *store);5758int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov,59int nid, const char *properties, void *method,60int (*method_up_ref)(void *),61void (*method_destruct)(void *));62int ossl_method_store_remove(OSSL_METHOD_STORE *store, int nid,63const void *method);64void ossl_method_store_do_all(OSSL_METHOD_STORE *store,65void (*fn)(int id, void *method, void *fnarg),66void *fnarg);67int ossl_method_store_fetch(OSSL_METHOD_STORE *store,68int nid, const char *prop_query,69const OSSL_PROVIDER **prov, void **method);70int ossl_method_store_remove_all_provided(OSSL_METHOD_STORE *store,71const OSSL_PROVIDER *prov);7273/* Get the global properties associate with the specified library context */74OSSL_PROPERTY_LIST **ossl_ctx_global_properties(OSSL_LIB_CTX *ctx,75int loadconfig);7677/* property query cache functions */78int ossl_method_store_cache_get(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov,79int nid, const char *prop_query, void **result);80int ossl_method_store_cache_set(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov,81int nid, const char *prop_query, void *result,82int (*method_up_ref)(void *),83void (*method_destruct)(void *));8485__owur int ossl_method_store_cache_flush_all(OSSL_METHOD_STORE *store);8687/* Merge two property queries together */88OSSL_PROPERTY_LIST *ossl_property_merge(const OSSL_PROPERTY_LIST *a,89const OSSL_PROPERTY_LIST *b);9091size_t ossl_property_list_to_string(OSSL_LIB_CTX *ctx,92const OSSL_PROPERTY_LIST *list, char *buf,93size_t bufsize);9495int ossl_global_properties_no_mirrored(OSSL_LIB_CTX *libctx);96void ossl_global_properties_stop_mirroring(OSSL_LIB_CTX *libctx);9798#endif99100101