]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cssm/lib/cssmcspi.h
Security-59754.80.3.tar.gz
[apple/security.git] / OSX / libsecurity_cssm / lib / cssmcspi.h
1 /*
2 * Copyright (c) 1999-2001,2004,2011,2014 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
11 * file.
12 *
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.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 *
23 * cssmcspi.h -- Service Provider Interface for
24 * Cryptographic Service Provider Modules
25 */
26
27 #ifndef _CSSMCSPI_H_
28 #define _CSSMCSPI_H_ 1
29
30 #include <Security/cssmspi.h>
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 #pragma clang diagnostic push
37 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
38
39 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_spi_csp_funcs {
40 CSSM_RETURN (CSSMCSPI *EventNotify)
41 (CSSM_CSP_HANDLE CSPHandle,
42 CSSM_CONTEXT_EVENT Event,
43 CSSM_CC_HANDLE CCHandle,
44 const CSSM_CONTEXT *Context);
45 CSSM_RETURN (CSSMCSPI *QuerySize)
46 (CSSM_CSP_HANDLE CSPHandle,
47 CSSM_CC_HANDLE CCHandle,
48 const CSSM_CONTEXT *Context,
49 CSSM_BOOL Encrypt,
50 uint32 QuerySizeCount,
51 CSSM_QUERY_SIZE_DATA_PTR DataBlock);
52 CSSM_RETURN (CSSMCSPI *SignData)
53 (CSSM_CSP_HANDLE CSPHandle,
54 CSSM_CC_HANDLE CCHandle,
55 const CSSM_CONTEXT *Context,
56 const CSSM_DATA *DataBufs,
57 uint32 DataBufCount,
58 CSSM_ALGORITHMS DigestAlgorithm,
59 CSSM_DATA_PTR Signature);
60 CSSM_RETURN (CSSMCSPI *SignDataInit)
61 (CSSM_CSP_HANDLE CSPHandle,
62 CSSM_CC_HANDLE CCHandle,
63 const CSSM_CONTEXT *Context);
64 CSSM_RETURN (CSSMCSPI *SignDataUpdate)
65 (CSSM_CSP_HANDLE CSPHandle,
66 CSSM_CC_HANDLE CCHandle,
67 const CSSM_DATA *DataBufs,
68 uint32 DataBufCount);
69 CSSM_RETURN (CSSMCSPI *SignDataFinal)
70 (CSSM_CSP_HANDLE CSPHandle,
71 CSSM_CC_HANDLE CCHandle,
72 CSSM_DATA_PTR Signature);
73 CSSM_RETURN (CSSMCSPI *VerifyData)
74 (CSSM_CSP_HANDLE CSPHandle,
75 CSSM_CC_HANDLE CCHandle,
76 const CSSM_CONTEXT *Context,
77 const CSSM_DATA *DataBufs,
78 uint32 DataBufCount,
79 CSSM_ALGORITHMS DigestAlgorithm,
80 const CSSM_DATA *Signature);
81 CSSM_RETURN (CSSMCSPI *VerifyDataInit)
82 (CSSM_CSP_HANDLE CSPHandle,
83 CSSM_CC_HANDLE CCHandle,
84 const CSSM_CONTEXT *Context);
85 CSSM_RETURN (CSSMCSPI *VerifyDataUpdate)
86 (CSSM_CSP_HANDLE CSPHandle,
87 CSSM_CC_HANDLE CCHandle,
88 const CSSM_DATA *DataBufs,
89 uint32 DataBufCount);
90 CSSM_RETURN (CSSMCSPI *VerifyDataFinal)
91 (CSSM_CSP_HANDLE CSPHandle,
92 CSSM_CC_HANDLE CCHandle,
93 const CSSM_DATA *Signature);
94 CSSM_RETURN (CSSMCSPI *DigestData)
95 (CSSM_CSP_HANDLE CSPHandle,
96 CSSM_CC_HANDLE CCHandle,
97 const CSSM_CONTEXT *Context,
98 const CSSM_DATA *DataBufs,
99 uint32 DataBufCount,
100 CSSM_DATA_PTR Digest);
101 CSSM_RETURN (CSSMCSPI *DigestDataInit)
102 (CSSM_CSP_HANDLE CSPHandle,
103 CSSM_CC_HANDLE CCHandle,
104 const CSSM_CONTEXT *Context);
105 CSSM_RETURN (CSSMCSPI *DigestDataUpdate)
106 (CSSM_CSP_HANDLE CSPHandle,
107 CSSM_CC_HANDLE CCHandle,
108 const CSSM_DATA *DataBufs,
109 uint32 DataBufCount);
110 CSSM_RETURN (CSSMCSPI *DigestDataClone)
111 (CSSM_CSP_HANDLE CSPHandle,
112 CSSM_CC_HANDLE CCHandle,
113 CSSM_CC_HANDLE ClonedCCHandle);
114 CSSM_RETURN (CSSMCSPI *DigestDataFinal)
115 (CSSM_CSP_HANDLE CSPHandle,
116 CSSM_CC_HANDLE CCHandle,
117 CSSM_DATA_PTR Digest);
118 CSSM_RETURN (CSSMCSPI *GenerateMac)
119 (CSSM_CSP_HANDLE CSPHandle,
120 CSSM_CC_HANDLE CCHandle,
121 const CSSM_CONTEXT *Context,
122 const CSSM_DATA *DataBufs,
123 uint32 DataBufCount,
124 CSSM_DATA_PTR Mac);
125 CSSM_RETURN (CSSMCSPI *GenerateMacInit)
126 (CSSM_CSP_HANDLE CSPHandle,
127 CSSM_CC_HANDLE CCHandle,
128 const CSSM_CONTEXT *Context);
129 CSSM_RETURN (CSSMCSPI *GenerateMacUpdate)
130 (CSSM_CSP_HANDLE CSPHandle,
131 CSSM_CC_HANDLE CCHandle,
132 const CSSM_DATA *DataBufs,
133 uint32 DataBufCount);
134 CSSM_RETURN (CSSMCSPI *GenerateMacFinal)
135 (CSSM_CSP_HANDLE CSPHandle,
136 CSSM_CC_HANDLE CCHandle,
137 CSSM_DATA_PTR Mac);
138 CSSM_RETURN (CSSMCSPI *VerifyMac)
139 (CSSM_CSP_HANDLE CSPHandle,
140 CSSM_CC_HANDLE CCHandle,
141 const CSSM_CONTEXT *Context,
142 const CSSM_DATA *DataBufs,
143 uint32 DataBufCount,
144 const CSSM_DATA *Mac);
145 CSSM_RETURN (CSSMCSPI *VerifyMacInit)
146 (CSSM_CSP_HANDLE CSPHandle,
147 CSSM_CC_HANDLE CCHandle,
148 const CSSM_CONTEXT *Context);
149 CSSM_RETURN (CSSMCSPI *VerifyMacUpdate)
150 (CSSM_CSP_HANDLE CSPHandle,
151 CSSM_CC_HANDLE CCHandle,
152 const CSSM_DATA *DataBufs,
153 uint32 DataBufCount);
154 CSSM_RETURN (CSSMCSPI *VerifyMacFinal)
155 (CSSM_CSP_HANDLE CSPHandle,
156 CSSM_CC_HANDLE CCHandle,
157 const CSSM_DATA *Mac);
158 CSSM_RETURN (CSSMCSPI *EncryptData)
159 (CSSM_CSP_HANDLE CSPHandle,
160 CSSM_CC_HANDLE CCHandle,
161 const CSSM_CONTEXT *Context,
162 const CSSM_DATA *ClearBufs,
163 uint32 ClearBufCount,
164 CSSM_DATA_PTR CipherBufs,
165 uint32 CipherBufCount,
166 CSSM_SIZE *bytesEncrypted,
167 CSSM_DATA_PTR RemData,
168 CSSM_PRIVILEGE Privilege);
169 CSSM_RETURN (CSSMCSPI *EncryptDataInit)
170 (CSSM_CSP_HANDLE CSPHandle,
171 CSSM_CC_HANDLE CCHandle,
172 const CSSM_CONTEXT *Context,
173 CSSM_PRIVILEGE Privilege);
174 CSSM_RETURN (CSSMCSPI *EncryptDataUpdate)
175 (CSSM_CSP_HANDLE CSPHandle,
176 CSSM_CC_HANDLE CCHandle,
177 const CSSM_DATA *ClearBufs,
178 uint32 ClearBufCount,
179 CSSM_DATA_PTR CipherBufs,
180 uint32 CipherBufCount,
181 CSSM_SIZE *bytesEncrypted);
182 CSSM_RETURN (CSSMCSPI *EncryptDataFinal)
183 (CSSM_CSP_HANDLE CSPHandle,
184 CSSM_CC_HANDLE CCHandle,
185 CSSM_DATA_PTR RemData);
186 CSSM_RETURN (CSSMCSPI *DecryptData)
187 (CSSM_CSP_HANDLE CSPHandle,
188 CSSM_CC_HANDLE CCHandle,
189 const CSSM_CONTEXT *Context,
190 const CSSM_DATA *CipherBufs,
191 uint32 CipherBufCount,
192 CSSM_DATA_PTR ClearBufs,
193 uint32 ClearBufCount,
194 CSSM_SIZE *bytesDecrypted,
195 CSSM_DATA_PTR RemData,
196 CSSM_PRIVILEGE Privilege);
197 CSSM_RETURN (CSSMCSPI *DecryptDataInit)
198 (CSSM_CSP_HANDLE CSPHandle,
199 CSSM_CC_HANDLE CCHandle,
200 const CSSM_CONTEXT *Context,
201 CSSM_PRIVILEGE Privilege);
202 CSSM_RETURN (CSSMCSPI *DecryptDataUpdate)
203 (CSSM_CSP_HANDLE CSPHandle,
204 CSSM_CC_HANDLE CCHandle,
205 const CSSM_DATA *CipherBufs,
206 uint32 CipherBufCount,
207 CSSM_DATA_PTR ClearBufs,
208 uint32 ClearBufCount,
209 CSSM_SIZE *bytesDecrypted);
210 CSSM_RETURN (CSSMCSPI *DecryptDataFinal)
211 (CSSM_CSP_HANDLE CSPHandle,
212 CSSM_CC_HANDLE CCHandle,
213 CSSM_DATA_PTR RemData);
214 CSSM_RETURN (CSSMCSPI *QueryKeySizeInBits)
215 (CSSM_CSP_HANDLE CSPHandle,
216 CSSM_CC_HANDLE CCHandle,
217 const CSSM_CONTEXT *Context,
218 const CSSM_KEY *Key,
219 CSSM_KEY_SIZE_PTR KeySize);
220 CSSM_RETURN (CSSMCSPI *GenerateKey)
221 (CSSM_CSP_HANDLE CSPHandle,
222 CSSM_CC_HANDLE CCHandle,
223 const CSSM_CONTEXT *Context,
224 uint32 KeyUsage,
225 uint32 KeyAttr,
226 const CSSM_DATA *KeyLabel,
227 const CSSM_RESOURCE_CONTROL_CONTEXT *CredAndAclEntry,
228 CSSM_KEY_PTR Key,
229 CSSM_PRIVILEGE Privilege);
230 CSSM_RETURN (CSSMCSPI *GenerateKeyPair)
231 (CSSM_CSP_HANDLE CSPHandle,
232 CSSM_CC_HANDLE CCHandle,
233 const CSSM_CONTEXT *Context,
234 uint32 PublicKeyUsage,
235 uint32 PublicKeyAttr,
236 const CSSM_DATA *PublicKeyLabel,
237 CSSM_KEY_PTR PublicKey,
238 uint32 PrivateKeyUsage,
239 uint32 PrivateKeyAttr,
240 const CSSM_DATA *PrivateKeyLabel,
241 const CSSM_RESOURCE_CONTROL_CONTEXT *CredAndAclEntry,
242 CSSM_KEY_PTR PrivateKey,
243 CSSM_PRIVILEGE Privilege);
244 CSSM_RETURN (CSSMCSPI *GenerateRandom)
245 (CSSM_CSP_HANDLE CSPHandle,
246 CSSM_CC_HANDLE CCHandle,
247 const CSSM_CONTEXT *Context,
248 CSSM_DATA_PTR RandomNumber);
249 CSSM_RETURN (CSSMCSPI *GenerateAlgorithmParams)
250 (CSSM_CSP_HANDLE CSPHandle,
251 CSSM_CC_HANDLE CCHandle,
252 const CSSM_CONTEXT *Context,
253 uint32 ParamBits,
254 CSSM_DATA_PTR Param,
255 uint32 *NumberOfUpdatedAttibutes,
256 CSSM_CONTEXT_ATTRIBUTE_PTR *UpdatedAttributes);
257 CSSM_RETURN (CSSMCSPI *WrapKey)
258 (CSSM_CSP_HANDLE CSPHandle,
259 CSSM_CC_HANDLE CCHandle,
260 const CSSM_CONTEXT *Context,
261 const CSSM_ACCESS_CREDENTIALS *AccessCred,
262 const CSSM_KEY *Key,
263 const CSSM_DATA *DescriptiveData,
264 CSSM_WRAP_KEY_PTR WrappedKey,
265 CSSM_PRIVILEGE Privilege);
266 CSSM_RETURN (CSSMCSPI *UnwrapKey)
267 (CSSM_CSP_HANDLE CSPHandle,
268 CSSM_CC_HANDLE CCHandle,
269 const CSSM_CONTEXT *Context,
270 const CSSM_KEY *PublicKey,
271 const CSSM_WRAP_KEY *WrappedKey,
272 uint32 KeyUsage,
273 uint32 KeyAttr,
274 const CSSM_DATA *KeyLabel,
275 const CSSM_RESOURCE_CONTROL_CONTEXT *CredAndAclEntry,
276 CSSM_KEY_PTR UnwrappedKey,
277 CSSM_DATA_PTR DescriptiveData,
278 CSSM_PRIVILEGE Privilege);
279 CSSM_RETURN (CSSMCSPI *DeriveKey)
280 (CSSM_CSP_HANDLE CSPHandle,
281 CSSM_CC_HANDLE CCHandle,
282 const CSSM_CONTEXT *Context,
283 CSSM_DATA_PTR Param,
284 uint32 KeyUsage,
285 uint32 KeyAttr,
286 const CSSM_DATA *KeyLabel,
287 const CSSM_RESOURCE_CONTROL_CONTEXT *CredAndAclEntry,
288 CSSM_KEY_PTR DerivedKey);
289 CSSM_RETURN (CSSMCSPI *FreeKey)
290 (CSSM_CSP_HANDLE CSPHandle,
291 const CSSM_ACCESS_CREDENTIALS *AccessCred,
292 CSSM_KEY_PTR KeyPtr,
293 CSSM_BOOL Delete);
294 CSSM_RETURN (CSSMCSPI *PassThrough)
295 (CSSM_CSP_HANDLE CSPHandle,
296 CSSM_CC_HANDLE CCHandle,
297 const CSSM_CONTEXT *Context,
298 uint32 PassThroughId,
299 const void *InData,
300 void **OutData);
301 CSSM_RETURN (CSSMCSPI *Login)
302 (CSSM_CSP_HANDLE CSPHandle,
303 const CSSM_ACCESS_CREDENTIALS *AccessCred,
304 const CSSM_DATA *LoginName,
305 const void *Reserved);
306 CSSM_RETURN (CSSMCSPI *Logout)
307 (CSSM_CSP_HANDLE CSPHandle);
308 CSSM_RETURN (CSSMCSPI *ChangeLoginAcl)
309 (CSSM_CSP_HANDLE CSPHandle,
310 const CSSM_ACCESS_CREDENTIALS *AccessCred,
311 const CSSM_ACL_EDIT *AclEdit);
312 CSSM_RETURN (CSSMCSPI *ObtainPrivateKeyFromPublicKey)
313 (CSSM_CSP_HANDLE CSPHandle,
314 const CSSM_KEY *PublicKey,
315 CSSM_KEY_PTR PrivateKey);
316 CSSM_RETURN (CSSMCSPI *RetrieveUniqueId)
317 (CSSM_CSP_HANDLE CSPHandle,
318 CSSM_DATA_PTR UniqueID);
319 CSSM_RETURN (CSSMCSPI *RetrieveCounter)
320 (CSSM_CSP_HANDLE CSPHandle,
321 CSSM_DATA_PTR Counter);
322 CSSM_RETURN (CSSMCSPI *VerifyDevice)
323 (CSSM_CSP_HANDLE CSPHandle,
324 const CSSM_DATA *DeviceCert);
325 CSSM_RETURN (CSSMCSPI *GetTimeValue)
326 (CSSM_CSP_HANDLE CSPHandle,
327 CSSM_ALGORITHMS TimeAlgorithm,
328 CSSM_DATA *TimeData);
329 CSSM_RETURN (CSSMCSPI *GetOperationalStatistics)
330 (CSSM_CSP_HANDLE CSPHandle,
331 CSSM_CSP_OPERATIONAL_STATISTICS *Statistics);
332 CSSM_RETURN (CSSMCSPI *GetLoginAcl)
333 (CSSM_CSP_HANDLE CSPHandle,
334 const CSSM_STRING *SelectionTag,
335 uint32 *NumberOfAclInfos,
336 CSSM_ACL_ENTRY_INFO_PTR *AclInfos);
337 CSSM_RETURN (CSSMCSPI *GetKeyAcl)
338 (CSSM_CSP_HANDLE CSPHandle,
339 const CSSM_KEY *Key,
340 const CSSM_STRING *SelectionTag,
341 uint32 *NumberOfAclInfos,
342 CSSM_ACL_ENTRY_INFO_PTR *AclInfos);
343 CSSM_RETURN (CSSMCSPI *ChangeKeyAcl)
344 (CSSM_CSP_HANDLE CSPHandle,
345 const CSSM_ACCESS_CREDENTIALS *AccessCred,
346 const CSSM_ACL_EDIT *AclEdit,
347 const CSSM_KEY *Key);
348 CSSM_RETURN (CSSMCSPI *GetKeyOwner)
349 (CSSM_CSP_HANDLE CSPHandle,
350 const CSSM_KEY *Key,
351 CSSM_ACL_OWNER_PROTOTYPE_PTR Owner);
352 CSSM_RETURN (CSSMCSPI *ChangeKeyOwner)
353 (CSSM_CSP_HANDLE CSPHandle,
354 const CSSM_ACCESS_CREDENTIALS *AccessCred,
355 const CSSM_KEY *Key,
356 const CSSM_ACL_OWNER_PROTOTYPE *NewOwner);
357 CSSM_RETURN (CSSMCSPI *GetLoginOwner)
358 (CSSM_CSP_HANDLE CSPHandle,
359 CSSM_ACL_OWNER_PROTOTYPE_PTR Owner);
360 CSSM_RETURN (CSSMCSPI *ChangeLoginOwner)
361 (CSSM_CSP_HANDLE CSPHandle,
362 const CSSM_ACCESS_CREDENTIALS *AccessCred,
363 const CSSM_ACL_OWNER_PROTOTYPE *NewOwner);
364 } CSSM_SPI_CSP_FUNCS DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER, *CSSM_SPI_CSP_FUNCS_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
365
366 #pragma clang diagnostic pop
367
368 #ifdef __cplusplus
369 }
370 #endif
371
372 #endif /* _CSSMCSPI_H_ */