]>
| Commit | Line | Data |
|---|---|---|
| 9e11fe0d | 1 | /* |
| fecb3aae | 2 | * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. |
| 9e11fe0d RL |
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 | |
| 3a111aad | 12 | # pragma once |
| 9e11fe0d RL |
13 | |
| 14 | /* | |
| 15 | * namespaces: | |
| 16 | * | |
| 17 | * ossl_method_ Core Method API | |
| 18 | */ | |
| 19 | ||
| 20 | /* | |
| 21 | * construct an arbitrary method from a dispatch table found by looking | |
| 22 | * up a match for the < operation_id, name, property > combination. | |
| 23 | * constructor and destructor are the constructor and destructor for that | |
| 24 | * arbitrary object. | |
| 25 | * | |
| 26 | * These objects are normally cached, unless the provider says not to cache. | |
| 27 | * However, force_cache can be used to force caching whatever the provider | |
| 28 | * says (for example, because the application knows better). | |
| 29 | */ | |
| 30 | typedef struct ossl_method_construct_method_st { | |
| 9067cf6c RL |
31 | /* Get a temporary store */ |
| 32 | void *(*get_tmp_store)(void *data); | |
| e1eafe8c RL |
33 | /* Reserve the appropriate method store */ |
| 34 | int (*lock_store)(void *store, void *data); | |
| 35 | /* Unreserve the appropriate method store */ | |
| 36 | int (*unlock_store)(void *store, void *data); | |
| 9e11fe0d | 37 | /* Get an already existing method from a store */ |
| dc010ca6 | 38 | void *(*get)(void *store, const OSSL_PROVIDER **prov, void *data); |
| 9e11fe0d | 39 | /* Store a method in a store */ |
| 6882652e RL |
40 | int (*put)(void *store, void *method, const OSSL_PROVIDER *prov, |
| 41 | const char *name, const char *propdef, void *data); | |
| 9e11fe0d | 42 | /* Construct a new method */ |
| 36fa4d8a RL |
43 | void *(*construct)(const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov, |
| 44 | void *data); | |
| 9e11fe0d | 45 | /* Destruct a method */ |
| 7bb19a0f | 46 | void (*destruct)(void *method, void *data); |
| 9e11fe0d RL |
47 | } OSSL_METHOD_CONSTRUCT_METHOD; |
| 48 | ||
| b4250010 | 49 | void *ossl_method_construct(OSSL_LIB_CTX *ctx, int operation_id, |
| dc010ca6 | 50 | OSSL_PROVIDER **provider_rw, int force_cache, |
| 9e11fe0d RL |
51 | OSSL_METHOD_CONSTRUCT_METHOD *mcm, void *mcm_data); |
| 52 | ||
| b4250010 | 53 | void ossl_algorithm_do_all(OSSL_LIB_CTX *libctx, int operation_id, |
| a883c02f | 54 | OSSL_PROVIDER *provider, |
| 5a29b628 | 55 | int (*pre)(OSSL_PROVIDER *, int operation_id, |
| 10937d58 | 56 | int no_store, void *data, int *result), |
| e1eafe8c | 57 | int (*reserve_store)(int no_store, void *data), |
| a883c02f RL |
58 | void (*fn)(OSSL_PROVIDER *provider, |
| 59 | const OSSL_ALGORITHM *algo, | |
| 60 | int no_store, void *data), | |
| e1eafe8c | 61 | int (*unreserve_store)(void *data), |
| 5a29b628 RL |
62 | int (*post)(OSSL_PROVIDER *, int operation_id, |
| 63 | int no_store, void *data, int *result), | |
| a883c02f | 64 | void *data); |
| 6c9bc258 | 65 | char *ossl_algorithm_get1_first_name(const OSSL_ALGORITHM *algo); |
| a883c02f | 66 | |
| 4b1f34f1 P |
67 | __owur int ossl_lib_ctx_write_lock(OSSL_LIB_CTX *ctx); |
| 68 | __owur int ossl_lib_ctx_read_lock(OSSL_LIB_CTX *ctx); | |
| 69 | int ossl_lib_ctx_unlock(OSSL_LIB_CTX *ctx); | |
| f12a5690 | 70 | int ossl_lib_ctx_is_child(OSSL_LIB_CTX *ctx); |
| 9e11fe0d | 71 | #endif |