API参考
载入中...
搜索中...
未找到
crypt_provider_local.h
1/*
2 * This file is part of the openHiTLS project.
3 *
4 * openHiTLS is licensed under the Mulan PSL v2.
5 * You can use this software according to the terms and conditions of the Mulan PSL v2.
6 * You may obtain a copy of Mulan PSL v2 at:
7 *
8 * http://license.coscl.org.cn/MulanPSL2
9 *
10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13 * See the Mulan PSL v2 for more details.
14 */
15
21
22#ifndef CRYPT_EAL_PROVIDER_LOCAL_H
23#define CRYPT_EAL_PROVIDER_LOCAL_H
24
25#include "hitls_build.h"
26#ifdef HITLS_CRYPTO_PROVIDER
27#include <stdint.h>
28#include "sal_atomic.h"
29#include "crypt_eal_implprovider.h"
30#include "bsl_list.h"
31#include "eal_drbg_local.h"
32#include "crypt_provider.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif // __cplusplus
37
38#define DEFAULT_PROVIDER_PATH_LEN_MAX 4095
39
40struct EAL_ProviderMgrCtx {
41#ifdef HITLS_BSL_SAL_DL
42 void *handle; // so handle
43#endif
44 void *provCtx;
45 BSL_SAL_RefCount ref;
46 char *providerName;
47 char *providerPath;
48#ifdef HITLS_CRYPTO_ENTROPY_DEFAULT
49 EAL_SeedDrbg providerSeed; // entropy ctx
50#endif
51 struct EAL_LibCtx *libCtx;
52 CRYPT_EAL_ImplProviderInit provInitFunc;
53
54 // out funcs
55 CRYPT_EAL_ProvFreeCb provFreeCb;
56 CRYPT_EAL_ProvQueryCb provQueryCb;
57 CRYPT_EAL_ProvCtrlCb provCtrlCb;
58 CRYPT_EAL_ProvGetCapsCb provGetCap;
59};
60
61int32_t CRYPT_EAL_InitProviderMethod(CRYPT_EAL_ProvMgrCtx *ctx, BSL_Param *param,
62 CRYPT_EAL_ImplProviderInit providerInit);
63CRYPT_EAL_LibCtx *CRYPT_EAL_LibCtxNewInternal(void);
64int32_t CRYPT_EAL_CompareAlgAndAttr(CRYPT_EAL_LibCtx *localCtx, int32_t operaId,
65 int32_t algId, const char *attribute, const CRYPT_EAL_Func **funcs, CRYPT_EAL_ProvMgrCtx **mgrCtx, bool noPushError);
66
67void CRYPT_EAL_ProviderMgrCtxFree(CRYPT_EAL_ProvMgrCtx *ctx);
68
69#ifdef __cplusplus
70}
71#endif // __cplusplus
72
73#endif /* HITLS_CRYPTO_PROVIDER */
74#endif // CRYPT_EAL_PROVIDER_LOCAL_H
int32_t(* CRYPT_EAL_ImplProviderInit)(CRYPT_EAL_ProvMgrCtx *mgrCtx, BSL_Param *param, CRYPT_EAL_Func *capFuncs, CRYPT_EAL_Func **outFuncs, void **provCtx)
Provider initialization function prototype,
定义 crypt_eal_implprovider.h:120
定义 crypt_types.h:952