2 * Copyright (c) 2000-2001,2011,2014 Apple 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.
23 #ifndef _CERT_GROUP_UTILS_H
24 #define _CERT_GROUP_UTILS_H
26 #include <Security/x509defs.h>
27 #include <security_utilities/alloc.h>
28 #include "TPCertInfo.h"
34 /* quick & dirty port from OS9 to OS X... */
35 #define tpFree(alloc, ptr) (alloc).free(ptr)
36 #define tpMalloc(alloc, size) (alloc).malloc(size)
37 #define tpCalloc(alloc, num, size) (alloc).calloc(num, size)
43 CSSM_DATA_PTR
tpMallocCopyCssmData(
45 const CSSM_DATA
*src
);
49 CSSM_BOOL freeStruct
);
50 CSSM_BOOL
tpCompareCssmData(
51 const CSSM_DATA
*data1
,
52 const CSSM_DATA
*data2
);
55 * This should break if/when CSSM_OID is not the same as
56 * CSSM_DATA, which is exactly what we want.
58 #define tpCompareOids(oid1, oid2) tpCompareCssmData(oid1, oid2)
60 void tpFreePluginMemory(
64 CSSM_DATA_PTR
tp_CertGetPublicKey(
66 CSSM_DATA_PTR
*valueToFree
); // used in tp_CertFreePublicKey
67 void tp_CertFreePublicKey(
68 CSSM_CL_HANDLE clHand
,
71 CSSM_X509_ALGORITHM_IDENTIFIER_PTR
tp_CertGetAlgId(
73 CSSM_DATA_PTR
*valueToFree
); // used in tp_CertFreeAlgId
74 void tp_CertFreeAlgId(
75 CSSM_CL_HANDLE clHand
,
78 CSSM_BOOL
tp_CompareCerts(
79 const CSSM_DATA
*cert1
,
80 const CSSM_DATA
*cert2
);
86 void tpNormalizeAddrSpec(
91 CSSM_BOOL
tpCompareHostNames(
92 const char *hostName
, // spec'd by app, tpToLower'd
94 char *certName
, // from cert, we tpToLower
97 CSSM_BOOL
tpCompareEmailAddr(
98 const char *appEmail
, // spec'd by app, tpToLower'd
100 char *certEmail
, // from cert, we tpToLower
102 bool normalizeAll
); // true : lower-case all certEmail characters
104 CSSM_BOOL
tpCompareDomainSuffix(
105 const char *hostName
, // spec'd by app, tpToLower'd
107 char *domainName
, // we tpToLower
108 uint32 domainNameLen
);
110 int decodeECDSA_SigAlgParams(
111 const CSSM_DATA
*params
,
112 CSSM_ALGORITHMS
*cssmAlg
); /* RETURNED */
118 #endif /* _CERT_GROUP_UTILS_H */