mirror of
https://github.com/stefanberger/libtpms
synced 2025-12-31 02:55:54 +00:00
tpm2: Move code to determine OBJECT hierarchy by its attribute flags
Move code that determines an OBJECT's hierarchy by its attribute flags into BackwardsCompatibilityObject.c since it will soon only serve the purpose of backwards compatibility. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
fade216e73
commit
ef4af2f0de
@ -151,6 +151,20 @@ typedef struct RSA2048_OBJECT
|
||||
|
||||
MUST_BE(sizeof(RSA2048_OBJECT) == 1896);
|
||||
|
||||
TPMI_RH_HIERARCHY ObjectGetHierarchyFromAttributes(OBJECT* object)
|
||||
{
|
||||
if(object->attributes.spsHierarchy)
|
||||
return TPM_RH_OWNER;
|
||||
|
||||
if(object->attributes.epsHierarchy)
|
||||
return TPM_RH_ENDORSEMENT;
|
||||
|
||||
if(object->attributes.ppsHierarchy)
|
||||
return TPM_RH_PLATFORM;
|
||||
|
||||
return TPM_RH_NULL;
|
||||
}
|
||||
|
||||
static void RSA2048_OBJECT_To_OBJECT(OBJECT* dest, const RSA2048_OBJECT* src)
|
||||
{
|
||||
dest->attributes = src->attributes;
|
||||
|
||||
@ -46,4 +46,6 @@ TPM_RC RSA2048_OBJECT_Buffer_To_OBJECT(OBJECT* object, BYTE* buffer, INT32 size)
|
||||
TPM_RC RSA3072_OBJECT_Buffer_To_OBJECT(OBJECT* object, BYTE* buffer, INT32 size);
|
||||
UINT32 OBJECT_To_Buffer_As_RSA3072_OBJECT(OBJECT* object, BYTE* buffer, UINT32 size);
|
||||
|
||||
TPMI_RH_HIERARCHY ObjectGetHierarchyFromAttributes(OBJECT* object);
|
||||
|
||||
#endif /* BACKWARDS_COMPATIBILITY_OBJECT_H */
|
||||
|
||||
@ -224,22 +224,7 @@ ObjectGetHierarchy(
|
||||
OBJECT *object // IN :object
|
||||
)
|
||||
{
|
||||
if(object->attributes.spsHierarchy)
|
||||
{
|
||||
return TPM_RH_OWNER;
|
||||
}
|
||||
else if(object->attributes.epsHierarchy)
|
||||
{
|
||||
return TPM_RH_ENDORSEMENT;
|
||||
}
|
||||
else if(object->attributes.ppsHierarchy)
|
||||
{
|
||||
return TPM_RH_PLATFORM;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TPM_RH_NULL;
|
||||
}
|
||||
return ObjectGetHierarchyFromAttributes(object);
|
||||
}
|
||||
/* 8.6.3.11 GetHierarchy() */
|
||||
/* This function returns the handle of the hierarchy to which a handle belongs. This function is
|
||||
|
||||
Loading…
Reference in New Issue
Block a user