13
#define CRLGEN_UNKNOWN_CONTEXT 0
14
#define CRLGEN_ISSUER_CONTEXT 1
15
#define CRLGEN_UPDATE_CONTEXT 2
16
#define CRLGEN_NEXT_UPDATE_CONTEXT 3
17
#define CRLGEN_ADD_EXTENSION_CONTEXT 4
18
#define CRLGEN_ADD_CERT_CONTEXT 6
19
#define CRLGEN_CHANGE_RANGE_CONTEXT 7
20
#define CRLGEN_RM_CERT_CONTEXT 8
22
#define CRLGEN_TYPE_DATE 0
23
#define CRLGEN_TYPE_ZDATE 1
24
#define CRLGEN_TYPE_DIGIT 2
25
#define CRLGEN_TYPE_DIGIT_RANGE 3
26
#define CRLGEN_TYPE_OID 4
27
#define CRLGEN_TYPE_STRING 5
28
#define CRLGEN_TYPE_ID 6
31
typedef struct CRLGENGeneratorDataStr CRLGENGeneratorData;
32
typedef struct CRLGENEntryDataStr CRLGENEntryData;
33
typedef struct CRLGENExtensionEntryStr CRLGENExtensionEntry;
34
typedef struct CRLGENCertEntrySrt CRLGENCertEntry;
35
typedef struct CRLGENCrlFieldStr CRLGENCrlField;
36
typedef struct CRLGENEntriesSortedDataStr CRLGENEntriesSortedData;
38
/* Exported functions */
40
/* Used for initialization of extension handles for crl and certs
41
* extensions from existing CRL data then modifying existing CRL.*/
42
extern SECStatus CRLGEN_ExtHandleInit(CRLGENGeneratorData *crlGenData);
44
/* Commits all added entries and their's extensions into CRL. */
45
extern SECStatus CRLGEN_CommitExtensionsAndEntries(CRLGENGeneratorData *crlGenData);
47
/* Lunches the crl generation script parse */
48
extern SECStatus CRLGEN_StartCrlGen(CRLGENGeneratorData *crlGenData);
50
/* Closes crl generation script file and frees crlGenData */
51
extern void CRLGEN_FinalizeCrlGeneration(CRLGENGeneratorData *crlGenData);
53
/* Parser initialization function. Creates CRLGENGeneratorData structure
54
* for the current thread */
55
extern CRLGENGeneratorData* CRLGEN_InitCrlGeneration(CERTSignedCrl *newCrl,
59
/* This lock is defined in crlgen_lex.c(derived from crlgen_lex.l).
60
* It controls access to invocation of yylex, allows to parse one
62
extern void CRLGEN_InitCrlGenParserLock();
63
extern void CRLGEN_DestroyCrlGenParserLock();
66
/* The following function types are used to define functions for each of
67
* CRLGENExtensionEntryStr, CRLGENCertEntrySrt, CRLGENCrlFieldStr to
68
* provide functionality needed for these structures*/
69
typedef SECStatus updateCrlFn_t(CRLGENGeneratorData *crlGenData, void *str);
70
typedef SECStatus setNextDataFn_t(CRLGENGeneratorData *crlGenData, void *str,
71
void *data, unsigned short dtype);
72
typedef SECStatus createNewLangStructFn_t(CRLGENGeneratorData *crlGenData,
73
void *str, unsigned i);
75
/* Sets reports failure to parser if anything goes wrong */
76
extern void crlgen_setFailure(CRLGENGeneratorData *str, char *);
78
/* Collects data in to one of the current data structure that corresponds
79
* to the correct context type. This function gets called after each token
80
* is found for a particular line */
81
extern SECStatus crlgen_setNextData(CRLGENGeneratorData *str, void *data,
82
unsigned short dtype);
84
/* initiates crl update with collected data. This function is called at the
86
extern SECStatus crlgen_updateCrl(CRLGENGeneratorData *str);
88
/* Creates new context structure depending on token that was parsed
89
* at the beginning of a line */
90
extern SECStatus crlgen_createNewLangStruct(CRLGENGeneratorData *str,
94
/* CRLGENExtensionEntry is used to store addext request data for either
95
* CRL extensions or CRL entry extensions. The differentiation between
96
* is based on order and type of extension been added.
97
* - extData : all data in request staring from name of the extension are
99
* - nextUpdatedData: counter of elements added to extData
101
struct CRLGENExtensionEntryStr {
104
updateCrlFn_t *updateCrlFn;
105
setNextDataFn_t *setNextDataFn;
108
/* CRLGENCeryestEntry is used to store addcert request data
109
* - certId : certificate id or range of certificate with dash as a delimiter
110
* All certs from range will be inclusively added to crl
111
* - revocationTime: revocation time of cert(s)
113
struct CRLGENCertEntrySrt {
115
char *revocationTime;
116
updateCrlFn_t *updateCrlFn;
117
setNextDataFn_t *setNextDataFn;
121
/* CRLGENCrlField is used to store crl fields record like update time, next
123
* - value: value of the parsed field data*/
124
struct CRLGENCrlFieldStr {
126
updateCrlFn_t *updateCrlFn;
127
setNextDataFn_t *setNextDataFn;
130
/* Can not create entries extension until completely done with parsing.
131
* Therefore need to keep joined data
132
* - certId : serial number of certificate
133
* - extHandle: head pointer to a list of extensions that belong to
135
* - entry : CERTCrlEntry structure pointer*/
136
struct CRLGENEntryDataStr {
142
/* Crl generator/parser main structure. Keeps info regarding current state of
143
* parser(context, status), parser helper functions pointers, parsed data and
145
* - contextId : current parsing context. Context in this parser environment
146
* defines what type of crl operations parser is going through
147
* in the current line of crl generation script.
148
* setting or new cert or an extension addition, etc.
149
* - createNewLangStructFn: pointer to top level function which creates
150
* data structures according contextId
151
* - setNextDataFn : pointer to top level function which sets new parsed data
152
* in temporary structure
153
* - updateCrlFn : pointer to top level function which triggers actual
154
* crl update functions with gathered data
155
* - union : data union create according to contextId
156
* - rangeFrom, rangeTo : holds last range in which certs was added
157
* - newCrl : pointer to CERTSignedCrl newly created crl
158
* - crlExtHandle : pointer to crl extension handle
159
* - entryDataHashTable: hash of CRLGENEntryData.
160
* key: cert serial number
161
* data: CRLGENEntryData pointer
162
* - parserStatus : current status of parser. Triggers parser to abort when
164
* - src : PRFileDesc structure pointer of crl generator config file
165
* - parsedLineNum : currently parsing line. Keeping it to report errors */
166
struct CRLGENGeneratorDataStr {
167
unsigned short contextId;
168
CRLGENCrlField *crlField;
169
CRLGENCertEntry *certEntry;
170
CRLGENExtensionEntry *extensionEntry;
173
CERTSignedCrl *signCrl;
175
PLHashTable *entryDataHashTable;
182
#endif /* _CRLGEN_H_ */