2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
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
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.
22 Created 10/9/2000 by Doug Mitchell.
25 #ifndef _CERT_GROUP_UTILS_H
26 #define _CERT_GROUP_UTILS_H
28 #include <Security/x509defs.h>
29 #include <Security/cssmalloc.h>
30 #include "TPCertInfo.h"
32 * Cheetah version of TP doesn't work with DLs.
34 #define TP_DL_ENABLE 1
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)
49 CSSM_DATA_PTR
tpMallocCopyCssmData(
51 const CSSM_DATA
*src
);
55 CSSM_BOOL freeStruct
);
56 CSSM_BOOL
tpCompareCssmData(
57 const CSSM_DATA
*data1
,
58 const CSSM_DATA
*data2
);
59 CSSM_BOOL
tpCompareOids(
61 const CSSM_OID
*oid2
);
63 CSSM_DATA_PTR
tp_CertGetPublicKey(
65 CSSM_DATA_PTR
*valueToFree
); // used in tp_CertFreePublicKey
66 void tp_CertFreePublicKey(
67 CSSM_CL_HANDLE clHand
,
70 CSSM_X509_ALGORITHM_IDENTIFIER_PTR
tp_CertGetAlgId(
72 CSSM_DATA_PTR
*valueToFree
); // used in tp_CertFreeAlgId
73 void tp_CertFreeAlgId(
74 CSSM_CL_HANDLE clHand
,
78 TPCertInfo
*tpFindIssuer(
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
88 #endif /* TP_DL_ENABLE*/
90 CSSM_BOOL
tpIsSameName(
91 const CSSM_DATA
*pName1
,
92 const CSSM_DATA
*pName2
);
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
);
102 CSSM_BOOL
tp_CompareCerts(
103 const CSSM_DATA
*cert1
,
104 const CSSM_DATA
*cert2
);
107 * Given an OID, return the corresponding CSSM_ALGID.
109 CSSM_ALGORITHMS
tpOidToAldId(
111 CSSM_ALGORITHMS
*keyAlg
); // RETURNED
117 CSSM_BOOL
tpCompareHostNames(
118 const char *hostName
, // spec'd by app, tpToLower'd
120 char *serverName
, // from cert, we tpToLower
121 uint32 serverNameLen
);
128 #endif /* _CERT_GROUP_UTILS_H */