2 * Copyright (c) 1999-2002,2004 Apple Computer, Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
23 * eisl.h -- Embedded Integrity Services Library Interface
29 #include <Security/cssmconfig.h>
35 /* Data Types for Embedded Integrity Services Library */
37 typedef const void *ISL_ITERATOR_PTR
;
39 typedef const void *ISL_VERIFIED_SIGNATURE_ROOT_PTR
;
41 typedef const void *ISL_VERIFIED_CERTIFICATE_CHAIN_PTR
;
43 typedef const void *ISL_VERIFIED_CERTIFICATE_PTR
;
45 typedef const void *ISL_MANIFEST_SECTION_PTR
;
47 typedef const void *ISL_VERIFIED_MODULE_PTR
;
49 typedef void (*ISL_FUNCTION_PTR
)(void);
51 typedef struct isl_data
{
52 CSSM_SIZE Length
; /* in bytes */
54 } ISL_DATA
, *ISL_DATA_PTR
;
56 typedef struct isl_const_data
{
57 CSSM_SIZE Length
; /* in bytes */
59 } ISL_CONST_DATA
, *ISL_CONST_DATA_PTR
;
61 typedef enum isl_status
{
67 /* Embedded Integrity Services Library Functions */
69 ISL_VERIFIED_MODULE_PTR
72 ISL_VERIFIED_MODULE_PTR
73 EISL_VerifyAndLoadModuleAndCredentialData (const ISL_CONST_DATA CredentialsImage
,
74 const ISL_CONST_DATA ModuleSearchPath
,
75 const ISL_CONST_DATA Name
,
76 const ISL_CONST_DATA Signer
,
77 const ISL_CONST_DATA PublicKey
);
79 ISL_VERIFIED_MODULE_PTR
80 EISL_VerifyAndLoadModuleAndCredentialDataWithCertificate (const ISL_CONST_DATA CredentialsImage
,
81 const ISL_CONST_DATA ModuleSearchPath
,
82 const ISL_CONST_DATA Name
,
83 const ISL_CONST_DATA Signer
,
84 const ISL_CONST_DATA Certificate
);
86 ISL_VERIFIED_MODULE_PTR
87 EISL_VerifyAndLoadModuleAndCredentials (ISL_CONST_DATA Credentials
,
89 ISL_CONST_DATA Signer
,
90 ISL_CONST_DATA PublicKey
);
92 ISL_VERIFIED_MODULE_PTR
93 EISL_VerifyAndLoadModuleAndCredentialsWithCertificate (const ISL_CONST_DATA Credentials
,
94 const ISL_CONST_DATA Name
,
95 const ISL_CONST_DATA Signer
,
96 const ISL_CONST_DATA Certificate
);
98 ISL_VERIFIED_MODULE_PTR
99 EISL_VerifyLoadedModuleAndCredentialData (const ISL_CONST_DATA CredentialsImage
,
100 const ISL_CONST_DATA ModuleSearchPath
,
101 const ISL_CONST_DATA Name
,
102 const ISL_CONST_DATA Signer
,
103 const ISL_CONST_DATA PublicKey
);
105 ISL_VERIFIED_MODULE_PTR
106 EISL_VerifyLoadedModuleAndCredentialDataWithCertificate (const ISL_CONST_DATA CredentialsImage
,
107 const ISL_CONST_DATA ModuleSearchPath
,
108 const ISL_CONST_DATA Name
,
109 const ISL_CONST_DATA Signer
,
110 const ISL_CONST_DATA Certificate
);
112 ISL_VERIFIED_MODULE_PTR
113 EISL_VerifyLoadedModuleAndCredentials (ISL_CONST_DATA Credentials
,
115 ISL_CONST_DATA Signer
,
116 ISL_CONST_DATA PublicKey
);
118 ISL_VERIFIED_MODULE_PTR
119 EISL_VerifyLoadedModuleAndCredentialsWithCertificate (const ISL_CONST_DATA Credentials
,
120 const ISL_CONST_DATA Name
,
121 const ISL_CONST_DATA Signer
,
122 const ISL_CONST_DATA Certificate
);
124 ISL_VERIFIED_CERTIFICATE_CHAIN_PTR
125 EISL_GetCertificateChain (ISL_VERIFIED_MODULE_PTR Module
);
128 EISL_ContinueVerification (ISL_VERIFIED_MODULE_PTR Module
,
131 ISL_VERIFIED_MODULE_PTR
132 EISL_DuplicateVerifiedModulePtr (ISL_VERIFIED_MODULE_PTR Module
);
135 EISL_RecycleVerifiedModuleCredentials (ISL_VERIFIED_MODULE_PTR Verification
);
138 /* Signature Root Methods */
140 ISL_VERIFIED_SIGNATURE_ROOT_PTR
141 EISL_CreateVerifiedSignatureRootWithCredentialData (const ISL_CONST_DATA CredentialsImage
,
142 const ISL_CONST_DATA ModuleSearchPath
,
143 const ISL_CONST_DATA Signer
,
144 const ISL_CONST_DATA PublicKey
);
146 ISL_VERIFIED_SIGNATURE_ROOT_PTR
147 EISL_CreateVerifiedSignatureRootWithCredentialDataAndCertificate (const ISL_CONST_DATA CredentialsImage
,
148 const ISL_CONST_DATA ModuleSearchPath
,
149 ISL_VERIFIED_CERTIFICATE_PTR Cert
);
151 ISL_VERIFIED_SIGNATURE_ROOT_PTR
152 EISL_CreateVerfiedSignatureRoot (ISL_CONST_DATA Credentials
,
153 ISL_CONST_DATA Signer
,
154 ISL_CONST_DATA PublicKey
);
156 ISL_VERIFIED_SIGNATURE_ROOT_PTR
157 EISL_CreateVerfiedSignatureRootWithCertificate (ISL_CONST_DATA Credentials
,
158 ISL_VERIFIED_CERTIFICATE_PTR Cert
);
160 ISL_MANIFEST_SECTION_PTR
161 EISL_FindManifestSection (ISL_VERIFIED_SIGNATURE_ROOT_PTR Root
,
162 ISL_CONST_DATA Name
);
165 EISL_CreateManifestSectionEnumerator (ISL_VERIFIED_SIGNATURE_ROOT_PTR Root
);
167 ISL_MANIFEST_SECTION_PTR
168 EISL_GetNextManifestSection (ISL_ITERATOR_PTR Iterator
);
171 EISL_RecycleManifestSectionEnumerator (ISL_ITERATOR_PTR Iterator
);
174 EISL_FindManifestAttribute (ISL_VERIFIED_SIGNATURE_ROOT_PTR Context
,
176 ISL_CONST_DATA_PTR Value
);
179 EISL_CreateManifestAttributeEnumerator (ISL_VERIFIED_SIGNATURE_ROOT_PTR Context
);
182 EISL_FindSignerInfoAttribute (ISL_VERIFIED_SIGNATURE_ROOT_PTR Context
,
184 ISL_CONST_DATA_PTR Value
);
187 EISL_CreateSignerInfoAttributeEnumerator (ISL_VERIFIED_SIGNATURE_ROOT_PTR Context
);
190 EISL_GetNextAttribute (ISL_ITERATOR_PTR Iterator
,
191 ISL_CONST_DATA_PTR Name
,
192 ISL_CONST_DATA_PTR Value
);
195 EISL_RecycleAttributeEnumerator (ISL_ITERATOR_PTR Iterator
);
198 EISL_FindSignatureAttribute (ISL_VERIFIED_SIGNATURE_ROOT_PTR Root
,
200 ISL_CONST_DATA_PTR Value
);
203 EISL_CreateSignatureAttributeEnumerator (ISL_VERIFIED_SIGNATURE_ROOT_PTR Root
);
206 EISL_GetNextSignatureAttribute (ISL_ITERATOR_PTR Iterator
,
207 ISL_CONST_DATA_PTR Name
,
208 ISL_CONST_DATA_PTR Value
);
211 EISL_RecycleSignatureAttributeEnumerator (ISL_ITERATOR_PTR Iterator
);
214 EISL_RecycleVerifiedSignatureRoot (ISL_VERIFIED_SIGNATURE_ROOT_PTR Root
);
217 /* Certificate Chain Methods */
219 const ISL_VERIFIED_CERTIFICATE_CHAIN_PTR
220 EISL_CreateCertificateChainWithCredentialData (const ISL_CONST_DATA RootIssuer
,
221 const ISL_CONST_DATA PublicKey
,
222 const ISL_CONST_DATA CredentialsImage
,
223 const ISL_CONST_DATA ModuleSearchPath
);
225 ISL_VERIFIED_CERTIFICATE_CHAIN_PTR
226 EISL_CreateCertificateChainWithCredentialDataAndCertificate (const ISL_CONST_DATA Certificate
,
227 const ISL_CONST_DATA CredentialsImage
,
228 const ISL_CONST_DATA ModuleSearchPath
);
230 ISL_VERIFIED_CERTIFICATE_CHAIN_PTR
231 EISL_CreateCertificateChain (ISL_CONST_DATA RootIssuer
,
232 ISL_CONST_DATA PublicKey
,
233 ISL_CONST_DATA Credential
);
235 ISL_VERIFIED_CERTIFICATE_CHAIN_PTR
236 EISL_CreateCertificateChainWithCertificate (const ISL_CONST_DATA Certificate
,
237 const ISL_CONST_DATA Credential
);
240 EISL_CopyCertificateChain (ISL_VERIFIED_CERTIFICATE_CHAIN_PTR Verification
,
241 ISL_VERIFIED_CERTIFICATE_PTR Certs
[],
242 uint32 MaxCertificates
);
245 EISL_RecycleVerifiedCertificateChain (ISL_VERIFIED_CERTIFICATE_CHAIN_PTR Chain
);
248 /* Certificate Attribute Methods */
251 EISL_FindCertificateAttribute (ISL_VERIFIED_CERTIFICATE_PTR Cert
,
253 ISL_CONST_DATA_PTR Value
);
256 EISL_CreateCertificateAttributeEnumerator (ISL_VERIFIED_CERTIFICATE_PTR Cert
);
259 EISL_GetNextCertificateAttribute (ISL_ITERATOR_PTR CertIterator
,
260 ISL_CONST_DATA_PTR Name
,
261 ISL_CONST_DATA_PTR Value
);
264 EISL_RecycleCertificateAttributeEnumerator (ISL_ITERATOR_PTR CertIterator
);
267 /* Manifest Section Object Methods */
269 ISL_VERIFIED_SIGNATURE_ROOT_PTR
270 EISL_GetManifestSignatureRoot (ISL_MANIFEST_SECTION_PTR Section
);
272 ISL_VERIFIED_MODULE_PTR
273 EISL_VerifyAndLoadModule (ISL_MANIFEST_SECTION_PTR Section
);
275 ISL_VERIFIED_MODULE_PTR
276 EISL_VerifyLoadedModule (ISL_MANIFEST_SECTION_PTR Section
);
279 EISL_FindManifestSectionAttribute (ISL_MANIFEST_SECTION_PTR Section
,
281 ISL_CONST_DATA_PTR Value
);
284 EISL_CreateManifestSectionAttributeEnumerator (ISL_MANIFEST_SECTION_PTR Section
);
287 EISL_GetNextManifestSectionAttribute (ISL_ITERATOR_PTR Iterator
,
288 ISL_CONST_DATA_PTR Name
,
289 ISL_CONST_DATA_PTR Value
);
292 EISL_RecycleManifestSectionAttributeEnumerator (ISL_ITERATOR_PTR Iterator
);
294 ISL_MANIFEST_SECTION_PTR
295 EISL_GetModuleManifestSection (ISL_VERIFIED_MODULE_PTR Module
);
298 /* Secure Linkage Services */
301 EISL_LocateProcedureAddress (ISL_VERIFIED_MODULE_PTR Module
,
302 ISL_CONST_DATA Name
);
305 #define EISL_GetReturnAddress(Address) \
307 /* Platform specific code in here */
312 EISL_CheckAddressWithinModule (ISL_VERIFIED_MODULE_PTR Verification
,
313 ISL_FUNCTION_PTR Address
);
316 EISL_CheckDataAddressWithinModule (ISL_VERIFIED_MODULE_PTR Verification
,
317 const void *Address
);
320 EISL_GetLibHandle (ISL_VERIFIED_MODULE_PTR Verification
);
326 #endif /* _EISL_H_ */