]>
Commit | Line | Data |
---|---|---|
bac41a7b A |
1 | /* |
2 | * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved. | |
3 | * | |
4 | * The contents of this file constitute Original Code as defined in and are | |
5 | * subject to the Apple Public Source License Version 1.2 (the 'License'). | |
6 | * You may not use this file except in compliance with the License. Please obtain | |
7 | * a copy of the License at http://www.apple.com/publicsource and read it before | |
8 | * using this file. | |
9 | * | |
10 | * This Original Code and all software distributed under the License are | |
11 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS | |
12 | * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT | |
13 | * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | |
14 | * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the | |
15 | * specific language governing rights and limitations under the License. | |
16 | */ | |
17 | ||
18 | ||
19 | /* | |
20 | certGroupUtils.h | |
21 | ||
22 | Created 10/9/2000 by Doug Mitchell. | |
23 | */ | |
24 | ||
25 | #ifndef _CERT_GROUP_UTILS_H | |
26 | #define _CERT_GROUP_UTILS_H | |
27 | ||
28 | #include <Security/x509defs.h> | |
29 | #include <Security/cssmalloc.h> | |
30 | #include "TPCertInfo.h" | |
31 | /* | |
32 | * Cheetah version of TP doesn't work with DLs. | |
33 | */ | |
29654253 | 34 | #define TP_DL_ENABLE 1 |
bac41a7b A |
35 | |
36 | #ifdef __cplusplus | |
37 | extern "C" { | |
38 | #endif | |
39 | ||
40 | /* quick & dirty port from OS9 to OS X... */ | |
41 | #define tpFree(alloc, ptr) (alloc).free(ptr) | |
42 | #define tpMalloc(alloc, size) (alloc).malloc(size) | |
43 | #define tpCalloc(alloc, num, size) (alloc).calloc(num, size) | |
44 | ||
45 | void tpCopyCssmData( | |
46 | CssmAllocator &alloc, | |
47 | const CSSM_DATA *src, | |
48 | CSSM_DATA_PTR dst); | |
49 | CSSM_DATA_PTR tpMallocCopyCssmData( | |
50 | CssmAllocator &alloc, | |
51 | const CSSM_DATA *src); | |
52 | void tpFreeCssmData( | |
53 | CssmAllocator &alloc, | |
54 | CSSM_DATA_PTR data, | |
55 | CSSM_BOOL freeStruct); | |
56 | CSSM_BOOL tpCompareCssmData( | |
57 | const CSSM_DATA *data1, | |
58 | const CSSM_DATA *data2); | |
59 | CSSM_BOOL tpCompareOids( | |
60 | const CSSM_OID *oid1, | |
61 | const CSSM_OID *oid2); | |
62 | ||
63 | CSSM_DATA_PTR tp_CertGetPublicKey( | |
64 | TPCertInfo *cert, | |
65 | CSSM_DATA_PTR *valueToFree); // used in tp_CertFreePublicKey | |
66 | void tp_CertFreePublicKey( | |
67 | CSSM_CL_HANDLE clHand, | |
68 | CSSM_DATA_PTR value); | |
69 | ||
70 | CSSM_X509_ALGORITHM_IDENTIFIER_PTR tp_CertGetAlgId( | |
71 | TPCertInfo *cert, | |
72 | CSSM_DATA_PTR *valueToFree); // used in tp_CertFreeAlgId | |
73 | void tp_CertFreeAlgId( | |
74 | CSSM_CL_HANDLE clHand, | |
75 | CSSM_DATA_PTR value); | |
76 | ||
77 | #if TP_DL_ENABLE | |
29654253 A |
78 | TPCertInfo *tpFindIssuer( |
79 | CssmAllocator &alloc, | |
80 | CSSM_CL_HANDLE clHand, | |
81 | CSSM_CSP_HANDLE cspHand, | |
82 | TPCertInfo *subjectCert, | |
83 | const CSSM_DATA *issuerName, // passed for convenience | |
84 | const CSSM_DL_DB_LIST *dbList, | |
85 | const char *cssmTimeStr, // may be NULL | |
86 | CSSM_RETURN *issuerExpired); // RETURNED | |
bac41a7b A |
87 | |
88 | #endif /* TP_DL_ENABLE*/ | |
89 | ||
90 | CSSM_BOOL tpIsSameName( | |
91 | const CSSM_DATA *pName1, | |
92 | const CSSM_DATA *pName2); | |
93 | ||
94 | CSSM_RETURN tp_VerifyCert( | |
95 | CSSM_CL_HANDLE clHand, | |
96 | CSSM_CSP_HANDLE cspHand, | |
97 | TPCertInfo *subjectCert, | |
98 | TPCertInfo *issuerCert, | |
99 | CSSM_BOOL checkIssuerCurrent, | |
100 | CSSM_BOOL allowExpired); | |
101 | ||
102 | CSSM_BOOL tp_CompareCerts( | |
103 | const CSSM_DATA *cert1, | |
104 | const CSSM_DATA *cert2); | |
105 | ||
bac41a7b A |
106 | /* |
107 | * Given an OID, return the corresponding CSSM_ALGID. | |
108 | */ | |
109 | CSSM_ALGORITHMS tpOidToAldId( | |
110 | const CSSM_OID *oid, | |
111 | CSSM_ALGORITHMS *keyAlg); // RETURNED | |
112 | ||
5a719ac8 A |
113 | void tpToLower( |
114 | char *str, | |
115 | unsigned strLen); | |
116 | ||
117 | CSSM_BOOL tpCompareHostNames( | |
118 | const char *hostName, // spec'd by app, tpToLower'd | |
119 | uint32 hostNameLen, | |
120 | char *serverName, // from cert, we tpToLower | |
121 | uint32 serverNameLen); | |
122 | ||
123 | ||
bac41a7b A |
124 | #ifdef __cplusplus |
125 | } | |
126 | #endif | |
127 | ||
128 | #endif /* _CERT_GROUP_UTILS_H */ |