openHiTLS API openHiTLS 0.1.0-Alpha1
crypt_eal_mac.h
浏览该文件的文档.
1/*---------------------------------------------------------------------------------------------
2 * This file is part of the openHiTLS project.
3 * Copyright © 2023 Huawei Technologies Co.,Ltd. All rights reserved.
4 * Licensed under the openHiTLS Software license agreement 1.0. See LICENSE in the project root
5 * for license information.
6 *---------------------------------------------------------------------------------------------
7 */
8
15#ifndef CRYPT_EAL_MAC_H
16#define CRYPT_EAL_MAC_H
17
18#include <stdbool.h>
19#include <stdint.h>
20#include "crypt_algid.h"
21#include "crypt_types.h"
22#include "crypt_method.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28typedef struct EAL_MacCtx CRYPT_EAL_MacCtx;
29
40
51
59
82int32_t CRYPT_EAL_MacInit(CRYPT_EAL_MacCtx *ctx, const uint8_t *key, uint32_t len);
83
102int32_t CRYPT_EAL_MacUpdate(CRYPT_EAL_MacCtx *ctx, const uint8_t *in, uint32_t len);
103
131int32_t CRYPT_EAL_MacFinal(CRYPT_EAL_MacCtx *ctx, uint8_t *out, uint32_t *len);
132
142
154
163
164#ifdef __cplusplus
165} // end extern "C"
166#endif
167
168#endif // CRYPT_EAL_MAC_H
struct EAL_MacCtx CRYPT_EAL_MacCtx
Definition crypt_eal_mac.h:28
CRYPT_MAC_AlgId
Definition crypt_algid.h:82
uint32_t CRYPT_EAL_GetMacLen(const CRYPT_EAL_MacCtx *ctx)
Through the context, obtain the output MAC length of the corresponding algorithm.
void CRYPT_EAL_MacDeinit(CRYPT_EAL_MacCtx *ctx)
Deinitialization function.
int32_t CRYPT_EAL_MacUpdate(CRYPT_EAL_MacCtx *ctx, const uint8_t *in, uint32_t len)
Continuously input the MAC data.
bool CRYPT_EAL_MacIsValidAlgId(CRYPT_MAC_AlgId id)
Check whether the id is Valid MAC algorithm ID.
CRYPT_EAL_MacCtx * CRYPT_EAL_MacNewCtx(CRYPT_MAC_AlgId id)
Apply for a MAC context.
int32_t CRYPT_EAL_MacFinal(CRYPT_EAL_MacCtx *ctx, uint8_t *out, uint32_t *len)
Output the MAC result.
int32_t CRYPT_EAL_MacInit(CRYPT_EAL_MacCtx *ctx, const uint8_t *key, uint32_t len)
int32_t CRYPT_EAL_MacReinit(CRYPT_EAL_MacCtx *ctx)
Re-initialize with the information retained in ctx.
void CRYPT_EAL_MacFreeCtx(CRYPT_EAL_MacCtx *ctx)
Release the MAC context memory.