API参考
载入中...
搜索中...
未找到
crypt_util_rand.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 CRYPT_UTIL_RAND_H
17#define CRYPT_UTIL_RAND_H
18
19#include "hitls_build.h"
20#if defined(HITLS_CRYPTO_DRBG) || defined(HITLS_CRYPTO_CURVE25519) || \
21 defined(HITLS_CRYPTO_RSA) || defined(HITLS_CRYPTO_BN_RAND) || defined(HITLS_CRYPTO_SM9)
22
23#include <stdint.h>
24#include "crypt_eal_rand.h"
25#ifdef __cplusplus
26extern "C" {
27#endif
28
34void CRYPT_RandRegist(CRYPT_EAL_RandFunc func);
35
41CRYPT_EAL_RandFunc CRYPT_RandRegistGet(void);
42
53int32_t CRYPT_Rand(uint8_t *rand, uint32_t randLen);
54
60void CRYPT_RandRegistEx(CRYPT_EAL_RandFuncEx func);
61
67CRYPT_EAL_RandFuncEx CRYPT_RandRegistExGet(void);
68
80int32_t CRYPT_RandEx(void *libCtx, uint8_t *rand, uint32_t randLen);
81
82#if defined(HITLS_CRYPTO_EAL)
83#ifdef HITLS_CRYPTO_ENTROPY
89int32_t EAL_SeedDrbgLockInit(void);
90
96void EAL_SeedDrbgLockDeInit(void);
97#endif
98#endif
99
100#ifdef __cplusplus
101}
102#endif
103
104#endif
105
106#endif
int32_t(* CRYPT_EAL_RandFunc)(uint8_t *rand, uint32_t randLen)
rand generate callback
定义 crypt_eal_rand.h:44
int32_t(* CRYPT_EAL_RandFuncEx)(void *ctx, uint8_t *rand, uint32_t randLen)
rand generate callback
定义 crypt_eal_rand.h:66