@@ -37,6 +37,8 @@ TPM2_ALG_SHA1 = 0x0004
TPM2_ALG_AES = 0x0006
TPM2_ALG_KEYEDHASH = 0x0008
TPM2_ALG_SHA256 = 0x000B
+TPM2_ALG_SHA384 = 0x000C
+TPM2_ALG_SHA512 = 0x000D
TPM2_ALG_NULL = 0x0010
TPM2_ALG_CBC = 0x0042
TPM2_ALG_CFB = 0x0043
@@ -67,6 +69,8 @@ HR_TRANSIENT = 0x80000000
SHA1_DIGEST_SIZE = 20
SHA256_DIGEST_SIZE = 32
+SHA384_DIGEST_SIZE = 48
+SHA512_DIGEST_SIZE = 64
TPM2_VER0_ERRORS = {
0x000: "TPM_RC_SUCCESS",
@@ -186,16 +190,22 @@ RC_WARN = 0x900
ALG_DIGEST_SIZE_MAP = {
TPM2_ALG_SHA1: SHA1_DIGEST_SIZE,
TPM2_ALG_SHA256: SHA256_DIGEST_SIZE,
+ TPM2_ALG_SHA384: SHA384_DIGEST_SIZE,
+ TPM2_ALG_SHA512: SHA512_DIGEST_SIZE,
}
ALG_HASH_FUNCTION_MAP = {
TPM2_ALG_SHA1: hashlib.sha1,
- TPM2_ALG_SHA256: hashlib.sha256
+ TPM2_ALG_SHA256: hashlib.sha256,
+ TPM2_ALG_SHA384: hashlib.sha384,
+ TPM2_ALG_SHA512: hashlib.sha512,
}
NAME_ALG_MAP = {
"sha1": TPM2_ALG_SHA1,
"sha256": TPM2_ALG_SHA256,
+ "sha384": TPM2_ALG_SHA384,
+ "sha512": TPM2_ALG_SHA512,
}
@@ -29,7 +29,8 @@ class SmokeTest(unittest.TestCase):
def determine_bank_alg(self):
# Probe for available PCR bank
- for bank_alg in [tpm2.TPM2_ALG_SHA1, tpm2.TPM2_ALG_SHA256]:
+ for bank_alg in [tpm2.TPM2_ALG_SHA1, tpm2.TPM2_ALG_SHA256,
+ tpm2.TPM2_ALG_SHA384, tpm2.TPM2_ALG_SHA512]:
try:
handle = self.client.start_auth_session(tpm2.TPM2_SE_TRIAL)
self.client.policy_pcr(handle, [17], bank_alg=bank_alg)