aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2015-06-01 10:20:42 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-03 21:46:17 +0000
commit5f32063528b7373b4f4ee76646776dada0b8b5c5 (patch)
tree43e2da9d4aff4395b863551fe5601a1ccb9094fc
parentbdcc5202ff9b13e5a0acce2201cc56bd44de9931 (diff)
downloadtpm2-5f32063528b7373b4f4ee76646776dada0b8b5c5.tar.gz
Changes to allow compilation of Object.c
BUG=none TEST=compilation succeeds: cc -Wall -Werror -c -o /dev/null Object.c Change-Id: I5c64c1eab8d9a61432a539312029701393cbd074 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274618 Reviewed-by: Utkarsh Sanghi <usanghi@chromium.org>
-rw-r--r--CryptUtil_fp.h17
-rw-r--r--NV_fp.h4
-rw-r--r--Object.c14
-rw-r--r--Object_fp.h6
-rw-r--r--TPM_Types.h1
-rw-r--r--marshal_fp.h1
6 files changed, 36 insertions, 7 deletions
diff --git a/CryptUtil_fp.h b/CryptUtil_fp.h
index 7388bcd..e89571b 100644
--- a/CryptUtil_fp.h
+++ b/CryptUtil_fp.h
@@ -242,6 +242,12 @@ TPM_RC CryptNewEccKey(
TPMS_ECC_POINT *publicPoint, // OUT: public point
TPM2B_ECC_PARAMETER *sensitive // OUT: private area
);
+BOOL CryptObjectIsPublicConsistent(
+ TPMT_PUBLIC *publicArea // IN: public area
+ );
+TPM_RC CryptObjectPublicPrivateMatch(
+ OBJECT *object // IN: the object to check
+ );
TPM_RC CryptSecretDecrypt(
TPM_HANDLE tpmKey, // IN: decrypt key
TPM2B_NONCE *nonceCaller, // IN: nonceCaller. It is needed for
@@ -274,6 +280,17 @@ LIB_EXPORT UINT16 CryptStartHMAC2B(
HMAC_STATE *hmacState // OUT: the state of HMAC stack. It will be used
// in HMAC update and completion
);
+UINT16 CryptStartHMACSequence2B(
+ TPMI_ALG_HASH hashAlg, // IN: hash algorithm
+ TPM2B *key, // IN: HMAC key
+ HMAC_STATE *hmacState // OUT: the state of HMAC stack. It will be used
+ // in HMAC update and completion
+ );
+UINT16 CryptStartHashSequence(
+ TPMI_ALG_HASH hashAlg, // IN: hash algorithm
+ HASH_STATE *hashState // OUT: the state of hash stack. It will be used
+ // in hash update and completion
+ );
void CryptStopUnits(
void
);
diff --git a/NV_fp.h b/NV_fp.h
index f8ecef4..63844db 100644
--- a/NV_fp.h
+++ b/NV_fp.h
@@ -28,6 +28,10 @@ void NvDeleteEntity(
void NvFlushHierarchy(
TPMI_RH_HIERARCHY hierarchy // IN: hierarchy to be flushed.
);
+TPM_RC NvGetEvictObject(
+ TPM_HANDLE handle, // IN: handle
+ OBJECT *object // OUT: object data
+ );
void NvGetIndexData(
TPMI_RH_NV_INDEX handle, // IN: handle
NV_INDEX *nvIndex, // IN: RAM image of index header
diff --git a/Object.c b/Object.c
index 66a23fe..306f85d 100644
--- a/Object.c
+++ b/Object.c
@@ -7,7 +7,7 @@
#define OBJECT_C
#include "InternalRoutines.h"
-#include <Platform.h>
+#include "Platform.h"
//
//
// Functions
@@ -147,7 +147,7 @@ ObjectGetName(
if(object->publicArea.nameAlg == TPM_ALG_NULL)
return 0;
// Copy the Name data to the output
- MemoryCopy(name, object->name.t.name, object->name.t.size, sizeof(NAME));
+ MemoryCopy(name, object->name.t.buffer, object->name.t.size, sizeof(NAME));
return object->name.t.size;
}
//
@@ -347,7 +347,7 @@ ObjectLoad(
// initialize QN
parentQN.t.size = 4;
// for a primary key, parent qualified name is the handle of hierarchy
- UINT32_TO_BYTE_ARRAY(parentHandle, parentQN.t.name);
+ UINT32_TO_BYTE_ARRAY(parentHandle, parentQN.t.buffer);
}
else
{
@@ -737,9 +737,9 @@ ObjectComputeName(
// Adding public area
CryptUpdateDigest2B(&hashState, &marshalBuffer.b);
// Complete hash leaving room for the name algorithm
- CryptCompleteHash(&hashState, name->t.size, &name->t.name[2]);
+ CryptCompleteHash(&hashState, name->t.size, &name->t.buffer[2]);
// set the nameAlg
- UINT16_TO_BYTE_ARRAY(publicArea->nameAlg, name->t.name);
+ (void)UINT16_TO_BYTE_ARRAY(publicArea->nameAlg, name->t.buffer);
//
name->t.size += 2;
return;
@@ -768,8 +768,8 @@ ObjectComputeQualifiedName(
CryptUpdateDigest2B(&hashState, &name->b);
// Complete hash leaving room for the name algorithm
CryptCompleteHash(&hashState, qualifiedName->t.size,
- &qualifiedName->t.name[2]);
- UINT16_TO_BYTE_ARRAY(nameAlg, qualifiedName->t.name);
+ &qualifiedName->t.buffer[2]);
+ UINT16_TO_BYTE_ARRAY(nameAlg, qualifiedName->t.buffer);
qualifiedName->t.size += 2;
return;
}
diff --git a/Object_fp.h b/Object_fp.h
index 02b83d9..155f954 100644
--- a/Object_fp.h
+++ b/Object_fp.h
@@ -22,6 +22,12 @@ void ObjectComputeName(
TPMT_PUBLIC *publicArea, // IN: public area of an object
TPM2B_NAME *name // OUT: name of the object
);
+void ObjectComputeQualifiedName(
+ TPM2B_NAME *parentQN, // IN: parent's qualified name
+ TPM_ALG_ID nameAlg, // IN: name hash
+ TPM2B_NAME *name, // IN: name of the object
+ TPM2B_NAME *qualifiedName // OUT: qualified name of the object
+ );
TPM_RC ObjectContextLoad(
OBJECT *object, // IN: object structure from saved context
TPMI_DH_OBJECT *handle // OUT: object handle
diff --git a/TPM_Types.h b/TPM_Types.h
index 9332e60..1e11fef 100644
--- a/TPM_Types.h
+++ b/TPM_Types.h
@@ -1097,6 +1097,7 @@ typedef union {
UINT16 size;
TPMT_PUBLIC publicArea;
} t;
+ TPM2B b;
} TPM2B_PUBLIC;
// Table 185 - TPM2B_PRIVATE_VENDOR_SPECIFIC Structure
diff --git a/marshal_fp.h b/marshal_fp.h
index e4c2e30..8cb3a62 100644
--- a/marshal_fp.h
+++ b/marshal_fp.h
@@ -25,6 +25,7 @@ MARSHAL_WRAPPER(TPMI_ST_COMMAND_TAG)
MARSHAL_WRAPPER(TPMS_ATTEST)
MARSHAL_WRAPPER(TPMS_ECC_POINT)
MARSHAL_WRAPPER(TPMS_NV_PUBLIC)
+MARSHAL_WRAPPER(TPMT_PUBLIC)
MARSHAL_WRAPPER(TPM_CC)
MARSHAL_WRAPPER(TPM_HANDLE)
MARSHAL_WRAPPER(TPM_RC)