]>
Commit | Line | Data |
---|---|---|
9e11fe0d RL |
1 | /* |
2 | * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved. | |
3 | * | |
4 | * Licensed under the Apache License 2.0 (the "License"). You may not use | |
5 | * this file except in compliance with the License. You can obtain a copy | |
6 | * in the file LICENSE in the source distribution or at | |
7 | * https://www.openssl.org/source/license.html | |
8 | */ | |
9 | ||
10 | #ifndef OSSL_INTERNAL_CORE_H | |
11 | # define OSSL_INTERNAL_CORE_H | |
12 | ||
13 | /* | |
14 | * namespaces: | |
15 | * | |
16 | * ossl_method_ Core Method API | |
17 | */ | |
18 | ||
19 | /* | |
20 | * construct an arbitrary method from a dispatch table found by looking | |
21 | * up a match for the < operation_id, name, property > combination. | |
22 | * constructor and destructor are the constructor and destructor for that | |
23 | * arbitrary object. | |
24 | * | |
25 | * These objects are normally cached, unless the provider says not to cache. | |
26 | * However, force_cache can be used to force caching whatever the provider | |
27 | * says (for example, because the application knows better). | |
28 | */ | |
29 | typedef struct ossl_method_construct_method_st { | |
30 | /* Create store */ | |
1aedc35f | 31 | void *(*alloc_tmp_store)(OPENSSL_CTX *ctx); |
9e11fe0d RL |
32 | /* Remove a store */ |
33 | void (*dealloc_tmp_store)(void *store); | |
34 | /* Get an already existing method from a store */ | |
2ccb1b4e RL |
35 | void *(*get)(OPENSSL_CTX *libctx, void *store, |
36 | int operation_id, const char *name, const char *propquery, | |
37 | void *data); | |
9e11fe0d | 38 | /* Store a method in a store */ |
2e49c054 | 39 | int (*put)(OPENSSL_CTX *libctx, void *store, void *method, |
2ccb1b4e RL |
40 | int operation_id, const char *name, const char *propdef, |
41 | void *data); | |
9e11fe0d | 42 | /* Construct a new method */ |
2e49c054 | 43 | void *(*construct)(const char *name, const OSSL_DISPATCH *fns, |
dc46e3dd | 44 | OSSL_PROVIDER *prov, void *data); |
9e11fe0d | 45 | /* Destruct a method */ |
7bb19a0f | 46 | void (*destruct)(void *method, void *data); |
9e11fe0d RL |
47 | } OSSL_METHOD_CONSTRUCT_METHOD; |
48 | ||
49 | void *ossl_method_construct(OPENSSL_CTX *ctx, int operation_id, | |
50 | const char *name, const char *properties, | |
51 | int force_cache, | |
52 | OSSL_METHOD_CONSTRUCT_METHOD *mcm, void *mcm_data); | |
53 | ||
a883c02f RL |
54 | void ossl_algorithm_do_all(OPENSSL_CTX *libctx, int operation_id, |
55 | OSSL_PROVIDER *provider, | |
56 | void (*fn)(OSSL_PROVIDER *provider, | |
57 | const OSSL_ALGORITHM *algo, | |
58 | int no_store, void *data), | |
59 | void *data); | |
60 | ||
9e11fe0d | 61 | #endif |