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