2019-02-25 08:59:02 +08:00
|
|
|
/*
|
2022-05-03 18:52:38 +08:00
|
|
|
* Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
|
2019-02-25 08:59:02 +08:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OSSL_INTERNAL_CORE_H
|
|
|
|
# define OSSL_INTERNAL_CORE_H
|
2021-02-07 05:14:03 +08:00
|
|
|
# pragma once
|
2019-02-25 08:59:02 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* namespaces:
|
|
|
|
*
|
|
|
|
* ossl_method_ Core Method API
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* construct an arbitrary method from a dispatch table found by looking
|
|
|
|
* up a match for the < operation_id, name, property > combination.
|
|
|
|
* constructor and destructor are the constructor and destructor for that
|
|
|
|
* arbitrary object.
|
|
|
|
*
|
|
|
|
* These objects are normally cached, unless the provider says not to cache.
|
|
|
|
* However, force_cache can be used to force caching whatever the provider
|
|
|
|
* says (for example, because the application knows better).
|
|
|
|
*/
|
|
|
|
typedef struct ossl_method_construct_method_st {
|
2021-06-14 15:25:53 +08:00
|
|
|
/* Get a temporary store */
|
|
|
|
void *(*get_tmp_store)(void *data);
|
2022-04-14 23:52:12 +08:00
|
|
|
/* Reserve the appropriate method store */
|
|
|
|
int (*lock_store)(void *store, void *data);
|
|
|
|
/* Unreserve the appropriate method store */
|
|
|
|
int (*unlock_store)(void *store, void *data);
|
2019-02-25 08:59:02 +08:00
|
|
|
/* Get an already existing method from a store */
|
2021-10-04 21:33:37 +08:00
|
|
|
void *(*get)(void *store, const OSSL_PROVIDER **prov, void *data);
|
2019-02-25 08:59:02 +08:00
|
|
|
/* Store a method in a store */
|
2021-06-15 16:18:19 +08:00
|
|
|
int (*put)(void *store, void *method, const OSSL_PROVIDER *prov,
|
|
|
|
const char *name, const char *propdef, void *data);
|
2019-02-25 08:59:02 +08:00
|
|
|
/* Construct a new method */
|
2019-11-19 16:55:56 +08:00
|
|
|
void *(*construct)(const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov,
|
|
|
|
void *data);
|
2019-02-25 08:59:02 +08:00
|
|
|
/* Destruct a method */
|
2019-03-13 18:12:00 +08:00
|
|
|
void (*destruct)(void *method, void *data);
|
2019-02-25 08:59:02 +08:00
|
|
|
} OSSL_METHOD_CONSTRUCT_METHOD;
|
|
|
|
|
2020-10-15 17:55:50 +08:00
|
|
|
void *ossl_method_construct(OSSL_LIB_CTX *ctx, int operation_id,
|
2021-10-04 21:33:37 +08:00
|
|
|
OSSL_PROVIDER **provider_rw, int force_cache,
|
2019-02-25 08:59:02 +08:00
|
|
|
OSSL_METHOD_CONSTRUCT_METHOD *mcm, void *mcm_data);
|
|
|
|
|
2020-10-15 17:55:50 +08:00
|
|
|
void ossl_algorithm_do_all(OSSL_LIB_CTX *libctx, int operation_id,
|
2019-07-11 05:11:27 +08:00
|
|
|
OSSL_PROVIDER *provider,
|
2020-05-15 21:56:05 +08:00
|
|
|
int (*pre)(OSSL_PROVIDER *, int operation_id,
|
2022-04-21 00:34:09 +08:00
|
|
|
int no_store, void *data, int *result),
|
2022-04-14 23:52:12 +08:00
|
|
|
int (*reserve_store)(int no_store, void *data),
|
2019-07-11 05:11:27 +08:00
|
|
|
void (*fn)(OSSL_PROVIDER *provider,
|
|
|
|
const OSSL_ALGORITHM *algo,
|
|
|
|
int no_store, void *data),
|
2022-04-14 23:52:12 +08:00
|
|
|
int (*unreserve_store)(void *data),
|
2020-05-15 21:56:05 +08:00
|
|
|
int (*post)(OSSL_PROVIDER *, int operation_id,
|
|
|
|
int no_store, void *data, int *result),
|
2019-07-11 05:11:27 +08:00
|
|
|
void *data);
|
2021-04-16 22:22:03 +08:00
|
|
|
char *ossl_algorithm_get1_first_name(const OSSL_ALGORITHM *algo);
|
2019-07-11 05:11:27 +08:00
|
|
|
|
2021-04-07 09:32:59 +08:00
|
|
|
__owur int ossl_lib_ctx_write_lock(OSSL_LIB_CTX *ctx);
|
|
|
|
__owur int ossl_lib_ctx_read_lock(OSSL_LIB_CTX *ctx);
|
|
|
|
int ossl_lib_ctx_unlock(OSSL_LIB_CTX *ctx);
|
2021-04-21 23:51:41 +08:00
|
|
|
int ossl_lib_ctx_is_child(OSSL_LIB_CTX *ctx);
|
2019-02-25 08:59:02 +08:00
|
|
|
#endif
|