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 Contains: Embedded Integrity Services Library Interface
24 Copyright: (c) 1999-2000 Apple Computer, Inc., all rights reserved.
30 #include <Security/cssmconfig.h>
36 /* Data Types for Embedded Integrity Services Library */
38 typedef const void *ISL_ITERATOR_PTR
;
40 typedef const void *ISL_VERIFIED_SIGNATURE_ROOT_PTR
;
42 typedef const void *ISL_VERIFIED_CERTIFICATE_CHAIN_PTR
;
44 typedef const void *ISL_VERIFIED_CERTIFICATE_PTR
;
46 typedef const void *ISL_MANIFEST_SECTION_PTR
;
48 typedef const void *ISL_VERIFIED_MODULE_PTR
;
50 typedef void (*ISL_FUNCTION_PTR
)(void);
52 typedef struct isl_data
{
53 uint32 Length
; /* in bytes */
55 } ISL_DATA
, *ISL_DATA_PTR
;
57 typedef struct isl_const_data
{
58 uint32 Length
; /* in bytes */
60 } ISL_CONST_DATA
, *ISL_CONST_DATA_PTR
;
62 typedef enum isl_status
{
68 /* Embedded Integrity Services Library Functions */
70 ISL_VERIFIED_MODULE_PTR
73 ISL_VERIFIED_MODULE_PTR
74 EISL_VerifyAndLoadModuleAndCredentialData (const ISL_CONST_DATA CredentialsImage
,
75 const ISL_CONST_DATA ModuleSearchPath
,
76 const ISL_CONST_DATA Name
,
77 const ISL_CONST_DATA Signer
,
78 const ISL_CONST_DATA PublicKey
);
80 ISL_VERIFIED_MODULE_PTR
81 EISL_VerifyAndLoadModuleAndCredentialDataWithCertificate (const ISL_CONST_DATA CredentialsImage
,
82 const ISL_CONST_DATA ModuleSearchPath
,
83 const ISL_CONST_DATA Name
,
84 const ISL_CONST_DATA Signer
,
85 const ISL_CONST_DATA Certificate
);
87 ISL_VERIFIED_MODULE_PTR
88 EISL_VerifyAndLoadModuleAndCredentials (ISL_CONST_DATA Credentials
,
90 ISL_CONST_DATA Signer
,
91 ISL_CONST_DATA PublicKey
);
93 ISL_VERIFIED_MODULE_PTR
94 EISL_VerifyAndLoadModuleAndCredentialsWithCertificate (const ISL_CONST_DATA Credentials
,
95 const ISL_CONST_DATA Name
,
96 const ISL_CONST_DATA Signer
,
97 const ISL_CONST_DATA Certificate
);
99 ISL_VERIFIED_MODULE_PTR
100 EISL_VerifyLoadedModuleAndCredentialData (const ISL_CONST_DATA CredentialsImage
,
101 const ISL_CONST_DATA ModuleSearchPath
,
102 const ISL_CONST_DATA Name
,
103 const ISL_CONST_DATA Signer
,
104 const ISL_CONST_DATA PublicKey
);
106 ISL_VERIFIED_MODULE_PTR
107 EISL_VerifyLoadedModuleAndCredentialDataWithCertificate (const ISL_CONST_DATA CredentialsImage
,
108 const ISL_CONST_DATA ModuleSearchPath
,
109 const ISL_CONST_DATA Name
,
110 const ISL_CONST_DATA Signer
,
111 const ISL_CONST_DATA Certificate
);
113 ISL_VERIFIED_MODULE_PTR
114 EISL_VerifyLoadedModuleAndCredentials (ISL_CONST_DATA Credentials
,
116 ISL_CONST_DATA Signer
,
117 ISL_CONST_DATA PublicKey
);
119 ISL_VERIFIED_MODULE_PTR
120 EISL_VerifyLoadedModuleAndCredentialsWithCertificate (const ISL_CONST_DATA Credentials
,
121 const ISL_CONST_DATA Name
,
122 const ISL_CONST_DATA Signer
,
123 const ISL_CONST_DATA Certificate
);
125 ISL_VERIFIED_CERTIFICATE_CHAIN_PTR
126 EISL_GetCertificateChain (ISL_VERIFIED_MODULE_PTR Module
);
129 EISL_ContinueVerification (ISL_VERIFIED_MODULE_PTR Module
,
132 ISL_VERIFIED_MODULE_PTR
133 EISL_DuplicateVerifiedModulePtr (ISL_VERIFIED_MODULE_PTR Module
);
136 EISL_RecycleVerifiedModuleCredentials (ISL_VERIFIED_MODULE_PTR Verification
);
139 /* Signature Root Methods */
141 ISL_VERIFIED_SIGNATURE_ROOT_PTR
142 EISL_CreateVerifiedSignatureRootWithCredentialData (const ISL_CONST_DATA CredentialsImage
,
143 const ISL_CONST_DATA ModuleSearchPath
,
144 const ISL_CONST_DATA Signer
,
145 const ISL_CONST_DATA PublicKey
);
147 ISL_VERIFIED_SIGNATURE_ROOT_PTR
148 EISL_CreateVerifiedSignatureRootWithCredentialDataAndCertificate (const ISL_CONST_DATA CredentialsImage
,
149 const ISL_CONST_DATA ModuleSearchPath
,
150 ISL_VERIFIED_CERTIFICATE_PTR Cert
);
152 ISL_VERIFIED_SIGNATURE_ROOT_PTR
153 EISL_CreateVerfiedSignatureRoot (ISL_CONST_DATA Credentials
,
154 ISL_CONST_DATA Signer
,
155 ISL_CONST_DATA PublicKey
);
157 ISL_VERIFIED_SIGNATURE_ROOT_PTR
158 EISL_CreateVerfiedSignatureRootWithCertificate (ISL_CONST_DATA Credentials
,
159 ISL_VERIFIED_CERTIFICATE_PTR Cert
);
161 ISL_MANIFEST_SECTION_PTR
162 EISL_FindManifestSection (ISL_VERIFIED_SIGNATURE_ROOT_PTR Root
,
163 ISL_CONST_DATA Name
);
166 EISL_CreateManifestSectionEnumerator (ISL_VERIFIED_SIGNATURE_ROOT_PTR Root
);
168 ISL_MANIFEST_SECTION_PTR
169 EISL_GetNextManifestSection (ISL_ITERATOR_PTR Iterator
);
172 EISL_RecycleManifestSectionEnumerator (ISL_ITERATOR_PTR Iterator
);
175 EISL_FindManifestAttribute (ISL_VERIFIED_SIGNATURE_ROOT_PTR Context
,
177 ISL_CONST_DATA_PTR Value
);
180 EISL_CreateManifestAttributeEnumerator (ISL_VERIFIED_SIGNATURE_ROOT_PTR Context
);
183 EISL_FindSignerInfoAttribute (ISL_VERIFIED_SIGNATURE_ROOT_PTR Context
,
185 ISL_CONST_DATA_PTR Value
);
188 EISL_CreateSignerInfoAttributeEnumerator (ISL_VERIFIED_SIGNATURE_ROOT_PTR Context
);
191 EISL_GetNextAttribute (ISL_ITERATOR_PTR Iterator
,
192 ISL_CONST_DATA_PTR Name
,
193 ISL_CONST_DATA_PTR Value
);
196 EISL_RecycleAttributeEnumerator (ISL_ITERATOR_PTR Iterator
);
199 EISL_FindSignatureAttribute (ISL_VERIFIED_SIGNATURE_ROOT_PTR Root
,
201 ISL_CONST_DATA_PTR Value
);
204 EISL_CreateSignatureAttributeEnumerator (ISL_VERIFIED_SIGNATURE_ROOT_PTR Root
);
207 EISL_GetNextSignatureAttribute (ISL_ITERATOR_PTR Iterator
,
208 ISL_CONST_DATA_PTR Name
,
209 ISL_CONST_DATA_PTR Value
);
212 EISL_RecycleSignatureAttributeEnumerator (ISL_ITERATOR_PTR Iterator
);
215 EISL_RecycleVerifiedSignatureRoot (ISL_VERIFIED_SIGNATURE_ROOT_PTR Root
);
218 /* Certificate Chain Methods */
220 const ISL_VERIFIED_CERTIFICATE_CHAIN_PTR
221 EISL_CreateCertificateChainWithCredentialData (const ISL_CONST_DATA RootIssuer
,
222 const ISL_CONST_DATA PublicKey
,
223 const ISL_CONST_DATA CredentialsImage
,
224 const ISL_CONST_DATA ModuleSearchPath
);
226 ISL_VERIFIED_CERTIFICATE_CHAIN_PTR
227 EISL_CreateCertificateChainWithCredentialDataAndCertificate (const ISL_CONST_DATA Certificate
,
228 const ISL_CONST_DATA CredentialsImage
,
229 const ISL_CONST_DATA ModuleSearchPath
);
231 ISL_VERIFIED_CERTIFICATE_CHAIN_PTR
232 EISL_CreateCertificateChain (ISL_CONST_DATA RootIssuer
,
233 ISL_CONST_DATA PublicKey
,
234 ISL_CONST_DATA Credential
);
236 ISL_VERIFIED_CERTIFICATE_CHAIN_PTR
237 EISL_CreateCertificateChainWithCertificate (const ISL_CONST_DATA Certificate
,
238 const ISL_CONST_DATA Credential
);
241 EISL_CopyCertificateChain (ISL_VERIFIED_CERTIFICATE_CHAIN_PTR Verification
,
242 ISL_VERIFIED_CERTIFICATE_PTR Certs
[],
243 uint32 MaxCertificates
);
246 EISL_RecycleVerifiedCertificateChain (ISL_VERIFIED_CERTIFICATE_CHAIN_PTR Chain
);
249 /* Certificate Attribute Methods */
252 EISL_FindCertificateAttribute (ISL_VERIFIED_CERTIFICATE_PTR Cert
,
254 ISL_CONST_DATA_PTR Value
);
257 EISL_CreateCertificateAttributeEnumerator (ISL_VERIFIED_CERTIFICATE_PTR Cert
);
260 EISL_GetNextCertificateAttribute (ISL_ITERATOR_PTR CertIterator
,
261 ISL_CONST_DATA_PTR Name
,
262 ISL_CONST_DATA_PTR Value
);
265 EISL_RecycleCertificateAttributeEnumerator (ISL_ITERATOR_PTR CertIterator
);
268 /* Manifest Section Object Methods */
270 ISL_VERIFIED_SIGNATURE_ROOT_PTR
271 EISL_GetManifestSignatureRoot (ISL_MANIFEST_SECTION_PTR Section
);
273 ISL_VERIFIED_MODULE_PTR
274 EISL_VerifyAndLoadModule (ISL_MANIFEST_SECTION_PTR Section
);
276 ISL_VERIFIED_MODULE_PTR
277 EISL_VerifyLoadedModule (ISL_MANIFEST_SECTION_PTR Section
);
280 EISL_FindManifestSectionAttribute (ISL_MANIFEST_SECTION_PTR Section
,
282 ISL_CONST_DATA_PTR Value
);
285 EISL_CreateManifestSectionAttributeEnumerator (ISL_MANIFEST_SECTION_PTR Section
);
288 EISL_GetNextManifestSectionAttribute (ISL_ITERATOR_PTR Iterator
,
289 ISL_CONST_DATA_PTR Name
,
290 ISL_CONST_DATA_PTR Value
);
293 EISL_RecycleManifestSectionAttributeEnumerator (ISL_ITERATOR_PTR Iterator
);
295 ISL_MANIFEST_SECTION_PTR
296 EISL_GetModuleManifestSection (ISL_VERIFIED_MODULE_PTR Module
);
299 /* Secure Linkage Services */
302 EISL_LocateProcedureAddress (ISL_VERIFIED_MODULE_PTR Module
,
303 ISL_CONST_DATA Name
);
306 #define EISL_GetReturnAddress(Address) \
308 /* Platform specific code in here */
313 EISL_CheckAddressWithinModule (ISL_VERIFIED_MODULE_PTR Verification
,
314 ISL_FUNCTION_PTR Address
);
317 EISL_CheckDataAddressWithinModule (ISL_VERIFIED_MODULE_PTR Verification
,
318 const void *Address
);
321 EISL_GetLibHandle (ISL_VERIFIED_MODULE_PTR Verification
);
327 #endif /* _EISL_H_ */