90 static
int updateActionPerms(
IN_FLAGS( ACTION_PERM )
int currentPerm,
91 IN_FLAGS( ACTION_PERM )
const int newPerm )
105 if( ( newPerm & permMask ) < ( currentPerm & permMask ) )
106 currentPerm = ( currentPerm & ~permMask ) | ( newPerm & permMask );
112 FORALL( i, 0, ACTION_PERM_COUNT,
116 return( currentPerm );
145 int actionFlags = 0,
status;
160 REQUIRES( objectTable[ objectHandle ].dependentObject != dependentObject || \
161 objectTable[ dependentObject ].dependentObject != objectHandle );
235 if( objectTable[ objectHandle ].uniqueID != uniqueID )
237 status = setPropertyAttribute( contextHandle, CRYPT_IATTRIBUTE_ACTIONPERMS,
242 FORALL( i, 0, ACTION_PERM_COUNT,
243 ( objectTable[ contextHandle ].actionFlags & (
ACTION_PERM_MASK << ( i * 2 ) ) ) <= \
289 krnlData = krnlDataPtr;
314 int getPropertyAttribute(
IN_HANDLE const int objectHandle,
319 int *
valuePtr = (
int * ) messageDataPtr;
321 assert(
isWritePtr( messageDataPtr,
sizeof(
int ) ) );
329 attribute == CRYPT_IATTRIBUTE_TYPE || \
330 attribute == CRYPT_IATTRIBUTE_SUBTYPE || \
331 attribute == CRYPT_IATTRIBUTE_STATUS || \
332 attribute == CRYPT_IATTRIBUTE_INTERNAL || \
333 attribute == CRYPT_IATTRIBUTE_ACTIONPERMS );
350 #ifdef NONSCALAR_THREADS
351 if(
sizeof( objectInfoPtr->objectOwner ) >
sizeof(
int ) )
354 *valuePtr = ( int ) objectInfoPtr->objectOwner;
369 *( (
BOOLEAN * ) messageDataPtr ) = \
379 case CRYPT_IATTRIBUTE_TYPE:
380 *valuePtr = objectInfoPtr->
type;
383 case CRYPT_IATTRIBUTE_SUBTYPE:
384 *valuePtr = objectInfoPtr->
subType;
387 case CRYPT_IATTRIBUTE_STATUS:
391 case CRYPT_IATTRIBUTE_INTERNAL:
392 *( (
BOOLEAN * ) messageDataPtr ) = \
397 case CRYPT_IATTRIBUTE_ACTIONPERMS:
409 int setPropertyAttribute(
IN_HANDLE const int objectHandle,
414 const int value = *( (
int * ) messageDataPtr );
416 assert(
isReadPtr( messageDataPtr,
sizeof(
int ) ) );
425 attribute == CRYPT_IATTRIBUTE_STATUS || \
426 attribute == CRYPT_IATTRIBUTE_INTERNAL || \
427 attribute == CRYPT_IATTRIBUTE_ACTIONPERMS || \
428 attribute == CRYPT_IATTRIBUTE_LOCKED );
430 attribute == CRYPT_IATTRIBUTE_STATUS );
461 #if defined( USE_THREADS )
464 #ifdef NONSCALAR_THREADS
465 if(
sizeof( objectInfoPtr->objectOwner ) <=
sizeof(
int ) )
508 case CRYPT_IATTRIBUTE_STATUS:
544 case CRYPT_IATTRIBUTE_INTERNAL:
559 case CRYPT_IATTRIBUTE_ACTIONPERMS:
561 const int newPerm = \
562 updateActionPerms( objectInfoPtr->
actionFlags, value );
570 case CRYPT_IATTRIBUTE_LOCKED:
633 REQUIRES( objectTable[ objectHandle ].referenceCount >= 0 );
640 ENSURES( objectTable[ objectHandle ].referenceCount >= 1 );
641 ENSURES( objectTable[ objectHandle ].referenceCount == \
675 if( objectTable[ objectHandle ].referenceCount > 0 )
681 ENSURES( objectTable[ objectHandle ].referenceCount >= 0 );
682 ENSURES( objectTable[ objectHandle ].referenceCount == \
701 int getDependentObject(
IN_HANDLE const int objectHandle,
704 const void *messageDataPtr,
713 int *
valuePtr = (
int * ) messageDataPtr, localObjectHandle;
715 assert(
isReadPtr( messageDataPtr,
sizeof(
int ) ) );
732 *valuePtr = localObjectHandle;
742 int setDependentObject(
IN_HANDLE const int objectHandle,
745 const void *messageDataPtr,
749 OBJECT_INFO *objectInfoPtr = &objectTable[ objectHandle ];
751 const int dependentObject = *( (
int * ) messageDataPtr );
753 int *objectHandlePtr, i,
status;
755 assert(
isReadPtr( messageDataPtr,
sizeof(
int ) ) );
767 dependentObjectInfoPtr = &objectTable[ dependentObject ];
789 ( objectInfoPtr->
type == dependentObjectInfoPtr->
type && \
800 if( dependencyACLTbl[ i ].
type == objectInfoPtr->
type && \
801 dependencyACLTbl[ i ].dType == dependentObjectInfoPtr->
type && \
803 dependentObjectInfoPtr->
subType ) || \
805 dependentObjectInfoPtr->
subType ) || \
807 dependentObjectInfoPtr->
subType ) ) )
809 dependencyACL = &dependencyACLTbl[ i ];
814 ENSURES( dependencyACL != NULL );
819 dependencyACL->
dType == dependentObjectInfoPtr->
type && \
821 dependentObjectInfoPtr->
subType ) || \
823 dependentObjectInfoPtr->
subType ) || \
825 dependentObjectInfoPtr->
subType ) ) );
842 dependentObjectInfoPtr->
subType ) || \
844 dependentObjectInfoPtr->
subType ) || \
846 dependentObjectInfoPtr->
subType ) );
860 status = updateDependentObjectPerms( objectHandle, dependentObject );
883 *objectHandlePtr = dependentObject;
916 REQUIRES( objectHandle != clonedObject );
950 status = setPropertyAttribute( clonedObject, CRYPT_IATTRIBUTE_ACTIONPERMS,
976 if( objectInfoPtr->
owner != clonedObjectInfoPtr->
owner )
980 &clonedObjectInfoPtr->
owner,