2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A * Obtain the session pointer. Also, increment the session 2N/A /* Create a new object. */ 2N/A * Decrement the session reference count. 2N/A * We do not hold the session lock. 2N/A * Obtain the session pointer. Also, increment the session 2N/A /* Check arguments */ 2N/A /* Obtain the object pointer. */ 2N/A * Copy the old object to a new object. 2N/A * The 3rd argument with SOFT_COPY_OBJ value indicates that 2N/A * everything in the object will be duplicated for C_CopyObject. 2N/A * The 4th argument has the session pointer that will be 2N/A * saved in the new copy of the session object. 2N/A /* Most likely we ran out of space. */ 2N/A /* No need to hold the lock on the old object. */ 2N/A /* Modifiy the objects if requested */ 2N/A /* Set the requested attribute into the new object. */ 2N/A * Does the new object violate the creation rule or access rule? 2N/A * If the new object is a token object, it will be added 2N/A * to token object list and write to disk. 2N/A * Write to the keystore file. 2N/A * Add the newly created token object to the global 2N/A * token object list in the slot struct. 2N/A /* Insert new object into this session's object list */ 2N/A * Decrement the session reference count. 2N/A * We do not hold the session lock. 2N/A /* set handle of the new object */ 2N/A * The reason that we don't call handle2session is because 2N/A * the argument hSession may not be the creating_session of 2N/A * the object to be destroyed, and we want to avoid the lock 2N/A * contention. The handle2session will be called later for 2N/A * the creating_session. 2N/A /* Obtain the object pointer. */ 2N/A /* Obtain the session handle which object belongs to. */ 2N/A * This is a token object to be deleted. 2N/A * For token object, there is no creating session concept, 2N/A * therefore, creating_session is always NULL. 2N/A /* Obtain the session pointer just for validity check. */ 2N/A * Set OBJECT_IS_DELETING flag so any access to this 2N/A * object will be rejected. 2N/A * Delete a token object by calling soft_delete_token_object() 2N/A * with the second argument B_TRUE indicating to delete the 2N/A * object from keystore and the third argument B_FALSE 2N/A * indicating that the caller does not hold the slot mutex. 2N/A * Obtain the session pointer. Also, increment the session 2N/A * Set OBJECT_IS_DELETING flag so any access to this 2N/A * object will be rejected. 2N/A * Delete an object by calling soft_delete_object() 2N/A * with a FALSE boolean argument indicating that 2N/A * the caller does not hold the session lock. 2N/A * Decrement the session reference count. 2N/A * We do not hold the session lock. 2N/A * Obtain the session pointer. Also, increment the session 2N/A * Decrement the session reference count. 2N/A * We do not hold the session lock. 2N/A /* Obtain the object pointer. */ 2N/A * Decrement the session reference count. 2N/A * We do not hold the session lock. 2N/A /* Acquire the lock on the object. */ 2N/A * Get the value of each attribute in the template. 2N/A * (We must process EVERY attribute in the template.) 2N/A /* At least we catch some type of error. */ 2N/A /* Release the object lock */ 2N/A * Decrement the session reference count. 2N/A * We do not hold the session lock. 2N/A * Obtain the session pointer. Also, increment the session 2N/A * Decrement the session reference count. 2N/A * We do not hold the session lock. 2N/A /* Obtain the object pointer. */ 2N/A * Decrement the session reference count. 2N/A * We do not hold the session lock. 2N/A * Start working on the object, so we need to set the write lock so that 2N/A * no one can write to it but still can read it. 2N/A * Copy the old object to a new object. We work on the copied 2N/A * version because in case of error we still keep the old one 2N/A * The 3rd argument with SOFT_SET_ATTR_VALUE value indicates that 2N/A * not everything will be duplicated for C_SetAttributeValue. 2N/A * Information not duplicated are those attributes that are not 2N/A /* Most likely we ran out of space. */ 2N/A * Decrement the session reference count. 2N/A * We do not hold the session lock. 2N/A * No need to hold the lock on the old object, because we 2N/A * will be working on the new scratch object. 2N/A /* Set the requested attribute into the new object. */ 2N/A * We've successfully set all the requested attributes. 2N/A * Merge the new object with the old object, then destroy 2N/A * the new one. The reason to do the merging is because we 2N/A * have to keep the original object handle (address of object). 2N/A * The object has been modified, so we write it back to keystore. 2N/A * Decrement the session reference count. 2N/A * We do not hold the session lock. 2N/A * Obtain the session pointer. Also, increment the session 2N/A /* Check the arguments */ 2N/A /* decrement the session count, we do not hold the lock */ 2N/A /* Acquire the session lock */ 2N/A /* Check to see if find operation is already active */ 2N/A /* decrement the session count, and unlock the mutex */ 2N/A * This active flag will remain ON until application calls 2N/A * C_FindObjectsFinal. 2N/A /* decrement the session count, and unlock the mutex */ 2N/A * Obtain the session pointer. Also, increment the session 2N/A /* check for invalid arguments */ 2N/A /* decrement the session count, we do not hold the lock */ 2N/A /* don't need to do anything, just return */ 2N/A /* decrement the session count, we do not hold the lock */ 2N/A /* Acquire the session lock */ 2N/A /* Check to see if find operation is active */ 2N/A /* decrement the session count, and release the lock */ 2N/A * Obtain the session pointer. Also, increment the session 2N/A /* Acquire the session lock */ 2N/A /* Check to see if find operation is active */ 2N/A /* decrement the session count, and release the lock */