REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4177 Add rand function for BaseCryptLibMbedTls. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Yi Li <yi1.li@intel.com> Signed-off-by: Wenxing Hou <wenxing.hou@intel.com> Reviewed-by: Yi Li <yi1.li@intel.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
/** @file
|
|
Internal include file for BaseCryptLib.
|
|
|
|
Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
**/
|
|
|
|
#ifndef INTERNAL_CRYPT_LIB_H_
|
|
#define INTERNAL_CRYPT_LIB_H_
|
|
|
|
#include <Library/BaseLib.h>
|
|
#include <Library/BaseMemoryLib.h>
|
|
#include <Library/MemoryAllocationLib.h>
|
|
#include <Library/DebugLib.h>
|
|
#include <Library/BaseCryptLib.h>
|
|
#include <stdio.h>
|
|
|
|
//
|
|
// We should alwasy add mbedtls/config.h here
|
|
// to ensure the config override takes effect.
|
|
//
|
|
#include <mbedtls/mbedtls_config.h>
|
|
|
|
/**
|
|
The MbedTLS function f_rng, which MbedtlsRand implements.
|
|
|
|
@param[in] RngState Not used, just for compatibility with mbedlts.
|
|
@param[out] Output Pointer to buffer to receive random value.
|
|
@param[in] Len Size of random bytes to generate.
|
|
|
|
@retval 0 Pseudorandom byte stream generated successfully.
|
|
@retval Non-0 Pseudorandom number generator fails to generate due to lack of entropy.
|
|
**/
|
|
INT32
|
|
MbedtlsRand (
|
|
VOID *RngState,
|
|
UINT8 *Output,
|
|
UINTN Len
|
|
);
|
|
#endif
|