mirror of
https://github.com/acidanthera/audk.git
synced 2025-08-18 16:18:12 +02:00
This patch adds a protocol for MockRng. This protocol is used to mock the Rng protocol for testing purposes. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
49 lines
1022 B
C
49 lines
1022 B
C
/** @file
|
|
This file declares a mock of Rng Protocol.
|
|
|
|
Copyright (c) Microsoft Corporation.
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
**/
|
|
|
|
#ifndef MOCK_RNG_H_
|
|
#define MOCK_RNG_H_
|
|
|
|
#include <Library/GoogleTestLib.h>
|
|
#include <Library/FunctionMockLib.h>
|
|
|
|
extern "C" {
|
|
#include <Uefi.h>
|
|
#include <Protocol/Rng.h>
|
|
}
|
|
|
|
struct MockRng {
|
|
MOCK_INTERFACE_DECLARATION (MockRng);
|
|
|
|
MOCK_FUNCTION_DECLARATION (
|
|
EFI_STATUS,
|
|
GetInfo,
|
|
(
|
|
IN EFI_RNG_PROTOCOL *This,
|
|
IN OUT UINTN *RNGAlgorithmListSize,
|
|
OUT EFI_RNG_ALGORITHM *RNGAlgorithmList
|
|
)
|
|
);
|
|
|
|
MOCK_FUNCTION_DECLARATION (
|
|
EFI_STATUS,
|
|
GetRng,
|
|
(
|
|
IN EFI_RNG_PROTOCOL *This,
|
|
IN EFI_RNG_ALGORITHM *RNGAlgorithm,
|
|
IN UINTN RNGValueLength,
|
|
OUT UINT8 *RNGValue
|
|
)
|
|
);
|
|
};
|
|
|
|
extern "C" {
|
|
extern EFI_RNG_PROTOCOL *gRngProtocol;
|
|
}
|
|
|
|
#endif // MOCK_RNG_H_
|