18 #ifdef USE_CERTIFICATES
42 assert( attributeListPtr == NULL || \
44 assert( groupID == NULL || \
46 assert( attributeID == NULL || \
48 assert( instanceID == NULL || \
56 if( attributeID != NULL )
58 if( instanceID != NULL )
62 if( attributeListPtr == NULL || \
66 attributeListPtr = attributeListPtr->
prev;
70 attributeListPtr = attributeListPtr->
next;
72 if( attributeListPtr == NULL || \
79 if( attributeID != NULL )
80 *attributeID = attributeListPtr->
fieldID;
81 if( instanceID != NULL )
83 return( attributeListPtr );
101 int attributeInfoSize, iterationCount,
status;
110 status = getAttributeInfo( attributeType, &attributeInfoPtr,
111 &attributeInfoSize );
113 for( iterationCount = 0;
115 iterationCount < attributeInfoSize; \
116 attributeInfoPtr++, iterationCount++ )
120 if( attributeInfoPtr->
oid != NULL && \
122 !memcmp( attributeInfoPtr->
oid, oid, oidLength ) )
123 return( attributeInfoPtr );
125 ENSURES_N( iterationCount < attributeInfoSize );
145 int attributeInfoSize, iterationCount,
status;
147 assert( attributeID == NULL || \
152 REQUIRES_N( fieldID >= CRYPT_CERTINFO_FIRST_EXTENSION && \
155 ( subFieldID >= CRYPT_CERTINFO_FIRST_NAME && \
156 subFieldID <= CRYPT_CERTINFO_LAST_GENERALNAME ) );
159 if( attributeID != NULL )
163 status = getAttributeInfo( attributeType, &attributeInfoPtr,
164 &attributeInfoSize );
166 for( iterationCount = 0;
168 iterationCount < attributeInfoSize;
169 attributeInfoPtr++, iterationCount++ )
172 int innerIterationCount;
194 lastAttributeID = attributeInfoPtr->
fieldID;
199 if( attributeInfoPtr->
fieldID != fieldID )
207 if( attributeID != NULL )
208 *attributeID = lastAttributeID;
209 return( attributeInfoPtr );
218 for( altEncodingTable = attributeInfoPtr->
extraData, \
219 innerIterationCount = 0;
222 altEncodingTable++, innerIterationCount++ )
224 if( altEncodingTable->
fieldID == subFieldID )
226 if( attributeID != NULL )
227 *attributeID = lastAttributeID;
228 return( altEncodingTable );
236 ENSURES_N( iterationCount < attributeInfoSize );
256 assert( attributeListPtr == NULL || \
271 ATTRIBUTE_PTR *findAttributeByOID(
const ATTRIBUTE_PTR *attributePtr,
285 for( attributeListPtr = attributePtr, iterationCount = 0;
286 attributeListPtr != NULL && \
288 attributeListPtr = attributeListPtr->
next, iterationCount++ )
291 if( !checkAttributeProperty( attributeListPtr,
296 if(
sizeofOID( attributeListPtr->
oid ) == oidLength && \
297 !memcmp( attributeListPtr->
oid, oid, oidLength ) )
300 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_LARGE );
311 assert( attributePtr == NULL || \
314 REQUIRES_N( fieldID >= CRYPT_CERTINFO_FIRST_EXTENSION && \
317 ( subFieldID >= CRYPT_CERTINFO_FIRST_NAME && \
318 subFieldID <= CRYPT_CERTINFO_LAST_GENERALNAME ) );
351 ( fieldID >= CRYPT_CERTINFO_FIRST_CMS ) ? \
355 assert( attributePtr == NULL || \
358 REQUIRES_N( fieldID >= CRYPT_CERTINFO_FIRST_EXTENSION && \
361 if( attributePtr == NULL )
365 attributeListCursor = attributeFind( attributePtr,
367 if( attributeListCursor != NULL )
382 if( attributeInfoPtr == NULL )
396 for( attributeListCursor = attributePtr, iterationCount = 0;
397 attributeListCursor != NULL && \
398 isValidAttributeField( attributeListCursor ) && \
399 attributeListCursor->
attributeID != attributeID && \
401 attributeListCursor = attributeListCursor->
next, iterationCount++ );
402 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_LARGE );
408 if( attributeListCursor == NULL || \
435 ATTRIBUTE_PTR *findNextFieldInstance(
const ATTRIBUTE_PTR *attributePtr )
457 for( iterationCount = 0;
458 attributeListPtr != NULL && \
460 attributeListPtr->fieldID == fieldID && \
462 attributeListPtr = attributeListPtr->
next, iterationCount++ )
467 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_LARGE );
483 assert( attributePtr == NULL || \
486 REQUIRES_N( attributeID >= CRYPT_CERTINFO_FIRST_EXTENSION && \
489 if( attributePtr == NULL )
499 &localAttributeID ) == NULL )
513 &localAttributeID ) == NULL || \
514 attributeID == localAttributeID );
520 for( attributeListPtr = attributePtr, iterationCount = 0;
521 attributeListPtr != NULL && \
522 isValidAttributeField( attributeListPtr ) && \
523 iterationCount < FAILSAFE_ITERATIONS_LARGE * 10;
524 attributeListPtr = attributeListPtr->
next, iterationCount++ )
526 if( attributeListPtr->
attributeID == localAttributeID )
529 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_LARGE * 10 );
533 return( attributeFindEx( attributePtr,
getAttrFunction, localAttributeID,
542 assert( attributePtr == NULL || \
545 REQUIRES_B( fieldID >= CRYPT_CERTINFO_FIRST_EXTENSION && \
556 assert( attributePtr == NULL || \
559 REQUIRES_B( fieldID >= CRYPT_CERTINFO_FIRST_EXTENSION && \
577 assert( currentCursor == NULL || \
588 certInfoType, position ) );
601 IN_ENUM( ATTRIBUTE_PROPERTY ) \
614 return( ( attributeListPtr->
fieldID == 0 && \
618 return( ( attributeListPtr->
fieldID == 0 && \
652 IN_ENUM( ATTRIBUTE_PROPERTY ) \
699 assert( attributeID == NULL || \
701 assert( fieldID == NULL || \
703 assert( subFieldID == NULL || \
706 REQUIRES( attributeID != NULL || fieldID != NULL || subFieldID != NULL );
709 if( attributeID != NULL )
711 if( fieldID != NULL )
712 *fieldID = attributeListPtr->
fieldID;
713 if( subFieldID != NULL )
733 assert( attributePtr == NULL || \
742 attrEnumInfo->enumType = enumType;
744 if( attributePtr == NULL )
757 for( iterationCount = 0;
758 attributeListPtr != NULL && \
759 !checkAttributeProperty( attributeListPtr,
762 attributeListPtr = attributeListPtr->
next, iterationCount++ );
763 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_LARGE );
767 if( attributeListPtr == NULL )
775 if( checkAttributeProperty( attributeListPtr,
778 attrEnumInfo->attributePtr = NULL;
787 return( attrEnumInfo->attributePtr );
793 const ATTRIBUTE_LIST *attributeListPtr = attrEnumInfo->attributePtr;
799 ENSURES_N( attrEnumInfo->attributePtr != NULL );
800 attrEnumInfo->attributePtr = \
802 if( attrEnumInfo->attributePtr == NULL )
805 switch( attrEnumInfo->enumType )
812 if( checkAttributeProperty( attributeListPtr,
815 attrEnumInfo->attributePtr = NULL;
824 return( attrEnumInfo->attributePtr );
845 *value = attributeListPtr->
intValue;
861 *value = *( ( time_t * ) attributeListPtr->value );
879 *dnPtr = (
DN_PTR ** ) &attributeListPtr->value;
893 *dataPtrPtr = attributeListPtr->value;
912 assert( attributePtr == NULL || \
915 REQUIRES( fieldID >= CRYPT_CERTINFO_FIRST_EXTENSION && \
918 ( subFieldID >= CRYPT_CERTINFO_FIRST_NAME && \
919 subFieldID <= CRYPT_CERTINFO_LAST_GENERALNAME ) );
927 if( attributeListPtr == NULL )
929 return( getAttributeDataValue( attributeListPtr, value ) );
941 assert( attributePtr == NULL || \
944 REQUIRES( fieldID >= CRYPT_CERTINFO_FIRST_EXTENSION && \
947 ( subFieldID >= CRYPT_CERTINFO_FIRST_NAME && \
948 subFieldID <= CRYPT_CERTINFO_LAST_GENERALNAME ) );
956 if( attributeListPtr == NULL )
958 return( getAttributeDataTime( attributeListPtr, value ) );
968 REQUIRES( fieldID >= CRYPT_CERTINFO_FIRST_EXTENSION && \
972 fieldIDToAttribute( ( fieldID >= CRYPT_CERTINFO_FIRST_CMS ) ? \
975 ENSURES( attributeInfoPtr != NULL );
1013 return(
compareDN( attributeField1->value, attributeField2->value,
1021 if( memcmp( attributeField1->value, attributeField2->value,
1047 for( iterationCount = 0;
1048 attributeListPtr1 != NULL && attributeListPtr2 != NULL && \
1049 attributeListPtr1->
attributeID == attributeID && \
1050 attributeListPtr2->attributeID == attributeID && \
1052 attributeListPtr1 = attributeListPtr1->
next, \
1053 attributeListPtr2 = attributeListPtr2->
next, \
1056 if( !compareAttributeField( attributeListPtr1, attributeListPtr2 ) )
1059 ENSURES_B( iterationCount < FAILSAFE_ITERATIONS_LARGE );
1064 if( attributeListPtr1 == NULL || attributeListPtr2 == NULL )
1068 if( attributeListPtr1 == NULL )
1072 if( attributeListPtr2 != NULL && \
1080 if( attributeListPtr1->
attributeID == attributeID )
1090 if( attributeListPtr1->
attributeID == attributeID || \
1109 #ifdef USE_CERTLEVEL_PKIX_PARTIAL
1110 int complianceLevel;
1118 status = convertEmail( certInfoPtr, &certInfoPtr->subjectName,
1121 status = convertEmail( certInfoPtr, &certInfoPtr->issuerName,
1126 #ifdef USE_CERTLEVEL_PKIX_PARTIAL
1149 status = getKeyUsageFromExtKeyUsage( certInfoPtr, &keyUsage,
1150 &certInfoPtr->errorLocus,
1151 &certInfoPtr->errorType );
1154 status = addAttributeField( &certInfoPtr->attributes,
1158 &certInfoPtr->errorLocus,
1159 &certInfoPtr->errorType );