2 Ihis is BaseCrypto router support function.
4 Copyright (c) 2013 - 2015, 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.
16 #include <Library/BaseLib.h>
17 #include <Library/BaseMemoryLib.h>
18 #include <Library/Tpm2CommandLib.h>
19 #include <Library/DebugLib.h>
20 #include <Library/MemoryAllocationLib.h>
21 #include <Library/HashLib.h>
22 #include <Protocol/Tcg2Protocol.h>
29 TPM2_HASH_MASK mTpm2HashMask
[] = {
30 {HASH_ALGORITHM_SHA1_GUID
, HASH_ALG_SHA1
},
31 {HASH_ALGORITHM_SHA256_GUID
, HASH_ALG_SHA256
},
32 {HASH_ALGORITHM_SHA384_GUID
, HASH_ALG_SHA384
},
33 {HASH_ALGORITHM_SHA512_GUID
, HASH_ALG_SHA512
},
37 The function get hash mask info from algorithm.
39 @param HashGuid Hash Guid
45 Tpm2GetHashMaskFromAlgo (
50 for (Index
= 0; Index
< sizeof(mTpm2HashMask
)/sizeof(mTpm2HashMask
[0]); Index
++) {
51 if (CompareGuid (HashGuid
, &mTpm2HashMask
[Index
].Guid
)) {
52 return mTpm2HashMask
[Index
].Mask
;
59 The function set digest to digest list.
61 @param DigestList digest list
62 @param Digest digest data
66 Tpm2SetHashToDigestList (
67 IN OUT TPML_DIGEST_VALUES
*DigestList
,
68 IN TPML_DIGEST_VALUES
*Digest
72 &DigestList
->digests
[DigestList
->count
],
74 sizeof(Digest
->digests
[0])