TianoCore EDK2 master
|
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/DebugLib.h>
#include <Library/UnitTestLib.h>
#include <Protocol/BlockIo.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/BaseMemoryLib.h>
#include <IndustryStandard/UefiTcgPlatform.h>
#include <Protocol/Tcg2Protocol.h>
#include "../DxeTpm2MeasureBootLibSanitization.h"
Go to the source code of this file.
Macros | |
#define | UNIT_TEST_NAME "DxeTpm2MeasureBootLibSanitizationTest" |
#define | UNIT_TEST_VERSION "1.0" |
#define | DEFAULT_PRIMARY_TABLE_HEADER_REVISION 0x00010000 |
#define | DEFAULT_PRIMARY_TABLE_HEADER_NUMBER_OF_PARTITION_ENTRIES 1 |
#define | DEFAULT_PRIMARY_TABLE_HEADER_SIZE_OF_PARTITION_ENTRY 128 |
#define | DxeTpm2MeasureBootLibUnitTestMain main |
Functions | |
UNIT_TEST_STATUS EFIAPI | TestSanitizeEfiPartitionTableHeader (IN UNIT_TEST_CONTEXT Context) |
UNIT_TEST_STATUS EFIAPI | TestSanitizePrimaryHeaderAllocationSize (IN UNIT_TEST_CONTEXT Context) |
UNIT_TEST_STATUS EFIAPI | TestSanitizePrimaryHeaderGptEventSize (IN UNIT_TEST_CONTEXT Context) |
UNIT_TEST_STATUS EFIAPI | TestSanitizePeImageEventSize (IN UNIT_TEST_CONTEXT Context) |
EFI_STATUS EFIAPI | UefiTestMain (VOID) |
INT32 | DxeTpm2MeasureBootLibUnitTestMain (IN INT32 Argc, IN CHAR8 *Argv[]) |
This file includes the unit test cases for the DxeTpm2MeasureBootLibSanitizationTest.c.
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file DxeTpm2MeasureBootLibSanitizationTest.c.
#define DEFAULT_PRIMARY_TABLE_HEADER_NUMBER_OF_PARTITION_ENTRIES 1 |
Definition at line 24 of file DxeTpm2MeasureBootLibSanitizationTest.c.
#define DEFAULT_PRIMARY_TABLE_HEADER_REVISION 0x00010000 |
Definition at line 23 of file DxeTpm2MeasureBootLibSanitizationTest.c.
#define DEFAULT_PRIMARY_TABLE_HEADER_SIZE_OF_PARTITION_ENTRY 128 |
Definition at line 25 of file DxeTpm2MeasureBootLibSanitizationTest.c.
#define DxeTpm2MeasureBootLibUnitTestMain main |
Avoid ECC error for function name that starts with lower case letter
Definition at line 327 of file DxeTpm2MeasureBootLibSanitizationTest.c.
#define UNIT_TEST_NAME "DxeTpm2MeasureBootLibSanitizationTest" |
Definition at line 20 of file DxeTpm2MeasureBootLibSanitizationTest.c.
#define UNIT_TEST_VERSION "1.0" |
Definition at line 21 of file DxeTpm2MeasureBootLibSanitizationTest.c.
Standard POSIX C entry point for host based unit test execution.
[in] | Argc | Number of arguments |
[in] | Argv | Array of pointers to arguments |
0 | Success |
other | Error |
Definition at line 339 of file DxeTpm2MeasureBootLibSanitizationTest.c.
UNIT_TEST_STATUS EFIAPI TestSanitizeEfiPartitionTableHeader | ( | IN UNIT_TEST_CONTEXT | Context | ) |
This function tests the SanitizeEfiPartitionTableHeader function. It's intent is to test that a malicious EFI_PARTITION_TABLE_HEADER structure will not cause undefined or unexpected behavior.
In general the TPM should still be able to measure the data, but be the header should be sanitized to prevent any unexpected behavior.
[in] | Context | The unit test context. |
UNIT_TEST_PASSED | The test passed. |
UNIT_TEST_ERROR_TEST_FAILED | The test failed. |
Definition at line 42 of file DxeTpm2MeasureBootLibSanitizationTest.c.
UNIT_TEST_STATUS EFIAPI TestSanitizePeImageEventSize | ( | IN UNIT_TEST_CONTEXT | Context | ) |
This function tests the SanitizePeImageEventSize function. It's intent is to test that the untrusted input from a file path when generating a EFI_IMAGE_LOAD_EVENT structure will not cause an overflow when calculating the event size when allocating space
[in] | Context | The unit test context. |
UNIT_TEST_PASSED | The test passed. |
UNIT_TEST_ERROR_TEST_FAILED | The test failed. |
Definition at line 236 of file DxeTpm2MeasureBootLibSanitizationTest.c.
UNIT_TEST_STATUS EFIAPI TestSanitizePrimaryHeaderAllocationSize | ( | IN UNIT_TEST_CONTEXT | Context | ) |
This function tests the SanitizePrimaryHeaderAllocationSize function. It's intent is to test that the untrusted input from a EFI_PARTITION_TABLE_HEADER structure will not cause an overflow when calculating the allocation size.
[in] | Context | The unit test context. |
UNIT_TEST_PASSED | The test passed. |
UNIT_TEST_ERROR_TEST_FAILED | The test failed. |
Definition at line 127 of file DxeTpm2MeasureBootLibSanitizationTest.c.
UNIT_TEST_STATUS EFIAPI TestSanitizePrimaryHeaderGptEventSize | ( | IN UNIT_TEST_CONTEXT | Context | ) |
This function tests the SanitizePrimaryHeaderGptEventSize function. It's intent is to test that the untrusted input from a EFI_GPT_DATA structure will not cause an overflow when calculating the event size.
[in] | Context | The unit test context. |
UNIT_TEST_PASSED | The test passed. |
UNIT_TEST_ERROR_TEST_FAILED | The test failed. |
Definition at line 181 of file DxeTpm2MeasureBootLibSanitizationTest.c.
EFI_STATUS EFIAPI UefiTestMain | ( | VOID | ) |
This function acts as the entry point for the unit tests.
UNIT_TEST_PASSED | The test passed. |
UNIT_TEST_ERROR_TEST_FAILED | The test failed. |
others | The test failed. |
Definition at line 282 of file DxeTpm2MeasureBootLibSanitizationTest.c.