]>
git.saurik.com Git - apple/security.git/blob - SecurityTests/clxutils/threadTest/trustSettings.cpp
2 * trustSettings.cpp - multi threaded TP evaluate with Trust Settings enabled
4 #include "testParams.h"
5 #include <Security/cssm.h>
6 #include <utilLib/common.h>
7 #include <utilLib/cspwrap.h>
8 #include <clAppUtils/BlobList.h>
9 #include <clAppUtils/certVerify.h>
10 #include <security_cdsa_utils/cuFileIo.h>
15 #include <Security/Security.h>
17 #define HOLD_SEARCH_LIST 0
19 /* for malloc debug */
22 static const char *CERT_FILE0
= "amazon_v3.100.cer";
23 static const char *CERT_FILE1
= "amazon_v3.101.cer";
25 /* common data, our known good cert, shared by all threads */
26 static BlobList blobList
;
27 static BlobList emptyRootList
;
29 /* read in our known good cert file, just once */
30 int trustSettingsInit(TestParams
*testParams
)
32 if(testParams
->verbose
) {
33 printf("trustSettingsInit thread %d: reading cert files %s and %s...\n",
34 testParams
->threadNum
, CERT_FILE0
, CERT_FILE1
);
36 if(blobList
.addFile(CERT_FILE0
)) {
37 printf("Error reading %s; aborting\n", CERT_FILE0
);
38 printf("***This test must be run from the clxutils/threadTest directory.\n");
41 if(blobList
.addFile(CERT_FILE1
)) {
42 printf("Error reading %s; aborting\n", CERT_FILE1
);
43 printf("***This test must be run from the clxutils/threadTest directory.\n");
50 int trustSettingsEval(TestParams
*testParams
)
56 ortn
= SecKeychainCopySearchList(&sl
);
58 cssmPerror("SecPolicySearchCreate", ortn
);
63 for(loopNum
=0; loopNum
<testParams
->numLoops
; loopNum
++) {
64 if(testParams
->verbose
) {
65 printf("trustSettingsEval loop %d\n", loopNum
);
67 else if(!testParams
->quiet
) {
68 printChar(testParams
->progressChar
);
70 int rtn
= certVerifySimple(testParams
->tpHand
,
75 CSSM_TRUE
, /* useSystemAnchors */
76 CSSM_FALSE
, /* leafCertIsCA */
79 NULL
, CSSM_FALSE
, NULL
,
81 NULL
, /* expectedErrStr */
82 0, NULL
, /* certErrors */
83 0, NULL
, /* certStatus */
84 CSSM_TRUE
, /* TrustSettings */
85 CSSM_TRUE
, CSSM_FALSE
);
87 printf("Cert Eval failed\n");
93 printf("Hit CR to continue: ");