2 * extenCooker.h - module to cook up random (but reasonable)
3 * versions of cert extensions
7 #ifndef _EXTEN_COOKER_H_
8 #define _EXTEN_COOKER_H_
10 #include <Security/cssmtype.h>
11 #include <Security/x509defs.h>
12 #include <Security/cssmapple.h>
19 * Define one extension test.
23 * Cook up this extension with random, reasonable values.
24 * Incoming pointer refers to extension-specific C struct, mallocd
25 * and zeroed by main test routine.
27 typedef void (*extenCreateFcn
)(void *arg
);
30 * Compare two instances of this extension. Return number of
33 typedef unsigned (*extenCompareFcn
)(
34 const void *preEncode
,
35 const void *postEncode
);
38 * Free struct components mallocd in extenCreateFcn. Do not free
41 typedef void (*extenFreeFcn
)(void *arg
);
44 /* three extension-specific functions */
45 extenCreateFcn createFcn
;
46 extenCompareFcn compareFcn
;
49 /* size of C struct passed to all three functions */
52 /* the OID for this extension */
55 /* description for error logging and blob writing */
56 const char *extenDescr
;
58 /* command-line letter for this one */
64 * extenCooker.cpp - module to cook up random (but reasonable)
65 * versions of cert extensions
70 #include "extenCooker.h"
74 /* Fill a CSSM_DATA with random data. Its referent is allocd with malloc. */
81 * Various compare tests
95 #pragma mark --- CE_KeyUsage ---
96 void kuCreate(void *arg
);
97 unsigned kuCompare(const void *pre
, const void *post
);
100 #pragma mark --- CE_BasicConstraints ---
101 void bcCreate(void *arg
);
102 unsigned bcCompare(const void *pre
, const void *post
);
105 #pragma mark --- CE_SubjectKeyID ---
106 void skidCreate(void *arg
);
107 unsigned skidCompare(const void *pre
, const void *post
);
108 void skidFree(void *arg
);
110 #pragma mark --- CE_NetscapeCertType ---
111 void nctCreate(void *arg
);
112 unsigned nctCompare(const void *pre
, const void *post
);
115 #pragma mark --- CE_ExtendedKeyUsage ---
116 void ekuCreate(void *arg
);
117 unsigned ekuCompare(const void *pre
, const void *post
);
120 #pragma mark --- general purpose X509 name generator ---
122 CSSM_X509_RDN_PTR rdn
);
124 CSSM_X509_RDN_PTR rdn1
,
125 CSSM_X509_RDN_PTR rdn2
);
127 CSSM_X509_RDN_PTR rdn
);
130 CSSM_X509_NAME_PTR x509Name
);
131 unsigned x509NameCompare(
132 const CSSM_X509_NAME_PTR n1
,
133 const CSSM_X509_NAME_PTR n2
);
135 CSSM_X509_NAME_PTR n
);
137 #pragma mark --- general purpose GeneralNames generator ---
139 void genNamesCreate(void *arg
);
140 unsigned genNamesCompare(const void *pre
, const void *post
);
141 void genNamesFree(void *arg
);
143 #pragma mark --- CE_CRLDistPointsSyntax ---
144 void cdpCreate(void *arg
);
145 unsigned cdpCompare(const void *pre
, const void *post
);
146 void cdpFree(void *arg
);
148 #pragma mark --- CE_AuthorityKeyID ---
149 void authKeyIdCreate(void *arg
);
150 unsigned authKeyIdCompare(const void *pre
, const void *post
);
151 void authKeyIdFree(void *arg
);
153 #pragma mark --- CE_CertPolicies ---
154 void cpCreate(void *arg
);
155 unsigned cpCompare(const void *pre
, const void *post
);
156 void cpFree(void *arg
);
162 #endif /* _EXTEN_COOKER_H_ */