API参考
载入中...
搜索中...
未找到
eal_md_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_MD_LOCAL_H
17#define EAL_MD_LOCAL_H
18
19#include "hitls_build.h"
20#if defined(HITLS_CRYPTO_EAL) && defined(HITLS_CRYPTO_MD)
21
22#include <stdint.h>
23#include "crypt_algid.h"
24#include "crypt_local_types.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif // __cplusplus
29
30typedef enum {
31 CRYPT_MD_STATE_NEW = 0,
32 CRYPT_MD_STATE_INIT,
33 CRYPT_MD_STATE_UPDATE,
34 CRYPT_MD_STATE_FINAL,
35 CRYPT_MD_STATE_SQUEEZE
36} CRYPT_MD_WORKSTATE;
37
38struct EAL_MdCtx {
39 EAL_MdMethod method; /* algorithm operation entity */
40#ifdef HITLS_CRYPTO_MD_MB
41 EAL_MdMBMethod mbMethod; /* multi-buffer operation entity */
42#endif
43 void *data; /* Algorithm ctx, mainly context */
44 uint32_t state;
46};
47
48#ifdef HITLS_CRYPTO_MD_MB
49EAL_MdMBMethod *EAL_MdFindMbMethod(CRYPT_MD_AlgId id, EAL_MdMBMethod *method);
50#endif
51
60const EAL_MdMethod *EAL_MdFindDefaultMethod(CRYPT_MD_AlgId id);
61
79EAL_MdMethod *EAL_MdFindMethod(CRYPT_MD_AlgId id, EAL_MdMethod *method);
80
102EAL_MdMethod *EAL_MdFindMethodEx(CRYPT_MD_AlgId id, void *libCtx, const char *attrName, EAL_MdMethod *method,
103 void **provCtx, bool isProvider);
104
121int32_t EAL_Md(CRYPT_MD_AlgId id, void *libCtx, const char *attr, const uint8_t *in, uint32_t inLen, uint8_t *out,
122 uint32_t *outLen, bool checkSignId, bool isProvider);
123
124#ifdef __cplusplus
125}
126#endif // __cplusplus
127
128#endif // HITLS_CRYPTO_MD
129
130#endif // EAL_MD_LOCAL_H
CRYPT_MD_AlgId
定义 crypt_algid.h:68
定义 crypt_local_types.h:63