Lines Matching full:object
36 // This file contains the functions that manage the object store of the TPM.
46 // This function marks an object slot as available.
52 OBJECT *object in ObjectFlush() argument
55 object->attributes.occupied = CLEAR; in ObjectFlush()
59 // This access function sets the occupied attribute of an object slot.
62 OBJECT *object in ObjectSetInUse() argument
65 object->attributes.occupied = SET; in ObjectSetInUse()
69 // This function is called at TPM2_Startup() to initialize the object subsystem.
77 // object slots initialization in ObjectStartup()
88 // In this implementation, a persistent object is moved from NV into an object slot
103 // If an object is a temporary evict object, flush it from slot in ObjectCleanupEvict()
104 OBJECT *object = &s_objects[i]; in ObjectCleanupEvict() local
105 if(object->attributes.evict == SET) in ObjectCleanupEvict()
106 ObjectFlush(object); in ObjectCleanupEvict()
113 // object. This routine should not be called if the handle is not a
117 // TRUE(1) handle references a loaded object
118 // FALSE(0) handle is not an object handle, or it does not
119 // reference to a loaded object
137 // This function is used to check if the object is a sequence object. This function
138 // should not be called if the handle does not reference a loaded object.
140 // TRUE(1) object is an HMAC, hash, or event sequence object
141 // FALSE(0) object is not an HMAC, hash, or event sequence object
144 OBJECT *object // IN: handle to be checked in ObjectIsSequence() argument
147 pAssert(object != NULL); in ObjectIsSequence()
148 return (object->attributes.hmacSeq == SET in ObjectIsSequence()
149 || object->attributes.hashSeq == SET in ObjectIsSequence()
150 || object->attributes.eventSeq == SET); in ObjectIsSequence()
154 // This function is used to find the object structure associated with a handle.
156 // This function requires that 'handle' references a loaded object or a permanent
158 OBJECT*
160 TPMI_DH_OBJECT handle // IN: handle of the object in HandleToObject()
166 // associated OBJECT. in HandleToObject()
170 // object. in HandleToObject()
179 // This function returns the Qualified Name of the object. In this implementation,
180 // the Qualified Name is computed when the object is loaded and is saved in the
181 // internal representation of the object. The alternative would be to retain the
185 // This function requires that 'handle' references a loaded object.
188 TPMI_DH_OBJECT handle, // IN: handle of the object in GetQualifiedName()
189 TPM2B_NAME *qualifiedName // OUT: qualified name of the object in GetQualifiedName()
192 OBJECT *object; in GetQualifiedName() local
201 object = HandleToObject(handle); in GetQualifiedName()
202 if(object == NULL || object->publicArea.nameAlg == TPM_ALG_NULL) in GetQualifiedName()
206 *qualifiedName = object->qualifiedName; in GetQualifiedName()
215 // This function returns the handle for the hierarchy of an object.
218 OBJECT *object // IN :object in ObjectGetHierarchy() argument
221 if(object->attributes.spsHierarchy) in ObjectGetHierarchy()
225 else if(object->attributes.epsHierarchy) in ObjectGetHierarchy()
229 else if(object->attributes.ppsHierarchy) in ObjectGetHierarchy()
242 // a handle but ObjectGetHierarchy() takes an pointer to an object.
244 // This function requires that 'handle' references a loaded object.
247 TPMI_DH_OBJECT handle // IN :object handle in GetHierarchy()
250 OBJECT *object = HandleToObject(handle); in GetHierarchy() local
252 return ObjectGetHierarchy(object); in GetHierarchy()
256 // This function finds an open object slot, if any. It will clear the attributes
259 // Return Type: OBJECT *
262 OBJECT *
268 OBJECT *object; in FindEmptyObjectSlot() local
272 object = &s_objects[i]; in FindEmptyObjectSlot()
273 if(object->attributes.occupied == CLEAR) in FindEmptyObjectSlot()
277 // Initialize the object attributes in FindEmptyObjectSlot()
278 MemorySet(&object->attributes, 0, sizeof(OBJECT_ATTRIBUTES)); in FindEmptyObjectSlot()
279 return object; in FindEmptyObjectSlot()
286 // This function is used to allocate a slot in internal object array.
287 OBJECT *
289 TPMI_DH_OBJECT *handle // OUT: handle of allocated object in ObjectAllocateSlot()
292 OBJECT *object = FindEmptyObjectSlot(handle); in ObjectAllocateSlot() local
294 if(object != NULL) in ObjectAllocateSlot()
297 ObjectSetInUse(object); in ObjectAllocateSlot()
299 return object; in ObjectAllocateSlot()
303 // This function sets the internal attributes for a loaded object. It is called to
304 // finalize the OBJECT attributes (not the TPMA_OBJECT attributes) for a loaded
305 // object.
308 OBJECT *object, // IN: object attributes to finalize in ObjectSetLoadedAttributes() argument
312 OBJECT *parent = HandleToObject(parentHandle); in ObjectSetLoadedAttributes()
313 TPMA_OBJECT objectAttributes = object->publicArea.objectAttributes; in ObjectSetLoadedAttributes()
317 object->attributes.stClear = in ObjectSetLoadedAttributes()
322 object->attributes.primary = SET; in ObjectSetLoadedAttributes()
326 object->attributes.epsHierarchy = SET; in ObjectSetLoadedAttributes()
329 object->attributes.spsHierarchy = SET; in ObjectSetLoadedAttributes()
332 object->attributes.ppsHierarchy = SET; in ObjectSetLoadedAttributes()
336 object->attributes.temporary = SET; in ObjectSetLoadedAttributes()
337 object->attributes.primary = CLEAR; in ObjectSetLoadedAttributes()
343 // is this a stClear object in ObjectSetLoadedAttributes()
344 object->attributes.stClear = in ObjectSetLoadedAttributes()
347 object->attributes.epsHierarchy = parent->attributes.epsHierarchy; in ObjectSetLoadedAttributes()
348 object->attributes.spsHierarchy = parent->attributes.spsHierarchy; in ObjectSetLoadedAttributes()
349 object->attributes.ppsHierarchy = parent->attributes.ppsHierarchy; in ObjectSetLoadedAttributes()
350 // An object is temporary if its parent is temporary or if the object in ObjectSetLoadedAttributes()
352 object->attributes.temporary = parent->attributes.temporary in ObjectSetLoadedAttributes()
353 || object->attributes.external; in ObjectSetLoadedAttributes()
355 // If this is an external object, set the QN == name but don't SET other in ObjectSetLoadedAttributes()
357 if(object->attributes.external) in ObjectSetLoadedAttributes()
358 object->qualifiedName = object->name; in ObjectSetLoadedAttributes()
363 && !object->attributes.publicOnly in ObjectSetLoadedAttributes()
365 && object->publicArea.nameAlg != TPM_ALG_NULL) in ObjectSetLoadedAttributes()
369 if(object->publicArea.type == TPM_ALG_KEYEDHASH) in ObjectSetLoadedAttributes()
370 object->attributes.derivation = SET; in ObjectSetLoadedAttributes()
372 object->attributes.isParent = SET; in ObjectSetLoadedAttributes()
374 ComputeQualifiedName(parentHandle, object->publicArea.nameAlg, in ObjectSetLoadedAttributes()
375 &object->name, &object->qualifiedName); in ObjectSetLoadedAttributes()
378 ObjectSetInUse(object); in ObjectSetLoadedAttributes()
383 // Common function to load an object. A loaded object has its public area validated
390 OBJECT *object, // IN: pointer to object slot in ObjectLoad() argument
391 // object in ObjectLoad()
392 OBJECT *parent, // IN: (optional) the parent object in ObjectLoad()
393 TPMT_PUBLIC *publicArea, // IN: public area to be installed in the object in ObjectLoad()
395 // installed in the object in ObjectLoad()
405 // Do validations of public area object descriptions in ObjectLoad()
408 // Is this public only or a no-name object? in ObjectLoad()
453 // See if there is an object to populate in ObjectLoad()
454 if((result == TPM_RC_SUCCESS) && (object != NULL)) in ObjectLoad()
457 object->publicArea = *publicArea; in ObjectLoad()
460 object->attributes.publicOnly = SET; in ObjectLoad()
462 object->sensitive = *sensitive; in ObjectLoad()
465 object->name = *name; in ObjectLoad()
467 object->name.t.size = 0; in ObjectLoad()
474 // are used by the normal objects so that a sequence object is not inadvertently
483 HASH_OBJECT *object = (HASH_OBJECT *)ObjectAllocateSlot(newHandle); in AllocateSequenceSlot() local
486 // object state data. It would be good if this could have been done at compile in AllocateSequenceSlot()
488 cAssert(offsetof(HASH_OBJECT, auth) == offsetof(OBJECT, publicArea.authPolicy)); in AllocateSequenceSlot()
490 if(object != NULL) in AllocateSequenceSlot()
493 // Set the common values that a sequence object shares with an ordinary object in AllocateSequenceSlot()
495 MemorySet(&object->objectAttributes, 0, sizeof(TPMA_OBJECT)); in AllocateSequenceSlot()
498 object->type = TPM_ALG_NULL; in AllocateSequenceSlot()
501 object->nameAlg = TPM_ALG_NULL; in AllocateSequenceSlot()
503 // A sequence object is considered to be in the NULL hierarchy so it should in AllocateSequenceSlot()
505 object->attributes.temporary = SET; in AllocateSequenceSlot()
507 // A sequence object is DA exempt. in AllocateSequenceSlot()
508 SET_ATTRIBUTE(object->objectAttributes, TPMA_OBJECT, noDA); in AllocateSequenceSlot()
512 object->auth = *auth; in AllocateSequenceSlot()
514 object->auth.t.size = 0; in AllocateSequenceSlot()
516 return object; in AllocateSequenceSlot()
522 // This function creates an internal HMAC sequence object.
524 // TPM_RC_OBJECT_MEMORY if there is no free slot for an object
528 OBJECT *keyObject, // IN: the object containing the HMAC key in ObjectCreateHMACSequence()
530 TPMI_DH_OBJECT *newHandle // OUT: HMAC sequence object handle in ObjectCreateHMACSequence()
535 // Try to allocate a slot for new object in ObjectCreateHMACSequence()
558 // This function creates a hash sequence object.
560 // TPM_RC_OBJECT_MEMORY if there is no free slot for an object
565 TPMI_DH_OBJECT *newHandle // OUT: sequence object handle in ObjectCreateHashSequence()
583 // This function creates an event sequence object.
585 // TPM_RC_OBJECT_MEMORY if there is no free slot for an object
589 TPMI_DH_OBJECT *newHandle // OUT: sequence object handle in ObjectCreateEventSequence()
622 // Don't assume that this is a proper sequence object in ObjectTerminateEvent()
633 // Flush sequence object in ObjectTerminateEvent()
640 // This function loads an object from a saved object context.
641 // Return Type: OBJECT *
642 // NULL if there is no free slot for an object
643 // != NULL points to the loaded object
644 OBJECT *
646 ANY_OBJECT_BUFFER *object, // IN: pointer to object structure in saved in ObjectContextLoad() argument
648 TPMI_DH_OBJECT *handle // OUT: object handle in ObjectContextLoad()
651 OBJECT *newObject = ObjectAllocateSlot(handle); in ObjectContextLoad()
653 // Try to allocate a slot for new object in ObjectContextLoad()
656 // Copy the first part of the object in ObjectContextLoad()
657 MemoryCopy(newObject, object, offsetof(HASH_OBJECT, state)); in ObjectContextLoad()
658 // See if this is a sequence object in ObjectContextLoad()
661 // If this is a sequence object, import the data in ObjectContextLoad()
663 (HASH_OBJECT_BUFFER *)object); in ObjectContextLoad()
667 // Copy input object data to internal structure in ObjectContextLoad()
668 MemoryCopy(newObject, object, sizeof(OBJECT)); in ObjectContextLoad()
675 // This function frees an object slot.
677 // This function requires that the object is loaded.
686 // Clear all the object attributes in FlushObject()
702 // iterate object slots in ObjectFlushHierarchy()
732 // This function loads a persistent object into a transient object slot.
734 // This function requires that 'handle' is associated with a persistent object.
736 // TPM_RC_HANDLE the persistent object does not exist
738 // TPM_RC_OBJECT_MEMORY no object slot
741 TPM_HANDLE *handle, // IN:OUT: evict object handle. If success, it in ObjectLoadEvict()
742 // will be replace by the loaded object handle in ObjectLoadEvict()
748 OBJECT *object; in ObjectLoadEvict() local
750 // If this is an index that references a persistent object created by in ObjectLoadEvict()
761 // Try to allocate a slot for an object in ObjectLoadEvict()
762 object = ObjectAllocateSlot(handle); in ObjectLoadEvict()
763 if(object == NULL) in ObjectLoadEvict()
765 // Copy persistent object to transient object slot. A TPM_RC_HANDLE in ObjectLoadEvict()
767 // a transient object so that it will be flushed at the end of the in ObjectLoadEvict()
769 result = NvGetEvictObject(evictHandle, object); in ObjectLoadEvict()
774 // check the object to see if it is in the endorsement hierarchy in ObjectLoadEvict()
779 if(ObjectGetHierarchy(object) == TPM_RH_ENDORSEMENT in ObjectLoadEvict()
808 // This function computes the Name of an object from its public area.
811 TPMT_PUBLIC *publicArea, // IN: public area of an object in PublicMarshalAndComputeName()
812 TPM2B_NAME *name // OUT: name of the object in PublicMarshalAndComputeName()
836 // This function computes the qualified name of an object.
841 TPM2B_NAME *name, // IN: name of the object in ComputeQualifiedName()
842 TPM2B_NAME *qualifiedName // OUT: qualified name of the object in ComputeQualifiedName()
878 // This function determines if an object has the attributes associated
882 // TRUE(1) object is a storage key
883 // FALSE(0) object is not a storage key
886 TPMI_DH_OBJECT handle // IN: object handle in ObjectIsStorage()
889 OBJECT *object = HandleToObject(handle); in ObjectIsStorage() local
890 TPMT_PUBLIC *publicArea = ((object != NULL) ? &object->publicArea : NULL); in ObjectIsStorage()
896 && (object->publicArea.type == TPM_ALG_RSA in ObjectIsStorage()
897 || object->publicArea.type == TPM_ALG_ECC)); in ObjectIsStorage()
901 // This function returns a a list of handles of loaded object, starting from
902 // 'handle'. 'Handle' must be in the range of valid transient object handles,
903 // but does not have to be the handle of a loaded transient object.
925 // Iterate object slots to get loaded object handles in ObjectCapGetLoaded()
930 // A valid transient object can not be the copy of a persistent object in ObjectCapGetLoaded()
935 // If we have not filled up the return list, add this object in ObjectCapGetLoaded()
942 // If the return list is full but we still have loaded object in ObjectCapGetLoaded()
964 // Iterate object slot to get the number of unoccupied slots in ObjectCapGetTransientAvail()
974 // Returns the attributes associated with an object handles.