API参考
载入中...
搜索中...
未找到
crypt_hmac.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_HMAC_H
17#define CRYPT_HMAC_H
18
19#include "hitls_build.h"
20#ifdef HITLS_CRYPTO_HMAC
21
22#include <stdint.h>
23#include "crypt_local_types.h"
24#include "bsl_params.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif /* __cplusplus */
29
30#define HMAC_MAXBLOCKSIZE 144
31#define HMAC_MAXOUTSIZE 64
32
33typedef struct HMAC_Ctx CRYPT_HMAC_Ctx;
34
35CRYPT_HMAC_Ctx *CRYPT_HMAC_NewCtx(CRYPT_MAC_AlgId id);
36CRYPT_HMAC_Ctx *CRYPT_HMAC_NewCtxEx(void *libCtx, CRYPT_MAC_AlgId id);
37int32_t CRYPT_HMAC_Init(CRYPT_HMAC_Ctx *ctx, const uint8_t *key, uint32_t len);
38int32_t CRYPT_HMAC_InitEx(CRYPT_HMAC_Ctx *ctx, const uint8_t *key, uint32_t len, BSL_Param *param);
39int32_t CRYPT_HMAC_Update(CRYPT_HMAC_Ctx *ctx, const uint8_t *in, uint32_t len);
40int32_t CRYPT_HMAC_Final(CRYPT_HMAC_Ctx *ctx, uint8_t *out, uint32_t *len);
41int32_t CRYPT_HMAC_Reinit(CRYPT_HMAC_Ctx *ctx);
42int32_t CRYPT_HMAC_Deinit(CRYPT_HMAC_Ctx *ctx);
43uint32_t CRYPT_HMAC_GetMacLen(CRYPT_HMAC_Ctx *ctx);
44int32_t CRYPT_HMAC_Ctrl(CRYPT_HMAC_Ctx *ctx, uint32_t opt, void *val, uint32_t len);
45#ifdef HITLS_CRYPTO_PROVIDER
46int32_t CRYPT_HMAC_SetParam(CRYPT_HMAC_Ctx *ctx, const BSL_Param *param);
47#else
48#define CRYPT_HMAC_SetParam NULL
49#endif // HITLS_CRYPTO_PROVIDER
50void CRYPT_HMAC_FreeCtx(CRYPT_HMAC_Ctx *ctx);
51CRYPT_HMAC_Ctx *CRYPT_HMAC_DupCtx(const CRYPT_HMAC_Ctx *macCtx);
52
53#ifdef __cplusplus
54}
55#endif /* __cplusplus */
56
57#endif // HITLS_CRYPTO_HMAC
58
59#endif // CRYPT_HMAC_H
CRYPT_MAC_AlgId
定义 crypt_algid.h:91