From c1b16825ee2d9f74cd834fd6aa89ed685a0d500b Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Tue, 11 Jun 2019 10:02:12 -0400 Subject: [PATCH] tpm2: rev155: Remove ObjectGetNameAlg() Signed-off-by: Stefan Berger --- src/tpm2/Object.c | 10 ---------- src/tpm2/Object_fp.h | 4 ---- src/tpm2/Object_spt.c | 10 +++++----- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/tpm2/Object.c b/src/tpm2/Object.c index a70254c5..43999b6e 100644 --- a/src/tpm2/Object.c +++ b/src/tpm2/Object.c @@ -182,16 +182,6 @@ HandleToObject( pAssert(s_objects[index].attributes.occupied); return &s_objects[index]; } -/* 8.6.3.8 ObjectGetNameAlg() */ -/* This function is used to get the Name algorithm of a object. */ -/* This function requires that object references a loaded object. */ -TPMI_ALG_HASH -ObjectGetNameAlg( - OBJECT *object // IN: handle of the object - ) -{ - return object->publicArea.nameAlg; -} /* 8.6.3.9 GetQualifiedName() */ /* This function returns the Qualified Name of the object. In this implementation, the Qualified Name is computed when the object is loaded and is saved in the internal representation of the diff --git a/src/tpm2/Object_fp.h b/src/tpm2/Object_fp.h index 10982f71..21dac136 100644 --- a/src/tpm2/Object_fp.h +++ b/src/tpm2/Object_fp.h @@ -95,10 +95,6 @@ GetName( TPMI_DH_OBJECT handle, // IN: handle of the object NAME *name // OUT: name of the object ); -TPMI_ALG_HASH -ObjectGetNameAlg( - OBJECT *object // IN: handle of the object - ); void GetQualifiedName( TPMI_DH_OBJECT handle, // IN: handle of the object diff --git a/src/tpm2/Object_spt.c b/src/tpm2/Object_spt.c index 6438ddba..1bbe933a 100644 --- a/src/tpm2/Object_spt.c +++ b/src/tpm2/Object_spt.c @@ -926,7 +926,7 @@ SensitiveToPrivate( else { // Otherwise, using parent's name algorithm - hashAlg = ObjectGetNameAlg(parent); + hashAlg = parent->publicArea.nameAlg; } // Starting of sensitive data without wrappers sensitiveData = outPrivate->t.buffer; @@ -993,7 +993,7 @@ PrivateToSensitive( else { // Otherwise, using parent's name algorithm - hashAlg = ObjectGetNameAlg(parent); + hashAlg = parent->publicArea.nameAlg; } // unwrap outer result = UnwrapOuter(parent, name, hashAlg, NULL, TRUE, @@ -1083,7 +1083,7 @@ SensitiveToDuplicate( { doOuterWrap = TRUE; // Use parent nameAlg as outer hash algorithm - outerHash = ObjectGetNameAlg(parent); + outerHash = parent->publicArea.nameAlg; // Adjust sensitive data pointer sensitiveData += sizeof(UINT16) + CryptHashGetDigestSize(outerHash); } @@ -1247,7 +1247,7 @@ SecretToCredential( UINT16 dataSize; // data blob size pAssert(secret != NULL && outIDObject != NULL); // use protector's name algorithm as outer hash - outerHash = ObjectGetNameAlg(protector); + outerHash = protector->publicArea.nameAlg; // Marshal secret area to credential buffer, leave space for integrity sensitiveData = outIDObject->t.credential + sizeof(UINT16) + CryptHashGetDigestSize(outerHash); @@ -1286,7 +1286,7 @@ CredentialToSecret( BYTE *sensitiveData; // pointer to the sensitive data UINT16 dataSize; // use protector's name algorithm as outer hash - outerHash = ObjectGetNameAlg(protector); + outerHash = protector->publicArea.nameAlg; // Unwrap outer, a TPM_RC_INTEGRITY error may be returned at this point result = UnwrapOuter(protector, name, outerHash, seed, FALSE, inIDObject->size, inIDObject->buffer);