OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 /* | 4 /* |
5 * pkix_comcertselparams.c | 5 * pkix_comcertselparams.c |
6 * | 6 * |
7 * ComCertSelParams Object Functions | 7 * ComCertSelParams Object Functions |
8 * | 8 * |
9 */ | 9 */ |
10 | 10 |
11 #include "pkix_comcertselparams.h" | 11 #include "pkix_comcertselparams.h" |
12 | 12 |
13 /* --Private-Functions-------------------------------------------- */ | 13 /* --Private-Functions-------------------------------------------- */ |
14 | 14 |
15 /* | 15 /* |
16 * FUNCTION: pkix_ComCertSelParams_Destroy | 16 * FUNCTION: pkix_ComCertSelParams_Destroy |
17 * (see comments for PKIX_PL_DestructorCallback in pkix_pl_system.h) | 17 * (see comments for PKIX_PL_DestructorCallback in pkix_pl_system.h) |
18 */ | 18 */ |
19 static PKIX_Error * | 19 static PKIX_Error *pkix_ComCertSelParams_Destroy(PKIX_PL_Object *object, |
20 pkix_ComCertSelParams_Destroy( | 20 void *plContext) { |
21 PKIX_PL_Object *object, | 21 PKIX_ComCertSelParams *params = NULL; |
22 void *plContext) | 22 |
23 { | 23 PKIX_ENTER(COMCERTSELPARAMS, "pkix_ComCertSelParams_Destroy"); |
24 PKIX_ComCertSelParams *params = NULL; | 24 PKIX_NULLCHECK_ONE(object); |
25 | 25 |
26 PKIX_ENTER(COMCERTSELPARAMS, "pkix_ComCertSelParams_Destroy"); | 26 /* Check that this object is a comCertSelParams object */ |
27 PKIX_NULLCHECK_ONE(object); | 27 PKIX_CHECK(pkix_CheckType(object, PKIX_COMCERTSELPARAMS_TYPE, plContext), |
28 | 28 PKIX_OBJECTNOTCOMCERTSELPARAMS); |
29 /* Check that this object is a comCertSelParams object */ | 29 |
30 PKIX_CHECK(pkix_CheckType | 30 params = (PKIX_ComCertSelParams *)object; |
31 (object, PKIX_COMCERTSELPARAMS_TYPE, plContext), | 31 |
32 PKIX_OBJECTNOTCOMCERTSELPARAMS); | 32 PKIX_DECREF(params->subject); |
33 | 33 PKIX_DECREF(params->policies); |
34 params = (PKIX_ComCertSelParams *)object; | 34 PKIX_DECREF(params->cert); |
35 | 35 PKIX_DECREF(params->nameConstraints); |
36 PKIX_DECREF(params->subject); | 36 PKIX_DECREF(params->pathToNames); |
37 PKIX_DECREF(params->policies); | 37 PKIX_DECREF(params->subjAltNames); |
38 PKIX_DECREF(params->cert); | 38 PKIX_DECREF(params->date); |
39 PKIX_DECREF(params->nameConstraints); | 39 PKIX_DECREF(params->extKeyUsage); |
40 PKIX_DECREF(params->pathToNames); | 40 PKIX_DECREF(params->certValid); |
41 PKIX_DECREF(params->subjAltNames); | 41 PKIX_DECREF(params->issuer); |
42 PKIX_DECREF(params->date); | 42 PKIX_DECREF(params->serialNumber); |
43 PKIX_DECREF(params->extKeyUsage); | 43 PKIX_DECREF(params->authKeyId); |
44 PKIX_DECREF(params->certValid); | 44 PKIX_DECREF(params->subjKeyId); |
45 PKIX_DECREF(params->issuer); | 45 PKIX_DECREF(params->subjPubKey); |
46 PKIX_DECREF(params->serialNumber); | 46 PKIX_DECREF(params->subjPKAlgId); |
47 PKIX_DECREF(params->authKeyId); | 47 |
48 PKIX_DECREF(params->subjKeyId); | 48 cleanup: |
49 PKIX_DECREF(params->subjPubKey); | 49 |
50 PKIX_DECREF(params->subjPKAlgId); | 50 PKIX_RETURN(COMCERTSELPARAMS); |
51 | |
52 cleanup: | |
53 | |
54 PKIX_RETURN(COMCERTSELPARAMS); | |
55 } | 51 } |
56 | 52 |
57 /* | 53 /* |
58 * FUNCTION: pkix_ComCertSelParams_Duplicate | 54 * FUNCTION: pkix_ComCertSelParams_Duplicate |
59 * (see comments for PKIX_PL_DuplicateCallback in pkix_pl_system.h) | 55 * (see comments for PKIX_PL_DuplicateCallback in pkix_pl_system.h) |
60 */ | 56 */ |
61 static PKIX_Error * | 57 static PKIX_Error *pkix_ComCertSelParams_Duplicate(PKIX_PL_Object *object, |
62 pkix_ComCertSelParams_Duplicate( | 58 PKIX_PL_Object **pNewObject, |
63 PKIX_PL_Object *object, | 59 void *plContext) { |
64 PKIX_PL_Object **pNewObject, | 60 PKIX_ComCertSelParams *params = NULL; |
65 void *plContext) | 61 PKIX_ComCertSelParams *paramsDuplicate = NULL; |
66 { | 62 |
67 PKIX_ComCertSelParams *params = NULL; | 63 PKIX_ENTER(COMCERTSELPARAMS, "pkix_ComCertSelParams_Duplicate"); |
68 PKIX_ComCertSelParams *paramsDuplicate = NULL; | 64 PKIX_NULLCHECK_TWO(object, pNewObject); |
69 | 65 |
70 PKIX_ENTER(COMCERTSELPARAMS, "pkix_ComCertSelParams_Duplicate"); | 66 PKIX_CHECK(pkix_CheckType(object, PKIX_COMCERTSELPARAMS_TYPE, plContext), |
71 PKIX_NULLCHECK_TWO(object, pNewObject); | 67 PKIX_OBJECTNOTCOMCERTSELPARAMS); |
72 | 68 |
73 PKIX_CHECK(pkix_CheckType | 69 params = (PKIX_ComCertSelParams *)object; |
74 (object, PKIX_COMCERTSELPARAMS_TYPE, plContext), | 70 |
75 PKIX_OBJECTNOTCOMCERTSELPARAMS); | 71 PKIX_CHECK(PKIX_ComCertSelParams_Create(¶msDuplicate, plContext), |
76 | 72 PKIX_COMCERTSELPARAMSCREATEFAILED); |
77 params = (PKIX_ComCertSelParams *)object; | 73 |
78 | 74 paramsDuplicate->minPathLength = params->minPathLength; |
79 PKIX_CHECK(PKIX_ComCertSelParams_Create(¶msDuplicate, plContext), | 75 paramsDuplicate->matchAllSubjAltNames = params->matchAllSubjAltNames; |
80 PKIX_COMCERTSELPARAMSCREATEFAILED); | 76 |
81 | 77 PKIX_DUPLICATE(params->subject, ¶msDuplicate->subject, plContext, |
82 paramsDuplicate->minPathLength = params->minPathLength; | 78 PKIX_OBJECTDUPLICATEFAILED); |
83 paramsDuplicate->matchAllSubjAltNames = params->matchAllSubjAltNames; | 79 |
84 | 80 PKIX_DUPLICATE(params->policies, ¶msDuplicate->policies, plContext, |
85 PKIX_DUPLICATE(params->subject, ¶msDuplicate->subject, plContext, | 81 PKIX_OBJECTDUPLICATEFAILED); |
86 PKIX_OBJECTDUPLICATEFAILED); | 82 |
87 | 83 if (params->cert) { |
88 PKIX_DUPLICATE(params->policies, ¶msDuplicate->policies, plContext, | 84 PKIX_CHECK(PKIX_PL_Object_Duplicate( |
89 PKIX_OBJECTDUPLICATEFAILED); | 85 (PKIX_PL_Object *)params->cert, |
90 | 86 (PKIX_PL_Object **)¶msDuplicate->cert, plContext), |
91 if (params->cert){ | 87 PKIX_OBJECTDUPLICATEFAILED); |
92 PKIX_CHECK(PKIX_PL_Object_Duplicate | 88 } |
93 ((PKIX_PL_Object *)params->cert, | 89 |
94 (PKIX_PL_Object **)¶msDuplicate->cert, | 90 PKIX_DUPLICATE(params->nameConstraints, ¶msDuplicate->nameConstraints, |
95 plContext), | 91 plContext, PKIX_OBJECTDUPLICATEFAILED); |
96 PKIX_OBJECTDUPLICATEFAILED); | 92 |
97 } | 93 PKIX_DUPLICATE(params->pathToNames, ¶msDuplicate->pathToNames, plContext, |
98 | 94 PKIX_OBJECTDUPLICATEFAILED); |
99 PKIX_DUPLICATE | 95 |
100 (params->nameConstraints, | 96 PKIX_DUPLICATE(params->subjAltNames, ¶msDuplicate->subjAltNames, |
101 ¶msDuplicate->nameConstraints, | 97 plContext, PKIX_OBJECTDUPLICATEFAILED); |
102 plContext, | 98 |
103 PKIX_OBJECTDUPLICATEFAILED); | 99 if (params->date) { |
104 | 100 PKIX_CHECK(PKIX_PL_Object_Duplicate( |
105 PKIX_DUPLICATE | 101 (PKIX_PL_Object *)params->date, |
106 (params->pathToNames, | 102 (PKIX_PL_Object **)¶msDuplicate->date, plContext), |
107 ¶msDuplicate->pathToNames, | 103 PKIX_OBJECTDUPLICATEFAILED); |
108 plContext, | 104 } |
109 PKIX_OBJECTDUPLICATEFAILED); | 105 |
110 | 106 paramsDuplicate->keyUsage = params->keyUsage; |
111 PKIX_DUPLICATE | 107 |
112 (params->subjAltNames, | 108 PKIX_DUPLICATE(params->certValid, ¶msDuplicate->certValid, plContext, |
113 ¶msDuplicate->subjAltNames, | 109 PKIX_OBJECTDUPLICATEFAILED); |
114 plContext, | 110 |
115 PKIX_OBJECTDUPLICATEFAILED); | 111 PKIX_DUPLICATE(params->issuer, ¶msDuplicate->issuer, plContext, |
116 | 112 PKIX_OBJECTDUPLICATEFAILED); |
117 if (params->date){ | 113 |
118 PKIX_CHECK(PKIX_PL_Object_Duplicate | 114 PKIX_DUPLICATE(params->serialNumber, ¶msDuplicate->serialNumber, |
119 ((PKIX_PL_Object *)params->date, | 115 plContext, PKIX_OBJECTDUPLICATEFAILED); |
120 (PKIX_PL_Object **)¶msDuplicate->date, | 116 |
121 plContext), | 117 PKIX_DUPLICATE(params->authKeyId, ¶msDuplicate->authKeyId, plContext, |
122 PKIX_OBJECTDUPLICATEFAILED); | 118 PKIX_OBJECTDUPLICATEFAILED); |
123 } | 119 |
124 | 120 PKIX_DUPLICATE(params->subjKeyId, ¶msDuplicate->subjKeyId, plContext, |
125 paramsDuplicate->keyUsage = params->keyUsage; | 121 PKIX_OBJECTDUPLICATEFAILED); |
126 | 122 |
127 PKIX_DUPLICATE(params->certValid, | 123 PKIX_DUPLICATE(params->subjPubKey, ¶msDuplicate->subjPubKey, plContext, |
128 ¶msDuplicate->certValid, | 124 PKIX_OBJECTDUPLICATEFAILED); |
129 plContext, | 125 |
130 PKIX_OBJECTDUPLICATEFAILED); | 126 PKIX_DUPLICATE(params->subjPKAlgId, ¶msDuplicate->subjPKAlgId, plContext, |
131 | 127 PKIX_OBJECTDUPLICATEFAILED); |
132 PKIX_DUPLICATE(params->issuer, | 128 |
133 ¶msDuplicate->issuer, | 129 paramsDuplicate->leafCertFlag = params->leafCertFlag; |
134 plContext, | 130 |
135 PKIX_OBJECTDUPLICATEFAILED); | 131 *pNewObject = (PKIX_PL_Object *)paramsDuplicate; |
136 | 132 |
137 PKIX_DUPLICATE(params->serialNumber, | 133 cleanup: |
138 ¶msDuplicate->serialNumber, | 134 |
139 plContext, | 135 if (PKIX_ERROR_RECEIVED) { |
140 PKIX_OBJECTDUPLICATEFAILED); | 136 PKIX_DECREF(paramsDuplicate); |
141 | 137 } |
142 PKIX_DUPLICATE(params->authKeyId, | 138 |
143 ¶msDuplicate->authKeyId, | 139 PKIX_RETURN(COMCERTSELPARAMS); |
144 plContext, | |
145 PKIX_OBJECTDUPLICATEFAILED); | |
146 | |
147 PKIX_DUPLICATE(params->subjKeyId, | |
148 ¶msDuplicate->subjKeyId, | |
149 plContext, | |
150 PKIX_OBJECTDUPLICATEFAILED); | |
151 | |
152 PKIX_DUPLICATE(params->subjPubKey, | |
153 ¶msDuplicate->subjPubKey, | |
154 plContext, | |
155 PKIX_OBJECTDUPLICATEFAILED); | |
156 | |
157 PKIX_DUPLICATE(params->subjPKAlgId, | |
158 ¶msDuplicate->subjPKAlgId, | |
159 plContext, | |
160 PKIX_OBJECTDUPLICATEFAILED); | |
161 | |
162 paramsDuplicate->leafCertFlag = params->leafCertFlag; | |
163 | |
164 *pNewObject = (PKIX_PL_Object *)paramsDuplicate; | |
165 | |
166 cleanup: | |
167 | |
168 if (PKIX_ERROR_RECEIVED){ | |
169 PKIX_DECREF(paramsDuplicate); | |
170 } | |
171 | |
172 PKIX_RETURN(COMCERTSELPARAMS); | |
173 } | 140 } |
174 | 141 |
175 /* | 142 /* |
176 * FUNCTION: pkix_ComCertSelParams_RegisterSelf | 143 * FUNCTION: pkix_ComCertSelParams_RegisterSelf |
177 * DESCRIPTION: | 144 * DESCRIPTION: |
178 * Registers PKIX_COMCERTSELPARAMS_TYPE and its related functions with | 145 * Registers PKIX_COMCERTSELPARAMS_TYPE and its related functions with |
179 * systemClasses[] | 146 * systemClasses[] |
180 * THREAD SAFETY: | 147 * THREAD SAFETY: |
181 * Not Thread Safe - for performance and complexity reasons | 148 * Not Thread Safe - for performance and complexity reasons |
182 * | 149 * |
183 * Since this function is only called by PKIX_PL_Initialize, which should | 150 * Since this function is only called by PKIX_PL_Initialize, which should |
184 * only be called once, it is acceptable that this function is not | 151 * only be called once, it is acceptable that this function is not |
185 * thread-safe. | 152 * thread-safe. |
186 */ | 153 */ |
187 PKIX_Error * | 154 PKIX_Error *pkix_ComCertSelParams_RegisterSelf(void *plContext) { |
188 pkix_ComCertSelParams_RegisterSelf(void *plContext) | 155 extern pkix_ClassTable_Entry systemClasses[PKIX_NUMTYPES]; |
189 { | 156 pkix_ClassTable_Entry *entry = &systemClasses[PKIX_COMCERTSELPARAMS_TYPE]; |
190 extern pkix_ClassTable_Entry systemClasses[PKIX_NUMTYPES]; | 157 |
191 pkix_ClassTable_Entry* entry = &systemClasses[PKIX_COMCERTSELPARAMS_TYPE
]; | 158 PKIX_ENTER(COMCERTSELPARAMS, "pkix_ComCertSelParams_RegisterSelf"); |
192 | 159 |
193 PKIX_ENTER(COMCERTSELPARAMS, "pkix_ComCertSelParams_RegisterSelf"); | 160 entry->description = "ComCertSelParams"; |
194 | 161 entry->typeObjectSize = sizeof(PKIX_ComCertSelParams); |
195 entry->description = "ComCertSelParams"; | 162 entry->destructor = pkix_ComCertSelParams_Destroy; |
196 entry->typeObjectSize = sizeof(PKIX_ComCertSelParams); | 163 entry->duplicateFunction = pkix_ComCertSelParams_Duplicate; |
197 entry->destructor = pkix_ComCertSelParams_Destroy; | 164 |
198 entry->duplicateFunction = pkix_ComCertSelParams_Duplicate; | 165 PKIX_RETURN(COMCERTSELPARAMS); |
199 | |
200 PKIX_RETURN(COMCERTSELPARAMS); | |
201 } | 166 } |
202 | 167 |
203 /* --Public-Functions--------------------------------------------- */ | 168 /* --Public-Functions--------------------------------------------- */ |
204 | 169 |
205 | |
206 /* | 170 /* |
207 * FUNCTION: PKIX_ComCertSelParams_Create (see comments in pkix_certsel.h) | 171 * FUNCTION: PKIX_ComCertSelParams_Create (see comments in pkix_certsel.h) |
208 */ | 172 */ |
209 PKIX_Error * | 173 PKIX_Error *PKIX_ComCertSelParams_Create(PKIX_ComCertSelParams **pParams, |
210 PKIX_ComCertSelParams_Create( | 174 void *plContext) { |
211 PKIX_ComCertSelParams **pParams, | 175 PKIX_ComCertSelParams *params = NULL; |
212 void *plContext) | 176 |
213 { | 177 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_Create"); |
214 PKIX_ComCertSelParams *params = NULL; | 178 PKIX_NULLCHECK_ONE(pParams); |
215 | 179 |
216 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_Create"); | 180 PKIX_CHECK(PKIX_PL_Object_Alloc(PKIX_COMCERTSELPARAMS_TYPE, |
217 PKIX_NULLCHECK_ONE(pParams); | 181 sizeof(PKIX_ComCertSelParams), |
218 | 182 (PKIX_PL_Object **)¶ms, plContext), |
219 PKIX_CHECK(PKIX_PL_Object_Alloc | 183 PKIX_COULDNOTCREATECOMMONCERTSELPARAMSOBJECT); |
220 (PKIX_COMCERTSELPARAMS_TYPE, | 184 |
221 sizeof (PKIX_ComCertSelParams), | 185 /* initialize fields */ |
222 (PKIX_PL_Object **)¶ms, | 186 params->version = 0xFFFFFFFF; |
223 plContext), | 187 params->minPathLength = -1; |
224 PKIX_COULDNOTCREATECOMMONCERTSELPARAMSOBJECT); | 188 params->matchAllSubjAltNames = PKIX_TRUE; |
225 | 189 params->subject = NULL; |
226 /* initialize fields */ | 190 params->policies = NULL; |
227 params->version = 0xFFFFFFFF; | 191 params->cert = NULL; |
228 params->minPathLength = -1; | 192 params->nameConstraints = NULL; |
229 params->matchAllSubjAltNames = PKIX_TRUE; | 193 params->pathToNames = NULL; |
230 params->subject = NULL; | 194 params->subjAltNames = NULL; |
231 params->policies = NULL; | 195 params->extKeyUsage = NULL; |
232 params->cert = NULL; | 196 params->keyUsage = 0; |
233 params->nameConstraints = NULL; | 197 params->extKeyUsage = NULL; |
234 params->pathToNames = NULL; | 198 params->keyUsage = 0; |
235 params->subjAltNames = NULL; | 199 params->date = NULL; |
236 params->extKeyUsage = NULL; | 200 params->certValid = NULL; |
237 params->keyUsage = 0; | 201 params->issuer = NULL; |
238 params->extKeyUsage = NULL; | 202 params->serialNumber = NULL; |
239 params->keyUsage = 0; | 203 params->authKeyId = NULL; |
240 params->date = NULL; | 204 params->subjKeyId = NULL; |
241 params->certValid = NULL; | 205 params->subjPubKey = NULL; |
242 params->issuer = NULL; | 206 params->subjPKAlgId = NULL; |
243 params->serialNumber = NULL; | 207 params->leafCertFlag = PKIX_FALSE; |
244 params->authKeyId = NULL; | 208 |
245 params->subjKeyId = NULL; | 209 *pParams = params; |
246 params->subjPubKey = NULL; | 210 |
247 params->subjPKAlgId = NULL; | 211 cleanup: |
248 params->leafCertFlag = PKIX_FALSE; | 212 |
249 | 213 PKIX_RETURN(COMCERTSELPARAMS); |
250 *pParams = params; | |
251 | |
252 cleanup: | |
253 | |
254 PKIX_RETURN(COMCERTSELPARAMS); | |
255 | |
256 } | 214 } |
257 | 215 |
258 /* | 216 /* |
259 * FUNCTION: PKIX_ComCertSelParams_GetSubject (see comments in pkix_certsel.h) | 217 * FUNCTION: PKIX_ComCertSelParams_GetSubject (see comments in pkix_certsel.h) |
260 */ | 218 */ |
261 PKIX_Error * | 219 PKIX_Error *PKIX_ComCertSelParams_GetSubject(PKIX_ComCertSelParams *params, |
262 PKIX_ComCertSelParams_GetSubject( | 220 PKIX_PL_X500Name **pSubject, |
263 PKIX_ComCertSelParams *params, | 221 void *plContext) { |
264 PKIX_PL_X500Name **pSubject, | 222 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSubject"); |
265 void *plContext) | 223 PKIX_NULLCHECK_TWO(params, pSubject); |
266 { | 224 |
267 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSubject"); | 225 PKIX_INCREF(params->subject); |
268 PKIX_NULLCHECK_TWO(params, pSubject); | 226 |
269 | 227 *pSubject = params->subject; |
270 PKIX_INCREF(params->subject); | 228 |
271 | 229 cleanup: |
272 *pSubject = params->subject; | 230 PKIX_RETURN(COMCERTSELPARAMS); |
273 | |
274 cleanup: | |
275 PKIX_RETURN(COMCERTSELPARAMS); | |
276 } | 231 } |
277 | 232 |
278 /* | 233 /* |
279 * FUNCTION: PKIX_ComCertSelParams_SetSubject (see comments in pkix_certsel.h) | 234 * FUNCTION: PKIX_ComCertSelParams_SetSubject (see comments in pkix_certsel.h) |
280 */ | 235 */ |
281 PKIX_Error * | 236 PKIX_Error *PKIX_ComCertSelParams_SetSubject(PKIX_ComCertSelParams *params, |
282 PKIX_ComCertSelParams_SetSubject( | 237 PKIX_PL_X500Name *subject, |
283 PKIX_ComCertSelParams *params, | 238 void *plContext) { |
284 PKIX_PL_X500Name *subject, | 239 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetSubject"); |
285 void *plContext) | 240 PKIX_NULLCHECK_ONE(params); |
286 { | 241 |
287 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetSubject"); | 242 PKIX_DECREF(params->subject); |
288 PKIX_NULLCHECK_ONE(params); | 243 |
289 | 244 PKIX_INCREF(subject); |
290 PKIX_DECREF(params->subject); | 245 |
291 | 246 params->subject = subject; |
292 PKIX_INCREF(subject); | 247 |
293 | 248 PKIX_CHECK( |
294 params->subject = subject; | 249 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
295 | 250 PKIX_OBJECTINVALIDATECACHEFAILED); |
296 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 251 |
297 ((PKIX_PL_Object *)params, plContext), | 252 cleanup: |
298 PKIX_OBJECTINVALIDATECACHEFAILED); | 253 |
299 | 254 PKIX_RETURN(COMCERTSELPARAMS); |
300 cleanup: | 255 } |
301 | |
302 PKIX_RETURN(COMCERTSELPARAMS); | |
303 } | |
304 | |
305 | 256 |
306 /* | 257 /* |
307 * FUNCTION: PKIX_ComCertSelParams_GetBasicConstraints | 258 * FUNCTION: PKIX_ComCertSelParams_GetBasicConstraints |
308 * (see comments in pkix_certsel.h) | 259 * (see comments in pkix_certsel.h) |
309 */ | 260 */ |
310 PKIX_Error * | 261 PKIX_Error *PKIX_ComCertSelParams_GetBasicConstraints( |
311 PKIX_ComCertSelParams_GetBasicConstraints( | 262 PKIX_ComCertSelParams *params, PKIX_Int32 *pMinPathLength, |
312 PKIX_ComCertSelParams *params, | 263 void *plContext) { |
313 PKIX_Int32 *pMinPathLength, | 264 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetBasicConstraints"); |
314 void *plContext) | 265 PKIX_NULLCHECK_TWO(params, pMinPathLength); |
315 { | 266 |
316 PKIX_ENTER(COMCERTSELPARAMS, | 267 *pMinPathLength = params->minPathLength; |
317 "PKIX_ComCertSelParams_GetBasicConstraints"); | 268 |
318 PKIX_NULLCHECK_TWO(params, pMinPathLength); | 269 PKIX_RETURN(COMCERTSELPARAMS); |
319 | 270 } |
320 *pMinPathLength = params->minPathLength; | |
321 | |
322 PKIX_RETURN(COMCERTSELPARAMS); | |
323 } | |
324 | |
325 | 271 |
326 /* | 272 /* |
327 * FUNCTION: PKIX_ComCertSelParams_SetBasicConstraints | 273 * FUNCTION: PKIX_ComCertSelParams_SetBasicConstraints |
328 * (see comments in pkix_certsel.h) | 274 * (see comments in pkix_certsel.h) |
329 */ | 275 */ |
330 PKIX_Error * | 276 PKIX_Error *PKIX_ComCertSelParams_SetBasicConstraints( |
331 PKIX_ComCertSelParams_SetBasicConstraints( | 277 PKIX_ComCertSelParams *params, PKIX_Int32 minPathLength, void *plContext) { |
332 PKIX_ComCertSelParams *params, | 278 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetBasicConstraints"); |
333 PKIX_Int32 minPathLength, | 279 PKIX_NULLCHECK_ONE(params); |
334 void *plContext) | 280 |
335 { | 281 params->minPathLength = minPathLength; |
336 PKIX_ENTER(COMCERTSELPARAMS, | 282 |
337 "PKIX_ComCertSelParams_SetBasicConstraints"); | 283 PKIX_CHECK( |
338 PKIX_NULLCHECK_ONE(params); | 284 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
339 | 285 PKIX_OBJECTINVALIDATECACHEFAILED); |
340 params->minPathLength = minPathLength; | 286 |
341 | 287 cleanup: |
342 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 288 |
343 ((PKIX_PL_Object *)params, plContext), | 289 PKIX_RETURN(COMCERTSELPARAMS); |
344 PKIX_OBJECTINVALIDATECACHEFAILED); | 290 } |
345 | |
346 cleanup: | |
347 | |
348 PKIX_RETURN(COMCERTSELPARAMS); | |
349 } | |
350 | |
351 | 291 |
352 /* | 292 /* |
353 * FUNCTION: PKIX_ComCertSelParams_GetPolicy (see comments in pkix_certsel.h) | 293 * FUNCTION: PKIX_ComCertSelParams_GetPolicy (see comments in pkix_certsel.h) |
354 */ | 294 */ |
355 PKIX_Error * | 295 PKIX_Error *PKIX_ComCertSelParams_GetPolicy( |
356 PKIX_ComCertSelParams_GetPolicy( | 296 PKIX_ComCertSelParams *params, |
357 PKIX_ComCertSelParams *params, | 297 PKIX_List **pPolicy, /* List of PKIX_PL_OID */ |
358 PKIX_List **pPolicy, /* List of PKIX_PL_OID */ | 298 void *plContext) { |
359 void *plContext) | 299 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetPolicy"); |
360 { | 300 PKIX_NULLCHECK_TWO(params, pPolicy); |
361 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetPolicy"); | 301 |
362 PKIX_NULLCHECK_TWO(params, pPolicy); | 302 PKIX_INCREF(params->policies); |
363 | 303 *pPolicy = params->policies; |
364 PKIX_INCREF(params->policies); | 304 |
365 *pPolicy = params->policies; | 305 cleanup: |
366 | 306 PKIX_RETURN(COMCERTSELPARAMS); |
367 cleanup: | |
368 PKIX_RETURN(COMCERTSELPARAMS); | |
369 } | 307 } |
370 | 308 |
371 /* | 309 /* |
372 * FUNCTION: PKIX_ComCertSelParams_SetPolicy (see comments in pkix_certsel.h) | 310 * FUNCTION: PKIX_ComCertSelParams_SetPolicy (see comments in pkix_certsel.h) |
373 */ | 311 */ |
374 PKIX_Error * | 312 PKIX_Error *PKIX_ComCertSelParams_SetPolicy(PKIX_ComCertSelParams *params, |
375 PKIX_ComCertSelParams_SetPolicy( | 313 PKIX_List *policy, /* List of |
376 PKIX_ComCertSelParams *params, | 314 PKIX_PL_OID */ |
377 PKIX_List *policy, /* List of PKIX_PL_OID */ | 315 void *plContext) { |
378 void *plContext) | 316 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetPolicy"); |
379 { | 317 PKIX_NULLCHECK_ONE(params); |
380 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetPolicy"); | 318 |
381 PKIX_NULLCHECK_ONE(params); | 319 PKIX_DECREF(params->policies); |
382 | 320 PKIX_INCREF(policy); |
383 PKIX_DECREF(params->policies); | 321 params->policies = policy; |
384 PKIX_INCREF(policy); | 322 |
385 params->policies = policy; | 323 PKIX_CHECK( |
386 | 324 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
387 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 325 PKIX_OBJECTINVALIDATECACHEFAILED); |
388 ((PKIX_PL_Object *)params, plContext), | 326 cleanup: |
389 PKIX_OBJECTINVALIDATECACHEFAILED); | 327 |
390 cleanup: | 328 PKIX_RETURN(COMCERTSELPARAMS); |
391 | |
392 PKIX_RETURN(COMCERTSELPARAMS); | |
393 } | 329 } |
394 | 330 |
395 /* | 331 /* |
396 * FUNCTION: PKIX_ComCertSelParams_GetCertificate | 332 * FUNCTION: PKIX_ComCertSelParams_GetCertificate |
397 * (see comments in pkix_certsel.h) | 333 * (see comments in pkix_certsel.h) |
398 */ | 334 */ |
399 PKIX_Error * | 335 PKIX_Error *PKIX_ComCertSelParams_GetCertificate(PKIX_ComCertSelParams *params, |
400 PKIX_ComCertSelParams_GetCertificate( | 336 PKIX_PL_Cert **pCert, |
401 PKIX_ComCertSelParams *params, | 337 void *plContext) { |
402 PKIX_PL_Cert **pCert, | 338 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetCertificate"); |
403 void *plContext) | 339 PKIX_NULLCHECK_TWO(params, pCert); |
404 { | 340 |
405 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetCertificate"); | 341 PKIX_INCREF(params->cert); |
406 PKIX_NULLCHECK_TWO(params, pCert); | 342 *pCert = params->cert; |
407 | 343 |
408 PKIX_INCREF(params->cert); | 344 cleanup: |
409 *pCert = params->cert; | 345 PKIX_RETURN(COMCERTSELPARAMS); |
410 | |
411 cleanup: | |
412 PKIX_RETURN(COMCERTSELPARAMS); | |
413 } | 346 } |
414 | 347 |
415 /* | 348 /* |
416 * FUNCTION: PKIX_ComCertSelParams_SetCertificate | 349 * FUNCTION: PKIX_ComCertSelParams_SetCertificate |
417 * (see comments in pkix_certsel.h) | 350 * (see comments in pkix_certsel.h) |
418 */ | 351 */ |
419 PKIX_Error * | 352 PKIX_Error *PKIX_ComCertSelParams_SetCertificate(PKIX_ComCertSelParams *params, |
420 PKIX_ComCertSelParams_SetCertificate( | 353 PKIX_PL_Cert *cert, |
421 PKIX_ComCertSelParams *params, | 354 void *plContext) { |
422 PKIX_PL_Cert *cert, | 355 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetCertificate"); |
423 void *plContext) | 356 PKIX_NULLCHECK_ONE(params); |
424 { | 357 |
425 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetCertificate"); | 358 PKIX_DECREF(params->cert); |
426 PKIX_NULLCHECK_ONE(params); | 359 PKIX_INCREF(cert); |
427 | 360 params->cert = cert; |
428 PKIX_DECREF(params->cert); | 361 |
429 PKIX_INCREF(cert); | 362 PKIX_CHECK( |
430 params->cert = cert; | 363 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
431 | 364 PKIX_OBJECTINVALIDATECACHEFAILED); |
432 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 365 cleanup: |
433 ((PKIX_PL_Object *)params, plContext), | 366 |
434 PKIX_OBJECTINVALIDATECACHEFAILED); | 367 PKIX_RETURN(COMCERTSELPARAMS); |
435 cleanup: | |
436 | |
437 PKIX_RETURN(COMCERTSELPARAMS); | |
438 } | 368 } |
439 | 369 |
440 /* | 370 /* |
441 * FUNCTION: PKIX_ComCertSelParams_GetCertificateValid | 371 * FUNCTION: PKIX_ComCertSelParams_GetCertificateValid |
442 * (see comments in pkix_certsel.h) | 372 * (see comments in pkix_certsel.h) |
443 */ | 373 */ |
444 PKIX_Error * | 374 PKIX_Error *PKIX_ComCertSelParams_GetCertificateValid( |
445 PKIX_ComCertSelParams_GetCertificateValid( | 375 PKIX_ComCertSelParams *params, PKIX_PL_Date **pDate, void *plContext) { |
446 PKIX_ComCertSelParams *params, | 376 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetCertificateValid"); |
447 PKIX_PL_Date **pDate, | 377 |
448 void *plContext) | 378 PKIX_NULLCHECK_TWO(params, pDate); |
449 { | 379 |
450 PKIX_ENTER(COMCERTSELPARAMS, | 380 PKIX_INCREF(params->date); |
451 "PKIX_ComCertSelParams_GetCertificateValid"); | 381 *pDate = params->date; |
452 | 382 |
453 PKIX_NULLCHECK_TWO(params, pDate); | 383 cleanup: |
454 | 384 PKIX_RETURN(COMCERTSELPARAMS); |
455 PKIX_INCREF(params->date); | |
456 *pDate = params->date; | |
457 | |
458 cleanup: | |
459 PKIX_RETURN(COMCERTSELPARAMS); | |
460 } | 385 } |
461 | 386 |
462 /* | 387 /* |
463 * FUNCTION: PKIX_ComCertSelParams_SetCertificateValid | 388 * FUNCTION: PKIX_ComCertSelParams_SetCertificateValid |
464 * (see comments in pkix_certsel.h) | 389 * (see comments in pkix_certsel.h) |
465 */ | 390 */ |
466 PKIX_Error * | 391 PKIX_Error *PKIX_ComCertSelParams_SetCertificateValid( |
467 PKIX_ComCertSelParams_SetCertificateValid( | 392 PKIX_ComCertSelParams *params, PKIX_PL_Date *date, void *plContext) { |
468 PKIX_ComCertSelParams *params, | 393 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetCertificateValid"); |
469 PKIX_PL_Date *date, | 394 PKIX_NULLCHECK_ONE(params); |
470 void *plContext) | 395 |
471 { | 396 PKIX_DECREF(params->date); |
472 PKIX_ENTER(COMCERTSELPARAMS, | 397 PKIX_INCREF(date); |
473 "PKIX_ComCertSelParams_SetCertificateValid"); | 398 params->date = date; |
474 PKIX_NULLCHECK_ONE(params); | 399 |
475 | 400 PKIX_CHECK( |
476 PKIX_DECREF(params->date); | 401 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
477 PKIX_INCREF(date); | 402 PKIX_OBJECTINVALIDATECACHEFAILED); |
478 params->date = date; | 403 cleanup: |
479 | 404 |
480 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 405 PKIX_RETURN(COMCERTSELPARAMS); |
481 ((PKIX_PL_Object *)params, plContext), | |
482 PKIX_OBJECTINVALIDATECACHEFAILED); | |
483 cleanup: | |
484 | |
485 PKIX_RETURN(COMCERTSELPARAMS); | |
486 } | 406 } |
487 | 407 |
488 /* | 408 /* |
489 * FUNCTION: PKIX_ComCertSelParams_GetNameConstraints | 409 * FUNCTION: PKIX_ComCertSelParams_GetNameConstraints |
490 * (see comments in pkix_certsel.h) | 410 * (see comments in pkix_certsel.h) |
491 */ | 411 */ |
492 PKIX_Error * | 412 PKIX_Error *PKIX_ComCertSelParams_GetNameConstraints( |
493 PKIX_ComCertSelParams_GetNameConstraints( | 413 PKIX_ComCertSelParams *params, |
494 PKIX_ComCertSelParams *params, | 414 PKIX_PL_CertNameConstraints **pNameConstraints, void *plContext) { |
495 PKIX_PL_CertNameConstraints **pNameConstraints, | 415 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetNameConstraints"); |
496 void *plContext) | 416 PKIX_NULLCHECK_TWO(params, pNameConstraints); |
497 { | 417 |
498 PKIX_ENTER(COMCERTSELPARAMS, | 418 PKIX_INCREF(params->nameConstraints); |
499 "PKIX_ComCertSelParams_GetNameConstraints"); | 419 |
500 PKIX_NULLCHECK_TWO(params, pNameConstraints); | 420 *pNameConstraints = params->nameConstraints; |
501 | 421 |
502 PKIX_INCREF(params->nameConstraints); | 422 cleanup: |
503 | 423 PKIX_RETURN(COMCERTSELPARAMS); |
504 *pNameConstraints = params->nameConstraints; | |
505 | |
506 cleanup: | |
507 PKIX_RETURN(COMCERTSELPARAMS); | |
508 } | 424 } |
509 | 425 |
510 /* | 426 /* |
511 * FUNCTION: PKIX_ComCertSelParams_SetNameConstraints | 427 * FUNCTION: PKIX_ComCertSelParams_SetNameConstraints |
512 * (see comments in pkix_certsel.h) | 428 * (see comments in pkix_certsel.h) |
513 */ | 429 */ |
514 PKIX_Error * | 430 PKIX_Error *PKIX_ComCertSelParams_SetNameConstraints( |
515 PKIX_ComCertSelParams_SetNameConstraints( | 431 PKIX_ComCertSelParams *params, PKIX_PL_CertNameConstraints *nameConstraints, |
516 PKIX_ComCertSelParams *params, | 432 void *plContext) { |
517 PKIX_PL_CertNameConstraints *nameConstraints, | 433 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetNameConstraints"); |
518 void *plContext) | 434 PKIX_NULLCHECK_ONE(params); |
519 { | 435 |
520 PKIX_ENTER(COMCERTSELPARAMS, | 436 PKIX_DECREF(params->nameConstraints); |
521 "PKIX_ComCertSelParams_SetNameConstraints"); | 437 PKIX_INCREF(nameConstraints); |
522 PKIX_NULLCHECK_ONE(params); | 438 params->nameConstraints = nameConstraints; |
523 | 439 |
524 PKIX_DECREF(params->nameConstraints); | 440 PKIX_CHECK( |
525 PKIX_INCREF(nameConstraints); | 441 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
526 params->nameConstraints = nameConstraints; | 442 PKIX_OBJECTINVALIDATECACHEFAILED); |
527 | 443 |
528 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 444 cleanup: |
529 ((PKIX_PL_Object *)params, plContext), | 445 |
530 PKIX_OBJECTINVALIDATECACHEFAILED); | 446 PKIX_RETURN(COMCERTSELPARAMS); |
531 | |
532 cleanup: | |
533 | |
534 PKIX_RETURN(COMCERTSELPARAMS); | |
535 } | 447 } |
536 | 448 |
537 /* | 449 /* |
538 * FUNCTION: PKIX_ComCertSelParams_GetPathToNames | 450 * FUNCTION: PKIX_ComCertSelParams_GetPathToNames |
539 * (see comments in pkix_certsel.h) | 451 * (see comments in pkix_certsel.h) |
540 */PKIX_Error * | 452 */ PKIX_Error *PKIX_ComCertSelParams_GetPathToNames( |
541 PKIX_ComCertSelParams_GetPathToNames( | 453 PKIX_ComCertSelParams *params, |
542 PKIX_ComCertSelParams *params, | 454 PKIX_List **pNames, /* list of PKIX_PL_GeneralName */ |
543 PKIX_List **pNames, /* list of PKIX_PL_GeneralName */ | 455 void *plContext) { |
544 void *plContext) | 456 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetPathToNames"); |
545 { | 457 PKIX_NULLCHECK_TWO(params, pNames); |
546 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetPathToNames"); | 458 |
547 PKIX_NULLCHECK_TWO(params, pNames); | 459 PKIX_INCREF(params->pathToNames); |
548 | 460 |
549 PKIX_INCREF(params->pathToNames); | 461 *pNames = params->pathToNames; |
550 | 462 |
551 *pNames = params->pathToNames; | 463 cleanup: |
552 | 464 PKIX_RETURN(COMCERTSELPARAMS); |
553 cleanup: | |
554 PKIX_RETURN(COMCERTSELPARAMS); | |
555 } | 465 } |
556 | 466 |
557 /* | 467 /* |
558 * FUNCTION: PKIX_ComCertSelParams_SetPathToNames | 468 * FUNCTION: PKIX_ComCertSelParams_SetPathToNames |
559 * (see comments in pkix_certsel.h) | 469 * (see comments in pkix_certsel.h) |
560 */ | 470 */ |
561 PKIX_Error * | 471 PKIX_Error *PKIX_ComCertSelParams_SetPathToNames( |
562 PKIX_ComCertSelParams_SetPathToNames( | 472 PKIX_ComCertSelParams *params, |
563 PKIX_ComCertSelParams *params, | 473 PKIX_List *names, /* list of PKIX_PL_GeneralName */ |
564 PKIX_List *names, /* list of PKIX_PL_GeneralName */ | 474 void *plContext) { |
565 void *plContext) | 475 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetPathToNames"); |
566 { | 476 PKIX_NULLCHECK_ONE(params); |
567 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetPathToNames"); | 477 |
568 PKIX_NULLCHECK_ONE(params); | 478 PKIX_DECREF(params->pathToNames); |
569 | 479 PKIX_INCREF(names); |
570 PKIX_DECREF(params->pathToNames); | 480 |
571 PKIX_INCREF(names); | 481 params->pathToNames = names; |
572 | 482 |
573 params->pathToNames = names; | 483 PKIX_CHECK( |
574 | 484 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
575 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 485 PKIX_OBJECTINVALIDATECACHEFAILED); |
576 ((PKIX_PL_Object *)params, plContext), | 486 |
577 PKIX_OBJECTINVALIDATECACHEFAILED); | 487 cleanup: |
578 | 488 |
579 cleanup: | 489 PKIX_RETURN(COMCERTSELPARAMS); |
580 | |
581 PKIX_RETURN(COMCERTSELPARAMS); | |
582 } | 490 } |
583 | 491 |
584 /* | 492 /* |
585 * FUNCTION: PKIX_ComCertSelParams_AddPathToName | 493 * FUNCTION: PKIX_ComCertSelParams_AddPathToName |
586 * (see comments in pkix_certsel.h) | 494 * (see comments in pkix_certsel.h) |
587 */ | 495 */ |
588 PKIX_Error * | 496 PKIX_Error *PKIX_ComCertSelParams_AddPathToName(PKIX_ComCertSelParams *params, |
589 PKIX_ComCertSelParams_AddPathToName( | 497 PKIX_PL_GeneralName *name, |
590 PKIX_ComCertSelParams *params, | 498 void *plContext) { |
591 PKIX_PL_GeneralName *name, | 499 PKIX_List *pathToNamesList = NULL; |
592 void *plContext) | 500 |
593 { | 501 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_AddPathToName"); |
594 PKIX_List *pathToNamesList = NULL; | 502 PKIX_NULLCHECK_ONE(params); |
595 | 503 |
596 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_AddPathToName"); | 504 if (name == NULL) { |
597 PKIX_NULLCHECK_ONE(params); | 505 goto cleanup; |
598 | 506 } |
599 if (name == NULL) { | 507 |
600 goto cleanup; | 508 if (params->pathToNames == NULL) { |
601 } | 509 /* Create a list for name item */ |
602 | 510 PKIX_CHECK(PKIX_List_Create(&pathToNamesList, plContext), |
603 if (params->pathToNames == NULL) { | 511 PKIX_LISTCREATEFAILED); |
604 /* Create a list for name item */ | 512 |
605 PKIX_CHECK(PKIX_List_Create(&pathToNamesList, plContext), | 513 params->pathToNames = pathToNamesList; |
606 PKIX_LISTCREATEFAILED); | 514 } |
607 | 515 |
608 params->pathToNames = pathToNamesList; | 516 PKIX_CHECK(PKIX_List_AppendItem(params->pathToNames, (PKIX_PL_Object *)name, |
609 } | 517 plContext), |
610 | 518 PKIX_LISTAPPENDITEMFAILED); |
611 PKIX_CHECK(PKIX_List_AppendItem | 519 |
612 (params->pathToNames, (PKIX_PL_Object *)name, plContext), | 520 PKIX_CHECK( |
613 PKIX_LISTAPPENDITEMFAILED); | 521 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
614 | 522 PKIX_OBJECTINVALIDATECACHEFAILED); |
615 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 523 |
616 ((PKIX_PL_Object *)params, plContext), | 524 cleanup: |
617 PKIX_OBJECTINVALIDATECACHEFAILED); | 525 |
618 | 526 PKIX_RETURN(COMCERTSELPARAMS); |
619 cleanup: | |
620 | |
621 PKIX_RETURN(COMCERTSELPARAMS); | |
622 } | 527 } |
623 | 528 |
624 /* | 529 /* |
625 * FUNCTION: PKIX_ComCertSelParams_GetSubjAltNames | 530 * FUNCTION: PKIX_ComCertSelParams_GetSubjAltNames |
626 * (see comments in pkix_certsel.h) | 531 * (see comments in pkix_certsel.h) |
627 */ | 532 */ |
628 PKIX_Error * | 533 PKIX_Error *PKIX_ComCertSelParams_GetSubjAltNames( |
629 PKIX_ComCertSelParams_GetSubjAltNames( | 534 PKIX_ComCertSelParams *params, |
630 PKIX_ComCertSelParams *params, | 535 PKIX_List **pNames, /* list of PKIX_PL_GeneralName */ |
631 PKIX_List **pNames, /* list of PKIX_PL_GeneralName */ | 536 void *plContext) { |
632 void *plContext) | 537 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSubjAltNames"); |
633 { | 538 PKIX_NULLCHECK_TWO(params, pNames); |
634 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSubjAltNames"); | 539 |
635 PKIX_NULLCHECK_TWO(params, pNames); | 540 PKIX_INCREF(params->subjAltNames); |
636 | 541 |
637 PKIX_INCREF(params->subjAltNames); | 542 *pNames = params->subjAltNames; |
638 | 543 |
639 *pNames = params->subjAltNames; | 544 cleanup: |
640 | 545 PKIX_RETURN(COMCERTSELPARAMS); |
641 cleanup: | |
642 PKIX_RETURN(COMCERTSELPARAMS); | |
643 } | 546 } |
644 | 547 |
645 /* | 548 /* |
646 * FUNCTION: PKIX_ComCertSelParams_SetSubjAltNames | 549 * FUNCTION: PKIX_ComCertSelParams_SetSubjAltNames |
647 * (see comments in pkix_certsel.h) | 550 * (see comments in pkix_certsel.h) |
648 */ | 551 */ |
649 PKIX_Error * | 552 PKIX_Error *PKIX_ComCertSelParams_SetSubjAltNames( |
650 PKIX_ComCertSelParams_SetSubjAltNames( | 553 PKIX_ComCertSelParams *params, |
651 PKIX_ComCertSelParams *params, | 554 PKIX_List *names, /* list of PKIX_PL_GeneralName */ |
652 PKIX_List *names, /* list of PKIX_PL_GeneralName */ | 555 void *plContext) { |
653 void *plContext) | 556 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetSubjAltNames"); |
654 { | 557 PKIX_NULLCHECK_TWO(params, names); |
655 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetSubjAltNames"); | 558 |
656 PKIX_NULLCHECK_TWO(params, names); | 559 PKIX_DECREF(params->subjAltNames); |
657 | 560 PKIX_INCREF(names); |
658 PKIX_DECREF(params->subjAltNames); | 561 |
659 PKIX_INCREF(names); | 562 params->subjAltNames = names; |
660 | 563 |
661 params->subjAltNames = names; | 564 cleanup: |
662 | 565 PKIX_RETURN(COMCERTSELPARAMS); |
663 cleanup: | |
664 PKIX_RETURN(COMCERTSELPARAMS); | |
665 } | 566 } |
666 | 567 |
667 /* | 568 /* |
668 * FUNCTION: PKIX_ComCertSelParams_AddSubjAltNames | 569 * FUNCTION: PKIX_ComCertSelParams_AddSubjAltNames |
669 * (see comments in pkix_certsel.h) | 570 * (see comments in pkix_certsel.h) |
670 */ | 571 */ |
671 PKIX_Error * | 572 PKIX_Error *PKIX_ComCertSelParams_AddSubjAltName(PKIX_ComCertSelParams *params, |
672 PKIX_ComCertSelParams_AddSubjAltName( | 573 PKIX_PL_GeneralName *name, |
673 PKIX_ComCertSelParams *params, | 574 void *plContext) { |
674 PKIX_PL_GeneralName *name, | 575 PKIX_List *list = NULL; |
675 void *plContext) | 576 |
676 { | 577 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_AddSubjAltName"); |
677 PKIX_List *list = NULL; | 578 PKIX_NULLCHECK_TWO(params, name); |
678 | 579 |
679 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_AddSubjAltName"); | 580 if (params->subjAltNames == NULL) { |
680 PKIX_NULLCHECK_TWO(params, name); | 581 PKIX_CHECK(PKIX_List_Create(&list, plContext), PKIX_LISTCREATEFAILED); |
681 | 582 params->subjAltNames = list; |
682 if (params->subjAltNames == NULL) { | 583 } |
683 PKIX_CHECK(PKIX_List_Create(&list, plContext), | 584 |
684 PKIX_LISTCREATEFAILED); | 585 PKIX_CHECK(PKIX_List_AppendItem(params->subjAltNames, (PKIX_PL_Object *)name, |
685 params->subjAltNames = list; | 586 plContext), |
686 } | 587 PKIX_LISTAPPENDITEMFAILED); |
687 | 588 |
688 PKIX_CHECK(PKIX_List_AppendItem | 589 cleanup: |
689 (params->subjAltNames, (PKIX_PL_Object *)name, plContext), | 590 |
690 PKIX_LISTAPPENDITEMFAILED); | 591 PKIX_RETURN(COMCERTSELPARAMS) |
691 | |
692 cleanup: | |
693 | |
694 PKIX_RETURN(COMCERTSELPARAMS) | |
695 } | 592 } |
696 | 593 |
697 /* | 594 /* |
698 * FUNCTION: PKIX_ComCertSelParams_GetMatchAllSubjAltNames | 595 * FUNCTION: PKIX_ComCertSelParams_GetMatchAllSubjAltNames |
699 * (see comments in pkix_certsel.h) | 596 * (see comments in pkix_certsel.h) |
700 */ | 597 */ |
701 PKIX_Error * | 598 PKIX_Error *PKIX_ComCertSelParams_GetMatchAllSubjAltNames( |
702 PKIX_ComCertSelParams_GetMatchAllSubjAltNames( | 599 PKIX_ComCertSelParams *params, PKIX_Boolean *pMatch, void *plContext) { |
703 PKIX_ComCertSelParams *params, | 600 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetMatchAllSubjAltNames"); |
704 PKIX_Boolean *pMatch, | 601 PKIX_NULLCHECK_TWO(params, pMatch); |
705 void *plContext) | 602 |
706 { | 603 *pMatch = params->matchAllSubjAltNames; |
707 PKIX_ENTER(COMCERTSELPARAMS, | 604 |
708 "PKIX_ComCertSelParams_GetMatchAllSubjAltNames"); | 605 PKIX_RETURN(COMCERTSELPARAMS); |
709 PKIX_NULLCHECK_TWO(params, pMatch); | |
710 | |
711 *pMatch = params->matchAllSubjAltNames; | |
712 | |
713 PKIX_RETURN(COMCERTSELPARAMS); | |
714 } | 606 } |
715 | 607 |
716 /* | 608 /* |
717 * FUNCTION: PKIX_ComCertSelParams_SetMatchAllSubjAltNames | 609 * FUNCTION: PKIX_ComCertSelParams_SetMatchAllSubjAltNames |
718 * (see comments in pkix_certsel.h) | 610 * (see comments in pkix_certsel.h) |
719 */ | 611 */ |
720 PKIX_Error * | 612 PKIX_Error *PKIX_ComCertSelParams_SetMatchAllSubjAltNames( |
721 PKIX_ComCertSelParams_SetMatchAllSubjAltNames( | 613 PKIX_ComCertSelParams *params, PKIX_Boolean match, void *plContext) { |
722 PKIX_ComCertSelParams *params, | 614 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetMatchAllSubjAltNames"); |
723 PKIX_Boolean match, | 615 PKIX_NULLCHECK_ONE(params); |
724 void *plContext) | 616 |
725 { | 617 params->matchAllSubjAltNames = match; |
726 PKIX_ENTER(COMCERTSELPARAMS, | 618 |
727 "PKIX_ComCertSelParams_SetMatchAllSubjAltNames"); | 619 PKIX_RETURN(COMCERTSELPARAMS); |
728 PKIX_NULLCHECK_ONE(params); | |
729 | |
730 params->matchAllSubjAltNames = match; | |
731 | |
732 PKIX_RETURN(COMCERTSELPARAMS); | |
733 } | 620 } |
734 | 621 |
735 /* | 622 /* |
736 * FUNCTION: PKIX_ComCertSelParams_GetExtendedKeyUsage | 623 * FUNCTION: PKIX_ComCertSelParams_GetExtendedKeyUsage |
737 * (see comments in pkix_certsel.h) | 624 * (see comments in pkix_certsel.h) |
738 */ | 625 */ |
739 PKIX_Error * | 626 PKIX_Error *PKIX_ComCertSelParams_GetExtendedKeyUsage( |
740 PKIX_ComCertSelParams_GetExtendedKeyUsage( | 627 PKIX_ComCertSelParams *params, |
741 PKIX_ComCertSelParams *params, | 628 PKIX_List **pExtKeyUsage, /* list of PKIX_PL_OID */ |
742 PKIX_List **pExtKeyUsage, /* list of PKIX_PL_OID */ | 629 void *plContext) { |
743 void *plContext) | 630 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetExtendedKeyUsage"); |
744 { | 631 PKIX_NULLCHECK_TWO(params, pExtKeyUsage); |
745 PKIX_ENTER(COMCERTSELPARAMS, | 632 |
746 "PKIX_ComCertSelParams_GetExtendedKeyUsage"); | 633 PKIX_INCREF(params->extKeyUsage); |
747 PKIX_NULLCHECK_TWO(params, pExtKeyUsage); | 634 *pExtKeyUsage = params->extKeyUsage; |
748 | 635 |
749 PKIX_INCREF(params->extKeyUsage); | 636 cleanup: |
750 *pExtKeyUsage = params->extKeyUsage; | 637 PKIX_RETURN(COMCERTSELPARAMS); |
751 | |
752 cleanup: | |
753 PKIX_RETURN(COMCERTSELPARAMS); | |
754 } | 638 } |
755 | 639 |
756 /* | 640 /* |
757 * FUNCTION: PKIX_ComCertSelParams_SetExtendedKeyUsage | 641 * FUNCTION: PKIX_ComCertSelParams_SetExtendedKeyUsage |
758 * (see comments in pkix_certsel.h) | 642 * (see comments in pkix_certsel.h) |
759 */ | 643 */ |
760 PKIX_Error * | 644 PKIX_Error *PKIX_ComCertSelParams_SetExtendedKeyUsage( |
761 PKIX_ComCertSelParams_SetExtendedKeyUsage( | 645 PKIX_ComCertSelParams *params, |
762 PKIX_ComCertSelParams *params, | 646 PKIX_List *extKeyUsage, /* list of PKIX_PL_OID */ |
763 PKIX_List *extKeyUsage, /* list of PKIX_PL_OID */ | 647 void *plContext) { |
764 void *plContext) | 648 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetExtendedKeyUsage"); |
765 { | 649 PKIX_NULLCHECK_ONE(params); |
766 PKIX_ENTER(COMCERTSELPARAMS, | 650 |
767 "PKIX_ComCertSelParams_SetExtendedKeyUsage"); | 651 PKIX_DECREF(params->extKeyUsage); |
768 PKIX_NULLCHECK_ONE(params); | 652 PKIX_INCREF(extKeyUsage); |
769 | 653 |
770 PKIX_DECREF(params->extKeyUsage); | 654 params->extKeyUsage = extKeyUsage; |
771 PKIX_INCREF(extKeyUsage); | 655 |
772 | 656 cleanup: |
773 params->extKeyUsage = extKeyUsage; | 657 PKIX_RETURN(COMCERTSELPARAMS); |
774 | |
775 cleanup: | |
776 PKIX_RETURN(COMCERTSELPARAMS); | |
777 } | 658 } |
778 | 659 |
779 /* | 660 /* |
780 * FUNCTION: PKIX_ComCertSelParams_GetKeyUsage | 661 * FUNCTION: PKIX_ComCertSelParams_GetKeyUsage |
781 * (see comments in pkix_certsel.h) | 662 * (see comments in pkix_certsel.h) |
782 */ | 663 */ |
783 PKIX_Error * | 664 PKIX_Error *PKIX_ComCertSelParams_GetKeyUsage(PKIX_ComCertSelParams *params, |
784 PKIX_ComCertSelParams_GetKeyUsage( | 665 PKIX_UInt32 *pKeyUsage, |
785 PKIX_ComCertSelParams *params, | 666 void *plContext) { |
786 PKIX_UInt32 *pKeyUsage, | 667 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetKeyUsage"); |
787 void *plContext) | 668 PKIX_NULLCHECK_TWO(params, pKeyUsage); |
788 { | 669 |
789 PKIX_ENTER(COMCERTSELPARAMS, | 670 *pKeyUsage = params->keyUsage; |
790 "PKIX_ComCertSelParams_GetKeyUsage"); | 671 |
791 PKIX_NULLCHECK_TWO(params, pKeyUsage); | 672 PKIX_RETURN(COMCERTSELPARAMS); |
792 | |
793 *pKeyUsage = params->keyUsage; | |
794 | |
795 PKIX_RETURN(COMCERTSELPARAMS); | |
796 } | 673 } |
797 | 674 |
798 /* | 675 /* |
799 * FUNCTION: PKIX_ComCertSelParams_SetKeyUsage | 676 * FUNCTION: PKIX_ComCertSelParams_SetKeyUsage |
800 * (see comments in pkix_certsel.h) | 677 * (see comments in pkix_certsel.h) |
801 */ | 678 */ |
802 PKIX_Error * | 679 PKIX_Error *PKIX_ComCertSelParams_SetKeyUsage(PKIX_ComCertSelParams *params, |
803 PKIX_ComCertSelParams_SetKeyUsage( | 680 PKIX_UInt32 keyUsage, |
804 PKIX_ComCertSelParams *params, | 681 void *plContext) { |
805 PKIX_UInt32 keyUsage, | 682 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetKeyUsage"); |
806 void *plContext) | 683 PKIX_NULLCHECK_ONE(params); |
807 { | 684 |
808 PKIX_ENTER(COMCERTSELPARAMS, | 685 params->keyUsage = keyUsage; |
809 "PKIX_ComCertSelParams_SetKeyUsage"); | 686 |
810 PKIX_NULLCHECK_ONE(params); | 687 PKIX_RETURN(COMCERTSELPARAMS); |
811 | |
812 params->keyUsage = keyUsage; | |
813 | |
814 PKIX_RETURN(COMCERTSELPARAMS); | |
815 } | 688 } |
816 | 689 |
817 /* | 690 /* |
818 * FUNCTION: PKIX_ComCertSelParams_GetIssuer | 691 * FUNCTION: PKIX_ComCertSelParams_GetIssuer |
819 * (see comments in pkix_certsel.h) | 692 * (see comments in pkix_certsel.h) |
820 */ | 693 */ |
821 PKIX_Error * | 694 PKIX_Error *PKIX_ComCertSelParams_GetIssuer(PKIX_ComCertSelParams *params, |
822 PKIX_ComCertSelParams_GetIssuer( | 695 PKIX_PL_X500Name **pIssuer, |
823 PKIX_ComCertSelParams *params, | 696 void *plContext) { |
824 PKIX_PL_X500Name **pIssuer, | 697 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetIssuer"); |
825 void *plContext) | 698 PKIX_NULLCHECK_TWO(params, pIssuer); |
826 { | 699 |
827 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetIssuer"); | 700 PKIX_INCREF(params->issuer); |
828 PKIX_NULLCHECK_TWO(params, pIssuer); | 701 *pIssuer = params->issuer; |
829 | 702 |
830 PKIX_INCREF(params->issuer); | 703 cleanup: |
831 *pIssuer = params->issuer; | 704 PKIX_RETURN(COMCERTSELPARAMS); |
832 | |
833 cleanup: | |
834 PKIX_RETURN(COMCERTSELPARAMS); | |
835 } | 705 } |
836 | 706 |
837 /* | 707 /* |
838 * FUNCTION: PKIX_ComCertSelParams_SetIssuer | 708 * FUNCTION: PKIX_ComCertSelParams_SetIssuer |
839 * (see comments in pkix_certsel.h) | 709 * (see comments in pkix_certsel.h) |
840 */ | 710 */ |
841 PKIX_Error * | 711 PKIX_Error *PKIX_ComCertSelParams_SetIssuer(PKIX_ComCertSelParams *params, |
842 PKIX_ComCertSelParams_SetIssuer( | 712 PKIX_PL_X500Name *issuer, |
843 PKIX_ComCertSelParams *params, | 713 void *plContext) { |
844 PKIX_PL_X500Name *issuer, | 714 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetIssuer"); |
845 void *plContext) | 715 PKIX_NULLCHECK_ONE(params); |
846 { | 716 |
847 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetIssuer"); | 717 PKIX_DECREF(params->issuer); |
848 PKIX_NULLCHECK_ONE(params); | 718 PKIX_INCREF(issuer); |
849 | 719 params->issuer = issuer; |
850 PKIX_DECREF(params->issuer); | 720 |
851 PKIX_INCREF(issuer); | 721 PKIX_CHECK( |
852 params->issuer = issuer; | 722 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
853 | 723 PKIX_OBJECTINVALIDATECACHEFAILED); |
854 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 724 |
855 ((PKIX_PL_Object *)params, plContext), | 725 cleanup: |
856 PKIX_OBJECTINVALIDATECACHEFAILED); | 726 |
857 | 727 PKIX_RETURN(COMCERTSELPARAMS); |
858 cleanup: | |
859 | |
860 PKIX_RETURN(COMCERTSELPARAMS); | |
861 } | 728 } |
862 | 729 |
863 /* | 730 /* |
864 * FUNCTION: PKIX_ComCertSelParams_GetSerialNumber | 731 * FUNCTION: PKIX_ComCertSelParams_GetSerialNumber |
865 * (see comments in pkix_certsel.h) | 732 * (see comments in pkix_certsel.h) |
866 */ | 733 */ |
867 PKIX_Error * | 734 PKIX_Error *PKIX_ComCertSelParams_GetSerialNumber( |
868 PKIX_ComCertSelParams_GetSerialNumber( | 735 PKIX_ComCertSelParams *params, PKIX_PL_BigInt **pSerialNumber, |
869 PKIX_ComCertSelParams *params, | 736 void *plContext) { |
870 PKIX_PL_BigInt **pSerialNumber, | 737 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSerialNumber"); |
871 void *plContext) | 738 PKIX_NULLCHECK_TWO(params, pSerialNumber); |
872 { | 739 |
873 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSerialNumber"); | 740 PKIX_INCREF(params->serialNumber); |
874 PKIX_NULLCHECK_TWO(params, pSerialNumber); | 741 *pSerialNumber = params->serialNumber; |
875 | 742 |
876 PKIX_INCREF(params->serialNumber); | 743 cleanup: |
877 *pSerialNumber = params->serialNumber; | 744 PKIX_RETURN(COMCERTSELPARAMS); |
878 | |
879 cleanup: | |
880 PKIX_RETURN(COMCERTSELPARAMS); | |
881 } | 745 } |
882 | 746 |
883 /* | 747 /* |
884 * FUNCTION: PKIX_ComCertSelParams_SetSerialNumber | 748 * FUNCTION: PKIX_ComCertSelParams_SetSerialNumber |
885 * (see comments in pkix_certsel.h) | 749 * (see comments in pkix_certsel.h) |
886 */ | 750 */ |
887 PKIX_Error * | 751 PKIX_Error *PKIX_ComCertSelParams_SetSerialNumber(PKIX_ComCertSelParams *params, |
888 PKIX_ComCertSelParams_SetSerialNumber( | 752 PKIX_PL_BigInt *serialNumber, |
889 PKIX_ComCertSelParams *params, | 753 void *plContext) { |
890 PKIX_PL_BigInt *serialNumber, | 754 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetSerialNumber"); |
891 void *plContext) | 755 PKIX_NULLCHECK_ONE(params); |
892 { | 756 |
893 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetSerialNumber"); | 757 PKIX_DECREF(params->serialNumber); |
894 PKIX_NULLCHECK_ONE(params); | 758 PKIX_INCREF(serialNumber); |
895 | 759 params->serialNumber = serialNumber; |
896 PKIX_DECREF(params->serialNumber); | 760 |
897 PKIX_INCREF(serialNumber); | 761 PKIX_CHECK( |
898 params->serialNumber = serialNumber; | 762 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
899 | 763 PKIX_OBJECTINVALIDATECACHEFAILED); |
900 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 764 |
901 ((PKIX_PL_Object *)params, plContext), | 765 cleanup: |
902 PKIX_OBJECTINVALIDATECACHEFAILED); | 766 |
903 | 767 PKIX_RETURN(COMCERTSELPARAMS); |
904 cleanup: | |
905 | |
906 PKIX_RETURN(COMCERTSELPARAMS); | |
907 } | 768 } |
908 | 769 |
909 /* | 770 /* |
910 * FUNCTION: PKIX_ComCertSelParams_GetVersion | 771 * FUNCTION: PKIX_ComCertSelParams_GetVersion |
911 * (see comments in pkix_certsel.h) | 772 * (see comments in pkix_certsel.h) |
912 */ | 773 */ |
913 PKIX_Error * | 774 PKIX_Error *PKIX_ComCertSelParams_GetVersion(PKIX_ComCertSelParams *params, |
914 PKIX_ComCertSelParams_GetVersion( | 775 PKIX_UInt32 *pVersion, |
915 PKIX_ComCertSelParams *params, | 776 void *plContext) { |
916 PKIX_UInt32 *pVersion, | 777 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetVersion"); |
917 void *plContext) | 778 PKIX_NULLCHECK_TWO(params, pVersion); |
918 { | 779 |
919 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetVersion"); | 780 *pVersion = params->version; |
920 PKIX_NULLCHECK_TWO(params, pVersion); | 781 |
921 | 782 PKIX_RETURN(COMCERTSELPARAMS); |
922 *pVersion = params->version; | |
923 | |
924 PKIX_RETURN(COMCERTSELPARAMS); | |
925 } | 783 } |
926 | 784 |
927 /* | 785 /* |
928 * FUNCTION: PKIX_ComCertSelParams_SetVersion | 786 * FUNCTION: PKIX_ComCertSelParams_SetVersion |
929 * (see comments in pkix_certsel.h) | 787 * (see comments in pkix_certsel.h) |
930 */ | 788 */ |
931 PKIX_Error * | 789 PKIX_Error *PKIX_ComCertSelParams_SetVersion(PKIX_ComCertSelParams *params, |
932 PKIX_ComCertSelParams_SetVersion( | 790 PKIX_Int32 version, |
933 PKIX_ComCertSelParams *params, | 791 void *plContext) { |
934 PKIX_Int32 version, | 792 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetVersion"); |
935 void *plContext) | 793 PKIX_NULLCHECK_ONE(params); |
936 { | 794 |
937 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetVersion"); | 795 params->version = version; |
938 PKIX_NULLCHECK_ONE(params); | 796 |
939 | 797 PKIX_CHECK( |
940 params->version = version; | 798 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
941 | 799 PKIX_OBJECTINVALIDATECACHEFAILED); |
942 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 800 |
943 ((PKIX_PL_Object *)params, plContext), | 801 cleanup: |
944 PKIX_OBJECTINVALIDATECACHEFAILED); | 802 |
945 | 803 PKIX_RETURN(COMCERTSELPARAMS); |
946 cleanup: | |
947 | |
948 PKIX_RETURN(COMCERTSELPARAMS); | |
949 } | 804 } |
950 | 805 |
951 /* | 806 /* |
952 * FUNCTION: PKIX_ComCertSelParams_GetSubjKeyIdentifier | 807 * FUNCTION: PKIX_ComCertSelParams_GetSubjKeyIdentifier |
953 * (see comments in pkix_certsel.h) | 808 * (see comments in pkix_certsel.h) |
954 */ | 809 */ |
955 PKIX_Error * | 810 PKIX_Error *PKIX_ComCertSelParams_GetSubjKeyIdentifier( |
956 PKIX_ComCertSelParams_GetSubjKeyIdentifier( | 811 PKIX_ComCertSelParams *params, PKIX_PL_ByteArray **pSubjKeyId, |
957 PKIX_ComCertSelParams *params, | 812 void *plContext) { |
958 PKIX_PL_ByteArray **pSubjKeyId, | 813 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSubjKeyIdentifier"); |
959 void *plContext) | 814 PKIX_NULLCHECK_TWO(params, pSubjKeyId); |
960 { | 815 |
961 PKIX_ENTER(COMCERTSELPARAMS, | 816 PKIX_INCREF(params->subjKeyId); |
962 "PKIX_ComCertSelParams_GetSubjKeyIdentifier"); | 817 |
963 PKIX_NULLCHECK_TWO(params, pSubjKeyId); | 818 *pSubjKeyId = params->subjKeyId; |
964 | 819 |
965 PKIX_INCREF(params->subjKeyId); | 820 cleanup: |
966 | 821 PKIX_RETURN(COMCERTSELPARAMS); |
967 *pSubjKeyId = params->subjKeyId; | |
968 | |
969 cleanup: | |
970 PKIX_RETURN(COMCERTSELPARAMS); | |
971 } | 822 } |
972 | 823 |
973 /* | 824 /* |
974 * FUNCTION: PKIX_ComCertSelParams_SetSubjKeyIdentifier | 825 * FUNCTION: PKIX_ComCertSelParams_SetSubjKeyIdentifier |
975 * (see comments in pkix_certsel.h) | 826 * (see comments in pkix_certsel.h) |
976 */ | 827 */ |
977 PKIX_Error * | 828 PKIX_Error *PKIX_ComCertSelParams_SetSubjKeyIdentifier( |
978 PKIX_ComCertSelParams_SetSubjKeyIdentifier( | 829 PKIX_ComCertSelParams *params, PKIX_PL_ByteArray *subjKeyId, |
979 PKIX_ComCertSelParams *params, | 830 void *plContext) { |
980 PKIX_PL_ByteArray *subjKeyId, | 831 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetSubjKeyIdentifier"); |
981 void *plContext) | 832 PKIX_NULLCHECK_ONE(params); |
982 { | 833 |
983 PKIX_ENTER(COMCERTSELPARAMS, | 834 PKIX_DECREF(params->subjKeyId); |
984 "PKIX_ComCertSelParams_SetSubjKeyIdentifier"); | 835 PKIX_INCREF(subjKeyId); |
985 PKIX_NULLCHECK_ONE(params); | 836 |
986 | 837 params->subjKeyId = subjKeyId; |
987 PKIX_DECREF(params->subjKeyId); | 838 |
988 PKIX_INCREF(subjKeyId); | 839 PKIX_CHECK( |
989 | 840 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
990 params->subjKeyId = subjKeyId; | 841 PKIX_OBJECTINVALIDATECACHEFAILED); |
991 | 842 |
992 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 843 cleanup: |
993 ((PKIX_PL_Object *)params, plContext), | 844 |
994 PKIX_OBJECTINVALIDATECACHEFAILED); | 845 PKIX_RETURN(COMCERTSELPARAMS); |
995 | |
996 cleanup: | |
997 | |
998 PKIX_RETURN(COMCERTSELPARAMS); | |
999 } | 846 } |
1000 | 847 |
1001 /* | 848 /* |
1002 * FUNCTION: PKIX_ComCertSelParams_GetAuthorityKeyIdentifier | 849 * FUNCTION: PKIX_ComCertSelParams_GetAuthorityKeyIdentifier |
1003 * (see comments in pkix_certsel.h) | 850 * (see comments in pkix_certsel.h) |
1004 */ | 851 */ |
1005 PKIX_Error * | 852 PKIX_Error *PKIX_ComCertSelParams_GetAuthorityKeyIdentifier( |
1006 PKIX_ComCertSelParams_GetAuthorityKeyIdentifier( | 853 PKIX_ComCertSelParams *params, PKIX_PL_ByteArray **pAuthKeyId, |
1007 PKIX_ComCertSelParams *params, | 854 void *plContext) { |
1008 PKIX_PL_ByteArray **pAuthKeyId, | 855 PKIX_ENTER(COMCERTSELPARAMS, |
1009 void *plContext) | 856 "PKIX_ComCertSelParams_GetAuthorityKeyIdentifier"); |
1010 { | 857 PKIX_NULLCHECK_TWO(params, pAuthKeyId); |
1011 PKIX_ENTER(COMCERTSELPARAMS, | 858 |
1012 "PKIX_ComCertSelParams_GetAuthorityKeyIdentifier"); | 859 PKIX_INCREF(params->authKeyId); |
1013 PKIX_NULLCHECK_TWO(params, pAuthKeyId); | 860 |
1014 | 861 *pAuthKeyId = params->authKeyId; |
1015 PKIX_INCREF(params->authKeyId); | 862 |
1016 | 863 cleanup: |
1017 *pAuthKeyId = params->authKeyId; | 864 PKIX_RETURN(COMCERTSELPARAMS); |
1018 | |
1019 cleanup: | |
1020 PKIX_RETURN(COMCERTSELPARAMS); | |
1021 } | 865 } |
1022 | 866 |
1023 /* | 867 /* |
1024 * FUNCTION: PKIX_ComCertSelParams_SetAuthorityKeyIdentifier | 868 * FUNCTION: PKIX_ComCertSelParams_SetAuthorityKeyIdentifier |
1025 * (see comments in pkix_certsel.h) | 869 * (see comments in pkix_certsel.h) |
1026 */ | 870 */ |
1027 PKIX_Error * | 871 PKIX_Error *PKIX_ComCertSelParams_SetAuthorityKeyIdentifier( |
1028 PKIX_ComCertSelParams_SetAuthorityKeyIdentifier( | 872 PKIX_ComCertSelParams *params, PKIX_PL_ByteArray *authKeyId, |
1029 PKIX_ComCertSelParams *params, | 873 void *plContext) { |
1030 PKIX_PL_ByteArray *authKeyId, | 874 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetAuthKeyIdentifier"); |
1031 void *plContext) | 875 PKIX_NULLCHECK_ONE(params); |
1032 { | 876 |
1033 PKIX_ENTER(COMCERTSELPARAMS, | 877 PKIX_DECREF(params->authKeyId); |
1034 "PKIX_ComCertSelParams_SetAuthKeyIdentifier"); | 878 PKIX_INCREF(authKeyId); |
1035 PKIX_NULLCHECK_ONE(params); | 879 |
1036 | 880 params->authKeyId = authKeyId; |
1037 PKIX_DECREF(params->authKeyId); | 881 |
1038 PKIX_INCREF(authKeyId); | 882 PKIX_CHECK( |
1039 | 883 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
1040 params->authKeyId = authKeyId; | 884 PKIX_OBJECTINVALIDATECACHEFAILED); |
1041 | 885 |
1042 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 886 cleanup: |
1043 ((PKIX_PL_Object *)params, plContext), | 887 |
1044 PKIX_OBJECTINVALIDATECACHEFAILED); | 888 PKIX_RETURN(COMCERTSELPARAMS); |
1045 | |
1046 cleanup: | |
1047 | |
1048 PKIX_RETURN(COMCERTSELPARAMS); | |
1049 } | 889 } |
1050 | 890 |
1051 /* | 891 /* |
1052 * FUNCTION: PKIX_ComCertSelParams_GetSubjPubKey | 892 * FUNCTION: PKIX_ComCertSelParams_GetSubjPubKey |
1053 * (see comments in pkix_certsel.h) | 893 * (see comments in pkix_certsel.h) |
1054 */ | 894 */ |
1055 PKIX_Error * | 895 PKIX_Error *PKIX_ComCertSelParams_GetSubjPubKey(PKIX_ComCertSelParams *params, |
1056 PKIX_ComCertSelParams_GetSubjPubKey( | 896 PKIX_PL_PublicKey **pSubjPubKey, |
1057 PKIX_ComCertSelParams *params, | 897 void *plContext) { |
1058 PKIX_PL_PublicKey **pSubjPubKey, | 898 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSubjPubKey"); |
1059 void *plContext) | 899 PKIX_NULLCHECK_TWO(params, pSubjPubKey); |
1060 { | 900 |
1061 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSubjPubKey"); | 901 PKIX_INCREF(params->subjPubKey); |
1062 PKIX_NULLCHECK_TWO(params, pSubjPubKey); | 902 |
1063 | 903 *pSubjPubKey = params->subjPubKey; |
1064 PKIX_INCREF(params->subjPubKey); | 904 |
1065 | 905 cleanup: |
1066 *pSubjPubKey = params->subjPubKey; | 906 PKIX_RETURN(COMCERTSELPARAMS); |
1067 | |
1068 cleanup: | |
1069 PKIX_RETURN(COMCERTSELPARAMS); | |
1070 } | 907 } |
1071 | 908 |
1072 /* | 909 /* |
1073 * FUNCTION: PKIX_ComCertSelParams_SetSubjPubKey | 910 * FUNCTION: PKIX_ComCertSelParams_SetSubjPubKey |
1074 * (see comments in pkix_certsel.h) | 911 * (see comments in pkix_certsel.h) |
1075 */ | 912 */ |
1076 PKIX_Error * | 913 PKIX_Error *PKIX_ComCertSelParams_SetSubjPubKey(PKIX_ComCertSelParams *params, |
1077 PKIX_ComCertSelParams_SetSubjPubKey( | 914 PKIX_PL_PublicKey *subjPubKey, |
1078 PKIX_ComCertSelParams *params, | 915 void *plContext) { |
1079 PKIX_PL_PublicKey *subjPubKey, | 916 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetSubjPubKey"); |
1080 void *plContext) | 917 PKIX_NULLCHECK_ONE(params); |
1081 { | 918 |
1082 PKIX_ENTER(COMCERTSELPARAMS, | 919 PKIX_DECREF(params->subjPubKey); |
1083 "PKIX_ComCertSelParams_SetSubjPubKey"); | 920 PKIX_INCREF(subjPubKey); |
1084 PKIX_NULLCHECK_ONE(params); | 921 |
1085 | 922 params->subjPubKey = subjPubKey; |
1086 PKIX_DECREF(params->subjPubKey); | 923 |
1087 PKIX_INCREF(subjPubKey); | 924 PKIX_CHECK( |
1088 | 925 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
1089 params->subjPubKey = subjPubKey; | 926 PKIX_OBJECTINVALIDATECACHEFAILED); |
1090 | 927 |
1091 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 928 cleanup: |
1092 ((PKIX_PL_Object *)params, plContext), | 929 |
1093 PKIX_OBJECTINVALIDATECACHEFAILED); | 930 PKIX_RETURN(COMCERTSELPARAMS); |
1094 | |
1095 cleanup: | |
1096 | |
1097 PKIX_RETURN(COMCERTSELPARAMS); | |
1098 } | 931 } |
1099 | 932 |
1100 /* | 933 /* |
1101 * FUNCTION: PKIX_ComCertSelParams_GetSubjPKAlgId | 934 * FUNCTION: PKIX_ComCertSelParams_GetSubjPKAlgId |
1102 * (see comments in pkix_certsel.h) | 935 * (see comments in pkix_certsel.h) |
1103 */ | 936 */ |
1104 PKIX_Error * | 937 PKIX_Error *PKIX_ComCertSelParams_GetSubjPKAlgId(PKIX_ComCertSelParams *params, |
1105 PKIX_ComCertSelParams_GetSubjPKAlgId( | 938 PKIX_PL_OID **pAlgId, |
1106 PKIX_ComCertSelParams *params, | 939 void *plContext) { |
1107 PKIX_PL_OID **pAlgId, | 940 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSubjPKAlgId"); |
1108 void *plContext) | 941 PKIX_NULLCHECK_TWO(params, pAlgId); |
1109 { | 942 |
1110 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSubjPKAlgId"); | 943 PKIX_INCREF(params->subjPKAlgId); |
1111 PKIX_NULLCHECK_TWO(params, pAlgId); | 944 |
1112 | 945 *pAlgId = params->subjPKAlgId; |
1113 PKIX_INCREF(params->subjPKAlgId); | 946 |
1114 | 947 cleanup: |
1115 *pAlgId = params->subjPKAlgId; | 948 PKIX_RETURN(COMCERTSELPARAMS); |
1116 | |
1117 cleanup: | |
1118 PKIX_RETURN(COMCERTSELPARAMS); | |
1119 } | 949 } |
1120 | 950 |
1121 /* | 951 /* |
1122 * FUNCTION: PKIX_ComCertSelParams_SetSubjPKAlgId | 952 * FUNCTION: PKIX_ComCertSelParams_SetSubjPKAlgId |
1123 * (see comments in pkix_certsel.h) | 953 * (see comments in pkix_certsel.h) |
1124 */ | 954 */ |
1125 PKIX_Error * | 955 PKIX_Error *PKIX_ComCertSelParams_SetSubjPKAlgId(PKIX_ComCertSelParams *params, |
1126 PKIX_ComCertSelParams_SetSubjPKAlgId( | 956 PKIX_PL_OID *algId, |
1127 PKIX_ComCertSelParams *params, | 957 void *plContext) { |
1128 PKIX_PL_OID *algId, | 958 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetSubjPKAlgId"); |
1129 void *plContext) | 959 PKIX_NULLCHECK_ONE(params); |
1130 { | 960 |
1131 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetSubjPKAlgId"); | 961 PKIX_DECREF(params->subjPKAlgId); |
1132 PKIX_NULLCHECK_ONE(params); | 962 PKIX_INCREF(algId); |
1133 | 963 |
1134 PKIX_DECREF(params->subjPKAlgId); | 964 params->subjPKAlgId = algId; |
1135 PKIX_INCREF(algId); | 965 |
1136 | 966 PKIX_CHECK( |
1137 params->subjPKAlgId = algId; | 967 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
1138 | 968 PKIX_OBJECTINVALIDATECACHEFAILED); |
1139 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 969 |
1140 ((PKIX_PL_Object *)params, plContext), | 970 cleanup: |
1141 PKIX_OBJECTINVALIDATECACHEFAILED); | 971 |
1142 | 972 PKIX_RETURN(COMCERTSELPARAMS); |
1143 cleanup: | |
1144 | |
1145 PKIX_RETURN(COMCERTSELPARAMS); | |
1146 } | 973 } |
1147 | 974 |
1148 /* | 975 /* |
1149 * FUNCTION: PKIX_ComCertSelParams_GetLeafCertFlag | 976 * FUNCTION: PKIX_ComCertSelParams_GetLeafCertFlag |
1150 * (see comments in pkix_certsel.h) | 977 * (see comments in pkix_certsel.h) |
1151 */ | 978 */ |
1152 PKIX_Error* | 979 PKIX_Error *PKIX_ComCertSelParams_GetLeafCertFlag(PKIX_ComCertSelParams *params, |
1153 PKIX_ComCertSelParams_GetLeafCertFlag( | 980 PKIX_Boolean *pLeafFlag, |
1154 PKIX_ComCertSelParams *params, | 981 void *plContext) { |
1155 PKIX_Boolean *pLeafFlag, | 982 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetLeafCertFlag"); |
1156 void *plContext) | 983 PKIX_NULLCHECK_TWO(params, pLeafFlag); |
1157 { | 984 |
1158 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetLeafCertFlag"); | 985 *pLeafFlag = params->leafCertFlag; |
1159 PKIX_NULLCHECK_TWO(params, pLeafFlag); | 986 |
1160 | 987 PKIX_RETURN(COMCERTSELPARAMS); |
1161 *pLeafFlag = params->leafCertFlag; | |
1162 | |
1163 PKIX_RETURN(COMCERTSELPARAMS); | |
1164 } | 988 } |
1165 | 989 |
1166 /* | 990 /* |
1167 * FUNCTION: PKIX_ComCertSelParams_SetLeafCertFlag | 991 * FUNCTION: PKIX_ComCertSelParams_SetLeafCertFlag |
1168 * (see comments in pkix_certsel.h) | 992 * (see comments in pkix_certsel.h) |
1169 */ | 993 */ |
1170 PKIX_Error * | 994 PKIX_Error *PKIX_ComCertSelParams_SetLeafCertFlag(PKIX_ComCertSelParams *params, |
1171 PKIX_ComCertSelParams_SetLeafCertFlag( | 995 PKIX_Boolean leafFlag, |
1172 PKIX_ComCertSelParams *params, | 996 void *plContext) { |
1173 PKIX_Boolean leafFlag, | 997 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetLeafCertFlag"); |
1174 void *plContext) | 998 PKIX_NULLCHECK_ONE(params); |
1175 { | 999 |
1176 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetLeafCertFlag"); | 1000 params->leafCertFlag = leafFlag; |
1177 PKIX_NULLCHECK_ONE(params); | 1001 |
1178 | 1002 PKIX_CHECK( |
1179 params->leafCertFlag = leafFlag; | 1003 PKIX_PL_Object_InvalidateCache((PKIX_PL_Object *)params, plContext), |
1180 | 1004 PKIX_OBJECTINVALIDATECACHEFAILED); |
1181 PKIX_CHECK(PKIX_PL_Object_InvalidateCache | 1005 |
1182 ((PKIX_PL_Object *)params, plContext), | 1006 cleanup: |
1183 PKIX_OBJECTINVALIDATECACHEFAILED); | 1007 |
1184 | 1008 PKIX_RETURN(COMCERTSELPARAMS); |
1185 cleanup: | 1009 } |
1186 | |
1187 PKIX_RETURN(COMCERTSELPARAMS); | |
1188 } | |
OLD | NEW |