]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cdsa_plugin/lib/CSPabstractsession.cpp
Security-59754.80.3.tar.gz
[apple/security.git] / OSX / libsecurity_cdsa_plugin / lib / CSPabstractsession.cpp
1 //
2 // CSP plugin transition layer.
3 // This file was automatically generated. Do not edit on penalty of futility!
4 //
5 #include <security_cdsa_plugin/CSPsession.h>
6 #include <security_cdsa_plugin/cssmplugin.h>
7 #include <security_cdsa_utilities/cssmbridge.h>
8 #include <Security/cssmcspi.h>
9 // The disclaimer up top used to be true but rdar://24426719 removed libsecurity_cdsa_plugin_generate
10 #include "LegacyAPICounts.h"
11
12 CSPAbstractPluginSession::~CSPAbstractPluginSession()
13 { /* virtual */ }
14
15 static CSSM_RETURN CSSMCSPI cssm_ObtainPrivateKeyFromPublicKey(CSSM_CSP_HANDLE CSPHandle,
16 const CSSM_KEY *PublicKey,
17 CSSM_KEY_PTR PrivateKey)
18 {
19 BEGIN_API
20 findSession<CSPPluginSession>(CSPHandle).ObtainPrivateKeyFromPublicKey(CssmKey::required(PublicKey),
21 CssmKey::required(PrivateKey));
22 END_API(CSP)
23 }
24
25 static CSSM_RETURN CSSMCSPI cssm_GetOperationalStatistics(CSSM_CSP_HANDLE CSPHandle,
26 CSSM_CSP_OPERATIONAL_STATISTICS *Statistics)
27 {
28 BEGIN_API
29 findSession<CSPPluginSession>(CSPHandle).GetOperationalStatistics(CSPOperationalStatistics::required(Statistics));
30 END_API(CSP)
31 }
32
33 static CSSM_RETURN CSSMCSPI cssm_ChangeLoginOwner(CSSM_CSP_HANDLE CSPHandle,
34 const CSSM_ACCESS_CREDENTIALS *AccessCred,
35 const CSSM_ACL_OWNER_PROTOTYPE *NewOwner)
36 {
37 BEGIN_API
38 findSession<CSPPluginSession>(CSPHandle).ChangeLoginOwner(AccessCredentials::required(AccessCred),
39 Required(NewOwner));
40 END_API(CSP)
41 }
42
43 static CSSM_RETURN CSSMCSPI cssm_EventNotify(CSSM_CSP_HANDLE CSPHandle,
44 CSSM_CONTEXT_EVENT Event,
45 CSSM_CC_HANDLE CCHandle,
46 const CSSM_CONTEXT *Context)
47 {
48 BEGIN_API
49 findSession<CSPPluginSession>(CSPHandle).EventNotify(Event,
50 CCHandle,
51 Context::required(Context));
52 END_API(CSP)
53 }
54
55 static CSSM_RETURN CSSMCSPI cssm_DecryptDataInit(CSSM_CSP_HANDLE CSPHandle,
56 CSSM_CC_HANDLE CCHandle,
57 const CSSM_CONTEXT *Context,
58 CSSM_PRIVILEGE Privilege)
59 {
60 BEGIN_API
61 findSession<CSPPluginSession>(CSPHandle).DecryptDataInit(CCHandle,
62 Context::required(Context),
63 Privilege);
64 END_API(CSP)
65 }
66
67 static CSSM_RETURN CSSMCSPI cssm_SignDataInit(CSSM_CSP_HANDLE CSPHandle,
68 CSSM_CC_HANDLE CCHandle,
69 const CSSM_CONTEXT *Context)
70 {
71 BEGIN_API
72 findSession<CSPPluginSession>(CSPHandle).SignDataInit(CCHandle,
73 Context::required(Context));
74 END_API(CSP)
75 }
76
77 static CSSM_RETURN CSSMCSPI cssm_DigestData(CSSM_CSP_HANDLE CSPHandle,
78 CSSM_CC_HANDLE CCHandle,
79 const CSSM_CONTEXT *Context,
80 const CSSM_DATA *DataBufs,
81 uint32 DataBufCount,
82 CSSM_DATA_PTR Digest)
83 {
84 BEGIN_API
85 findSession<CSPPluginSession>(CSPHandle).DigestData(CCHandle,
86 Context::required(Context),
87 &CssmData::required(DataBufs),
88 DataBufCount,
89 CssmData::required(Digest));
90 END_API(CSP)
91 }
92
93 static CSSM_RETURN CSSMCSPI cssm_GetKeyOwner(CSSM_CSP_HANDLE CSPHandle,
94 const CSSM_KEY *Key,
95 CSSM_ACL_OWNER_PROTOTYPE_PTR Owner)
96 {
97 BEGIN_API
98 findSession<CSPPluginSession>(CSPHandle).GetKeyOwner(CssmKey::required(Key),
99 Required(Owner));
100 END_API(CSP)
101 }
102
103 static CSSM_RETURN CSSMCSPI cssm_GetLoginAcl(CSSM_CSP_HANDLE CSPHandle,
104 const CSSM_STRING *SelectionTag,
105 uint32 *NumberOfAclInfos,
106 CSSM_ACL_ENTRY_INFO_PTR *AclInfos)
107 {
108 BEGIN_API
109 findSession<CSPPluginSession>(CSPHandle).GetLoginAcl(SelectionTag,
110 Required(NumberOfAclInfos),
111 Required(AclInfos));
112 END_API(CSP)
113 }
114
115 static CSSM_RETURN CSSMCSPI cssm_VerifyMac(CSSM_CSP_HANDLE CSPHandle,
116 CSSM_CC_HANDLE CCHandle,
117 const CSSM_CONTEXT *Context,
118 const CSSM_DATA *DataBufs,
119 uint32 DataBufCount,
120 const CSSM_DATA *Mac)
121 {
122 BEGIN_API
123 findSession<CSPPluginSession>(CSPHandle).VerifyMac(CCHandle,
124 Context::required(Context),
125 &CssmData::required(DataBufs),
126 DataBufCount,
127 CssmData::required(Mac));
128 END_API(CSP)
129 }
130
131 static CSSM_RETURN CSSMCSPI cssm_SignDataFinal(CSSM_CSP_HANDLE CSPHandle,
132 CSSM_CC_HANDLE CCHandle,
133 CSSM_DATA_PTR Signature)
134 {
135 BEGIN_API
136 findSession<CSPPluginSession>(CSPHandle).SignDataFinal(CCHandle,
137 CssmData::required(Signature));
138 END_API(CSP)
139 }
140
141 static CSSM_RETURN CSSMCSPI cssm_VerifyDataUpdate(CSSM_CSP_HANDLE CSPHandle,
142 CSSM_CC_HANDLE CCHandle,
143 const CSSM_DATA *DataBufs,
144 uint32 DataBufCount)
145 {
146 BEGIN_API
147 findSession<CSPPluginSession>(CSPHandle).VerifyDataUpdate(CCHandle,
148 &CssmData::required(DataBufs),
149 DataBufCount);
150 END_API(CSP)
151 }
152
153 static CSSM_RETURN CSSMCSPI cssm_GenerateMac(CSSM_CSP_HANDLE CSPHandle,
154 CSSM_CC_HANDLE CCHandle,
155 const CSSM_CONTEXT *Context,
156 const CSSM_DATA *DataBufs,
157 uint32 DataBufCount,
158 CSSM_DATA_PTR Mac)
159 {
160 BEGIN_API
161 findSession<CSPPluginSession>(CSPHandle).GenerateMac(CCHandle,
162 Context::required(Context),
163 &CssmData::required(DataBufs),
164 DataBufCount,
165 CssmData::required(Mac));
166 END_API(CSP)
167 }
168
169 static CSSM_RETURN CSSMCSPI cssm_VerifyMacFinal(CSSM_CSP_HANDLE CSPHandle,
170 CSSM_CC_HANDLE CCHandle,
171 const CSSM_DATA *Mac)
172 {
173 BEGIN_API
174 findSession<CSPPluginSession>(CSPHandle).VerifyMacFinal(CCHandle,
175 CssmData::required(Mac));
176 END_API(CSP)
177 }
178
179 static CSSM_RETURN CSSMCSPI cssm_GenerateRandom(CSSM_CSP_HANDLE CSPHandle,
180 CSSM_CC_HANDLE CCHandle,
181 const CSSM_CONTEXT *Context,
182 CSSM_DATA_PTR RandomNumber)
183 {
184 BEGIN_API
185 findSession<CSPPluginSession>(CSPHandle).GenerateRandom(CCHandle,
186 Context::required(Context),
187 CssmData::required(RandomNumber));
188 END_API(CSP)
189 }
190
191 static CSSM_RETURN CSSMCSPI cssm_RetrieveUniqueId(CSSM_CSP_HANDLE CSPHandle,
192 CSSM_DATA_PTR UniqueID)
193 {
194 BEGIN_API
195 findSession<CSPPluginSession>(CSPHandle).RetrieveUniqueId(CssmData::required(UniqueID));
196 END_API(CSP)
197 }
198
199 static CSSM_RETURN CSSMCSPI cssm_UnwrapKey(CSSM_CSP_HANDLE CSPHandle,
200 CSSM_CC_HANDLE CCHandle,
201 const CSSM_CONTEXT *Context,
202 const CSSM_KEY *PublicKey,
203 const CSSM_WRAP_KEY *WrappedKey,
204 uint32 KeyUsage,
205 uint32 KeyAttr,
206 const CSSM_DATA *KeyLabel,
207 const CSSM_RESOURCE_CONTROL_CONTEXT *CredAndAclEntry,
208 CSSM_KEY_PTR UnwrappedKey,
209 CSSM_DATA_PTR DescriptiveData,
210 CSSM_PRIVILEGE Privilege)
211 {
212 BEGIN_API
213 findSession<CSPPluginSession>(CSPHandle).UnwrapKey(CCHandle,
214 Context::required(Context),
215 CssmKey::optional(PublicKey),
216 CssmKey::required(WrappedKey),
217 KeyUsage,
218 KeyAttr,
219 CssmData::optional(KeyLabel),
220 CredAndAclEntry,
221 CssmKey::required(UnwrappedKey),
222 CssmData::required(DescriptiveData),
223 Privilege);
224 END_API(CSP)
225 }
226
227 static CSSM_RETURN CSSMCSPI cssm_GenerateMacFinal(CSSM_CSP_HANDLE CSPHandle,
228 CSSM_CC_HANDLE CCHandle,
229 CSSM_DATA_PTR Mac)
230 {
231 BEGIN_API
232 findSession<CSPPluginSession>(CSPHandle).GenerateMacFinal(CCHandle,
233 CssmData::required(Mac));
234 END_API(CSP)
235 }
236
237 static CSSM_RETURN CSSMCSPI cssm_WrapKey(CSSM_CSP_HANDLE CSPHandle,
238 CSSM_CC_HANDLE CCHandle,
239 const CSSM_CONTEXT *Context,
240 const CSSM_ACCESS_CREDENTIALS *AccessCred,
241 const CSSM_KEY *Key,
242 const CSSM_DATA *DescriptiveData,
243 CSSM_WRAP_KEY_PTR WrappedKey,
244 CSSM_PRIVILEGE Privilege)
245 {
246 BEGIN_API
247 findSession<CSPPluginSession>(CSPHandle).WrapKey(CCHandle,
248 Context::required(Context),
249 AccessCredentials::required(AccessCred),
250 CssmKey::required(Key),
251 CssmData::optional(DescriptiveData),
252 CssmKey::required(WrappedKey),
253 Privilege);
254 END_API(CSP)
255 }
256
257 static CSSM_RETURN CSSMCSPI cssm_DecryptDataFinal(CSSM_CSP_HANDLE CSPHandle,
258 CSSM_CC_HANDLE CCHandle,
259 CSSM_DATA_PTR RemData)
260 {
261 BEGIN_API
262 findSession<CSPPluginSession>(CSPHandle).DecryptDataFinal(CCHandle,
263 CssmData::required(RemData));
264 END_API(CSP)
265 }
266
267 static CSSM_RETURN CSSMCSPI cssm_SignData(CSSM_CSP_HANDLE CSPHandle,
268 CSSM_CC_HANDLE CCHandle,
269 const CSSM_CONTEXT *Context,
270 const CSSM_DATA *DataBufs,
271 uint32 DataBufCount,
272 CSSM_ALGORITHMS DigestAlgorithm,
273 CSSM_DATA_PTR Signature)
274 {
275 BEGIN_API
276 findSession<CSPPluginSession>(CSPHandle).SignData(CCHandle,
277 Context::required(Context),
278 &CssmData::required(DataBufs),
279 DataBufCount,
280 DigestAlgorithm,
281 CssmData::required(Signature));
282 END_API(CSP)
283 }
284
285 static CSSM_RETURN CSSMCSPI cssm_EncryptDataInit(CSSM_CSP_HANDLE CSPHandle,
286 CSSM_CC_HANDLE CCHandle,
287 const CSSM_CONTEXT *Context,
288 CSSM_PRIVILEGE Privilege)
289 {
290 BEGIN_API
291 findSession<CSPPluginSession>(CSPHandle).EncryptDataInit(CCHandle,
292 Context::required(Context),
293 Privilege);
294 END_API(CSP)
295 }
296
297 static CSSM_RETURN CSSMCSPI cssm_VerifyData(CSSM_CSP_HANDLE CSPHandle,
298 CSSM_CC_HANDLE CCHandle,
299 const CSSM_CONTEXT *Context,
300 const CSSM_DATA *DataBufs,
301 uint32 DataBufCount,
302 CSSM_ALGORITHMS DigestAlgorithm,
303 const CSSM_DATA *Signature)
304 {
305 BEGIN_API
306 findSession<CSPPluginSession>(CSPHandle).VerifyData(CCHandle,
307 Context::required(Context),
308 &CssmData::required(DataBufs),
309 DataBufCount,
310 DigestAlgorithm,
311 CssmData::required(Signature));
312 END_API(CSP)
313 }
314
315 static CSSM_RETURN CSSMCSPI cssm_GenerateMacUpdate(CSSM_CSP_HANDLE CSPHandle,
316 CSSM_CC_HANDLE CCHandle,
317 const CSSM_DATA *DataBufs,
318 uint32 DataBufCount)
319 {
320 BEGIN_API
321 findSession<CSPPluginSession>(CSPHandle).GenerateMacUpdate(CCHandle,
322 &CssmData::required(DataBufs),
323 DataBufCount);
324 END_API(CSP)
325 }
326
327 static CSSM_RETURN CSSMCSPI cssm_EncryptDataFinal(CSSM_CSP_HANDLE CSPHandle,
328 CSSM_CC_HANDLE CCHandle,
329 CSSM_DATA_PTR RemData)
330 {
331 BEGIN_API
332 findSession<CSPPluginSession>(CSPHandle).EncryptDataFinal(CCHandle,
333 CssmData::required(RemData));
334 END_API(CSP)
335 }
336
337 static CSSM_RETURN CSSMCSPI cssm_ChangeKeyOwner(CSSM_CSP_HANDLE CSPHandle,
338 const CSSM_ACCESS_CREDENTIALS *AccessCred,
339 const CSSM_KEY *Key,
340 const CSSM_ACL_OWNER_PROTOTYPE *NewOwner)
341 {
342 BEGIN_API
343 findSession<CSPPluginSession>(CSPHandle).ChangeKeyOwner(AccessCredentials::required(AccessCred),
344 CssmKey::required(Key),
345 Required(NewOwner));
346 END_API(CSP)
347 }
348
349 static CSSM_RETURN CSSMCSPI cssm_VerifyMacInit(CSSM_CSP_HANDLE CSPHandle,
350 CSSM_CC_HANDLE CCHandle,
351 const CSSM_CONTEXT *Context)
352 {
353 BEGIN_API
354 findSession<CSPPluginSession>(CSPHandle).VerifyMacInit(CCHandle,
355 Context::required(Context));
356 END_API(CSP)
357 }
358
359 static CSSM_RETURN CSSMCSPI cssm_DigestDataClone(CSSM_CSP_HANDLE CSPHandle,
360 CSSM_CC_HANDLE CCHandle,
361 CSSM_CC_HANDLE ClonedCCHandle)
362 {
363 BEGIN_API
364 findSession<CSPPluginSession>(CSPHandle).DigestDataClone(CCHandle,
365 ClonedCCHandle);
366 END_API(CSP)
367 }
368
369 static CSSM_RETURN CSSMCSPI cssm_VerifyDataInit(CSSM_CSP_HANDLE CSPHandle,
370 CSSM_CC_HANDLE CCHandle,
371 const CSSM_CONTEXT *Context)
372 {
373 BEGIN_API
374 findSession<CSPPluginSession>(CSPHandle).VerifyDataInit(CCHandle,
375 Context::required(Context));
376 END_API(CSP)
377 }
378
379 static CSSM_RETURN CSSMCSPI cssm_DecryptDataUpdate(CSSM_CSP_HANDLE CSPHandle,
380 CSSM_CC_HANDLE CCHandle,
381 const CSSM_DATA *CipherBufs,
382 uint32 CipherBufCount,
383 CSSM_DATA_PTR ClearBufs,
384 uint32 ClearBufCount,
385 CSSM_SIZE *bytesDecrypted)
386 {
387 BEGIN_API
388 findSession<CSPPluginSession>(CSPHandle).DecryptDataUpdate(CCHandle,
389 &CssmData::required(CipherBufs),
390 CipherBufCount,
391 &CssmData::required(ClearBufs),
392 ClearBufCount,
393 Required(bytesDecrypted));
394 END_API(CSP)
395 }
396
397 static CSSM_RETURN CSSMCSPI cssm_GenerateAlgorithmParams(CSSM_CSP_HANDLE CSPHandle,
398 CSSM_CC_HANDLE CCHandle,
399 const CSSM_CONTEXT *Context,
400 uint32 ParamBits,
401 CSSM_DATA_PTR Param,
402 uint32 *NumberOfUpdatedAttibutes,
403 CSSM_CONTEXT_ATTRIBUTE_PTR *UpdatedAttributes)
404 {
405 BEGIN_API
406 findSession<CSPPluginSession>(CSPHandle).GenerateAlgorithmParams(CCHandle,
407 Context::required(Context),
408 ParamBits,
409 CssmData::required(Param),
410 Required(NumberOfUpdatedAttibutes),
411 Required(UpdatedAttributes));
412 END_API(CSP)
413 }
414
415 static CSSM_RETURN CSSMCSPI cssm_GetLoginOwner(CSSM_CSP_HANDLE CSPHandle,
416 CSSM_ACL_OWNER_PROTOTYPE_PTR Owner)
417 {
418 BEGIN_API
419 findSession<CSPPluginSession>(CSPHandle).GetLoginOwner(Required(Owner));
420 END_API(CSP)
421 }
422
423 static CSSM_RETURN CSSMCSPI cssm_GetKeyAcl(CSSM_CSP_HANDLE CSPHandle,
424 const CSSM_KEY *Key,
425 const CSSM_STRING *SelectionTag,
426 uint32 *NumberOfAclInfos,
427 CSSM_ACL_ENTRY_INFO_PTR *AclInfos)
428 {
429 BEGIN_API
430 findSession<CSPPluginSession>(CSPHandle).GetKeyAcl(CssmKey::required(Key),
431 SelectionTag,
432 Required(NumberOfAclInfos),
433 Required(AclInfos));
434 END_API(CSP)
435 }
436
437 static CSSM_RETURN CSSMCSPI cssm_VerifyDevice(CSSM_CSP_HANDLE CSPHandle,
438 const CSSM_DATA *DeviceCert)
439 {
440 BEGIN_API
441 findSession<CSPPluginSession>(CSPHandle).VerifyDevice(CssmData::required(DeviceCert));
442 END_API(CSP)
443 }
444
445 static CSSM_RETURN CSSMCSPI cssm_EncryptDataUpdate(CSSM_CSP_HANDLE CSPHandle,
446 CSSM_CC_HANDLE CCHandle,
447 const CSSM_DATA *ClearBufs,
448 uint32 ClearBufCount,
449 CSSM_DATA_PTR CipherBufs,
450 uint32 CipherBufCount,
451 CSSM_SIZE *bytesEncrypted)
452 {
453 BEGIN_API
454 findSession<CSPPluginSession>(CSPHandle).EncryptDataUpdate(CCHandle,
455 &CssmData::required(ClearBufs),
456 ClearBufCount,
457 &CssmData::required(CipherBufs),
458 CipherBufCount,
459 Required(bytesEncrypted));
460 END_API(CSP)
461 }
462
463 static CSSM_RETURN CSSMCSPI cssm_DigestDataFinal(CSSM_CSP_HANDLE CSPHandle,
464 CSSM_CC_HANDLE CCHandle,
465 CSSM_DATA_PTR Digest)
466 {
467 BEGIN_API
468 findSession<CSPPluginSession>(CSPHandle).DigestDataFinal(CCHandle,
469 CssmData::required(Digest));
470 END_API(CSP)
471 }
472
473 static CSSM_RETURN CSSMCSPI cssm_Login(CSSM_CSP_HANDLE CSPHandle,
474 const CSSM_ACCESS_CREDENTIALS *AccessCred,
475 const CSSM_DATA *LoginName,
476 const void *Reserved)
477 {
478 BEGIN_API
479 findSession<CSPPluginSession>(CSPHandle).Login(AccessCredentials::required(AccessCred),
480 CssmData::optional(LoginName),
481 Reserved);
482 END_API(CSP)
483 }
484
485 static CSSM_RETURN CSSMCSPI cssm_ChangeKeyAcl(CSSM_CSP_HANDLE CSPHandle,
486 const CSSM_ACCESS_CREDENTIALS *AccessCred,
487 const CSSM_ACL_EDIT *AclEdit,
488 const CSSM_KEY *Key)
489 {
490 BEGIN_API
491 findSession<CSPPluginSession>(CSPHandle).ChangeKeyAcl(AccessCredentials::required(AccessCred),
492 Required(AclEdit),
493 CssmKey::required(Key));
494 END_API(CSP)
495 }
496
497 static CSSM_RETURN CSSMCSPI cssm_SignDataUpdate(CSSM_CSP_HANDLE CSPHandle,
498 CSSM_CC_HANDLE CCHandle,
499 const CSSM_DATA *DataBufs,
500 uint32 DataBufCount)
501 {
502 BEGIN_API
503 findSession<CSPPluginSession>(CSPHandle).SignDataUpdate(CCHandle,
504 &CssmData::required(DataBufs),
505 DataBufCount);
506 END_API(CSP)
507 }
508
509 static CSSM_RETURN CSSMCSPI cssm_QueryKeySizeInBits(CSSM_CSP_HANDLE CSPHandle,
510 CSSM_CC_HANDLE CCHandle,
511 const CSSM_CONTEXT *Context,
512 const CSSM_KEY *Key,
513 CSSM_KEY_SIZE_PTR KeySize)
514 {
515 BEGIN_API
516 findSession<CSPPluginSession>(CSPHandle).QueryKeySizeInBits(CCHandle,
517 Context::optional(Context),
518 CssmKey::optional(Key),
519 Required(KeySize));
520 END_API(CSP)
521 }
522
523 static CSSM_RETURN CSSMCSPI cssm_Logout(CSSM_CSP_HANDLE CSPHandle)
524 {
525 BEGIN_API
526 findSession<CSPPluginSession>(CSPHandle).Logout();
527 END_API(CSP)
528 }
529
530 static CSSM_RETURN CSSMCSPI cssm_DecryptData(CSSM_CSP_HANDLE CSPHandle,
531 CSSM_CC_HANDLE CCHandle,
532 const CSSM_CONTEXT *Context,
533 const CSSM_DATA *CipherBufs,
534 uint32 CipherBufCount,
535 CSSM_DATA_PTR ClearBufs,
536 uint32 ClearBufCount,
537 CSSM_SIZE *bytesDecrypted,
538 CSSM_DATA_PTR RemData,
539 CSSM_PRIVILEGE Privilege)
540 {
541 BEGIN_API
542 findSession<CSPPluginSession>(CSPHandle).DecryptData(CCHandle,
543 Context::required(Context),
544 &CssmData::required(CipherBufs),
545 CipherBufCount,
546 &CssmData::required(ClearBufs),
547 ClearBufCount,
548 Required(bytesDecrypted),
549 CssmData::required(RemData),
550 Privilege);
551 END_API(CSP)
552 }
553
554 static CSSM_RETURN CSSMCSPI cssm_DigestDataInit(CSSM_CSP_HANDLE CSPHandle,
555 CSSM_CC_HANDLE CCHandle,
556 const CSSM_CONTEXT *Context)
557 {
558 BEGIN_API
559 findSession<CSPPluginSession>(CSPHandle).DigestDataInit(CCHandle,
560 Context::required(Context));
561 END_API(CSP)
562 }
563
564 static CSSM_RETURN CSSMCSPI cssm_VerifyDataFinal(CSSM_CSP_HANDLE CSPHandle,
565 CSSM_CC_HANDLE CCHandle,
566 const CSSM_DATA *Signature)
567 {
568 BEGIN_API
569 findSession<CSPPluginSession>(CSPHandle).VerifyDataFinal(CCHandle,
570 CssmData::required(Signature));
571 END_API(CSP)
572 }
573
574 static CSSM_RETURN CSSMCSPI cssm_GenerateKeyPair(CSSM_CSP_HANDLE CSPHandle,
575 CSSM_CC_HANDLE CCHandle,
576 const CSSM_CONTEXT *Context,
577 uint32 PublicKeyUsage,
578 uint32 PublicKeyAttr,
579 const CSSM_DATA *PublicKeyLabel,
580 CSSM_KEY_PTR PublicKey,
581 uint32 PrivateKeyUsage,
582 uint32 PrivateKeyAttr,
583 const CSSM_DATA *PrivateKeyLabel,
584 const CSSM_RESOURCE_CONTROL_CONTEXT *CredAndAclEntry,
585 CSSM_KEY_PTR PrivateKey,
586 CSSM_PRIVILEGE Privilege)
587 {
588 BEGIN_API
589 findSession<CSPPluginSession>(CSPHandle).GenerateKeyPair(CCHandle,
590 Context::required(Context),
591 PublicKeyUsage,
592 PublicKeyAttr,
593 CssmData::optional(PublicKeyLabel),
594 CssmKey::required(PublicKey),
595 PrivateKeyUsage,
596 PrivateKeyAttr,
597 CssmData::optional(PrivateKeyLabel),
598 CredAndAclEntry,
599 CssmKey::required(PrivateKey),
600 Privilege);
601 END_API(CSP)
602 }
603
604 static CSSM_RETURN CSSMCSPI cssm_EncryptData(CSSM_CSP_HANDLE CSPHandle,
605 CSSM_CC_HANDLE CCHandle,
606 const CSSM_CONTEXT *Context,
607 const CSSM_DATA *ClearBufs,
608 uint32 ClearBufCount,
609 CSSM_DATA_PTR CipherBufs,
610 uint32 CipherBufCount,
611 CSSM_SIZE *bytesEncrypted,
612 CSSM_DATA_PTR RemData,
613 CSSM_PRIVILEGE Privilege)
614 {
615 BEGIN_API
616 findSession<CSPPluginSession>(CSPHandle).EncryptData(CCHandle,
617 Context::required(Context),
618 &CssmData::required(ClearBufs),
619 ClearBufCount,
620 &CssmData::required(CipherBufs),
621 CipherBufCount,
622 Required(bytesEncrypted),
623 CssmData::required(RemData),
624 Privilege);
625 END_API(CSP)
626 }
627
628 static CSSM_RETURN CSSMCSPI cssm_GetTimeValue(CSSM_CSP_HANDLE CSPHandle,
629 CSSM_ALGORITHMS TimeAlgorithm,
630 CSSM_DATA *TimeData)
631 {
632 BEGIN_API
633 findSession<CSPPluginSession>(CSPHandle).GetTimeValue(TimeAlgorithm,
634 CssmData::required(TimeData));
635 END_API(CSP)
636 }
637
638 static CSSM_RETURN CSSMCSPI cssm_DeriveKey(CSSM_CSP_HANDLE CSPHandle,
639 CSSM_CC_HANDLE CCHandle,
640 const CSSM_CONTEXT *Context,
641 CSSM_DATA_PTR Param,
642 uint32 KeyUsage,
643 uint32 KeyAttr,
644 const CSSM_DATA *KeyLabel,
645 const CSSM_RESOURCE_CONTROL_CONTEXT *CredAndAclEntry,
646 CSSM_KEY_PTR DerivedKey)
647 {
648 BEGIN_API
649 findSession<CSPPluginSession>(CSPHandle).DeriveKey(CCHandle,
650 Context::required(Context),
651 CssmData::required(Param),
652 KeyUsage,
653 KeyAttr,
654 CssmData::optional(KeyLabel),
655 CredAndAclEntry,
656 CssmKey::required(DerivedKey));
657 END_API(CSP)
658 }
659
660 static CSSM_RETURN CSSMCSPI cssm_GenerateKey(CSSM_CSP_HANDLE CSPHandle,
661 CSSM_CC_HANDLE CCHandle,
662 const CSSM_CONTEXT *Context,
663 uint32 KeyUsage,
664 uint32 KeyAttr,
665 const CSSM_DATA *KeyLabel,
666 const CSSM_RESOURCE_CONTROL_CONTEXT *CredAndAclEntry,
667 CSSM_KEY_PTR Key,
668 CSSM_PRIVILEGE Privilege)
669 {
670 BEGIN_API
671 findSession<CSPPluginSession>(CSPHandle).GenerateKey(CCHandle,
672 Context::required(Context),
673 KeyUsage,
674 KeyAttr,
675 CssmData::optional(KeyLabel),
676 CredAndAclEntry,
677 CssmKey::required(Key),
678 Privilege);
679 END_API(CSP)
680 }
681
682 static CSSM_RETURN CSSMCSPI cssm_PassThrough(CSSM_CSP_HANDLE CSPHandle,
683 CSSM_CC_HANDLE CCHandle,
684 const CSSM_CONTEXT *Context,
685 uint32 PassThroughId,
686 const void *InData,
687 void **OutData)
688 {
689 BEGIN_API
690 findSession<CSPPluginSession>(CSPHandle).PassThrough(CCHandle,
691 Context::required(Context),
692 PassThroughId,
693 InData,
694 OutData);
695 END_API(CSP)
696 }
697
698 static CSSM_RETURN CSSMCSPI cssm_VerifyMacUpdate(CSSM_CSP_HANDLE CSPHandle,
699 CSSM_CC_HANDLE CCHandle,
700 const CSSM_DATA *DataBufs,
701 uint32 DataBufCount)
702 {
703 BEGIN_API
704 findSession<CSPPluginSession>(CSPHandle).VerifyMacUpdate(CCHandle,
705 &CssmData::required(DataBufs),
706 DataBufCount);
707 END_API(CSP)
708 }
709
710 static CSSM_RETURN CSSMCSPI cssm_FreeKey(CSSM_CSP_HANDLE CSPHandle,
711 const CSSM_ACCESS_CREDENTIALS *AccessCred,
712 CSSM_KEY_PTR KeyPtr,
713 CSSM_BOOL Delete)
714 {
715 BEGIN_API
716 findSession<CSPPluginSession>(CSPHandle).FreeKey(AccessCredentials::optional(AccessCred),
717 CssmKey::required(KeyPtr),
718 Delete);
719 END_API(CSP)
720 }
721
722 static CSSM_RETURN CSSMCSPI cssm_GenerateMacInit(CSSM_CSP_HANDLE CSPHandle,
723 CSSM_CC_HANDLE CCHandle,
724 const CSSM_CONTEXT *Context)
725 {
726 BEGIN_API
727 findSession<CSPPluginSession>(CSPHandle).GenerateMacInit(CCHandle,
728 Context::required(Context));
729 END_API(CSP)
730 }
731
732 static CSSM_RETURN CSSMCSPI cssm_RetrieveCounter(CSSM_CSP_HANDLE CSPHandle,
733 CSSM_DATA_PTR Counter)
734 {
735 BEGIN_API
736 findSession<CSPPluginSession>(CSPHandle).RetrieveCounter(CssmData::required(Counter));
737 END_API(CSP)
738 }
739
740 static CSSM_RETURN CSSMCSPI cssm_QuerySize(CSSM_CSP_HANDLE CSPHandle,
741 CSSM_CC_HANDLE CCHandle,
742 const CSSM_CONTEXT *Context,
743 CSSM_BOOL Encrypt,
744 uint32 QuerySizeCount,
745 CSSM_QUERY_SIZE_DATA_PTR DataBlock)
746 {
747 BEGIN_API
748 findSession<CSPPluginSession>(CSPHandle).QuerySize(CCHandle,
749 Context::required(Context),
750 Encrypt,
751 QuerySizeCount,
752 QuerySizeData::optional(DataBlock));
753 END_API(CSP)
754 }
755
756 static CSSM_RETURN CSSMCSPI cssm_ChangeLoginAcl(CSSM_CSP_HANDLE CSPHandle,
757 const CSSM_ACCESS_CREDENTIALS *AccessCred,
758 const CSSM_ACL_EDIT *AclEdit)
759 {
760 BEGIN_API
761 findSession<CSPPluginSession>(CSPHandle).ChangeLoginAcl(AccessCredentials::required(AccessCred),
762 Required(AclEdit));
763 END_API(CSP)
764 }
765
766 static CSSM_RETURN CSSMCSPI cssm_DigestDataUpdate(CSSM_CSP_HANDLE CSPHandle,
767 CSSM_CC_HANDLE CCHandle,
768 const CSSM_DATA *DataBufs,
769 uint32 DataBufCount)
770 {
771 BEGIN_API
772 findSession<CSPPluginSession>(CSPHandle).DigestDataUpdate(CCHandle,
773 &CssmData::required(DataBufs),
774 DataBufCount);
775 END_API(CSP)
776 }
777
778
779 static const CSSM_SPI_CSP_FUNCS CSPFunctionStruct = {
780 cssm_EventNotify,
781 cssm_QuerySize,
782 cssm_SignData,
783 cssm_SignDataInit,
784 cssm_SignDataUpdate,
785 cssm_SignDataFinal,
786 cssm_VerifyData,
787 cssm_VerifyDataInit,
788 cssm_VerifyDataUpdate,
789 cssm_VerifyDataFinal,
790 cssm_DigestData,
791 cssm_DigestDataInit,
792 cssm_DigestDataUpdate,
793 cssm_DigestDataClone,
794 cssm_DigestDataFinal,
795 cssm_GenerateMac,
796 cssm_GenerateMacInit,
797 cssm_GenerateMacUpdate,
798 cssm_GenerateMacFinal,
799 cssm_VerifyMac,
800 cssm_VerifyMacInit,
801 cssm_VerifyMacUpdate,
802 cssm_VerifyMacFinal,
803 cssm_EncryptData,
804 cssm_EncryptDataInit,
805 cssm_EncryptDataUpdate,
806 cssm_EncryptDataFinal,
807 cssm_DecryptData,
808 cssm_DecryptDataInit,
809 cssm_DecryptDataUpdate,
810 cssm_DecryptDataFinal,
811 cssm_QueryKeySizeInBits,
812 cssm_GenerateKey,
813 cssm_GenerateKeyPair,
814 cssm_GenerateRandom,
815 cssm_GenerateAlgorithmParams,
816 cssm_WrapKey,
817 cssm_UnwrapKey,
818 cssm_DeriveKey,
819 cssm_FreeKey,
820 cssm_PassThrough,
821 cssm_Login,
822 cssm_Logout,
823 cssm_ChangeLoginAcl,
824 cssm_ObtainPrivateKeyFromPublicKey,
825 cssm_RetrieveUniqueId,
826 cssm_RetrieveCounter,
827 cssm_VerifyDevice,
828 cssm_GetTimeValue,
829 cssm_GetOperationalStatistics,
830 cssm_GetLoginAcl,
831 cssm_GetKeyAcl,
832 cssm_ChangeKeyAcl,
833 cssm_GetKeyOwner,
834 cssm_ChangeKeyOwner,
835 cssm_GetLoginOwner,
836 cssm_ChangeLoginOwner,
837 };
838
839 static CSSM_MODULE_FUNCS CSPFunctionTable = {
840 CSSM_SERVICE_CSP, // service type
841 57, // number of functions
842 (const CSSM_PROC_ADDR *)&CSPFunctionStruct
843 };
844
845 CSSM_MODULE_FUNCS_PTR CSPPluginSession::construct()
846 {
847 return &CSPFunctionTable;
848 }