cryptlib  3.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros
user_int.h
Go to the documentation of this file.
1 /****************************************************************************
2 * *
3 * Interal User Header File *
4 * Copyright Peter Gutmann 1999-2008 *
5 * *
6 ****************************************************************************/
7 
8 #ifndef _USER_INT_DEFINED
9 
10 #define _USER_INT_DEFINED
11 
12 /* Configuration option types */
13 
14 typedef enum {
15  OPTION_NONE, /* Non-option */
16  OPTION_STRING, /* Literal string */
17  OPTION_NUMERIC, /* Numeric value */
18  OPTION_BOOLEAN /* Boolean flag */
19  } OPTION_TYPE;
20 
21 /* The configuration options. Alongside the CRYPT_ATTRIBUTE_TYPE we store a
22  persistent index value for the option that always stays the same even if
23  the attribute type changes. This avoids the need to change the config
24  file every time that an attribute is added or deleted. Some options
25  can't be made persistent, for these the index value is set to
26  CRYPT_UNUSED */
27 
28 typedef struct {
29  const CRYPT_ATTRIBUTE_TYPE option;/* Attribute ID */
30  const OPTION_TYPE type; /* Option type */
31  const int index; /* Index value for this option */
32  BUFFER_OPT_FIXED( intDefault ) \
33  const char FAR_BSS *strDefault; /* Default if it's a string option */
34  const int intDefault; /* Default if it's a numeric/boolean
35  or length if it's a string */
37 
38 typedef struct {
39  BUFFER_OPT_FIXED( intValue ) \
40  char *strValue; /* Value if it's a string option */
41  int intValue; /* Value if it's a numeric/boolean
42  or length if it's a string */
44  /* Pointer to corresponding built-in
45  option info */
46  BOOLEAN dirty; /* Whether option has been changed */
47  } OPTION_INFO;
48 
49 /* The attribute ID of the last option that's written to disk, and an upper
50  bound on the corresponding persistent index value used for range checking.
51  Further options beyond this one are ephemeral and are never written to
52  disk */
53 
54 #define LAST_STORED_OPTION CRYPT_OPTION_MISC_SIDECHANNELPROTECTION
55 #define LAST_OPTION_INDEX 1000
56 
57 /* Prototypes for functions in user_cfg.c */
58 
59 CHECK_RETVAL_PTR \
61  const int optionCode );
63 BOOLEAN checkConfigChanged( IN_ARRAY( configOptionsCount ) \
64  const OPTION_INFO *optionList,
66 
67 #endif /* _USER_INT_DEFINED */