API参考
载入中...
搜索中...
未找到
eal_drbg_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
16#ifndef EAL_DRBG_LOCAL_H
17#define EAL_DRBG_LOCAL_H
18
19#include "hitls_build.h"
20#if defined(HITLS_CRYPTO_EAL) && defined(HITLS_CRYPTO_DRBG)
21
22#include <stdint.h>
23#include "bsl_sal.h"
24
25#include "crypt_eal_rand.h"
26#include "sal_atomic.h"
27#include "crypt_local_types.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif // __cplusplus
32
33struct EAL_RndCtx {
34 bool isProvider;
36 EAL_RandUnitaryMethod *meth;
37 void *ctx;
38 bool working; // whether the system is in the working state
39 bool isDefaultSeed;
40 BSL_SAL_ThreadLockHandle lock; // thread lock
41};
42
43typedef struct {
44 CRYPT_RAND_AlgId id; // seed-drbg algorithm
45 CRYPT_EAL_RndCtx *seed; // seed-drbg
46 void *seedCtx; // seed-drbg entropy source handle
47 CRYPT_RandSeedMethod seedMeth; // seed-drbg entropy source implementation function
48 BSL_SAL_RefCount references;
49} EAL_SeedDrbg;
50
51int32_t EAL_SeedDrbgInit(EAL_SeedDrbg *seedDrbg);
52
53void EAL_SeedDrbgEntropyMeth(CRYPT_RandSeedMethod *meth);
54
55void EAL_SeedDrbgRandDeinit(CRYPT_EAL_RndCtx *rndCtx);
56
62void EAL_RandDeinit(CRYPT_EAL_RndCtx *ctx);
63
69EAL_RandUnitaryMethod* EAL_RandGetMethod(void);
70
77int32_t EAL_GetDefaultSeed(CRYPT_RandSeedMethod *seedMeth, void **seedCtx);
78
79#ifdef __cplusplus
80}
81#endif // __cplusplus
82
83#endif // HITLS_CRYPTO_DRBG
84
85#endif // EAL_DRBG_LOCAL_H
void * BSL_SAL_ThreadLockHandle
定义 bsl_sal.h:63
CRYPT_RAND_AlgId
定义 crypt_algid.h:41
定义 sal_atomic.h:88
定义 crypt_types.h:587
定义 crypt_local_types.h:375