/** @file\r
Implement TPM2 Sequences related command.\r
\r
-Copyright (c) 2013, Intel Corporation. All rights reserved. <BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved. <BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
@param[in] HashAlg The hash algorithm to use for the hash sequence\r
An Event sequence starts if this is TPM_ALG_NULL.\r
@param[out] SequenceHandle A handle to reference the sequence\r
- \r
+\r
@retval EFI_SUCCESS Operation completed successfully.\r
@retval EFI_DEVICE_ERROR Unexpected device behavior.\r
**/\r
\r
@param[in] SequenceHandle Handle for the sequence object\r
@param[in] Buffer Data to be added to hash\r
- \r
+\r
@retval EFI_SUCCESS Operation completed successfully.\r
@retval EFI_DEVICE_ERROR Unexpected device behavior.\r
**/\r
@param[in] SequenceHandle Authorization for the sequence\r
@param[in] Buffer Data to be added to the Event\r
@param[out] Results List of digests computed for the PCR\r
- \r
+\r
@retval EFI_SUCCESS Operation completed successfully.\r
@retval EFI_DEVICE_ERROR Unexpected device behavior.\r
**/\r
\r
// count\r
Results->count = SwapBytes32(ReadUnaligned32 ((UINT32 *)BufferPtr));\r
+ if (Results->count > HASH_COUNT) {\r
+ DEBUG ((DEBUG_ERROR, "Tpm2EventSequenceComplete - Results->count error %x\n", Results->count));\r
+ return EFI_DEVICE_ERROR;\r
+ }\r
+\r
BufferPtr += sizeof(UINT32);\r
\r
for (Index = 0; Index < Results->count; Index++) {\r
@param[in] SequenceHandle Authorization for the sequence\r
@param[in] Buffer Data to be added to the hash/HMAC\r
@param[out] Result The returned HMAC or digest in a sized buffer\r
- \r
+\r
@retval EFI_SUCCESS Operation completed successfully.\r
@retval EFI_DEVICE_ERROR Unexpected device behavior.\r
**/\r
\r
// digestSize\r
Result->size = SwapBytes16(ReadUnaligned16 ((UINT16 *)BufferPtr));\r
+ if (Result->size > sizeof(TPMU_HA)){\r
+ DEBUG ((DEBUG_ERROR, "Tpm2SequenceComplete - Result->size error %x\n", Result->size));\r
+ return EFI_DEVICE_ERROR;\r
+ }\r
+\r
BufferPtr += sizeof(UINT16);\r
\r
CopyMem(\r