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