TianoCore EDK2 master
|
#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) |
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.
#define KECCAK1600_WIDTH 1600 |
Definition at line 26 of file CryptParallelHash.h.
typedef UINT64 uint64_t |
Definition at line 28 of file CryptParallelHash.h.
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.
[in] | Data | Pointer to the buffer containing the data to be hashed. |
[in] | DataSize | Size of Data buffer in bytes. |
[in] | OutputLen | Size of output in bytes. |
[in] | Name | Pointer to the function name string. |
[in] | NameLen | Size of the function name in bytes. |
[in] | Customization | Pointer to the customization string. |
[in] | CustomizationLen | Size of the customization string in bytes. |
[out] | HashValue | Pointer to a buffer that receives the CSHAKE-256 digest value. |
TRUE | CSHAKE-256 digest computation succeeded. |
FALSE | CSHAKE-256 digest computation failed. |
FALSE | This interface is not supported. |
Definition at line 246 of file CryptCShake256.c.
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.
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.
[out] | Context | Pointer to the context being initialized. |
[in] | Pad | Delimited Suffix. |
[in] | BlockSize | Size of context block. |
[in] | MessageDigestLen | Size of message digest in bytes. |
1 | Initialize successfully. |
0 | Fail to initialize. |
Definition at line 31 of file CryptSha3.c.
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.
[out] | EncBuf | Result of left encode. |
[in] | Value | Input of left encode. |
EncLen | Size of encode result in bytes. |
Definition at line 35 of file CryptXkcp.c.
VOID EFIAPI ParallelHashApExecute | ( | IN VOID * | ProcedureArgument | ) |
Complete computation of digest of each block.
Each AP perform the function called by BSP.
[in] | ProcedureArgument | Argument of the procedure. |
Definition at line 32 of file CryptParallelHash.c.
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.
[out] | EncBuf | Result of right encode. |
[in] | Value | Input of right encode. |
EncLen | Size of encode result in bytes. |
Definition at line 79 of file CryptXkcp.c.
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.
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.
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.
[in,out] | Context | Pointer to the keccak context. |
[out] | MessageDigest | Pointer to a buffer that receives the message digest. |
1 | Meaasge digest computation succeeded. |
Definition at line 137 of file CryptSha3.c.
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.
[in,out] | Context | Pointer to the Keccak context. |
[in] | Data | Pointer to the buffer containing the data to be hashed. |
[in] | DataSize | Size of Data buffer in bytes. |
1 | Update successfully. |
Definition at line 66 of file CryptSha3.c.