TianoCore EDK2 master
Loading...
Searching...
No Matches
InternalCryptLib.h File Reference
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseCryptLib.h>
#include <stdio.h>
#include <mbedtls/mbedtls_config.h>

Go to the source code of this file.

Functions

INT32 MbedtlsRand (VOID *RngState, UINT8 *Output, UINTN Len)
 
BOOLEAN WrapPkcs7Data (IN CONST UINT8 *P7Data, IN UINTN P7Length, OUT BOOLEAN *WrapFlag, OUT UINT8 **WrapData, OUT UINTN *WrapDataSize)
 

Detailed Description

Internal include file for BaseCryptLib.

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

Definition in file InternalCryptLib.h.

Function Documentation

◆ MbedtlsRand()

INT32 MbedtlsRand ( VOID *  RngState,
UINT8 *  Output,
UINTN  Len 
)

The MbedTLS function f_rng, which MbedtlsRand implements.

Parameters
[in]RngStateNot used, just for compatibility with mbedtls.
[out]OutputPointer to buffer to receive random value.
[in]LenSize of random bytes to generate.
Return values
0Pseudorandom byte stream generated successfully.
Non-0Pseudorandom number generator fails to generate due to lack of entropy.

Definition at line 103 of file CryptRand.c.

◆ WrapPkcs7Data()

BOOLEAN WrapPkcs7Data ( IN CONST UINT8 *  P7Data,
IN UINTN  P7Length,
OUT BOOLEAN *  WrapFlag,
OUT UINT8 **  WrapData,
OUT UINTN WrapDataSize 
)

Check input P7Data is a wrapped ContentInfo structure or not. If not construct a new structure to wrap P7Data.

Caution: This function may receive untrusted input. UEFI Authenticated Variable is external input, so this function will do basic check for PKCS#7 data structure.

Parameters
[in]P7DataPointer to the PKCS#7 message to verify.
[in]P7LengthLength of the PKCS#7 message in bytes.
[out]WrapFlagIf TRUE P7Data is a ContentInfo structure, otherwise return FALSE.
[out]WrapDataIf return status of this function is TRUE: 1) when WrapFlag is TRUE, pointer to P7Data. 2) when WrapFlag is FALSE, pointer to a new ContentInfo structure. It's caller's responsibility to free this buffer.
[out]WrapDataSizeLength of ContentInfo structure in bytes.
Return values
TRUEThe operation is finished successfully.
FALSEThe operation is failed due to lack of resources.

Definition at line 51 of file CryptPkcs7VerifyCommon.c.