16#ifndef CIPHER_MAC_COMMON_H
17#define CIPHER_MAC_COMMON_H
19#include "hitls_build.h"
20#if defined(HITLS_CRYPTO_CBC_MAC) || defined(HITLS_CRYPTO_CMAC)
22#include "crypt_local_types.h"
23#include "crypt_cmac.h"
29#define CIPHER_MAC_MAXBLOCKSIZE 16
31struct Cipher_MAC_Ctx {
32 const EAL_SymMethod *method;
35 uint8_t data[CIPHER_MAC_MAXBLOCKSIZE];
36 uint8_t left[CIPHER_MAC_MAXBLOCKSIZE];
40typedef struct Cipher_MAC_Ctx Cipher_MAC_Common_Ctx;
42#ifdef HITLS_CRYPTO_CBC_MAC
44 Cipher_MAC_Common_Ctx common;
45 CRYPT_PaddingType paddingType;
49int32_t CipherMacInitCtx(Cipher_MAC_Common_Ctx *ctx,
const EAL_SymMethod *method);
51void CipherMacDeinitCtx(Cipher_MAC_Common_Ctx *ctx);
53int32_t CipherMacInit(Cipher_MAC_Common_Ctx *ctx,
const uint8_t *key, uint32_t len);
55int32_t CipherMacUpdate(Cipher_MAC_Common_Ctx *ctx,
const uint8_t *in, uint32_t len);
57int32_t CipherMacReinit(Cipher_MAC_Common_Ctx *ctx);
59int32_t CipherMacDeinit(Cipher_MAC_Common_Ctx *ctx);
61int32_t CipherMacGetMacLen(
const Cipher_MAC_Common_Ctx *ctx,
void *val, uint32_t len);
定义 crypt_local_types.h:241