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_utilities/alloc.h>
30 #include "TPCertInfo.h"
36 /* quick & dirty port from OS9 to OS X... */
37 #define tpFree(alloc, ptr) (alloc).free(ptr)
38 #define tpMalloc(alloc, size) (alloc).malloc(size)
39 #define tpCalloc(alloc, num, size) (alloc).calloc(num, size)
45 CSSM_DATA_PTR
tpMallocCopyCssmData(
47 const CSSM_DATA
*src
);
51 CSSM_BOOL freeStruct
);
52 CSSM_BOOL
tpCompareCssmData(
53 const CSSM_DATA
*data1
,
54 const CSSM_DATA
*data2
);
57 * This should break if/when CSSM_OID is not the same as
58 * CSSM_DATA, which is exactly what we want.
60 #define tpCompareOids(oid1, oid2) tpCompareCssmData(oid1, oid2)
62 void tpFreePluginMemory(
66 CSSM_DATA_PTR
tp_CertGetPublicKey(
68 CSSM_DATA_PTR
*valueToFree
); // used in tp_CertFreePublicKey
69 void tp_CertFreePublicKey(
70 CSSM_CL_HANDLE clHand
,
73 CSSM_X509_ALGORITHM_IDENTIFIER_PTR
tp_CertGetAlgId(
75 CSSM_DATA_PTR
*valueToFree
); // used in tp_CertFreeAlgId
76 void tp_CertFreeAlgId(
77 CSSM_CL_HANDLE clHand
,
80 CSSM_BOOL
tp_CompareCerts(
81 const CSSM_DATA
*cert1
,
82 const CSSM_DATA
*cert2
);
88 void tpNormalizeAddrSpec(
93 CSSM_BOOL
tpCompareHostNames(
94 const char *hostName
, // spec'd by app, tpToLower'd
96 char *certName
, // from cert, we tpToLower
99 CSSM_BOOL
tpCompareEmailAddr(
100 const char *appEmail
, // spec'd by app, tpToLower'd
102 char *certEmail
, // from cert, we tpToLower
104 bool normalizeAll
); // true : lower-case all certEmail characters
106 int decodeECDSA_SigAlgParams(
107 const CSSM_DATA
*params
,
108 CSSM_ALGORITHMS
*cssmAlg
); /* RETURNED */
114 #endif /* _CERT_GROUP_UTILS_H */