TianoCore EDK2 master
Loading...
Searching...
No Matches
CryptCShake256.c File Reference

Go to the source code of this file.

Macros

#define CSHAKE256_SECURITY_STRENGTH   256
 
#define CSHAKE256_RATE_IN_BYTES   136
 

Functions

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 CShake256Update (IN OUT VOID *CShake256Context, IN CONST VOID *Data, IN UINTN DataSize)
 
BOOLEAN EFIAPI CShake256Final (IN OUT VOID *CShake256Context, OUT UINT8 *HashValue)
 
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)
 

Variables

CONST CHAR8 mZeroPadding [CSHAKE256_RATE_IN_BYTES] = { 0 }
 

Detailed Description

cSHAKE-256 Digest Wrapper Implementations.

Copyright (c) 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file CryptCShake256.c.

Macro Definition Documentation

◆ CSHAKE256_RATE_IN_BYTES

#define CSHAKE256_RATE_IN_BYTES   136

Definition at line 12 of file CryptCShake256.c.

◆ CSHAKE256_SECURITY_STRENGTH

#define CSHAKE256_SECURITY_STRENGTH   256

Definition at line 11 of file CryptCShake256.c.

Function Documentation

◆ CShake256Final()

BOOLEAN EFIAPI CShake256Final ( IN OUT VOID *  CShake256Context,
OUT UINT8 *  HashValue 
)

Completes computation of the cSHAKE-256 digest value.

This function completes cSHAKE-256 hash computation and retrieves the digest value into the specified memory. After this function has been called, the cSHAKE-256 context cannot be used again. cSHAKE-256 context should be already correctly initialized by CShake256Init(), and should not be finalized by CShake256Final(). Behavior with invalid cSHAKE-256 context is undefined.

Parameters
[in,out]CShake256ContextPointer to the cSHAKE-256 context.
[out]HashValuePointer to a buffer that receives the cSHAKE-256 digest value.
Return values
TRUEcSHAKE-256 digest computation succeeded.
FALSEcSHAKE-256 digest computation failed.
FALSEThis interface is not supported.

Definition at line 205 of file CryptCShake256.c.

◆ CShake256HashAll()

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 
)

Computes the CSHAKE-256 message digest of a input data buffer.

This function performs the CSHAKE-256 message digest of a given data buffer, and places the digest value into the specified memory.

Parameters
[in]DataPointer to the buffer containing the data to be hashed.
[in]DataSizeSize of Data buffer in bytes.
[in]OutputLenSize of output in bytes.
[in]NamePointer to the function name string.
[in]NameLenSize of the function name in bytes.
[in]CustomizationPointer to the customization string.
[in]CustomizationLenSize of the customization string in bytes.
[out]HashValuePointer to a buffer that receives the CSHAKE-256 digest value.
Return values
TRUECSHAKE-256 digest computation succeeded.
FALSECSHAKE-256 digest computation failed.
FALSEThis interface is not supported.

Definition at line 246 of file CryptCShake256.c.

◆ CShake256Init()

BOOLEAN EFIAPI CShake256Init ( OUT VOID *  CShake256Context,
IN UINTN  OutputLen,
IN CONST VOID *  Name,
IN UINTN  NameLen,
IN CONST VOID *  Customization,
IN UINTN  CustomizationLen 
)

CShake256 initial function.

Initializes user-supplied memory pointed by CShake256Context as cSHAKE-256 hash context for subsequent use.

Parameters
[out]CShake256ContextPointer to cSHAKE-256 context being initialized.
[in]OutputLenThe desired number of output length in bytes.
[in]NamePointer to the function name string.
[in]NameLenThe length of the function name in bytes.
[in]CustomizationPointer to the customization string.
[in]CustomizationLenThe length of the customization string in bytes.
Return values
TRUEcSHAKE-256 context initialization succeeded.
FALSEcSHAKE-256 context initialization failed.
FALSEThis interface is not supported.

Definition at line 35 of file CryptCShake256.c.

◆ CShake256Update()

BOOLEAN EFIAPI CShake256Update ( IN OUT VOID *  CShake256Context,
IN CONST VOID *  Data,
IN UINTN  DataSize 
)

Digests the input data and updates cSHAKE-256 context.

This function performs cSHAKE-256 digest on a data buffer of the specified size. It can be called multiple times to compute the digest of long or discontinuous data streams. cSHAKE-256 context should be already correctly initialized by CShake256Init(), and should not be finalized by CShake256Final(). Behavior with invalid context is undefined.

Parameters
[in,out]CShake256ContextPointer to the cSHAKE-256 context.
[in]DataPointer to the buffer containing the data to be hashed.
[in]DataSizeSize of Data buffer in bytes.
Return values
TRUEcSHAKE-256 data digest succeeded.
FALSEcSHAKE-256 data digest failed.
FALSEThis interface is not supported.

Definition at line 162 of file CryptCShake256.c.

Variable Documentation

◆ mZeroPadding

CONST CHAR8 mZeroPadding[CSHAKE256_RATE_IN_BYTES] = { 0 }

Definition at line 14 of file CryptCShake256.c.