diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2015-06-01 10:55:46 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-06-03 21:46:24 +0000 |
commit | fe7bde4f6f18efd7a80611108290bf2981cbd726 (patch) | |
tree | 2b7de838bf2f865b4af6d8b132ec89c5ddc45364 | |
parent | 524cf981660daf28a2b73f22a78b552388e9ce4c (diff) | |
download | tpm2-fe7bde4f6f18efd7a80611108290bf2981cbd726.tar.gz |
Changes to allow compilation of Object_spt.c
BUG=none
TEST=compilation succeeds:
cc -Wall -Werror -c -o /dev/null Object_spt.c
Change-Id: I0e0295e79f7e37c0406353b2d528af46759138a4
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274620
Reviewed-by: Utkarsh Sanghi <usanghi@chromium.org>
-rw-r--r-- | CryptUtil_fp.h | 9 | ||||
-rw-r--r-- | Locality_fp.h | 14 | ||||
-rw-r--r-- | Object_fp.h | 6 | ||||
-rw-r--r-- | Object_spt.c | 18 | ||||
-rw-r--r-- | Object_spt_fp.h | 4 | ||||
-rw-r--r-- | PCR_fp.h | 6 | ||||
-rw-r--r-- | TPM_Types.h | 8 | ||||
-rw-r--r-- | marshal_fp.h | 7 |
8 files changed, 62 insertions, 10 deletions
diff --git a/CryptUtil_fp.h b/CryptUtil_fp.h index e89571b..9c23c81 100644 --- a/CryptUtil_fp.h +++ b/CryptUtil_fp.h @@ -231,9 +231,15 @@ void CryptHashStateImportExport( BOOL CryptIsAsymAlgorithm( TPM_ALG_ID algID // IN: algorithm ID ); +BOOL CryptIsDecryptScheme( + TPMI_ALG_ASYM_SCHEME scheme + ); BOOL CryptIsSchemeAnonymous( TPM_ALG_ID scheme // IN: the scheme algorithm to test ); +BOOL CryptIsSignScheme( + TPMI_ALG_ASYM_SCHEME scheme + ); BOOL CryptIsSplitSign( TPM_ALG_ID scheme // IN: the algorithm selector ); @@ -264,6 +270,9 @@ TPM_RC CryptSecretEncrypt( TPM2B_DATA *data, // OUT: secret value TPM2B_ENCRYPTED_SECRET *secret // OUT: secret structure ); +const TPMT_ECC_SCHEME * CryptGetCurveSignScheme( + TPM_ECC_CURVE curveId // IN: The curve selector + ); TPM_RC CryptSelectSignScheme( TPMI_DH_OBJECT signHandle, // IN: handle of signing key TPMT_SIG_SCHEME *scheme // IN/OUT: signing scheme diff --git a/Locality_fp.h b/Locality_fp.h index e69de29..74de9c5 100644 --- a/Locality_fp.h +++ b/Locality_fp.h @@ -0,0 +1,14 @@ +/* + * Copyright 2015 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef __TPM2_LOCALITY_FP_H +#define __TPM2_LOCALITY_FP_H + +TPMA_LOCALITY LocalityGetAttributes( + UINT8 locality // IN: locality value + ); + +#endif // __TPM2_LOCALITY_FP_H diff --git a/Object_fp.h b/Object_fp.h index 155f954..8be2ef3 100644 --- a/Object_fp.h +++ b/Object_fp.h @@ -51,12 +51,18 @@ TPM_RC ObjectCreateHashSequence( TPMI_RH_HIERARCHY ObjectDataGetHierarchy( OBJECT *object // IN :object ); +BOOL ObjectDataIsStorage( + TPMT_PUBLIC *publicArea // IN: public area of the object + ); OBJECT* ObjectGet( TPMI_DH_OBJECT handle // IN: handle of the object ); TPMI_RH_HIERARCHY ObjectGetHierarchy( TPMI_DH_OBJECT handle // IN :object handle ); +TPMI_ALG_HASH ObjectGetNameAlg( + TPMI_DH_OBJECT handle // IN: handle of the object + ); TPM_RC ObjectLoadEvict( TPM_HANDLE *handle, // IN:OUT: evict object handle. If success, it // will be replace by the loaded object handle diff --git a/Object_spt.c b/Object_spt.c index 6478a21..d2f4c2b 100644 --- a/Object_spt.c +++ b/Object_spt.c @@ -7,7 +7,7 @@ #include "InternalRoutines.h" #include "Object_spt_fp.h" -#include <Platform.h> +#include "Platform.h" // // // @@ -397,9 +397,9 @@ SchemeChecks( if(keyScheme->scheme != curveScheme->scheme) return TPM_RC_SCHEME; // The scheme can allow any hash, or not... - if( curveScheme->details.anySig.hashAlg != TPM_ALG_NULL + if( curveScheme->details.any.hashAlg != TPM_ALG_NULL && ( keyScheme->details.anySig.hashAlg - != curveScheme->details.anySig.hashAlg + != curveScheme->details.any.hashAlg ) ) return TPM_RC_SCHEME; @@ -607,14 +607,14 @@ FillInCreationData( // and QN of the parent are the parent's handle. if(HandleGetType(parentHandle) == TPM_HT_PERMANENT) { - BYTE *buffer = &outCreation->t.creationData.parentName.t.name[0]; + BYTE *buffer = &outCreation->t.creationData.parentName.t.buffer[0]; outCreation->t.creationData.parentName.t.size = TPM_HANDLE_Marshal(&parentHandle, &buffer, NULL); // Parent qualified name of a Temporary Object is the same as parent's // name MemoryCopy2B(&outCreation->t.creationData.parentQualifiedName.b, &outCreation->t.creationData.parentName.b, - sizeof(outCreation->t.creationData.parentQualifiedName.t.name)); + sizeof(outCreation->t.creationData.parentQualifiedName.t.buffer)); } else // Regular object { @@ -1245,7 +1245,7 @@ SecretToCredential( // use protector's name algorithm as outer hash outerHash = ObjectGetNameAlg(protector); // Marshal secret area to credential buffer, leave space for integrity - sensitiveData = outIDObject->t.credential + sensitiveData = outIDObject->t.buffer + sizeof(UINT16) + CryptGetHashDigestSize(outerHash); // Marshal secret area buffer = sensitiveData; @@ -1257,7 +1257,7 @@ SecretToCredential( seed, FALSE, dataSize, - outIDObject->t.credential); + outIDObject->t.buffer); return; } // @@ -1296,11 +1296,11 @@ CredentialToSecret( outerHash = ObjectGetNameAlg(protector); // Unwrap outer, a TPM_RC_INTEGRITY error may be returned at this point result = UnwrapOuter(protector, name, outerHash, seed, FALSE, - inIDObject->t.size, inIDObject->t.credential); + inIDObject->t.size, inIDObject->t.buffer); if(result == TPM_RC_SUCCESS) { // Compute the beginning of sensitive data - sensitiveData = inIDObject->t.credential + sensitiveData = inIDObject->t.buffer + sizeof(UINT16) + CryptGetHashDigestSize(outerHash); dataSize = inIDObject->t.size - (sizeof(UINT16) + CryptGetHashDigestSize(outerHash)); diff --git a/Object_spt_fp.h b/Object_spt_fp.h index 15657d1..343a65f 100644 --- a/Object_spt_fp.h +++ b/Object_spt_fp.h @@ -42,6 +42,10 @@ void FillInCreationData( TPM2B_CREATION_DATA *outCreation, // OUT: creation data for output TPM2B_DIGEST *creationDigest // OUT: creation digest ); +TPM2B_SEED* GetSeedForKDF( + TPM_HANDLE protectorHandle, // IN: the protector handle + TPM2B_SEED *seedIn // IN: the optional input seed + ); TPM_RC PrivateToSensitive( TPM2B_PRIVATE *inPrivate, // IN: input private structure TPM2B_NAME *name, // IN: the name of the object @@ -11,6 +11,12 @@ TPMI_YES_NO PCRCapGetAllocation( UINT32 count, // IN: count of return TPML_PCR_SELECTION *pcrSelection // OUT: PCR allocation list ); +void PCRComputeCurrentDigest( + TPMI_ALG_HASH hashAlg, // IN: hash algorithm to compute digest + TPML_PCR_SELECTION *selection, // IN/OUT: PCR selection (filtered on + // output) + TPM2B_DIGEST *digest // OUT: digest + ); TPMI_ALG_HASH PCRGetAuthPolicy( TPMI_DH_PCR handle, // IN: PCR handle TPM2B_DIGEST *policy // OUT: policy of PCR diff --git a/TPM_Types.h b/TPM_Types.h index c96d38b..63044cc 100644 --- a/TPM_Types.h +++ b/TPM_Types.h @@ -1220,7 +1220,13 @@ typedef struct { } TPMS_CREATION_DATA; // Table 204 - TPM2B_CREATION_DATA Structure -TPM2B_TYPE(CREATION_DATA, sizeof(TPMS_CREATION_DATA)); +typedef union { + struct { + UINT16 size; + TPMS_CREATION_DATA creationData; + } t __attribute__((packed)); + TPM2B b; +} TPM2B_CREATION_DATA; // // Unknown defines to be investigated and resolved diff --git a/marshal_fp.h b/marshal_fp.h index 8cb3a62..cc1262f 100644 --- a/marshal_fp.h +++ b/marshal_fp.h @@ -21,15 +21,22 @@ TPM_RC Common_Unmarshal(void *source, BYTE **buffer, INT32 *size, } MARSHAL_WRAPPER(TPM2B_DIGEST) +MARSHAL_WRAPPER(TPM2B_IV) MARSHAL_WRAPPER(TPMI_ST_COMMAND_TAG) MARSHAL_WRAPPER(TPMS_ATTEST) +MARSHAL_WRAPPER(TPMS_CREATION_DATA) MARSHAL_WRAPPER(TPMS_ECC_POINT) MARSHAL_WRAPPER(TPMS_NV_PUBLIC) MARSHAL_WRAPPER(TPMT_PUBLIC) +MARSHAL_WRAPPER(TPMT_SENSITIVE) MARSHAL_WRAPPER(TPM_CC) MARSHAL_WRAPPER(TPM_HANDLE) MARSHAL_WRAPPER(TPM_RC) MARSHAL_WRAPPER(TPM_ST) +MARSHAL_WRAPPER(UINT16) MARSHAL_WRAPPER(UINT32) +UINT16 TPMU_PUBLIC_PARMS_Marshal(TPMU_PUBLIC_PARMS *x, BYTE **y, + INT32 *z, TPMI_ALG_PUBLIC type); + #endif // __TPM2_MARSHAL_FP_H |