]> git.saurik.com Git - apple/security.git/blob - SecurityTests/clxutils/threadTest/copyRoots.cpp
Security-57031.10.10.tar.gz
[apple/security.git] / SecurityTests / clxutils / threadTest / copyRoots.cpp
1 /*
2 * DER decode test
3 */
4 #include "testParams.h"
5 #include <stdlib.h>
6 #include <stdio.h>
7 #include <time.h>
8 #include <string.h>
9 #include <utilLib/common.h>
10 #include <utilLib/cspwrap.h>
11 #include <Security/Security.h>
12 #include <Security/SecTrustSettingsPriv.h>
13 #include <stddef.h>
14 #include <unistd.h>
15
16 int copyRootsInit(
17 TestParams *testParams)
18 {
19 /* nothing for now */
20 return 0;
21 }
22
23 int copyRootsTest(TestParams *testParams)
24 {
25 for(unsigned loop=0; loop<testParams->numLoops; loop++) {
26 if(testParams->verbose) {
27 printf("derDecode thread %d: loop %d\n",
28 testParams->threadNum, loop);
29 }
30 else if(!testParams->quiet) {
31 printChar(testParams->progressChar);
32 }
33
34 CFArrayRef theArray = NULL;
35 OSStatus ortn = SecTrustSettingsCopyQualifiedCerts(&CSSMOID_APPLE_TP_SSL,
36 "localhost", 10, // policyString
37 CSSM_KEYUSE_ENCRYPT, // wrong key use type but that's what ST passes
38 &theArray);
39 if(ortn) {
40 cssmPerror("SecTrustSettingsCopyQualifiedCerts", ortn);
41 return 1;
42 }
43 CFRelease(theArray);
44 }
45 return 0;
46 }