]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_apple_x509_tp/lib/certGroupUtils.h
Security-57337.40.85.tar.gz
[apple/security.git] / OSX / libsecurity_apple_x509_tp / lib / certGroupUtils.h
1 /*
2 * Copyright (c) 2000-2001,2011,2014 Apple 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
23 #ifndef _CERT_GROUP_UTILS_H
24 #define _CERT_GROUP_UTILS_H
25
26 #include <Security/x509defs.h>
27 #include <security_utilities/alloc.h>
28 #include "TPCertInfo.h"
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
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)
38
39 void tpCopyCssmData(
40 Allocator &alloc,
41 const CSSM_DATA *src,
42 CSSM_DATA_PTR dst);
43 CSSM_DATA_PTR tpMallocCopyCssmData(
44 Allocator &alloc,
45 const CSSM_DATA *src);
46 void tpFreeCssmData(
47 Allocator &alloc,
48 CSSM_DATA_PTR data,
49 CSSM_BOOL freeStruct);
50 CSSM_BOOL tpCompareCssmData(
51 const CSSM_DATA *data1,
52 const CSSM_DATA *data2);
53
54 /*
55 * This should break if/when CSSM_OID is not the same as
56 * CSSM_DATA, which is exactly what we want.
57 */
58 #define tpCompareOids(oid1, oid2) tpCompareCssmData(oid1, oid2)
59
60 void tpFreePluginMemory(
61 CSSM_HANDLE hand,
62 void *p);
63
64 CSSM_DATA_PTR tp_CertGetPublicKey(
65 TPCertInfo *cert,
66 CSSM_DATA_PTR *valueToFree); // used in tp_CertFreePublicKey
67 void tp_CertFreePublicKey(
68 CSSM_CL_HANDLE clHand,
69 CSSM_DATA_PTR value);
70
71 CSSM_X509_ALGORITHM_IDENTIFIER_PTR tp_CertGetAlgId(
72 TPCertInfo *cert,
73 CSSM_DATA_PTR *valueToFree); // used in tp_CertFreeAlgId
74 void tp_CertFreeAlgId(
75 CSSM_CL_HANDLE clHand,
76 CSSM_DATA_PTR value);
77
78 CSSM_BOOL tp_CompareCerts(
79 const CSSM_DATA *cert1,
80 const CSSM_DATA *cert2);
81
82 void tpToLower(
83 char *str,
84 unsigned strLen);
85
86 void tpNormalizeAddrSpec(
87 char *addr,
88 unsigned addrLen,
89 bool normalizeAll);
90
91 CSSM_BOOL tpCompareHostNames(
92 const char *hostName, // spec'd by app, tpToLower'd
93 uint32 hostNameLen,
94 char *certName, // from cert, we tpToLower
95 uint32 certNameLen);
96
97 CSSM_BOOL tpCompareEmailAddr(
98 const char *appEmail, // spec'd by app, tpToLower'd
99 uint32 appEmailLen,
100 char *certEmail, // from cert, we tpToLower
101 uint32 certEmailLen,
102 bool normalizeAll); // true : lower-case all certEmail characters
103
104 CSSM_BOOL tpCompareDomainSuffix(
105 const char *hostName, // spec'd by app, tpToLower'd
106 uint32 hostNameLen,
107 char *domainName, // we tpToLower
108 uint32 domainNameLen);
109
110 int decodeECDSA_SigAlgParams(
111 const CSSM_DATA *params,
112 CSSM_ALGORITHMS *cssmAlg); /* RETURNED */
113
114 #ifdef __cplusplus
115 }
116 #endif
117
118 #endif /* _CERT_GROUP_UTILS_H */