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 "../DxeTpmMeasureBootLibSanitization.h"
Go to the source code of this file.
Macros | |
#define | UNIT_TEST_NAME "DxeTpmMeasureBootLibSanitizationTest" |
#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 | DxeTpmMeasureBootLibUnitTestMain 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 | DxeTpmMeasureBootLibUnitTestMain (IN INT32 Argc, IN CHAR8 *Argv[]) |
This file includes the unit test cases for the DxeTpmMeasureBootLibSanitizationTest.c.
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file DxeTpmMeasureBootLibSanitizationTest.c.
#define DEFAULT_PRIMARY_TABLE_HEADER_NUMBER_OF_PARTITION_ENTRIES 1 |
Definition at line 23 of file DxeTpmMeasureBootLibSanitizationTest.c.
#define DEFAULT_PRIMARY_TABLE_HEADER_REVISION 0x00010000 |
Definition at line 22 of file DxeTpmMeasureBootLibSanitizationTest.c.
#define DEFAULT_PRIMARY_TABLE_HEADER_SIZE_OF_PARTITION_ENTRY 128 |
Definition at line 24 of file DxeTpmMeasureBootLibSanitizationTest.c.
#define DxeTpmMeasureBootLibUnitTestMain main |
Avoid ECC error for function name that starts with lower case letter
Definition at line 369 of file DxeTpmMeasureBootLibSanitizationTest.c.
#define UNIT_TEST_NAME "DxeTpmMeasureBootLibSanitizationTest" |
Definition at line 19 of file DxeTpmMeasureBootLibSanitizationTest.c.
#define UNIT_TEST_VERSION "1.0" |
Definition at line 20 of file DxeTpmMeasureBootLibSanitizationTest.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 381 of file DxeTpmMeasureBootLibSanitizationTest.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 41 of file DxeTpmMeasureBootLibSanitizationTest.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 for an 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 235 of file DxeTpmMeasureBootLibSanitizationTest.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 126 of file DxeTpmMeasureBootLibSanitizationTest.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 180 of file DxeTpmMeasureBootLibSanitizationTest.c.
EFI_STATUS EFIAPI UefiTestMain | ( | VOID | ) |
This function acts as the entry point for the unit tests.
argc | - The number of command line arguments |
argv | - The command line arguments |
Definition at line 324 of file DxeTpmMeasureBootLibSanitizationTest.c.