25 #define MK_OPTION( option, value, index ) \
26 { option, OPTION_NUMERIC, index, NULL, value }
27 #define MK_OPTION_B( option, value, index ) \
28 { option, OPTION_BOOLEAN, index, NULL, value }
29 #define MK_OPTION_S( option, value, length, index ) \
30 { option, OPTION_STRING, index, value, length }
31 #define MK_OPTION_NONE() \
32 { CRYPT_ATTRIBUTE_NONE, OPTION_NONE, CRYPT_UNUSED, NULL, 0 }
59 #ifdef CONFIG_SLOW_CPU
129 #define OPTION_INFO_SIZE ( sizeof( OPTION_INFO ) * \
130 CRYPT_OPTION_CONFIGCHANGED - CRYPT_OPTION_FIRST )
143 const int optionCode )
153 if( builtinOptionInfo[ i ].
index == optionCode )
154 return( &builtinOptionInfo[ i ] );
183 i < configOptionsCount && \
188 if( optionList[ i ].builtinOptionInfo->
option == option )
189 return( &optionList[ i ] );
211 getOptionInfo( optionList, configOptionsCount,
229 REQUIRES( configOptionsCount > 0 && \
233 i < configOptionsCount && \
234 optionList[ i ].builtinOptionInfo != NULL && \
238 if( optionList[ i ].dirty )
256 const void *configOptions,
267 REQUIRES( configOptionsCount > 0 && \
274 optionInfoPtr = getOptionInfo( configOptions, configOptionsCount,
276 ENSURES( optionInfoPtr != NULL && \
286 const void *configOptions,
296 assert(
isReadPtr( strPtrPtr,
sizeof(
void * ) ) );
297 assert(
isWritePtr( strLen,
sizeof(
int ) ) );
299 REQUIRES( configOptionsCount > 0 && \
307 optionInfoPtr = getOptionInfo( configOptions, configOptionsCount,
309 ENSURES( optionInfoPtr != NULL && \
313 *strPtrPtr = optionInfoPtr->strValue;
340 REQUIRES( configOptionsCount > 0 && \
348 getOptionInfo( configOptions, configOptionsCount,
350 ENSURES( optionInfoPtr != NULL );
352 ENSURES( builtinOptionInfoPtr != NULL && \
358 if( optionInfoPtr->
intValue == value )
425 setConfigChanged( configOptions, configOptionsCount );
443 REQUIRES( configOptionsCount > 0 && \
458 getOptionInfo( configOptions, configOptionsCount,
460 ENSURES( optionInfoPtr != NULL && \
482 assert(
isReadPtr( value, valueLength ) );
484 REQUIRES( configOptionsCount > 0 && \
492 getOptionInfo( configOptions, configOptionsCount,
494 ENSURES( optionInfoPtr != NULL );
496 ENSURES( builtinOptionInfoPtr != NULL && \
500 if( optionInfoPtr->strValue != NULL && \
501 optionInfoPtr->
intValue == valueLength && \
502 !memcmp( optionInfoPtr->strValue, value, valueLength ) )
507 if( builtinOptionInfoPtr->strDefault != NULL && \
508 builtinOptionInfoPtr->
intDefault == valueLength && \
509 !memcmp( builtinOptionInfoPtr->strDefault, value, valueLength ) )
511 if( optionInfoPtr->strValue != NULL && \
512 optionInfoPtr->strValue != builtinOptionInfoPtr->strDefault )
515 clFree(
"setOptionString", optionInfoPtr->strValue );
517 optionInfoPtr->strValue = (
char * ) builtinOptionInfoPtr->strDefault;
519 setConfigChanged( configOptions, configOptionsCount );
524 if( ( valuePtr =
clAlloc(
"setOptionString", valueLength ) ) == NULL )
526 memcpy( valuePtr, value, valueLength );
530 if( optionInfoPtr->strValue != NULL && \
531 optionInfoPtr->strValue != builtinOptionInfoPtr->strDefault )
534 clFree(
"setOptionString", optionInfoPtr->strValue );
542 setConfigChanged( configOptions, configOptionsCount );
566 REQUIRES( configOptionsCount > 0 && \
573 getOptionInfo( configOptions, configOptionsCount, option );
574 ENSURES( optionInfoPtr != NULL );
576 ENSURES( builtinOptionInfoPtr != NULL && \
585 ENSURES( builtinOptionInfoPtr->strDefault == NULL );
586 if( optionInfoPtr->strValue == NULL )
589 clFree(
"setOptionString", optionInfoPtr->strValue );
590 optionInfoPtr->strValue = NULL;
593 setConfigChanged( configOptions, configOptionsCount );
600 int initOptions(
OUT_OPT_PTR void **configOptionsPtr,
607 *configOptionsPtr = NULL;
608 *configOptionsCount = 0;
629 optionInfoPtr->strValue = (
char * ) builtinOptionInfoPtr->strDefault;
634 *configOptionsPtr = optionList;
668 if( optionInfoPtr->strValue != builtinOptionInfoPtr->strDefault )
671 clFree(
"endOptions", optionInfoPtr->strValue );
676 ENSURES_V( i == configOptionsCount - 1 );
679 memset( optionList, 0,
sizeof(
OPTION_INFO ) * configOptionsCount );
680 clFree(
"endOptions", optionList );