35 const BOOLEAN pkcs15certPresent,
40 BOOLEAN unneededCert, unneededKey;
50 *isCertUpdate =
FALSE;
54 unneededCert = certPresent & pkcs15certPresent;
55 if( ( ( unneededCert && !privkeyPresent ) || \
56 ( unneededKey && unneededCert ) ) && \
115 assert( !
"Attempt to replace certificate with future-dated certificate" );
122 if( ( unneededKey && !certPresent ) ||
123 ( unneededCert && !privkeyPresent ) ||
124 ( unneededKey && unneededCert ) )
132 "No new data to add" ) );
158 IN_FLAGS( KEYMGMT )
const int flags )
165 ( keysetInfoPtr->keysetFile->iHardwareDevice !=
CRYPT_UNUSED ) ? \
184 REQUIRES( ( password == NULL && passwordLength == 0 ) || \
185 ( password != NULL && \
190 password == NULL && passwordLength == 0 ) || \
193 password != NULL && passwordLength != 0 ) );
197 ( !isStorageObject && \
204 return( addSecretKey( pkcs15info, noPkcs15objects, cryptHandle ) );
240 privkeyPresent =
TRUE;
246 privkeyPresent =
TRUE;
250 &msgData, CRYPT_IATTRIBUTE_KEYID );
263 CRYPT_IATTRIBUTE_DEVICESTORAGEID );
269 if( !isStorageObject )
274 if( isStorageObject )
290 if( password != NULL )
295 if( !privkeyPresent )
299 "Item being added doesn't contain a private "
302 if( password == NULL )
333 "Certificate being added is incomplete (unsigned)" ) );
366 if( pkcs15infoPtr != NULL )
369 if( pkcs15infoPtr->privKeyData != NULL )
370 pkcs15keyPresent =
TRUE;
371 if( pkcs15infoPtr->certData != NULL )
372 pkcs15certPresent =
TRUE;
375 status = checkAddInfo( pkcs15infoPtr, cryptHandle, isCertChain,
376 privkeyPresent, certPresent,
377 pkcs15keyPresent, pkcs15certPresent,
391 CRYPT_IATTRIBUTE_LOCKED );
394 status = pkcs15AddCertChain( pkcs15infoPtr, noPkcs15objects,
398 CRYPT_IATTRIBUTE_LOCKED );
417 msgData.data, msgData.
length,
422 "Item with this label is already present" ) );
427 pkcs15infoPtr = findFreeEntry( pkcs15info, noPkcs15objects,
429 if( pkcs15infoPtr == NULL )
433 "No more room in keyset to add this item" ) );
442 CRYPT_IATTRIBUTE_LOCKED );
449 status = pkcs15AddKey( pkcs15infoPtr, cryptHandle, password,
450 passwordLength, keysetInfoPtr->ownerHandle,
451 privkeyPresent, certPresent,
452 ( isCertUpdate || !pkcs15certPresent ) ? \
454 pkcs15keyPresent, isStorageObject,
462 CRYPT_IATTRIBUTE_LOCKED );
472 pkcs15infoPtr->
index = pkcs15index;
488 ( void ) pkcs15AddCertChain( pkcs15infoPtr, noPkcs15objects,
497 CRYPT_IATTRIBUTE_LOCKED );
512 const int noPkcs15objects = keysetInfoPtr->keyDataNoObjects;
521 REQUIRES( dataType == CRYPT_IATTRIBUTE_CONFIGDATA || \
522 dataType == CRYPT_IATTRIBUTE_USERINDEX || \
523 dataType == CRYPT_IATTRIBUTE_USERID || \
524 dataType == CRYPT_IATTRIBUTE_USERINFO || \
525 dataType == CRYPT_IATTRIBUTE_HWSTORAGE );
531 if( dataType == CRYPT_IATTRIBUTE_HWSTORAGE )
533 keysetInfoPtr->keysetFile->iHardwareDevice = \
538 return( addConfigData( pkcs15info, noPkcs15objects, dataType,
539 data, dataLength ) );
559 assert(
isReadPtr( keyID, keyIDlength ) );
567 keyIDtype == CRYPT_IKEYID_KEYID || \
568 keyIDtype == CRYPT_IKEYID_ISSUERID );
573 pkcs15infoPtr = findEntry( keysetInfoPtr->keyData,
574 keysetInfoPtr->keyDataNoObjects, keyIDtype,
576 if( pkcs15infoPtr == NULL )
580 "No information present for this ID" ) );
584 pkcs15freeEntry( pkcs15infoPtr );
604 keysetInfoPtr->setItemFunction = setItemFunction;
605 keysetInfoPtr->setSpecialItemFunction = setSpecialItemFunction;
606 keysetInfoPtr->deleteItemFunction = deleteItemFunction;