16 #define MAX_ACTIONS FAILSAFE_ITERATIONS_MED - 1
40 assert( actionListPtr == NULL || \
51 for( iterationCount = 0;
53 actionListPtr = actionListPtr->next, iterationCount++ )
55 if( actionListPtr->action == actionType )
58 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_MED );
69 assert( actionListPtr == NULL || \
80 actionListPtr =
findAction( actionListPtr, actionType );
81 if( actionListPtr == NULL )
85 for( iterationCount = 0;
86 actionListPtr->
next != NULL && \
88 actionListPtr = actionListPtr->
next, iterationCount++ )
90 if( actionListPtr->
next->
action != actionType )
93 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_MED );
113 for( actionListPtr = actionListStart, iterationCount = 0;
115 actionListPtr = actionListPtr->
next, iterationCount++ )
121 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_MED );
139 assert( actionListPtr == NULL || \
142 for( actionCount = 0;
144 actionListPtr = actionListPtr->next, actionCount++ );
145 ENSURES_B( actionCount < FAILSAFE_ITERATIONS_MED );
163 assert( newActionPtrPtr == NULL || \
178 if( newActionPtrPtr != NULL )
179 *newActionPtrPtr = NULL;
182 if( ( newItem = getMemPool( memPoolState, \
186 newItem->
action = actionType;
192 for( actionListPtr = *actionListHeadPtrPtr, iterationCount = 0;
193 actionListPtr != NULL && actionListPtr->
action <= actionType && \
195 actionListPtr = actionListPtr->
next, iterationCount++ )
199 ENSURES( iterationCount < FAILSAFE_ITERATIONS_MED );
203 if( newActionPtrPtr != NULL )
204 *newActionPtrPtr = newItem;
219 return( createNewAction( newActionPtrPtr, actionListHeadPtrPtr,
220 memPoolState, actionType, cryptHandle ) );
229 return( createNewAction( NULL, actionListHeadPtrPtr, memPoolState,
230 actionType, cryptHandle ) );
251 freeMemPool( memPoolState, actionListItem );
266 REQUIRES( *actionListHeadPtrPtr != NULL );
269 for( listPrevPtr = *actionListHeadPtrPtr, iterationCount = 0;
270 listPrevPtr != NULL && listPrevPtr->
next != actionListItem && \
272 listPrevPtr = listPrevPtr->
next, iterationCount++ );
273 ENSURES( iterationCount < FAILSAFE_ITERATIONS_MED );
280 deleteActionListItem( memPoolState, actionListItem );
296 for( iterationCount = 0;
297 actionListPtr != NULL && \
303 actionListPtr = actionListPtr->
next;
304 deleteActionListItem( memPoolState, actionListItem );
306 ENSURES_V( iterationCount < FAILSAFE_ITERATIONS_MED );
316 int iterationCount,
status;
322 for( actionListPtr = envelopeInfoPtr->actionList, iterationCount = 0;
323 actionListPtr != NULL && \
324 iterationCount < FAILSAFE_ITERATIONS_MED;
329 actionListPtr = actionListPtr->
next;
336 status = deleteAction( &envelopeInfoPtr->actionList,
337 envelopeInfoPtr->memPoolState,
343 ENSURES( iterationCount < FAILSAFE_ITERATIONS_MED );
367 assert( actionListPtr == NULL || \
379 if( actionListPtr == NULL )
398 &msgData, CRYPT_IATTRIBUTE_KEYID );
417 for( actionListPtr =
findAction( actionListPtr, actionType ), \
419 actionListPtr != NULL && actionListPtr->
action == actionType && \
421 actionListPtr = actionListPtr->
next, iterationCount++ )
476 actionAlgo == algorithm )
496 ENSURES_EXT( ( iterationCount < FAILSAFE_ITERATIONS_MED ), \
506 int checkActionIndirect(
const ACTION_LIST *actionListStart,
507 IN CHECKACTIONFUNCTION checkActionFunction,
515 REQUIRES( checkActionFunction != NULL );
517 for( actionListPtr = actionListStart, iterationCount = 0;
519 actionListPtr = actionListPtr->
next, iterationCount++ )
525 ENSURES( iterationCount < FAILSAFE_ITERATIONS_MED );
564 if( envelopeInfoPtr->actionList == NULL )
573 if( envelopeInfoPtr->preActionList != NULL || \
574 envelopeInfoPtr->postActionList != NULL )
582 if( envelopeInfoPtr->preActionList != NULL )
584 int cryptActionCount = 0, macActionCount = 0;
585 int genericSecretActionCount = 0;
595 for( actionListPtr = envelopeInfoPtr->preActionList, \
597 actionListPtr != NULL && \
599 iterationCount < FAILSAFE_ITERATIONS_MED;
600 actionListPtr = actionListPtr->
next, iterationCount++ );
601 ENSURES_B( iterationCount < FAILSAFE_ITERATIONS_MED );
603 actionListPtr != NULL )
609 for( iterationCount = 0;
610 actionListPtr != NULL && \
613 actionListPtr = actionListPtr->
next, iterationCount++ );
614 ENSURES_B( iterationCount < FAILSAFE_ITERATIONS_MED );
615 if( actionListPtr != NULL )
617 ENSURES_B( envelopeInfoPtr->actionList != NULL );
622 for( actionListPtr = envelopeInfoPtr->actionList, iterationCount = 0;
623 actionListPtr != NULL && \
624 iterationCount < FAILSAFE_ITERATIONS_MED;
625 actionListPtr = actionListPtr->
next, iterationCount++ )
627 switch( actionListPtr->
action )
630 genericSecretActionCount++;
645 ENSURES_B( iterationCount < FAILSAFE_ITERATIONS_MED );
649 if( genericSecretActionCount > 0 )
653 if( genericSecretActionCount != 1 || \
654 cryptActionCount != 1 || macActionCount != 1 )
659 if( cryptActionCount > 0 )
662 if( cryptActionCount > 1 || \
663 genericSecretActionCount != 0 || macActionCount != 0 )
669 if( genericSecretActionCount != 0 || cryptActionCount != 0 )
676 ( macActionCount != 0 || genericSecretActionCount != 0 ) )
680 if( envelopeInfoPtr->postActionList != NULL )
688 if( envelopeInfoPtr->postActionList != NULL )
690 int hashActionCount = 0, sigActionCount = 0;
698 if( envelopeInfoPtr->preActionList != NULL )
702 if( envelopeInfoPtr->actionList == NULL )
704 for( actionListPtr = envelopeInfoPtr->actionList, iterationCount = 0;
705 actionListPtr != NULL && \
706 iterationCount < FAILSAFE_ITERATIONS_MED;
707 actionListPtr = actionListPtr->
next, iterationCount++ )
713 ENSURES_B( iterationCount < FAILSAFE_ITERATIONS_MED );
720 for( actionListPtr = envelopeInfoPtr->postActionList, \
722 actionListPtr != NULL && \
723 iterationCount < FAILSAFE_ITERATIONS_MED;
724 actionListPtr = actionListPtr->
next, iterationCount++ )
730 ENSURES_B( iterationCount < FAILSAFE_ITERATIONS_MED );
742 actionListPtr = envelopeInfoPtr->actionList;
755 actionListPtr = actionListPtr->
next;
756 if( actionListPtr == NULL || \
758 actionListPtr->
next != NULL )
767 actionListPtr->
next != NULL )
769 actionListPtr = actionListPtr->
next;
771 actionListPtr->
next != NULL )
778 if( actionListPtr->
next != NULL )
789 actionListPtr->
next != NULL && \
801 nextActionPtr->
next != NULL )
813 actionListPtr->
next != NULL )
829 for( iterationCount = 0; \
830 actionListPtr != NULL && \
832 actionListPtr = actionListPtr->
next, iterationCount++ )
837 ENSURES_B( iterationCount < FAILSAFE_ITERATIONS_MED );