diff --git a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc index 0643e38c48..236137470a 100644 --- a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc +++ b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc @@ -71,3 +71,4 @@ MdeModulePkg/Test/Mock/Library/GoogleTest/MockHiiLib/MockHiiLib.inf MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf MdeModulePkg/Test/Mock/Library/GoogleTest/MockVariablePolicyHelperLib/MockVariablePolicyHelperLib.inf + MdeModulePkg/Test/Mock/Library/GoogleTest/MockSecurityManagementLib/MockSecurityManagementLib.inf diff --git a/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockSecurityManagementLib.h b/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockSecurityManagementLib.h new file mode 100644 index 0000000000..59ec205186 --- /dev/null +++ b/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockSecurityManagementLib.h @@ -0,0 +1,54 @@ +/** @file + Google Test mocks for DevicePathLib + + Copyright (c) 2025, Yandex. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef MOCK_SECURITY_MANAGEMENT_LIB_H_ +#define MOCK_SECURITY_MANAGEMENT_LIB_LIB_H_ + +#include +#include +extern "C" { + #include + #include +} + +struct MockSecurityManagementLib { + MOCK_INTERFACE_DECLARATION (MockSecurityManagementLib); + + MOCK_FUNCTION_DECLARATION ( + EFI_STATUS, + RegisterSecurityHandler, + (IN SECURITY_FILE_AUTHENTICATION_STATE_HANDLER SecurityHandler, + IN UINT32 AuthenticationOperation) + ); + + MOCK_FUNCTION_DECLARATION ( + EFI_STATUS, + ExecuteSecurityHandlers, + (IN UINT32 AuthenticationStatus, + IN CONST EFI_DEVICE_PATH_PROTOCOL *FilePath) + ); + + MOCK_FUNCTION_DECLARATION ( + EFI_STATUS, + RegisterSecurity2Handler, + (IN SECURITY2_FILE_AUTHENTICATION_HANDLER Security2Handler, + IN UINT32 AuthenticationOperation) + ); + + MOCK_FUNCTION_DECLARATION ( + EFI_STATUS, + ExecuteSecurity2Handlers, + (IN UINT32 AuthenticationOperation, + IN UINT32 AuthenticationStatus, + IN CONST EFI_DEVICE_PATH_PROTOCOL *File OPTIONAL, + IN VOID *FileBuffer, + IN UINTN FileSize, + IN BOOLEAN BootPolicy) + ); +}; + +#endif // MOCK_SECURITY_MANAGEMENT_LIB_H_ diff --git a/MdeModulePkg/Test/Mock/Library/GoogleTest/MockSecurityManagementLib/MockSecurityManagementLib.cpp b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockSecurityManagementLib/MockSecurityManagementLib.cpp new file mode 100644 index 0000000000..fa3b24bca5 --- /dev/null +++ b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockSecurityManagementLib/MockSecurityManagementLib.cpp @@ -0,0 +1,15 @@ +/** @file + Google Test mocks for SecurityManagementLib + + Copyright (c) 2025, Yandex. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include + +MOCK_INTERFACE_DEFINITION (MockSecurityManagementLib); + +MOCK_FUNCTION_DEFINITION (MockSecurityManagementLib, RegisterSecurityHandler, 2, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockSecurityManagementLib, ExecuteSecurityHandlers, 2, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockSecurityManagementLib, RegisterSecurity2Handler, 2, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockSecurityManagementLib, ExecuteSecurity2Handlers, 6, EFIAPI); diff --git a/MdeModulePkg/Test/Mock/Library/GoogleTest/MockSecurityManagementLib/MockSecurityManagementLib.inf b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockSecurityManagementLib/MockSecurityManagementLib.inf new file mode 100644 index 0000000000..d64e28c5c4 --- /dev/null +++ b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockSecurityManagementLib/MockSecurityManagementLib.inf @@ -0,0 +1,34 @@ +## @file +# Google Test mocks for SecurityManagementLib +# +# Copyright (c) 2025, Yandex. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MockSecurityManagementLib + FILE_GUID = 22FF8498-3FE9-495B-81B7-6595145F5832 + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + LIBRARY_CLASS = SecurityManagementLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MockSecurityManagementLib.cpp + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + +[LibraryClasses] + GoogleTestLib + +[BuildOptions] + MSFT:*_*_*_CC_FLAGS = /EHsc