87 #ifdef USE_CERTIFICATES
108 NULL, &fieldID, NULL );
131 if( currentSelection->
dnPtr != NULL && \
139 if( isGeneralNameSelected( certInfoPtr ) && \
176 REQUIRES( sanityCheckSelectionInfo( certInfoPtr ) );
179 attributePtr = findDnInAttribute( certInfoPtr->attributeCursor );
180 if( attributePtr == NULL )
184 status = getAttributeDataDN( attributePtr, &dnPtr );
187 certInfoPtr->currentSelection.dnPtr =
dnPtr;
190 certInfoPtr->currentSelection.dnInExtension =
TRUE;
192 ENSURES( sanityCheckSelectionInfo( certInfoPtr ) );
205 selectionInfoPtr->dnInExtension =
FALSE;
207 selectionInfoPtr->dnComponentCount = 0;
216 SELECTION_INFO *currentSelection = &certInfoPtr->currentSelection;
229 if( !isGeneralNameSelected( certInfoPtr ) || \
232 resetDNselection( currentSelection );
233 currentSelection->
dnPtr = NULL;
236 ENSURES_V( sanityCheckSelectionInfo( certInfoPtr ) );
250 REQUIRES( sanityCheckSelectionInfo( certInfoPtr ) );
251 REQUIRES( certInfoType >= CRYPT_CERTINFO_FIRST_EXTENSION && \
257 if( attributePtr == NULL )
262 certInfoPtr->currentSelection.updateCursor =
FALSE;
263 certInfoPtr->attributeCursor = (
ATTRIBUTE_PTR * ) attributePtr;
269 ( void ) findDnInGeneralName( certInfoPtr,
FALSE );
277 ENSURES( sanityCheckSelectionInfo( certInfoPtr ) );
333 int generalNameTblSize, i;
339 if( certInfoType >= CRYPT_CERTINFO_FIRST_EXTENSION && \
340 certInfoType <= CRYPT_CERTINFO_LAST_EXTENSION )
342 generalNameTbl = certGeneralNameTbl;
348 if( certInfoType >= CRYPT_CERTINFO_FIRST_CMS && \
349 certInfoType <= CRYPT_CERTINFO_LAST_CMS )
351 generalNameTbl = cmsGeneralNameTbl;
366 for( i = 0; i < generalNameTblSize && \
369 if( generalNameTbl[ i ] == certInfoType )
391 REQUIRES( sanityCheckSelectionInfo( certInfoPtr ) );
402 certInfoPtr->currentSelection.updateCursor =
FALSE;
408 if(
cryptStatusOK( moveCursorToField( certInfoPtr, certInfoType ) ) )
414 if( certInfoPtr->certificate != NULL )
419 certInfoPtr->currentSelection.generalName =
certInfoType;
420 certInfoPtr->attributeCursor = NULL;
422 ENSURES( sanityCheckSelectionInfo( certInfoPtr ) );
433 if( isGeneralNameSelected( certInfoPtr ) )
438 certInfoPtr->currentSelection.generalName = \
439 CRYPT_CERTINFO_SUBJECTALTNAME;
444 moveCursorToField( certInfoPtr,
445 certInfoPtr->currentSelection.generalName ) ) )
453 resetDNselection( &certInfoPtr->currentSelection );
454 certInfoPtr->currentSelection.dnPtr = NULL;
455 certInfoPtr->currentSelection.updateCursor =
TRUE;
457 ENSURES( sanityCheckSelectionInfo( certInfoPtr ) );
474 REQUIRES( sanityCheckSelectionInfo( certInfoPtr ) );
482 ENSURES( isGeneralNameSelected( certInfoPtr ) );
487 status = getAttributeIdInfo( certInfoPtr->attributeCursor, NULL,
488 &generalName, NULL );
492 generalName, certInfoType );
493 if( attributePtr == NULL )
495 certInfoPtr->currentSelection.updateCursor =
FALSE;
496 certInfoPtr->attributeCursor = (
ATTRIBUTE_PTR * ) attributePtr;
498 ENSURES( sanityCheckSelectionInfo( certInfoPtr ) );
538 REQUIRES( sanityCheckSelectionInfo( certInfoPtr ) );
543 switch( certInfoType )
546 certInfoPtr->currentSelection.dnPtr = &certInfoPtr->subjectName;
550 certInfoPtr->currentSelection.dnPtr = &certInfoPtr->issuerName;
555 if( certInfoPtr->issuerName == NULL && \
557 certInfoPtr->currentSelection.dnPtr = &certInfoPtr->subjectName;
569 resetDNselection( &certInfoPtr->currentSelection );
570 certInfoPtr->attributeCursor = NULL;
572 ENSURES( sanityCheckSelectionInfo( certInfoPtr ) );
578 if( certInfoPtr->currentSelection.dnPtr != NULL )
594 if( isGeneralNameSelected( certInfoPtr ) )
597 if( checkAttributeProperty( certInfoPtr->attributeCursor, \
602 status = getAttributeDataDN( certInfoPtr->attributeCursor,
606 resetDNselection( &certInfoPtr->currentSelection );
607 certInfoPtr->currentSelection.dnPtr =
dnPtr;
608 certInfoPtr->currentSelection.dnInExtension =
TRUE;
610 ENSURES( sanityCheckSelectionInfo( certInfoPtr ) );
626 status = getAttributeIdInfo( certInfoPtr->attributeCursor, NULL,
627 &generalName, NULL );
634 status = addAttributeField( &certInfoPtr->attributes, generalName,
636 0, &certInfoPtr->errorLocus,
637 &certInfoPtr->errorType );
646 return( selectGeneralName( certInfoPtr, generalName,
MAY_BE_ABSENT ) );
659 REQUIRES( sanityCheckSelectionInfo( certInfoPtr ) );
667 certInfoPtr->currentSelection.dnComponent =
certInfoType;
668 certInfoPtr->currentSelection.dnComponentCount = 0;
670 ENSURES( sanityCheckSelectionInfo( certInfoPtr ) );
687 const int cursorMoveType )
697 switch( cursorMoveType )
738 const int cursorMoveType )
740 CERT_VAL_INFO *certValInfo = certInfoPtr->cCertVal;
741 VALIDITY_INFO *valInfo = certValInfo->validityInfo;
751 switch( cursorMoveType )
754 certValInfo->currentValidity = certValInfo->validityInfo;
755 if( certValInfo->currentValidity == NULL )
760 if( valInfo == NULL || \
761 certValInfo->currentValidity == NULL || \
762 valInfo == certValInfo->currentValidity )
770 for( iterationCount = 0;
772 valInfo->next != certValInfo->currentValidity && \
774 valInfo = valInfo->next, iterationCount++ );
775 ENSURES( iterationCount < FAILSAFE_ITERATIONS_LARGE );
776 certValInfo->currentValidity = valInfo;
780 if( certValInfo->currentValidity == NULL || \
781 certValInfo->currentValidity->next == NULL )
783 certValInfo->currentValidity = certValInfo->currentValidity->next;
787 if( valInfo == NULL )
794 for( iterationCount = 0;
795 valInfo->next != NULL && \
797 valInfo = valInfo->next, iterationCount++ );
798 ENSURES( iterationCount < FAILSAFE_ITERATIONS_LARGE );
799 certValInfo->currentValidity = valInfo;
816 const int cursorMoveType )
818 CERT_REV_INFO *certRevInfo = certInfoPtr->cCertRev;
819 REVOCATION_INFO *revInfo = certRevInfo->revocations;
830 switch( cursorMoveType )
833 certRevInfo->currentRevocation = certRevInfo->revocations;
834 if( certRevInfo->currentRevocation == NULL )
839 if( revInfo == NULL || \
840 certRevInfo->currentRevocation == NULL || \
841 revInfo == certRevInfo->currentRevocation )
851 for( iterationCount = 0;
853 revInfo->next != certRevInfo->currentRevocation && \
855 revInfo = revInfo->next, iterationCount++ );
856 ENSURES( iterationCount < FAILSAFE_ITERATIONS_MAX );
857 certRevInfo->currentRevocation = revInfo;
861 if( certRevInfo->currentRevocation == NULL || \
862 certRevInfo->currentRevocation->next == NULL )
864 certRevInfo->currentRevocation = certRevInfo->currentRevocation->next;
868 if( revInfo == NULL )
876 for( iterationCount = 0;
877 revInfo->next != NULL && \
879 revInfo = revInfo->next, iterationCount++ );
880 ENSURES( iterationCount < FAILSAFE_ITERATIONS_MAX );
881 certRevInfo->currentRevocation = revInfo;
896 const int cursorMoveType )
908 REQUIRES( certInfoPtr->cCertCert->chainEnd == 0 );
916 switch( certInfoPtr->type )
919 return( setCursorCertChain( certInfoPtr, cursorMoveType ) );
924 return( setCursorValInfo( certInfoPtr, cursorMoveType ) );
931 return( setCursorRevInfo( certInfoPtr, cursorMoveType ) );
948 IN const int moveType )
951 int count = 0, iterationCount;
962 currentSelection->dnComponentCount = 0;
967 if( currentSelection->dnComponentCount <= 0 )
969 currentSelection->dnComponentCount--;
978 for( iterationCount = 0;
985 getDNComponentValue( dnComponentList,
986 currentSelection->dnComponent,
987 count + 1, NULL, 0, &dummy ) ) )
991 ENSURES( iterationCount < FAILSAFE_ITERATIONS_MED );
993 currentSelection->dnComponentCount = count;
996 if( currentSelection->dnComponentCount >= count )
998 currentSelection->dnComponentCount++;
1010 static
int setAttributeCursorRelative(
INOUT CERT_INFO *certInfoPtr,
1024 ( value >= CRYPT_CERTINFO_FIRST_EXTENSION && \
1025 value <= CRYPT_CERTINFO_LAST_EXTENSION ) || \
1050 certInfoPtr->attributeCursor == NULL && \
1051 certInfoPtr->currentSelection.dnPtr != NULL && \
1054 return( setAttributeCursorDN( &certInfoPtr->currentSelection,
1062 if( certInfoPtr->attributes == NULL )
1068 certInfoPtr->attributeCursor = certInfoPtr->attributes;
1073 if( certInfoPtr->attributeCursor == NULL )
1074 certInfoPtr->attributeCursor = certInfoPtr->attributes;
1079 if( certInfoPtr->attributeCursor == NULL )
1092 if( certInfoPtr->attributeCursor == NULL )
1098 certInfoType, value );
1099 if( attributeCursor == NULL )
1101 certInfoPtr->attributeCursor = attributeCursor;
1102 syncSelection( certInfoPtr );
1110 IN const int value )
1119 ( value >= CRYPT_CERTINFO_FIRST_EXTENSION && \
1120 value <= CRYPT_CERTINFO_LAST_EXTENSION ) ||
1135 return( setAttributeCursorRelative( certInfoPtr, certInfoType,
1146 if( attributePtr == NULL )
1149 syncSelection( certInfoPtr );
1161 ENSURES( ( value >= CRYPT_CERTINFO_FIRST_EXTENSION && \
1162 value <= CRYPT_CERTINFO_LAST_EXTENSION ) || \
1178 return( selectGeneralName( certInfoPtr, value,
MAY_BE_ABSENT ) );
1180 return( selectGeneralNameComponent( certInfoPtr, value ) );
1188 return( selectDNComponent( certInfoPtr, value ) );
1191 return( moveCursorToField( certInfoPtr, value ) );