11#define CSHAKE256_SECURITY_STRENGTH 256
12#define CSHAKE256_RATE_IN_BYTES 136
14CONST CHAR8 mZeroPadding[CSHAKE256_RATE_IN_BYTES] = { 0 };
36 OUT VOID *CShake256Context,
45 UINT8 EncBuf[
sizeof (
UINTN) + 1];
53 if ((CShake256Context ==
NULL) || (OutputLen == 0) || ((NameLen != 0) && (Name ==
NULL)) || ((CustomizationLen != 0) && (Customization ==
NULL))) {
60 if ((NameLen == 0) && (CustomizationLen == 0)) {
68 (KECCAK1600_WIDTH - CSHAKE256_SECURITY_STRENGTH * 2) / 8,
77 (KECCAK1600_WIDTH - CSHAKE256_SECURITY_STRENGTH * 2) / 8,
88 EncLen =
LeftEncode (EncBuf, CSHAKE256_RATE_IN_BYTES);
111 AbsorbLen += NameLen;
116 EncLen =
LeftEncode (EncBuf, CustomizationLen * 8);
128 AbsorbLen += CustomizationLen;
133 PadLen = CSHAKE256_RATE_IN_BYTES - AbsorbLen % CSHAKE256_RATE_IN_BYTES;
163 IN OUT VOID *CShake256Context,
171 if (CShake256Context ==
NULL) {
178 if ((Data ==
NULL) && (DataSize != 0)) {
206 IN OUT VOID *CShake256Context,
213 if ((CShake256Context ==
NULL) || (HashValue ==
NULL)) {
263 if (HashValue ==
NULL) {
267 if ((Data ==
NULL) && (DataSize != 0)) {
271 Status =
CShake256Init (&Ctx, OutputLen, Name, NameLen, Customization, CustomizationLen);
BOOLEAN EFIAPI CShake256Init(OUT VOID *CShake256Context, IN UINTN OutputLen, IN CONST VOID *Name, IN UINTN NameLen, IN CONST VOID *Customization, IN UINTN CustomizationLen)
BOOLEAN EFIAPI CShake256Final(IN OUT VOID *CShake256Context, OUT UINT8 *HashValue)
BOOLEAN EFIAPI CShake256Update(IN OUT VOID *CShake256Context, IN CONST VOID *Data, IN UINTN DataSize)
BOOLEAN EFIAPI CShake256HashAll(IN CONST VOID *Data, IN UINTN DataSize, IN UINTN OutputLen, IN CONST VOID *Name, IN UINTN NameLen, IN CONST VOID *Customization, IN UINTN CustomizationLen, OUT UINT8 *HashValue)
UINTN EFIAPI LeftEncode(OUT UINT8 *EncBuf, IN UINTN Value)
UINT8 EFIAPI KeccakInit(OUT Keccak1600_Ctx *Context, IN UINT8 Pad, IN UINTN BlockSize, IN UINTN MessageDigstLen)
UINT8 EFIAPI Sha3Final(IN OUT Keccak1600_Ctx *Context, OUT UINT8 *MessageDigest)
UINT8 EFIAPI Sha3Update(IN OUT Keccak1600_Ctx *Context, IN const VOID *Data, IN UINTN DataSize)