92 contentListPtr->clSigInfo.attributeCursorEntry = \
93 CRYPT_ENVINFO_SIGNATURE_RESULT;
116 for( doContinue =
TRUE, iterationCount = 0;
126 attributeOrderList[ i ] != attributeType && \
142 attributeOrderList[ i - 1 ];
144 attributeType = attributeOrderList[ i + 1 ];
155 switch( attributeType )
179 ENSURES( iterationCount < FAILSAFE_ITERATIONS_SMALL );
202 assert( contentListPtr == NULL || \
204 assert( groupID == NULL || \
206 assert( attributeID == NULL || \
208 assert( instanceID == NULL || \
214 if( groupID != NULL )
216 if( attributeID != NULL )
218 if( instanceID != NULL )
229 if( contentListPtr == NULL )
231 subGroupMove = ( ( attrGetType ==
ATTR_PREV || \
236 subGroupMove = moveVirtualCursor( contentListPtr, attrGetType );
244 contentListPtr = ( attrGetType ==
ATTR_PREV ) ? \
245 contentListPtr->
prev : contentListPtr->
next;
246 if( contentListPtr != NULL )
247 resetVirtualCursor( contentListPtr );
249 if( contentListPtr == NULL )
261 if( groupID != NULL && ( attrGetType ==
ATTR_CURRENT || subGroupMove ) )
262 *groupID = contentListPtr->
envInfo;
264 *attributeID = contentListPtr->clSigInfo.attributeCursorEntry;
265 return( contentListPtr );
273 const void *certChainData,
275 const int certChainDataLength )
281 assert(
isReadPtr( certChainData, certChainDataLength ) );
292 certChainDataLength, CRYPT_ICERTTYPE_CMS_CERTSET );
293 if( contentListItem->issuerAndSerialNumber == NULL )
295 createInfo.
arg2 = CRYPT_IKEYID_KEYID;
296 createInfo.strArg2 = contentListItem->keyID;
297 createInfo.
strArgLen2 = contentListItem->keyIDsize;
301 createInfo.
arg2 = CRYPT_IKEYID_ISSUERANDSERIALNUMBER;
302 createInfo.strArg2 = contentListItem->issuerAndSerialNumber;
303 createInfo.
strArgLen2 = contentListItem->issuerAndSerialNumberSize;
309 contentListItem->clSigInfo.iSigCheckKey = createInfo.
cryptHandle;
322 CONTENT_LIST *contentListItem = envelopeInfoPtr->contentListCurrent;
327 assert(
isWritePtr( valuePtr,
sizeof(
int ) ) );
329 REQUIRES( contentListItem != NULL );
338 envelopeInfoPtr->iDecryptionKeyset ==
CRYPT_ERROR )
340 *valuePtr = contentListItem->
envInfo;
356 if( contentListItem->issuerAndSerialNumber == NULL )
360 CRYPT_IKEYID_PGPKEYID : CRYPT_IKEYID_KEYID,
361 contentListItem->keyID, contentListItem->
keyIDsize,
367 CRYPT_IKEYID_ISSUERANDSERIALNUMBER,
368 contentListItem->issuerAndSerialNumber,
414 status = envelopeInfoPtr->addInfo( envelopeInfoPtr,
432 envelopeInfoPtr->contentListCurrent->envInfo : \
433 CRYPT_ATTRIBUTE_NONE;
447 CONTENT_LIST *contentListItem = envelopeInfoPtr->contentListCurrent;
452 assert(
isWritePtr( valuePtr,
sizeof(
int ) ) );
457 contentListItem != NULL );
476 *valuePtr = ( envelopeInfoPtr->errorState !=
CRYPT_OK ) ? \
481 REQUIRES( contentListItem != NULL );
488 sigInfo = &contentListItem->clSigInfo;
490 return( exitErrorNotFound( envelopeInfoPtr,
503 envelopeInfoPtr->auxBuffer != NULL )
505 ( void ) instantiateCertChain( contentListItem,
506 envelopeInfoPtr->auxBuffer,
507 envelopeInfoPtr->auxBufSize );
520 *valuePtr = envelopeInfoPtr->addInfo( envelopeInfoPtr,
529 if( envelopeInfoPtr->iSigCheckKeyset ==
CRYPT_ERROR )
530 return( exitErrorNotInited( envelopeInfoPtr,
538 if( contentListItem->issuerAndSerialNumber == NULL )
542 CRYPT_IKEYID_PGPKEYID : CRYPT_IKEYID_KEYID,
543 contentListItem->keyID, contentListItem->
keyIDsize,
549 CRYPT_IKEYID_ISSUERANDSERIALNUMBER,
550 contentListItem->issuerAndSerialNumber,
561 envelopeInfoPtr->iSigCheckKeyset,
562 "Couldn't retrieve signature-check key from keyset" ) );
574 *valuePtr = envelopeInfoPtr->addInfo( envelopeInfoPtr,
593 CONTENT_LIST *contentListItem = envelopeInfoPtr->contentListCurrent;
598 assert(
isWritePtr( valuePtr,
sizeof(
int ) ) );
600 REQUIRES( contentListItem != NULL );
609 if( envelopeInfoPtr->auxBuffer == NULL )
613 return( exitErrorNotFound( envelopeInfoPtr,
616 status = instantiateCertChain( contentListItem,
617 envelopeInfoPtr->auxBuffer,
618 envelopeInfoPtr->auxBufSize );
646 &sigCheckCert, CRYPT_IATTRIBUTE_CERTCOPY );
685 if( !envelopeInfoPtr->checkAlgo( value,
690 envelopeInfoPtr->defaultAlgo =
value;
696 envelopeInfoPtr->defaultHash =
value;
702 envelopeInfoPtr->defaultMAC =
value;
707 return( exitErrorInited( envelopeInfoPtr,
739 if( envelopeInfoPtr->contentType && \
740 envelopeInfoPtr->contentType != value )
741 return( exitErrorInited( envelopeInfoPtr,
761 return( exitErrorInited( envelopeInfoPtr,
778 return( exitErrorInited( envelopeInfoPtr,
786 return( exitErrorInited( envelopeInfoPtr,
789 if( envelopeInfoPtr->iExtraCertChain !=
CRYPT_ERROR )
790 return( exitErrorInited( envelopeInfoPtr,
796 if( envelopeInfoPtr->iEncryptionKeyset !=
CRYPT_ERROR )
797 return( exitErrorInited( envelopeInfoPtr,
803 if( envelopeInfoPtr->iDecryptionKeyset !=
CRYPT_ERROR )
804 return( exitErrorInited( envelopeInfoPtr,
810 if( envelopeInfoPtr->iSigCheckKeyset !=
CRYPT_ERROR )
811 return( exitErrorInited( envelopeInfoPtr,
833 assert(
isWritePtr( valuePtr,
sizeof(
int ) ) );
844 *valuePtr = envelopeInfoPtr->bufSize;
849 *valuePtr = envelopeInfoPtr->errorType;
854 *valuePtr = envelopeInfoPtr->errorLocus;
894 if( ( envelopeInfoPtr->usage ==
ACTION_MAC || \
914 if( envelopeInfoPtr->contentListCurrent == NULL )
916 if( envelopeInfoPtr->contentList == NULL )
917 return( exitErrorNotFound( envelopeInfoPtr,
919 envelopeInfoPtr->contentListCurrent = envelopeInfoPtr->contentList;
920 resetVirtualCursor( envelopeInfoPtr->contentListCurrent );
929 attribute == CRYPT_IATTRIBUTE_ATTRONLY );
937 return( getCurrentAttributeInfo( envelopeInfoPtr, valuePtr ) );
941 return( exitErrorNotInited( envelopeInfoPtr,
943 *valuePtr = envelopeInfoPtr->defaultAlgo;
948 return( exitErrorNotInited( envelopeInfoPtr,
950 *valuePtr = envelopeInfoPtr->defaultHash;
955 return( exitErrorNotInited( envelopeInfoPtr,
957 *valuePtr = envelopeInfoPtr->defaultMAC;
962 return( exitErrorNotInited( envelopeInfoPtr,
970 return( exitErrorNotFound( envelopeInfoPtr,
972 *valuePtr = envelopeInfoPtr->contentType;
990 return( exitErrorNotFound( envelopeInfoPtr,
997 return( getSignatureResult( envelopeInfoPtr, valuePtr ) );
1000 *valuePtr = ( envelopeInfoPtr->usage ==
ACTION_MAC ) ? \
1008 return( getSignatureKey( envelopeInfoPtr, valuePtr ) );
1015 envelopeInfoPtr->contentListCurrent;
1017 REQUIRES( contentListItem != NULL );
1022 contentListItem->clSigInfo.iExtraData : \
1023 contentListItem->clSigInfo.iTimestamp;
1025 return( exitErrorNotFound( envelopeInfoPtr, attribute ) );
1034 case CRYPT_IATTRIBUTE_ATTRONLY:
1038 return( exitErrorNotFound( envelopeInfoPtr,
1039 CRYPT_IATTRIBUTE_ATTRONLY ) );
1069 envelopeInfoPtr->contentListCurrent == NULL )
1071 if( envelopeInfoPtr->contentList == NULL )
1072 return( exitErrorNotFound( envelopeInfoPtr,
1074 envelopeInfoPtr->contentListCurrent = envelopeInfoPtr->contentList;
1075 resetVirtualCursor( envelopeInfoPtr->contentListCurrent );
1084 if( errorInfo->errorStringLength > 0 )
1086 return( attributeCopy( msgData, errorInfo->errorString,
1087 errorInfo->errorStringLength ) );
1103 contentListItem = envelopeInfoPtr->contentListCurrent;
1105 return( exitErrorNotFound( envelopeInfoPtr,
1107 if( envelopeInfoPtr->iDecryptionKeyset ==
CRYPT_ERROR )
1108 return( exitErrorNotInited( envelopeInfoPtr,
1114 if( contentListItem->issuerAndSerialNumber == NULL )
1118 CRYPT_IKEYID_PGPKEYID : CRYPT_IKEYID_KEYID,
1119 contentListItem->keyID,
1127 CRYPT_IKEYID_ISSUERANDSERIALNUMBER,
1128 contentListItem->issuerAndSerialNumber,
1140 envelopeInfoPtr->iDecryptionKeyset,
1141 "Couldn't retrieve private-key label from "
1142 "keyset/device" ) );
1144 return( attributeCopy( msgData, getkeyInfo.auxInfo,
1171 static const CHECK_INFO checkTable[] = {
1176 #ifdef USE_COMPRESSION
1206 envelopeInfoPtr->bufSize =
value;
1220 if( envelopeInfoPtr->contentList == NULL )
1223 ENSURES( envelopeInfoPtr->contentList != NULL );
1230 envelopeInfoPtr->contentListCurrent == NULL )
1232 envelopeInfoPtr->contentListCurrent = \
1233 envelopeInfoPtr->contentList;
1234 if( envelopeInfoPtr->contentListCurrent != NULL )
1235 resetVirtualCursor( envelopeInfoPtr->contentListCurrent );
1240 if( envelopeInfoPtr->contentListCurrent == NULL )
1255 if( envelopeInfoPtr->contentListCurrent == NULL )
1258 ENSURES( envelopeInfoPtr->contentListCurrent != NULL );
1262 attributeMoveCursor( envelopeInfoPtr->contentListCurrent,
1264 if( contentListCursor == NULL )
1266 envelopeInfoPtr->contentListCurrent = \
1312 for( i = 0; checkTable[ i ].type !=
ACTION_NONE && \
1315 if( checkTable[ i ].
type == attribute )
1318 envelopeInfoPtr->usage != checkTable[ i ].usage )
1319 return( exitErrorInited( envelopeInfoPtr, attribute ) );
1320 usage = checkTable[ i ].usage;
1321 checkType = checkTable[ i ].checkType;
1331 envelopeInfoPtr->usage != usage )
1332 return( exitErrorInited( envelopeInfoPtr,
1339 status = checkOtherAttribute( envelopeInfoPtr, value, attribute,
1340 &usage, &checkType );
1386 if( !envelopeInfoPtr->checkAlgo( algorithm, mode ) )
1429 status = envelopeInfoPtr->addInfo( envelopeInfoPtr, attribute,
1434 return( exitErrorInited( envelopeInfoPtr, attribute ) );
1441 envelopeInfoPtr->usage = usage;
1469 assert(
isReadPtr( data, dataLength ) );
1487 return( exitErrorInited( envelopeInfoPtr,
1497 return( exitErrorInited( envelopeInfoPtr,
1502 status = envelopeInfoPtr->addInfoString( envelopeInfoPtr,
1519 if( envelopeInfoPtr->iEncryptionKeyset ==
CRYPT_ERROR )
1520 return( exitErrorNotInited( envelopeInfoPtr,
1534 dataLength, NULL, 0,
1548 dataLength, NULL, 0,
1558 envelopeInfoPtr->iEncryptionKeyset,
1559 "Couldn't retrieve encryption key from keyset" ) );
1572 status = envelopeInfoPtr->addInfo( envelopeInfoPtr,
1587 return( exitErrorInited( envelopeInfoPtr, attribute ) );
1594 envelopeInfoPtr->usage = usage;