|
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 |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 /* |
|
5 * testutil_nss.c |
|
6 * |
|
7 * NSS-specific utility functions for handling test errors |
|
8 * |
|
9 */ |
|
10 |
|
11 #include <stdio.h> |
|
12 #include <string.h> |
|
13 #include <stddef.h> |
|
14 |
|
15 #include "pkix_pl_generalname.h" |
|
16 #include "pkix_pl_cert.h" |
|
17 #include "pkix.h" |
|
18 #include "testutil.h" |
|
19 #include "prlong.h" |
|
20 #include "plstr.h" |
|
21 #include "prthread.h" |
|
22 #include "secutil.h" |
|
23 #include "nspr.h" |
|
24 #include "prtypes.h" |
|
25 #include "prtime.h" |
|
26 #include "pk11func.h" |
|
27 #include "secasn1.h" |
|
28 #include "cert.h" |
|
29 #include "cryptohi.h" |
|
30 #include "secoid.h" |
|
31 #include "certdb.h" |
|
32 #include "secitem.h" |
|
33 #include "keythi.h" |
|
34 #include "nss.h" |
|
35 |
|
36 static char *catDirName(char *dir, char *name, void *plContext) |
|
37 { |
|
38 char *pathName = NULL; |
|
39 PKIX_UInt32 nameLen; |
|
40 PKIX_UInt32 dirLen; |
|
41 |
|
42 PKIX_TEST_STD_VARS(); |
|
43 |
|
44 nameLen = PL_strlen(name); |
|
45 dirLen = PL_strlen(dir); |
|
46 |
|
47 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Malloc |
|
48 (dirLen + nameLen + 2, |
|
49 (void **)&pathName, |
|
50 plContext)); |
|
51 |
|
52 PL_strcpy(pathName, dir); |
|
53 PL_strcat(pathName, "/"); |
|
54 PL_strcat(pathName, name); |
|
55 printf("pathName = %s\n", pathName); |
|
56 |
|
57 cleanup: |
|
58 |
|
59 PKIX_TEST_RETURN(); |
|
60 |
|
61 return (pathName); |
|
62 } |
|
63 |
|
64 PKIX_PL_Cert * |
|
65 createCert( |
|
66 char *dirName, |
|
67 char *certFileName, |
|
68 void *plContext) |
|
69 { |
|
70 PKIX_PL_ByteArray *byteArray = NULL; |
|
71 void *buf = NULL; |
|
72 PRFileDesc *certFile = NULL; |
|
73 PKIX_UInt32 len; |
|
74 SECItem certDER; |
|
75 SECStatus rv; |
|
76 /* default: NULL cert (failure case) */ |
|
77 PKIX_PL_Cert *cert = NULL; |
|
78 char *pathName = NULL; |
|
79 |
|
80 PKIX_TEST_STD_VARS(); |
|
81 |
|
82 |
|
83 certDER.data = NULL; |
|
84 |
|
85 pathName = catDirName(dirName, certFileName, plContext); |
|
86 certFile = PR_Open(pathName, PR_RDONLY, 0); |
|
87 |
|
88 if (!certFile){ |
|
89 pkixTestErrorMsg = "Unable to open cert file"; |
|
90 goto cleanup; |
|
91 } else { |
|
92 rv = SECU_ReadDERFromFile(&certDER, certFile, PR_FALSE, PR_FALSE); |
|
93 if (!rv){ |
|
94 buf = (void *)certDER.data; |
|
95 len = certDER.len; |
|
96 |
|
97 PKIX_TEST_EXPECT_NO_ERROR |
|
98 (PKIX_PL_ByteArray_Create |
|
99 (buf, len, &byteArray, plContext)); |
|
100 |
|
101 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Cert_Create |
|
102 (byteArray, &cert, plContext)); |
|
103 |
|
104 SECITEM_FreeItem(&certDER, PR_FALSE); |
|
105 } else { |
|
106 pkixTestErrorMsg = "Unable to read DER from cert file"; |
|
107 goto cleanup; |
|
108 } |
|
109 } |
|
110 |
|
111 cleanup: |
|
112 |
|
113 pkixTestErrorResult = PKIX_PL_Free(pathName, plContext); |
|
114 |
|
115 if (certFile){ |
|
116 PR_Close(certFile); |
|
117 } |
|
118 |
|
119 if (PKIX_TEST_ERROR_RECEIVED){ |
|
120 SECITEM_FreeItem(&certDER, PR_FALSE); |
|
121 } |
|
122 |
|
123 PKIX_TEST_DECREF_AC(byteArray); |
|
124 |
|
125 PKIX_TEST_RETURN(); |
|
126 |
|
127 return (cert); |
|
128 } |
|
129 |
|
130 PKIX_PL_CRL * |
|
131 createCRL( |
|
132 char *dirName, |
|
133 char *crlFileName, |
|
134 void *plContext) |
|
135 { |
|
136 PKIX_PL_ByteArray *byteArray = NULL; |
|
137 PKIX_PL_CRL *crl = NULL; |
|
138 PKIX_Error *error = NULL; |
|
139 PRFileDesc *inFile = NULL; |
|
140 SECItem crlDER; |
|
141 void *buf = NULL; |
|
142 PKIX_UInt32 len; |
|
143 SECStatus rv; |
|
144 char *pathName = NULL; |
|
145 |
|
146 PKIX_TEST_STD_VARS(); |
|
147 |
|
148 crlDER.data = NULL; |
|
149 |
|
150 pathName = catDirName(dirName, crlFileName, plContext); |
|
151 inFile = PR_Open(pathName, PR_RDONLY, 0); |
|
152 |
|
153 if (!inFile){ |
|
154 pkixTestErrorMsg = "Unable to open crl file"; |
|
155 goto cleanup; |
|
156 } else { |
|
157 rv = SECU_ReadDERFromFile(&crlDER, inFile, PR_FALSE, PR_FALSE); |
|
158 if (!rv){ |
|
159 buf = (void *)crlDER.data; |
|
160 len = crlDER.len; |
|
161 |
|
162 error = PKIX_PL_ByteArray_Create |
|
163 (buf, len, &byteArray, plContext); |
|
164 |
|
165 if (error){ |
|
166 pkixTestErrorMsg = |
|
167 "PKIX_PL_ByteArray_Create failed"; |
|
168 goto cleanup; |
|
169 } |
|
170 |
|
171 error = PKIX_PL_CRL_Create(byteArray, &crl, plContext); |
|
172 if (error){ |
|
173 pkixTestErrorMsg = "PKIX_PL_Crl_Create failed"; |
|
174 goto cleanup; |
|
175 } |
|
176 |
|
177 SECITEM_FreeItem(&crlDER, PR_FALSE); |
|
178 } else { |
|
179 pkixTestErrorMsg = "Unable to read DER from crl file"; |
|
180 goto cleanup; |
|
181 } |
|
182 } |
|
183 |
|
184 cleanup: |
|
185 |
|
186 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Free(pathName, plContext)); |
|
187 |
|
188 if (inFile){ |
|
189 PR_Close(inFile); |
|
190 } |
|
191 |
|
192 if (error){ |
|
193 SECITEM_FreeItem(&crlDER, PR_FALSE); |
|
194 } |
|
195 |
|
196 PKIX_TEST_DECREF_AC(byteArray); |
|
197 |
|
198 PKIX_TEST_RETURN(); |
|
199 |
|
200 return (crl); |
|
201 |
|
202 } |
|
203 |
|
204 PKIX_TrustAnchor * |
|
205 createTrustAnchor( |
|
206 char *dirName, |
|
207 char *certFileName, |
|
208 PKIX_Boolean useCert, |
|
209 void *plContext) |
|
210 { |
|
211 PKIX_TrustAnchor *anchor = NULL; |
|
212 PKIX_PL_Cert *cert = NULL; |
|
213 PKIX_PL_X500Name *name = NULL; |
|
214 PKIX_PL_PublicKey *pubKey = NULL; |
|
215 PKIX_PL_CertNameConstraints *nameConstraints = NULL; |
|
216 |
|
217 PKIX_TEST_STD_VARS(); |
|
218 |
|
219 cert = createCert(dirName, certFileName, plContext); |
|
220 |
|
221 if (useCert){ |
|
222 PKIX_TEST_EXPECT_NO_ERROR(PKIX_TrustAnchor_CreateWithCert |
|
223 (cert, &anchor, plContext)); |
|
224 } else { |
|
225 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Cert_GetSubject |
|
226 (cert, &name, plContext)); |
|
227 |
|
228 if (name == NULL){ |
|
229 goto cleanup; |
|
230 } |
|
231 |
|
232 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Cert_GetSubjectPublicKey |
|
233 (cert, &pubKey, plContext)); |
|
234 |
|
235 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Cert_GetNameConstraints |
|
236 (cert, &nameConstraints, NULL)); |
|
237 |
|
238 PKIX_TEST_EXPECT_NO_ERROR |
|
239 (PKIX_TrustAnchor_CreateWithNameKeyPair |
|
240 (name, pubKey, nameConstraints, &anchor, plContext)); |
|
241 } |
|
242 |
|
243 cleanup: |
|
244 |
|
245 if (PKIX_TEST_ERROR_RECEIVED){ |
|
246 PKIX_TEST_DECREF_AC(anchor); |
|
247 } |
|
248 |
|
249 PKIX_TEST_DECREF_AC(cert); |
|
250 PKIX_TEST_DECREF_AC(name); |
|
251 PKIX_TEST_DECREF_AC(pubKey); |
|
252 PKIX_TEST_DECREF_AC(nameConstraints); |
|
253 |
|
254 PKIX_TEST_RETURN(); |
|
255 |
|
256 return (anchor); |
|
257 } |
|
258 |
|
259 PKIX_List * |
|
260 createCertChain( |
|
261 char *dirName, |
|
262 char *firstCertFileName, |
|
263 char *secondCertFileName, |
|
264 void *plContext) |
|
265 { |
|
266 PKIX_PL_Cert *firstCert = NULL; |
|
267 PKIX_PL_Cert *secondCert = NULL; |
|
268 PKIX_List *certList = NULL; |
|
269 |
|
270 PKIX_TEST_STD_VARS(); |
|
271 |
|
272 PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_Create(&certList, plContext)); |
|
273 |
|
274 firstCert = createCert(dirName, firstCertFileName, plContext); |
|
275 |
|
276 PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_AppendItem |
|
277 (certList, (PKIX_PL_Object *)firstCert, plContext)); |
|
278 |
|
279 if (secondCertFileName){ |
|
280 secondCert = createCert(dirName, secondCertFileName, plContext); |
|
281 |
|
282 PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_AppendItem |
|
283 (certList, (PKIX_PL_Object *)secondCert, plContext)); |
|
284 } |
|
285 |
|
286 PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_SetImmutable |
|
287 (certList, plContext)); |
|
288 |
|
289 cleanup: |
|
290 |
|
291 if (PKIX_TEST_ERROR_RECEIVED){ |
|
292 PKIX_TEST_DECREF_AC(certList); |
|
293 } |
|
294 |
|
295 PKIX_TEST_DECREF_AC(firstCert); |
|
296 PKIX_TEST_DECREF_AC(secondCert); |
|
297 |
|
298 PKIX_TEST_RETURN(); |
|
299 |
|
300 return (certList); |
|
301 } |
|
302 |
|
303 PKIX_List * |
|
304 createCertChainPlus( |
|
305 char *dirName, |
|
306 char *certNames[], |
|
307 PKIX_PL_Cert *certs[], |
|
308 PKIX_UInt32 numCerts, |
|
309 void *plContext) |
|
310 { |
|
311 PKIX_List *certList = NULL; |
|
312 PKIX_UInt32 i; |
|
313 |
|
314 PKIX_TEST_STD_VARS(); |
|
315 |
|
316 PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_Create(&certList, plContext)); |
|
317 |
|
318 for (i = 0; i < numCerts; i++) { |
|
319 |
|
320 certs[i] = createCert(dirName, certNames[i], plContext); |
|
321 |
|
322 /* Create Cert may fail */ |
|
323 if (certs[i] == NULL) { |
|
324 PKIX_TEST_DECREF_BC(certList); |
|
325 goto cleanup; |
|
326 } |
|
327 |
|
328 PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_AppendItem |
|
329 (certList, |
|
330 (PKIX_PL_Object *)certs[i], |
|
331 plContext)); |
|
332 } |
|
333 |
|
334 PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_SetImmutable |
|
335 (certList, plContext)); |
|
336 |
|
337 cleanup: |
|
338 |
|
339 if (PKIX_TEST_ERROR_RECEIVED){ |
|
340 PKIX_TEST_DECREF_AC(certList); |
|
341 } |
|
342 |
|
343 for (i = 0; i < numCerts; i++) { |
|
344 PKIX_TEST_DECREF_AC(certs[i]); |
|
345 } |
|
346 |
|
347 PKIX_TEST_RETURN(); |
|
348 |
|
349 return (certList); |
|
350 |
|
351 } |
|
352 |
|
353 PKIX_PL_Date * |
|
354 createDate( |
|
355 char *asciiDate, |
|
356 void *plContext) |
|
357 { |
|
358 PKIX_PL_Date *date = NULL; |
|
359 PKIX_PL_String *plString = NULL; |
|
360 |
|
361 PKIX_TEST_STD_VARS(); |
|
362 |
|
363 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_String_Create |
|
364 (PKIX_ESCASCII, asciiDate, 0, &plString, plContext)); |
|
365 |
|
366 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Date_Create_UTCTime |
|
367 (plString, &date, plContext)); |
|
368 |
|
369 cleanup: |
|
370 |
|
371 PKIX_TEST_DECREF_AC(plString); |
|
372 |
|
373 PKIX_TEST_RETURN(); |
|
374 |
|
375 return (date); |
|
376 } |
|
377 |
|
378 PKIX_ProcessingParams * |
|
379 createProcessingParams( |
|
380 char *dirName, |
|
381 char *firstAnchorFileName, |
|
382 char *secondAnchorFileName, |
|
383 char *dateAscii, |
|
384 PKIX_List *initialPolicies, /* List of PKIX_PL_OID */ |
|
385 PKIX_Boolean isCrlEnabled, |
|
386 void *plContext) |
|
387 { |
|
388 |
|
389 PKIX_TrustAnchor *firstAnchor = NULL; |
|
390 PKIX_TrustAnchor *secondAnchor = NULL; |
|
391 PKIX_List *anchorsList = NULL; |
|
392 PKIX_ProcessingParams *procParams = NULL; |
|
393 PKIX_PL_String *dateString = NULL; |
|
394 PKIX_PL_Date *testDate = NULL; |
|
395 |
|
396 PKIX_TEST_STD_VARS(); |
|
397 |
|
398 PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_Create(&anchorsList, plContext)); |
|
399 |
|
400 firstAnchor = createTrustAnchor |
|
401 (dirName, firstAnchorFileName, PKIX_FALSE, plContext); |
|
402 |
|
403 PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_AppendItem |
|
404 (anchorsList, |
|
405 (PKIX_PL_Object *)firstAnchor, |
|
406 plContext)); |
|
407 |
|
408 if (secondAnchorFileName){ |
|
409 secondAnchor = |
|
410 createTrustAnchor |
|
411 (dirName, secondAnchorFileName, PKIX_FALSE, plContext); |
|
412 |
|
413 PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_AppendItem |
|
414 (anchorsList, |
|
415 (PKIX_PL_Object *)secondAnchor, |
|
416 plContext)); |
|
417 } |
|
418 |
|
419 PKIX_TEST_EXPECT_NO_ERROR(PKIX_ProcessingParams_Create |
|
420 (anchorsList, &procParams, plContext)); |
|
421 |
|
422 if (dateAscii){ |
|
423 PKIX_TEST_EXPECT_NO_ERROR |
|
424 (PKIX_PL_String_Create |
|
425 (PKIX_ESCASCII, |
|
426 dateAscii, |
|
427 0, |
|
428 &dateString, |
|
429 plContext)); |
|
430 |
|
431 PKIX_TEST_EXPECT_NO_ERROR |
|
432 (PKIX_PL_Date_Create_UTCTime |
|
433 (dateString, &testDate, plContext)); |
|
434 |
|
435 PKIX_TEST_EXPECT_NO_ERROR |
|
436 (PKIX_ProcessingParams_SetDate |
|
437 (procParams, testDate, plContext)); |
|
438 } |
|
439 |
|
440 PKIX_TEST_EXPECT_NO_ERROR(PKIX_ProcessingParams_SetInitialPolicies |
|
441 (procParams, initialPolicies, plContext)); |
|
442 |
|
443 PKIX_TEST_EXPECT_NO_ERROR(PKIX_ProcessingParams_SetRevocationEnabled |
|
444 (procParams, isCrlEnabled, plContext)); |
|
445 |
|
446 cleanup: |
|
447 |
|
448 if (PKIX_TEST_ERROR_RECEIVED){ |
|
449 PKIX_TEST_DECREF_AC(procParams); |
|
450 } |
|
451 |
|
452 PKIX_TEST_DECREF_AC(dateString); |
|
453 PKIX_TEST_DECREF_AC(testDate); |
|
454 PKIX_TEST_DECREF_AC(anchorsList); |
|
455 PKIX_TEST_DECREF_AC(firstAnchor); |
|
456 PKIX_TEST_DECREF_AC(secondAnchor); |
|
457 |
|
458 PKIX_TEST_RETURN(); |
|
459 |
|
460 return (procParams); |
|
461 } |
|
462 |
|
463 PKIX_ValidateParams * |
|
464 createValidateParams( |
|
465 char *dirName, |
|
466 char *firstAnchorFileName, |
|
467 char *secondAnchorFileName, |
|
468 char *dateAscii, |
|
469 PKIX_List *initialPolicies, /* List of PKIX_PL_OID */ |
|
470 PKIX_Boolean initialPolicyMappingInhibit, |
|
471 PKIX_Boolean initialAnyPolicyInhibit, |
|
472 PKIX_Boolean initialExplicitPolicy, |
|
473 PKIX_Boolean isCrlEnabled, |
|
474 PKIX_List *chain, |
|
475 void *plContext) |
|
476 { |
|
477 |
|
478 PKIX_ProcessingParams *procParams = NULL; |
|
479 PKIX_ValidateParams *valParams = NULL; |
|
480 |
|
481 PKIX_TEST_STD_VARS(); |
|
482 |
|
483 procParams = |
|
484 createProcessingParams |
|
485 (dirName, |
|
486 firstAnchorFileName, |
|
487 secondAnchorFileName, |
|
488 dateAscii, |
|
489 NULL, |
|
490 isCrlEnabled, |
|
491 plContext); |
|
492 |
|
493 PKIX_TEST_EXPECT_NO_ERROR(PKIX_ProcessingParams_SetInitialPolicies |
|
494 (procParams, initialPolicies, plContext)); |
|
495 |
|
496 PKIX_TEST_EXPECT_NO_ERROR |
|
497 (PKIX_ProcessingParams_SetPolicyMappingInhibited |
|
498 (procParams, initialPolicyMappingInhibit, NULL)); |
|
499 |
|
500 PKIX_TEST_EXPECT_NO_ERROR(PKIX_ProcessingParams_SetAnyPolicyInhibited |
|
501 (procParams, initialAnyPolicyInhibit, NULL)); |
|
502 |
|
503 PKIX_TEST_EXPECT_NO_ERROR |
|
504 (PKIX_ProcessingParams_SetExplicitPolicyRequired |
|
505 (procParams, initialExplicitPolicy, NULL)); |
|
506 |
|
507 PKIX_TEST_EXPECT_NO_ERROR(PKIX_ValidateParams_Create |
|
508 (procParams, chain, &valParams, plContext)); |
|
509 |
|
510 cleanup: |
|
511 |
|
512 if (PKIX_TEST_ERROR_RECEIVED){ |
|
513 PKIX_TEST_DECREF_AC(valParams); |
|
514 } |
|
515 |
|
516 PKIX_TEST_DECREF_AC(procParams); |
|
517 |
|
518 PKIX_TEST_RETURN(); |
|
519 |
|
520 return (valParams); |
|
521 } |
|
522 |
|
523 PKIX_ValidateResult * |
|
524 createValidateResult( |
|
525 char *dirName, |
|
526 char *anchorFileName, |
|
527 char *pubKeyCertFileName, |
|
528 void *plContext) |
|
529 { |
|
530 |
|
531 PKIX_TrustAnchor *anchor = NULL; |
|
532 PKIX_ValidateResult *valResult = NULL; |
|
533 PKIX_PL_Cert *cert = NULL; |
|
534 PKIX_PL_PublicKey *pubKey = NULL; |
|
535 |
|
536 PKIX_TEST_STD_VARS(); |
|
537 |
|
538 anchor = createTrustAnchor |
|
539 (dirName, anchorFileName, PKIX_FALSE, plContext); |
|
540 cert = createCert(dirName, pubKeyCertFileName, plContext); |
|
541 |
|
542 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Cert_GetSubjectPublicKey |
|
543 (cert, &pubKey, plContext)); |
|
544 |
|
545 PKIX_TEST_EXPECT_NO_ERROR |
|
546 (pkix_ValidateResult_Create |
|
547 (pubKey, anchor, NULL, &valResult, plContext)); |
|
548 |
|
549 cleanup: |
|
550 |
|
551 if (PKIX_TEST_ERROR_RECEIVED){ |
|
552 PKIX_TEST_DECREF_AC(valResult); |
|
553 } |
|
554 |
|
555 PKIX_TEST_DECREF_AC(anchor); |
|
556 PKIX_TEST_DECREF_AC(cert); |
|
557 PKIX_TEST_DECREF_AC(pubKey); |
|
558 |
|
559 PKIX_TEST_RETURN(); |
|
560 |
|
561 return (valResult); |
|
562 } |
|
563 |
|
564 PKIX_PL_GeneralName * |
|
565 createGeneralName( |
|
566 PKIX_UInt32 nameType, |
|
567 char *asciiName, |
|
568 void *plContext) |
|
569 { |
|
570 |
|
571 PKIX_PL_GeneralName *generalName = NULL; |
|
572 PKIX_PL_String *plString = NULL; |
|
573 |
|
574 PKIX_TEST_STD_VARS(); |
|
575 |
|
576 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_String_Create |
|
577 (PKIX_ESCASCII, asciiName, 0, &plString, plContext)); |
|
578 |
|
579 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_GeneralName_Create |
|
580 (nameType, plString, &generalName, plContext)); |
|
581 |
|
582 cleanup: |
|
583 |
|
584 PKIX_TEST_DECREF_AC(plString); |
|
585 |
|
586 PKIX_TEST_RETURN(); |
|
587 |
|
588 return (generalName); |
|
589 } |
|
590 |
|
591 PKIX_BuildResult * |
|
592 createBuildResult( |
|
593 char *dirName, |
|
594 char *anchorFileName, |
|
595 char *pubKeyCertFileName, |
|
596 char *firstChainCertFileName, |
|
597 char *secondChainCertFileName, |
|
598 void *plContext) |
|
599 { |
|
600 PKIX_BuildResult *buildResult = NULL; |
|
601 PKIX_ValidateResult *valResult = NULL; |
|
602 PKIX_List *certChain = NULL; |
|
603 |
|
604 PKIX_TEST_STD_VARS(); |
|
605 |
|
606 valResult = createValidateResult |
|
607 (dirName, anchorFileName, pubKeyCertFileName, plContext); |
|
608 certChain = createCertChain |
|
609 (dirName, |
|
610 firstChainCertFileName, |
|
611 secondChainCertFileName, |
|
612 plContext); |
|
613 |
|
614 PKIX_TEST_EXPECT_NO_ERROR |
|
615 (pkix_BuildResult_Create |
|
616 (valResult, certChain, &buildResult, plContext)); |
|
617 |
|
618 cleanup: |
|
619 |
|
620 if (PKIX_TEST_ERROR_RECEIVED){ |
|
621 PKIX_TEST_DECREF_AC(buildResult); |
|
622 } |
|
623 |
|
624 PKIX_TEST_DECREF_AC(valResult); |
|
625 PKIX_TEST_DECREF_AC(certChain); |
|
626 |
|
627 PKIX_TEST_RETURN(); |
|
628 |
|
629 return (buildResult); |
|
630 } |