TianoCore EDK2 master
Loading...
Searching...
No Matches
CryptParallelHash.h File Reference
#include "InternalCryptLib.h"

Go to the source code of this file.

Data Structures

struct  Keccak1600_Ctx
 

Macros

#define KECCAK1600_WIDTH   1600
 

Typedefs

typedef UINT64 uint64_t
 

Functions

size_t SHA3_absorb (uint64_t A[5][5], const unsigned char *inp, size_t len, size_t r)
 
void SHA3_squeeze (uint64_t A[5][5], unsigned char *out, size_t len, size_t r)
 
UINTN EFIAPI LeftEncode (OUT UINT8 *EncBuf, IN UINTN Value)
 
UINTN EFIAPI RightEncode (OUT UINT8 *EncBuf, IN UINTN Value)
 
UINT8 EFIAPI KeccakInit (OUT Keccak1600_Ctx *Context, IN UINT8 Pad, IN UINTN BlockSize, IN UINTN MessageDigstLen)
 
UINT8 EFIAPI Sha3Update (IN OUT Keccak1600_Ctx *Context, IN const VOID *Data, IN UINTN DataSize)
 
UINT8 EFIAPI Sha3Final (IN OUT Keccak1600_Ctx *Context, OUT UINT8 *MessageDigest)
 
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)
 
VOID EFIAPI ParallelHashApExecute (IN VOID *ProcedureArgument)
 
VOID EFIAPI DispatchBlockToAp (VOID)
 

Detailed Description

ParallelHash related function and type declaration.

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

Copyright 2022 The OpenSSL Project Authors. All Rights Reserved. Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html

Copyright 2022 The eXtended Keccak Code Package (XKCP) https://github.com/XKCP/XKCP Keccak, designed by Guido Bertoni, Joan Daemen, Michael Peeters and Gilles Van Assche. Implementation by the designers, hereby denoted as "the implementer". For more information, feedback or questions, please refer to the Keccak Team website: https://keccak.team/ To the extent possible under law, the implementer has waived all copyright and related or neighboring rights to the source code in this file. http://creativecommons.org/publicdomain/zero/1.0/

Definition in file CryptParallelHash.h.

Macro Definition Documentation

◆ KECCAK1600_WIDTH

#define KECCAK1600_WIDTH   1600

Definition at line 26 of file CryptParallelHash.h.

Typedef Documentation

◆ uint64_t

typedef UINT64 uint64_t

Definition at line 28 of file CryptParallelHash.h.

Function Documentation

◆ 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.

◆ DispatchBlockToAp()

VOID EFIAPI DispatchBlockToAp ( VOID  )

Dispatch the block task to each AP.

Dispatch the block task to each AP in PEI phase.

Dispatch the block task to each AP in SMM mode.

Definition at line 19 of file CryptDispatchApDxe.c.

◆ KeccakInit()

UINT8 EFIAPI KeccakInit ( OUT Keccak1600_Ctx Context,
IN UINT8  Pad,
IN UINTN  BlockSize,
IN UINTN  MessageDigestLen 
)

Keccak initial fuction.

Set up state with specified capacity.

Parameters
[out]ContextPointer to the context being initialized.
[in]PadDelimited Suffix.
[in]BlockSizeSize of context block.
[in]MessageDigestLenSize of message digest in bytes.
Return values
1Initialize successfully.
0Fail to initialize.

Definition at line 31 of file CryptSha3.c.

◆ LeftEncode()

UINTN EFIAPI LeftEncode ( OUT UINT8 *  EncBuf,
IN UINTN  Value 
)

Encode function from XKCP.

Encodes the input as a byte string in a way that can be unambiguously parsed from the beginning of the string by inserting the length of the byte string before the byte string representation of input.

Parameters
[out]EncBufResult of left encode.
[in]ValueInput of left encode.
Return values
EncLenSize of encode result in bytes.

Definition at line 35 of file CryptXkcp.c.

◆ ParallelHashApExecute()

VOID EFIAPI ParallelHashApExecute ( IN VOID *  ProcedureArgument)

Complete computation of digest of each block.

Each AP perform the function called by BSP.

Parameters
[in]ProcedureArgumentArgument of the procedure.

Definition at line 32 of file CryptParallelHash.c.

◆ RightEncode()

UINTN EFIAPI RightEncode ( OUT UINT8 *  EncBuf,
IN UINTN  Value 
)

Encode function from XKCP.

Encodes the input as a byte string in a way that can be unambiguously parsed from the end of the string by inserting the length of the byte string after the byte string representation of input.

Parameters
[out]EncBufResult of right encode.
[in]ValueInput of right encode.
Return values
EncLenSize of encode result in bytes.

Definition at line 79 of file CryptXkcp.c.

◆ SHA3_absorb()

size_t SHA3_absorb ( uint64_t  A[5][5],
const unsigned char *  inp,
size_t  len,
size_t  r 
)

SHA3_absorb can be called multiple times, but at each invocation largest multiple of |r| out of |len| bytes are processed. Then remaining amount of bytes is returned. This is done to spare caller trouble of calculating the largest multiple of |r|. |r| can be viewed as blocksize. It is commonly (1600 - 256*n)/8, e.g. 168, 136, 104, 72, but can also be (1600 - 448)/8 = 144. All this means that message padding and intermediate sub-block buffering, byte- or bitwise, is caller's responsibility.

◆ SHA3_squeeze()

void SHA3_squeeze ( uint64_t  A[5][5],
unsigned char *  out,
size_t  len,
size_t  r 
)

SHA3_squeeze is called once at the end to generate |out| hash value of |len| bytes.

◆ Sha3Final()

UINT8 EFIAPI Sha3Final ( IN OUT Keccak1600_Ctx Context,
OUT UINT8 *  MessageDigest 
)

Completes computation of Sha3 message digest.

This function completes sha3 hash computation and retrieves the digest value into the specified memory. After this function has been called, the keccak context cannot be used again.

Parameters
[in,out]ContextPointer to the keccak context.
[out]MessageDigestPointer to a buffer that receives the message digest.
Return values
1Meaasge digest computation succeeded.

Definition at line 137 of file CryptSha3.c.

◆ Sha3Update()

UINT8 EFIAPI Sha3Update ( IN OUT Keccak1600_Ctx Context,
IN const VOID *  Data,
IN UINTN  DataSize 
)

Sha3 update fuction.

This function performs Sha3 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.

Parameters
[in,out]ContextPointer to the Keccak context.
[in]DataPointer to the buffer containing the data to be hashed.
[in]DataSizeSize of Data buffer in bytes.
Return values
1Update successfully.

Definition at line 66 of file CryptSha3.c.