Path: blob/main/crypto/openssl/include/internal/core.h
34879 views
/*1* Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.2*3* Licensed under the Apache License 2.0 (the "License"). You may not use4* this file except in compliance with the License. You can obtain a copy5* in the file LICENSE in the source distribution or at6* https://www.openssl.org/source/license.html7*/89#ifndef OSSL_INTERNAL_CORE_H10# define OSSL_INTERNAL_CORE_H11# pragma once1213/*14* namespaces:15*16* ossl_method_ Core Method API17*/1819/*20* construct an arbitrary method from a dispatch table found by looking21* up a match for the < operation_id, name, property > combination.22* constructor and destructor are the constructor and destructor for that23* 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 provider27* says (for example, because the application knows better).28*/29typedef struct ossl_method_construct_method_st {30/* Get a temporary store */31void *(*get_tmp_store)(void *data);32/* Reserve the appropriate method store */33int (*lock_store)(void *store, void *data);34/* Unreserve the appropriate method store */35int (*unlock_store)(void *store, void *data);36/* Get an already existing method from a store */37void *(*get)(void *store, const OSSL_PROVIDER **prov, void *data);38/* Store a method in a store */39int (*put)(void *store, void *method, const OSSL_PROVIDER *prov,40const char *name, const char *propdef, void *data);41/* Construct a new method */42void *(*construct)(const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov,43void *data);44/* Destruct a method */45void (*destruct)(void *method, void *data);46} OSSL_METHOD_CONSTRUCT_METHOD;4748void *ossl_method_construct(OSSL_LIB_CTX *ctx, int operation_id,49OSSL_PROVIDER **provider_rw, int force_cache,50OSSL_METHOD_CONSTRUCT_METHOD *mcm, void *mcm_data);5152void ossl_algorithm_do_all(OSSL_LIB_CTX *libctx, int operation_id,53OSSL_PROVIDER *provider,54int (*pre)(OSSL_PROVIDER *, int operation_id,55int no_store, void *data, int *result),56int (*reserve_store)(int no_store, void *data),57void (*fn)(OSSL_PROVIDER *provider,58const OSSL_ALGORITHM *algo,59int no_store, void *data),60int (*unreserve_store)(void *data),61int (*post)(OSSL_PROVIDER *, int operation_id,62int no_store, void *data, int *result),63void *data);64char *ossl_algorithm_get1_first_name(const OSSL_ALGORITHM *algo);6566__owur int ossl_lib_ctx_write_lock(OSSL_LIB_CTX *ctx);67__owur int ossl_lib_ctx_read_lock(OSSL_LIB_CTX *ctx);68int ossl_lib_ctx_unlock(OSSL_LIB_CTX *ctx);69int ossl_lib_ctx_is_child(OSSL_LIB_CTX *ctx);70#endif717273