47 readSequence( stream, NULL );
54 return( readUniversal( stream ) );
57 if( builtinOptionInfoPtr == NULL || \
58 builtinOptionInfoPtr->
index < 0 || \
59 builtinOptionInfoPtr->
index > LAST_OPTION_INDEX || \
63 return( readUniversal( stream ) );
65 attributeType = builtinOptionInfoPtr->
option;
71 tag = peekTag( stream );
86 value = ( int ) integer;
91 &value, attributeType );
98 status = sMemGetDataBlock( stream, &dataPtr, length );
100 status = sSkip( stream, length );
105 &msgData, attributeType );
125 assert(
isWritePtr( length,
sizeof(
int ) ) );
127 REQUIRES( configOptionsCount > 0 && \
136 i < configOptionsCount && \
142 optionList[ i ].builtinOptionInfo;
143 const OPTION_INFO *optionInfoPtr = &optionList[ i ];
154 if( optionInfoPtr->strValue == NULL || \
155 optionInfoPtr->strValue == builtinOptionInfoPtr->strDefault )
157 lengthValue = ( int ) \
160 sizeofObject( optionInfoPtr->
intValue ) );
168 lengthValue = ( int ) \
172 sizeofShortInteger( optionInfoPtr->
intValue ) : \
176 dataLength += lengthValue;
178 ENSURES( i < configOptionsCount );
199 REQUIRES( configOptionsCount > 0 && \
204 i < configOptionsCount && \
210 optionList[ i ].builtinOptionInfo;
211 const OPTION_INFO *optionInfoPtr = &optionList[ i ];
219 if( optionInfoPtr->strValue == NULL || \
220 optionInfoPtr->strValue == builtinOptionInfoPtr->strDefault )
222 writeSequence( stream,
224 sizeofObject( optionInfoPtr->
intValue ) );
225 writeShortInteger( stream, builtinOptionInfoPtr->
index,
227 status = writeCharacterString( stream, optionInfoPtr->strValue,
239 writeSequence( stream,
242 writeShortInteger( stream, builtinOptionInfoPtr->
index,
244 status = writeShortInteger( stream, optionInfoPtr->
intValue,
249 writeSequence( stream,
252 writeShortInteger( stream, builtinOptionInfoPtr->
index,
254 status = writeBoolean( stream, optionInfoPtr->
intValue,
260 ENSURES( i < configOptionsCount );
276 #ifdef USE_CERTIFICATES
284 int iterationCount,
status;
286 assert( trustInfoPtr != NULL );
293 &msgData, CRYPT_IATTRIBUTE_TRUSTEDCERT );
294 for( iterationCount = 0;
308 CRYPT_IATTRIBUTE_TRUSTEDCERT_NEXT );
311 ENSURES( iterationCount < FAILSAFE_ITERATIONS_LARGE );
326 char configFilePath[ MAX_PATH_LENGTH + 8 ];
327 int configFilePathLen, iterationCount,
status;
337 status = fileBuildCryptlibPath( configFilePath, MAX_PATH_LENGTH,
338 &configFilePathLen, fileName,
344 createInfo.strArg1 = configFilePath;
357 status = dynCreate( &configDB, iCryptKeyset,
358 CRYPT_IATTRIBUTE_CONFIGDATA );
363 #ifdef USE_CERTIFICATES
365 status = readTrustedCerts( iCryptKeyset, trustInfoPtr );
370 #ifdef USE_CERTIFICATES
371 if( trustInfoPtr != NULL )
372 status = readTrustedCerts( iCryptKeyset, trustInfoPtr );
377 dynDestroy( &configDB );
383 for( iterationCount = 0;
385 stell( &stream ) <
dynLength( configDB ) && \
389 status = readConfigOption( &stream, iCryptUser );
391 ENSURES( iterationCount < FAILSAFE_ITERATIONS_LARGE );
392 sMemDisconnect( &stream );
395 dynDestroy( &configDB );
425 const void *trustInfoPtr,
429 #ifdef USE_CERTIFICATES
430 const BOOLEAN hasTrustedCerts = trustedCertsPresent( trustInfoPtr );
438 assert( trustInfoPtr != NULL );
441 REQUIRES( configOptionsCount > 0 && \
449 if( !checkConfigChanged( configOptions, configOptionsCount ) && \
458 status = sizeofConfigData( configOptions, configOptionsCount, &length );
466 *disposition = hasTrustedCerts ? \
467 CONFIG_DISPOSITION_TRUSTED_CERTS_ONLY : \
468 CONFIG_DISPOSITION_EMPTY_CONFIG_FILE;
475 CONFIG_DISPOSITION_DATA_ONLY;
492 assert(
isWritePtr( dataPtrPtr,
sizeof(
void * ) ) );
493 assert(
isWritePtr( dataLength,
sizeof(
int ) ) );
495 REQUIRES( configOptionsCount > 0 && \
503 status = sizeofConfigData( configOptions, configOptionsCount, &length );
509 if( ( dataPtr =
clAlloc(
"prepareConfigData", length ) ) == NULL )
513 sMemOpen( &stream, dataPtr, length );
514 status = writeConfigData( &stream, configOptions, configOptionsCount );
516 length = stell( &stream );
517 sMemDisconnect( &stream );
520 clFree(
"prepareConfigData", dataPtr );
521 DEBUG_DIAG((
"Couldn't prepare config data for write" ));
525 *dataPtrPtr = dataPtr;
539 char configFilePath[ MAX_PATH_LENGTH + 8 ];
540 int configFilePathLen,
status;
543 assert( ( data == NULL && dataLength == 0 ) || \
549 REQUIRES( ( data == NULL && dataLength == 0 ) || \
553 status = fileBuildCryptlibPath( configFilePath, MAX_PATH_LENGTH,
554 &configFilePathLen, fileName,
565 createInfo.strArg1 = configFilePath;
584 CRYPT_IATTRIBUTE_CONFIGDATA );
592 CRYPT_IATTRUBUTE_CERTKEYSET );
597 fileErase( configFilePath );
613 int deleteConfig(
IN_STRING const char *fileName )
615 char configFilePath[ MAX_PATH_LENGTH + 1 + 8 ];
616 int configFilePathLen,
status;
618 status = fileBuildCryptlibPath( configFilePath, MAX_PATH_LENGTH,
619 &configFilePathLen, fileName,
623 configFilePath[ configFilePathLen ] =
'\0';
624 fileErase( configFilePath );