]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cdsa_plugin/lib/CLabstractsession.cpp
Security-59754.80.3.tar.gz
[apple/security.git] / OSX / libsecurity_cdsa_plugin / lib / CLabstractsession.cpp
1 //
2 // CL plugin transition layer.
3 // This file was automatically generated. Do not edit on penalty of futility!
4 //
5 #include <security_cdsa_plugin/CLsession.h>
6 #include <security_cdsa_plugin/cssmplugin.h>
7 #include <security_cdsa_utilities/cssmbridge.h>
8 #include <Security/cssmcli.h>
9 // The disclaimer up top used to be true but rdar://24426719 removed libsecurity_cdsa_plugin_generate
10 #include "LegacyAPICounts.h"
11
12 CLAbstractPluginSession::~CLAbstractPluginSession()
13 { /* virtual */ }
14
15 static CSSM_RETURN CSSMCLI cssm_CertGetFirstFieldValue(CSSM_CL_HANDLE CLHandle,
16 const CSSM_DATA *Cert,
17 const CSSM_OID *CertField,
18 CSSM_HANDLE_PTR ResultsHandle,
19 uint32 *NumberOfMatchedFields,
20 CSSM_DATA_PTR *Value)
21 {
22 BEGIN_API
23 if ((Required(ResultsHandle) = findSession<CLPluginSession>(CLHandle).CertGetFirstFieldValue(CssmData::required(Cert),
24 CssmData::required(CertField),
25 Required(NumberOfMatchedFields),
26 Required(Value))) == CSSM_INVALID_HANDLE)
27 return CSSMERR_CL_NO_FIELD_VALUES;
28 END_API(CL)
29 }
30
31 static CSSM_RETURN CSSMCLI cssm_PassThrough(CSSM_CL_HANDLE CLHandle,
32 CSSM_CC_HANDLE CCHandle,
33 uint32 PassThroughId,
34 const void *InputParams,
35 void **OutputParams)
36 {
37 BEGIN_API
38 findSession<CLPluginSession>(CLHandle).PassThrough(CCHandle,
39 PassThroughId,
40 InputParams,
41 OutputParams);
42 END_API(CL)
43 }
44
45 static CSSM_RETURN CSSMCLI cssm_CertGetNextCachedFieldValue(CSSM_CL_HANDLE CLHandle,
46 CSSM_HANDLE ResultsHandle,
47 CSSM_DATA_PTR *Value)
48 {
49 BEGIN_API
50 if (!findSession<CLPluginSession>(CLHandle).CertGetNextCachedFieldValue(ResultsHandle,
51 Required(Value)))
52 return CSSMERR_CL_NO_FIELD_VALUES;
53 END_API(CL)
54 }
55
56 static CSSM_RETURN CSSMCLI cssm_CrlCreateTemplate(CSSM_CL_HANDLE CLHandle,
57 uint32 NumberOfFields,
58 const CSSM_FIELD *CrlTemplate,
59 CSSM_DATA_PTR NewCrl)
60 {
61 BEGIN_API
62 findSession<CLPluginSession>(CLHandle).CrlCreateTemplate(NumberOfFields,
63 CrlTemplate,
64 CssmData::required(NewCrl));
65 END_API(CL)
66 }
67
68 static CSSM_RETURN CSSMCLI cssm_CertSign(CSSM_CL_HANDLE CLHandle,
69 CSSM_CC_HANDLE CCHandle,
70 const CSSM_DATA *CertTemplate,
71 const CSSM_FIELD *SignScope,
72 uint32 ScopeSize,
73 CSSM_DATA_PTR SignedCert)
74 {
75 BEGIN_API
76 findSession<CLPluginSession>(CLHandle).CertSign(CCHandle,
77 CssmData::required(CertTemplate),
78 SignScope,
79 ScopeSize,
80 CssmData::required(SignedCert));
81 END_API(CL)
82 }
83
84 static CSSM_RETURN CSSMCLI cssm_CrlGetFirstFieldValue(CSSM_CL_HANDLE CLHandle,
85 const CSSM_DATA *Crl,
86 const CSSM_OID *CrlField,
87 CSSM_HANDLE_PTR ResultsHandle,
88 uint32 *NumberOfMatchedFields,
89 CSSM_DATA_PTR *Value)
90 {
91 BEGIN_API
92 if ((Required(ResultsHandle) = findSession<CLPluginSession>(CLHandle).CrlGetFirstFieldValue(CssmData::required(Crl),
93 CssmData::required(CrlField),
94 Required(NumberOfMatchedFields),
95 Required(Value))) == CSSM_INVALID_HANDLE)
96 return CSSMERR_CL_NO_FIELD_VALUES;
97 END_API(CL)
98 }
99
100 static CSSM_RETURN CSSMCLI cssm_CrlGetNextFieldValue(CSSM_CL_HANDLE CLHandle,
101 CSSM_HANDLE ResultsHandle,
102 CSSM_DATA_PTR *Value)
103 {
104 BEGIN_API
105 if (!findSession<CLPluginSession>(CLHandle).CrlGetNextFieldValue(ResultsHandle,
106 Required(Value)))
107 return CSSMERR_CL_NO_FIELD_VALUES;
108 END_API(CL)
109 }
110
111 static CSSM_RETURN CSSMCLI cssm_FreeFields(CSSM_CL_HANDLE CLHandle,
112 uint32 NumberOfFields,
113 CSSM_FIELD_PTR *FieldArray)
114 {
115 BEGIN_API
116 findSession<CLPluginSession>(CLHandle).FreeFields(NumberOfFields,
117 Required(FieldArray));
118 END_API(CL)
119 }
120
121 static CSSM_RETURN CSSMCLI cssm_CrlGetAllFields(CSSM_CL_HANDLE CLHandle,
122 const CSSM_DATA *Crl,
123 uint32 *NumberOfCrlFields,
124 CSSM_FIELD_PTR *CrlFields)
125 {
126 BEGIN_API
127 findSession<CLPluginSession>(CLHandle).CrlGetAllFields(CssmData::required(Crl),
128 Required(NumberOfCrlFields),
129 Required(CrlFields));
130 END_API(CL)
131 }
132
133 static CSSM_RETURN CSSMCLI cssm_CrlAbortCache(CSSM_CL_HANDLE CLHandle,
134 CSSM_HANDLE CrlHandle)
135 {
136 BEGIN_API
137 findSession<CLPluginSession>(CLHandle).CrlAbortCache(CrlHandle);
138 END_API(CL)
139 }
140
141 static CSSM_RETURN CSSMCLI cssm_CertGetAllTemplateFields(CSSM_CL_HANDLE CLHandle,
142 const CSSM_DATA *CertTemplate,
143 uint32 *NumberOfFields,
144 CSSM_FIELD_PTR *CertFields)
145 {
146 BEGIN_API
147 findSession<CLPluginSession>(CLHandle).CertGetAllTemplateFields(CssmData::required(CertTemplate),
148 Required(NumberOfFields),
149 Required(CertFields));
150 END_API(CL)
151 }
152
153 static CSSM_RETURN CSSMCLI cssm_CrlSetFields(CSSM_CL_HANDLE CLHandle,
154 uint32 NumberOfFields,
155 const CSSM_FIELD *CrlTemplate,
156 const CSSM_DATA *OldCrl,
157 CSSM_DATA_PTR ModifiedCrl)
158 {
159 BEGIN_API
160 findSession<CLPluginSession>(CLHandle).CrlSetFields(NumberOfFields,
161 CrlTemplate,
162 CssmData::required(OldCrl),
163 CssmData::required(ModifiedCrl));
164 END_API(CL)
165 }
166
167 static CSSM_RETURN CSSMCLI cssm_CertGetAllFields(CSSM_CL_HANDLE CLHandle,
168 const CSSM_DATA *Cert,
169 uint32 *NumberOfFields,
170 CSSM_FIELD_PTR *CertFields)
171 {
172 BEGIN_API
173 findSession<CLPluginSession>(CLHandle).CertGetAllFields(CssmData::required(Cert),
174 Required(NumberOfFields),
175 Required(CertFields));
176 END_API(CL)
177 }
178
179 static CSSM_RETURN CSSMCLI cssm_CrlAddCert(CSSM_CL_HANDLE CLHandle,
180 CSSM_CC_HANDLE CCHandle,
181 const CSSM_DATA *Cert,
182 uint32 NumberOfFields,
183 const CSSM_FIELD *CrlEntryFields,
184 const CSSM_DATA *OldCrl,
185 CSSM_DATA_PTR NewCrl)
186 {
187 BEGIN_API
188 findSession<CLPluginSession>(CLHandle).CrlAddCert(CCHandle,
189 CssmData::required(Cert),
190 NumberOfFields,
191 CrlEntryFields,
192 CssmData::required(OldCrl),
193 CssmData::required(NewCrl));
194 END_API(CL)
195 }
196
197 static CSSM_RETURN CSSMCLI cssm_IsCertInCachedCrl(CSSM_CL_HANDLE CLHandle,
198 const CSSM_DATA *Cert,
199 CSSM_HANDLE CrlHandle,
200 CSSM_BOOL *CertFound,
201 CSSM_DATA_PTR CrlRecordIndex)
202 {
203 BEGIN_API
204 findSession<CLPluginSession>(CLHandle).IsCertInCachedCrl(CssmData::required(Cert),
205 CrlHandle,
206 Required(CertFound),
207 CssmData::required(CrlRecordIndex));
208 END_API(CL)
209 }
210
211 static CSSM_RETURN CSSMCLI cssm_CrlSign(CSSM_CL_HANDLE CLHandle,
212 CSSM_CC_HANDLE CCHandle,
213 const CSSM_DATA *UnsignedCrl,
214 const CSSM_FIELD *SignScope,
215 uint32 ScopeSize,
216 CSSM_DATA_PTR SignedCrl)
217 {
218 BEGIN_API
219 findSession<CLPluginSession>(CLHandle).CrlSign(CCHandle,
220 CssmData::required(UnsignedCrl),
221 SignScope,
222 ScopeSize,
223 CssmData::required(SignedCrl));
224 END_API(CL)
225 }
226
227 static CSSM_RETURN CSSMCLI cssm_CertAbortQuery(CSSM_CL_HANDLE CLHandle,
228 CSSM_HANDLE ResultsHandle)
229 {
230 BEGIN_API
231 findSession<CLPluginSession>(CLHandle).CertAbortQuery(ResultsHandle);
232 END_API(CL)
233 }
234
235 static CSSM_RETURN CSSMCLI cssm_CertGetNextFieldValue(CSSM_CL_HANDLE CLHandle,
236 CSSM_HANDLE ResultsHandle,
237 CSSM_DATA_PTR *Value)
238 {
239 BEGIN_API
240 if (!findSession<CLPluginSession>(CLHandle).CertGetNextFieldValue(ResultsHandle,
241 Required(Value)))
242 return CSSMERR_CL_NO_FIELD_VALUES;
243 END_API(CL)
244 }
245
246 static CSSM_RETURN CSSMCLI cssm_CertCreateTemplate(CSSM_CL_HANDLE CLHandle,
247 uint32 NumberOfFields,
248 const CSSM_FIELD *CertFields,
249 CSSM_DATA_PTR CertTemplate)
250 {
251 BEGIN_API
252 findSession<CLPluginSession>(CLHandle).CertCreateTemplate(NumberOfFields,
253 CertFields,
254 CssmData::required(CertTemplate));
255 END_API(CL)
256 }
257
258 static CSSM_RETURN CSSMCLI cssm_CertCache(CSSM_CL_HANDLE CLHandle,
259 const CSSM_DATA *Cert,
260 CSSM_HANDLE_PTR CertHandle)
261 {
262 BEGIN_API
263 findSession<CLPluginSession>(CLHandle).CertCache(CssmData::required(Cert),
264 Required(CertHandle));
265 END_API(CL)
266 }
267
268 static CSSM_RETURN CSSMCLI cssm_CrlVerifyWithKey(CSSM_CL_HANDLE CLHandle,
269 CSSM_CC_HANDLE CCHandle,
270 const CSSM_DATA *CrlToBeVerified)
271 {
272 BEGIN_API
273 findSession<CLPluginSession>(CLHandle).CrlVerifyWithKey(CCHandle,
274 CssmData::required(CrlToBeVerified));
275 END_API(CL)
276 }
277
278 static CSSM_RETURN CSSMCLI cssm_CrlGetAllCachedRecordFields(CSSM_CL_HANDLE CLHandle,
279 CSSM_HANDLE CrlHandle,
280 const CSSM_DATA *CrlRecordIndex,
281 uint32 *NumberOfFields,
282 CSSM_FIELD_PTR *CrlFields)
283 {
284 BEGIN_API
285 findSession<CLPluginSession>(CLHandle).CrlGetAllCachedRecordFields(CrlHandle,
286 CssmData::required(CrlRecordIndex),
287 Required(NumberOfFields),
288 Required(CrlFields));
289 END_API(CL)
290 }
291
292 static CSSM_RETURN CSSMCLI cssm_CrlRemoveCert(CSSM_CL_HANDLE CLHandle,
293 const CSSM_DATA *Cert,
294 const CSSM_DATA *OldCrl,
295 CSSM_DATA_PTR NewCrl)
296 {
297 BEGIN_API
298 findSession<CLPluginSession>(CLHandle).CrlRemoveCert(CssmData::required(Cert),
299 CssmData::required(OldCrl),
300 CssmData::required(NewCrl));
301 END_API(CL)
302 }
303
304 static CSSM_RETURN CSSMCLI cssm_CertVerifyWithKey(CSSM_CL_HANDLE CLHandle,
305 CSSM_CC_HANDLE CCHandle,
306 const CSSM_DATA *CertToBeVerified)
307 {
308 BEGIN_API
309 findSession<CLPluginSession>(CLHandle).CertVerifyWithKey(CCHandle,
310 CssmData::required(CertToBeVerified));
311 END_API(CL)
312 }
313
314 static CSSM_RETURN CSSMCLI cssm_CrlGetFirstCachedFieldValue(CSSM_CL_HANDLE CLHandle,
315 CSSM_HANDLE CrlHandle,
316 const CSSM_DATA *CrlRecordIndex,
317 const CSSM_OID *CrlField,
318 CSSM_HANDLE_PTR ResultsHandle,
319 uint32 *NumberOfMatchedFields,
320 CSSM_DATA_PTR *Value)
321 {
322 BEGIN_API
323 if ((Required(ResultsHandle) = findSession<CLPluginSession>(CLHandle).CrlGetFirstCachedFieldValue(CrlHandle,
324 CssmData::optional(CrlRecordIndex),
325 CssmData::required(CrlField),
326 Required(NumberOfMatchedFields),
327 Required(Value))) == CSSM_INVALID_HANDLE)
328 return CSSMERR_CL_NO_FIELD_VALUES;
329 END_API(CL)
330 }
331
332 static CSSM_RETURN CSSMCLI cssm_CertGetFirstCachedFieldValue(CSSM_CL_HANDLE CLHandle,
333 CSSM_HANDLE CertHandle,
334 const CSSM_OID *CertField,
335 CSSM_HANDLE_PTR ResultsHandle,
336 uint32 *NumberOfMatchedFields,
337 CSSM_DATA_PTR *Value)
338 {
339 BEGIN_API
340 if ((Required(ResultsHandle) = findSession<CLPluginSession>(CLHandle).CertGetFirstCachedFieldValue(CertHandle,
341 CssmData::required(CertField),
342 Required(NumberOfMatchedFields),
343 Required(Value))) == CSSM_INVALID_HANDLE)
344 return CSSMERR_CL_NO_FIELD_VALUES;
345 END_API(CL)
346 }
347
348 static CSSM_RETURN CSSMCLI cssm_CertVerify(CSSM_CL_HANDLE CLHandle,
349 CSSM_CC_HANDLE CCHandle,
350 const CSSM_DATA *CertToBeVerified,
351 const CSSM_DATA *SignerCert,
352 const CSSM_FIELD *VerifyScope,
353 uint32 ScopeSize)
354 {
355 BEGIN_API
356 findSession<CLPluginSession>(CLHandle).CertVerify(CCHandle,
357 CssmData::required(CertToBeVerified),
358 CssmData::optional(SignerCert),
359 VerifyScope,
360 ScopeSize);
361 END_API(CL)
362 }
363
364 static CSSM_RETURN CSSMCLI cssm_CertGetKeyInfo(CSSM_CL_HANDLE CLHandle,
365 const CSSM_DATA *Cert,
366 CSSM_KEY_PTR *Key)
367 {
368 BEGIN_API
369 findSession<CLPluginSession>(CLHandle).CertGetKeyInfo(CssmData::required(Cert),
370 Required(Key));
371 END_API(CL)
372 }
373
374 static CSSM_RETURN CSSMCLI cssm_CrlVerify(CSSM_CL_HANDLE CLHandle,
375 CSSM_CC_HANDLE CCHandle,
376 const CSSM_DATA *CrlToBeVerified,
377 const CSSM_DATA *SignerCert,
378 const CSSM_FIELD *VerifyScope,
379 uint32 ScopeSize)
380 {
381 BEGIN_API
382 findSession<CLPluginSession>(CLHandle).CrlVerify(CCHandle,
383 CssmData::required(CrlToBeVerified),
384 CssmData::optional(SignerCert),
385 VerifyScope,
386 ScopeSize);
387 END_API(CL)
388 }
389
390 static CSSM_RETURN CSSMCLI cssm_CrlDescribeFormat(CSSM_CL_HANDLE CLHandle,
391 uint32 *NumberOfFields,
392 CSSM_OID_PTR *OidList)
393 {
394 BEGIN_API
395 findSession<CLPluginSession>(CLHandle).CrlDescribeFormat(Required(NumberOfFields),
396 Required(OidList));
397 END_API(CL)
398 }
399
400 static CSSM_RETURN CSSMCLI cssm_CrlAbortQuery(CSSM_CL_HANDLE CLHandle,
401 CSSM_HANDLE ResultsHandle)
402 {
403 BEGIN_API
404 findSession<CLPluginSession>(CLHandle).CrlAbortQuery(ResultsHandle);
405 END_API(CL)
406 }
407
408 static CSSM_RETURN CSSMCLI cssm_CertDescribeFormat(CSSM_CL_HANDLE CLHandle,
409 uint32 *NumberOfFields,
410 CSSM_OID_PTR *OidList)
411 {
412 BEGIN_API
413 findSession<CLPluginSession>(CLHandle).CertDescribeFormat(Required(NumberOfFields),
414 Required(OidList));
415 END_API(CL)
416 }
417
418 static CSSM_RETURN CSSMCLI cssm_FreeFieldValue(CSSM_CL_HANDLE CLHandle,
419 const CSSM_OID *CertOrCrlOid,
420 CSSM_DATA_PTR Value)
421 {
422 BEGIN_API
423 findSession<CLPluginSession>(CLHandle).FreeFieldValue(CssmData::required(CertOrCrlOid),
424 CssmData::required(Value));
425 END_API(CL)
426 }
427
428 static CSSM_RETURN CSSMCLI cssm_CertGroupToSignedBundle(CSSM_CL_HANDLE CLHandle,
429 CSSM_CC_HANDLE CCHandle,
430 const CSSM_CERTGROUP *CertGroupToBundle,
431 const CSSM_CERT_BUNDLE_HEADER *BundleInfo,
432 CSSM_DATA_PTR SignedBundle)
433 {
434 BEGIN_API
435 findSession<CLPluginSession>(CLHandle).CertGroupToSignedBundle(CCHandle,
436 Required(CertGroupToBundle),
437 BundleInfo,
438 CssmData::required(SignedBundle));
439 END_API(CL)
440 }
441
442 static CSSM_RETURN CSSMCLI cssm_CertAbortCache(CSSM_CL_HANDLE CLHandle,
443 CSSM_HANDLE CertHandle)
444 {
445 BEGIN_API
446 findSession<CLPluginSession>(CLHandle).CertAbortCache(CertHandle);
447 END_API(CL)
448 }
449
450 static CSSM_RETURN CSSMCLI cssm_CrlCache(CSSM_CL_HANDLE CLHandle,
451 const CSSM_DATA *Crl,
452 CSSM_HANDLE_PTR CrlHandle)
453 {
454 BEGIN_API
455 findSession<CLPluginSession>(CLHandle).CrlCache(CssmData::required(Crl),
456 Required(CrlHandle));
457 END_API(CL)
458 }
459
460 static CSSM_RETURN CSSMCLI cssm_IsCertInCrl(CSSM_CL_HANDLE CLHandle,
461 const CSSM_DATA *Cert,
462 const CSSM_DATA *Crl,
463 CSSM_BOOL *CertFound)
464 {
465 BEGIN_API
466 findSession<CLPluginSession>(CLHandle).IsCertInCrl(CssmData::required(Cert),
467 CssmData::required(Crl),
468 Required(CertFound));
469 END_API(CL)
470 }
471
472 static CSSM_RETURN CSSMCLI cssm_CrlGetNextCachedFieldValue(CSSM_CL_HANDLE CLHandle,
473 CSSM_HANDLE ResultsHandle,
474 CSSM_DATA_PTR *Value)
475 {
476 BEGIN_API
477 if (!findSession<CLPluginSession>(CLHandle).CrlGetNextCachedFieldValue(ResultsHandle,
478 Required(Value)))
479 return CSSMERR_CL_NO_FIELD_VALUES;
480 END_API(CL)
481 }
482
483 static CSSM_RETURN CSSMCLI cssm_CertGroupFromVerifiedBundle(CSSM_CL_HANDLE CLHandle,
484 CSSM_CC_HANDLE CCHandle,
485 const CSSM_CERT_BUNDLE *CertBundle,
486 const CSSM_DATA *SignerCert,
487 CSSM_CERTGROUP_PTR *CertGroup)
488 {
489 BEGIN_API
490 findSession<CLPluginSession>(CLHandle).CertGroupFromVerifiedBundle(CCHandle,
491 Required(CertBundle),
492 CssmData::optional(SignerCert),
493 Required(CertGroup));
494 END_API(CL)
495 }
496
497
498 static const CSSM_SPI_CL_FUNCS CLFunctionStruct = {
499 cssm_CertCreateTemplate,
500 cssm_CertGetAllTemplateFields,
501 cssm_CertSign,
502 cssm_CertVerify,
503 cssm_CertVerifyWithKey,
504 cssm_CertGetFirstFieldValue,
505 cssm_CertGetNextFieldValue,
506 cssm_CertAbortQuery,
507 cssm_CertGetKeyInfo,
508 cssm_CertGetAllFields,
509 cssm_FreeFields,
510 cssm_FreeFieldValue,
511 cssm_CertCache,
512 cssm_CertGetFirstCachedFieldValue,
513 cssm_CertGetNextCachedFieldValue,
514 cssm_CertAbortCache,
515 cssm_CertGroupToSignedBundle,
516 cssm_CertGroupFromVerifiedBundle,
517 cssm_CertDescribeFormat,
518 cssm_CrlCreateTemplate,
519 cssm_CrlSetFields,
520 cssm_CrlAddCert,
521 cssm_CrlRemoveCert,
522 cssm_CrlSign,
523 cssm_CrlVerify,
524 cssm_CrlVerifyWithKey,
525 cssm_IsCertInCrl,
526 cssm_CrlGetFirstFieldValue,
527 cssm_CrlGetNextFieldValue,
528 cssm_CrlAbortQuery,
529 cssm_CrlGetAllFields,
530 cssm_CrlCache,
531 cssm_IsCertInCachedCrl,
532 cssm_CrlGetFirstCachedFieldValue,
533 cssm_CrlGetNextCachedFieldValue,
534 cssm_CrlGetAllCachedRecordFields,
535 cssm_CrlAbortCache,
536 cssm_CrlDescribeFormat,
537 cssm_PassThrough,
538 };
539
540 static CSSM_MODULE_FUNCS CLFunctionTable = {
541 CSSM_SERVICE_CL, // service type
542 39, // number of functions
543 (const CSSM_PROC_ADDR *)&CLFunctionStruct
544 };
545
546 CSSM_MODULE_FUNCS_PTR CLPluginSession::construct()
547 {
548 return &CLFunctionTable;
549 }