]>
Commit | Line | Data |
---|---|---|
1bdbdaff | 1 | /* |
a28d06f3 | 2 | * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. |
1bdbdaff P |
3 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
4 | * | |
5 | * Licensed under the Apache License 2.0 (the "License"). You may not use | |
6 | * this file except in compliance with the License. You can obtain a copy | |
7 | * in the file LICENSE in the source distribution or at | |
8 | * https://www.openssl.org/source/license.html | |
9 | */ | |
10 | ||
ae4186b0 DMSP |
11 | #ifndef OSSL_INTERNAL_PROPERTY_H |
12 | # define OSSL_INTERNAL_PROPERTY_H | |
3a111aad | 13 | # pragma once |
1bdbdaff | 14 | |
3a111aad | 15 | # include "internal/cryptlib.h" |
1aedc35f | 16 | |
1bdbdaff | 17 | typedef struct ossl_method_store_st OSSL_METHOD_STORE; |
1793d270 | 18 | typedef struct ossl_property_list_st OSSL_PROPERTY_LIST; |
1bdbdaff | 19 | |
6ec3b2cf RL |
20 | typedef enum { |
21 | OSSL_PROPERTY_TYPE_STRING, OSSL_PROPERTY_TYPE_NUMBER, | |
22 | OSSL_PROPERTY_TYPE_VALUE_UNDEFINED | |
23 | } OSSL_PROPERTY_TYPE; | |
24 | typedef struct ossl_property_definition_st OSSL_PROPERTY_DEFINITION; | |
25 | ||
505f4660 | 26 | /* Initialisation */ |
b4250010 | 27 | int ossl_property_parse_init(OSSL_LIB_CTX *ctx); |
505f4660 | 28 | |
1793d270 | 29 | /* Property definition parser */ |
b4250010 | 30 | OSSL_PROPERTY_LIST *ossl_parse_property(OSSL_LIB_CTX *ctx, const char *defn); |
1793d270 | 31 | /* Property query parser */ |
1e08f3ba P |
32 | OSSL_PROPERTY_LIST *ossl_parse_query(OSSL_LIB_CTX *ctx, const char *s, |
33 | int create_values); | |
1793d270 RL |
34 | /* Property checker of query vs definition */ |
35 | int ossl_property_match_count(const OSSL_PROPERTY_LIST *query, | |
36 | const OSSL_PROPERTY_LIST *defn); | |
b4250010 | 37 | int ossl_property_is_enabled(OSSL_LIB_CTX *ctx, const char *property_name, |
e0624f0d | 38 | const OSSL_PROPERTY_LIST *prop_list); |
b305452f RL |
39 | /* Free a parsed property list */ |
40 | void ossl_property_free(OSSL_PROPERTY_LIST *p); | |
41 | ||
6ec3b2cf RL |
42 | /* Get a property from a property list */ |
43 | const OSSL_PROPERTY_DEFINITION * | |
44 | ossl_property_find_property(const OSSL_PROPERTY_LIST *list, | |
45 | OSSL_LIB_CTX *libctx, const char *name); | |
46 | OSSL_PROPERTY_TYPE ossl_property_get_type(const OSSL_PROPERTY_DEFINITION *prop); | |
47 | const char *ossl_property_get_string_value(OSSL_LIB_CTX *libctx, | |
48 | const OSSL_PROPERTY_DEFINITION *prop); | |
49 | int64_t ossl_property_get_number_value(const OSSL_PROPERTY_DEFINITION *prop); | |
50 | ||
1793d270 | 51 | |
1bdbdaff | 52 | /* Implementation store functions */ |
b4250010 | 53 | OSSL_METHOD_STORE *ossl_method_store_new(OSSL_LIB_CTX *ctx); |
1bdbdaff | 54 | void ossl_method_store_free(OSSL_METHOD_STORE *store); |
e1eafe8c RL |
55 | |
56 | int ossl_method_lock_store(OSSL_METHOD_STORE *store); | |
57 | int ossl_method_unlock_store(OSSL_METHOD_STORE *store); | |
58 | ||
c1d56231 RL |
59 | int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov, |
60 | int nid, const char *properties, void *method, | |
61 | int (*method_up_ref)(void *), | |
62 | void (*method_destruct)(void *)); | |
63 | int ossl_method_store_remove(OSSL_METHOD_STORE *store, int nid, | |
64 | const void *method); | |
f0191d0b RL |
65 | void ossl_method_store_do_all(OSSL_METHOD_STORE *store, |
66 | void (*fn)(int id, void *method, void *fnarg), | |
67 | void *fnarg); | |
dc010ca6 RL |
68 | int ossl_method_store_fetch(OSSL_METHOD_STORE *store, |
69 | int nid, const char *prop_query, | |
70 | const OSSL_PROVIDER **prov, void **method); | |
2e4d0677 RL |
71 | int ossl_method_store_remove_all_provided(OSSL_METHOD_STORE *store, |
72 | const OSSL_PROVIDER *prov); | |
f9e504e8 P |
73 | |
74 | /* Get the global properties associate with the specified library context */ | |
b4250010 DMSP |
75 | OSSL_PROPERTY_LIST **ossl_ctx_global_properties(OSSL_LIB_CTX *ctx, |
76 | int loadconfig); | |
1bdbdaff | 77 | |
c2969ff6 | 78 | /* property query cache functions */ |
dc010ca6 RL |
79 | int ossl_method_store_cache_get(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov, |
80 | int nid, const char *prop_query, void **result); | |
81 | int ossl_method_store_cache_set(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov, | |
82 | int nid, const char *prop_query, void *result, | |
bdbf2df2 P |
83 | int (*method_up_ref)(void *), |
84 | void (*method_destruct)(void *)); | |
04cb5ec0 | 85 | |
60640d79 | 86 | __owur int ossl_method_store_cache_flush_all(OSSL_METHOD_STORE *store); |
f9e504e8 P |
87 | |
88 | /* Merge two property queries together */ | |
89 | OSSL_PROPERTY_LIST *ossl_property_merge(const OSSL_PROPERTY_LIST *a, | |
90 | const OSSL_PROPERTY_LIST *b); | |
91 | ||
e2ed740e MC |
92 | size_t ossl_property_list_to_string(OSSL_LIB_CTX *ctx, |
93 | const OSSL_PROPERTY_LIST *list, char *buf, | |
94 | size_t bufsize); | |
95 | ||
b1c053ac MC |
96 | int ossl_global_properties_no_mirrored(OSSL_LIB_CTX *libctx); |
97 | void ossl_global_properties_stop_mirroring(OSSL_LIB_CTX *libctx); | |
98 | ||
1bdbdaff | 99 | #endif |