2 Implement TPM2 Test related command.
4 Copyright (c) 2013, Intel Corporation. All rights reserved. <BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include <IndustryStandard/UefiTcgPlatform.h>
16 #include <Library/Tpm2CommandLib.h>
17 #include <Library/Tpm2DeviceLib.h>
18 #include <Library/BaseMemoryLib.h>
19 #include <Library/BaseLib.h>
20 #include <Library/DebugLib.h>
25 TPM2_COMMAND_HEADER Header
;
27 } TPM2_SELF_TEST_COMMAND
;
30 TPM2_RESPONSE_HEADER Header
;
31 } TPM2_SELF_TEST_RESPONSE
;
36 This command causes the TPM to perform a test of its capabilities.
37 If the fullTest is YES, the TPM will test all functions.
38 If fullTest = NO, the TPM will only test those functions that have not previously been tested.
40 @param[in] FullTest YES if full test to be performed
41 NO if only test of untested functions required
43 @retval EFI_SUCCESS Operation completed successfully.
44 @retval EFI_DEVICE_ERROR Unexpected device behavior.
49 IN TPMI_YES_NO FullTest
53 TPM2_SELF_TEST_COMMAND Cmd
;
54 TPM2_SELF_TEST_RESPONSE Res
;
57 Cmd
.Header
.tag
= SwapBytes16(TPM_ST_NO_SESSIONS
);
58 Cmd
.Header
.paramSize
= SwapBytes32(sizeof(Cmd
));
59 Cmd
.Header
.commandCode
= SwapBytes32(TPM_CC_SelfTest
);
60 Cmd
.FullTest
= FullTest
;
62 ResultBufSize
= sizeof(Res
);
63 Status
= Tpm2SubmitCommand (sizeof(Cmd
), (UINT8
*)&Cmd
, &ResultBufSize
, (UINT8
*)&Res
);