2 // CL plugin transition layer.
3 // This file was automatically generated. Do not edit on penalty of futility!
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"
12 CLAbstractPluginSession::~CLAbstractPluginSession()
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
,
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
;
31 static CSSM_RETURN CSSMCLI
cssm_PassThrough(CSSM_CL_HANDLE CLHandle
,
32 CSSM_CC_HANDLE CCHandle
,
34 const void *InputParams
,
38 findSession
<CLPluginSession
>(CLHandle
).PassThrough(CCHandle
,
45 static CSSM_RETURN CSSMCLI
cssm_CertGetNextCachedFieldValue(CSSM_CL_HANDLE CLHandle
,
46 CSSM_HANDLE ResultsHandle
,
50 if (!findSession
<CLPluginSession
>(CLHandle
).CertGetNextCachedFieldValue(ResultsHandle
,
52 return CSSMERR_CL_NO_FIELD_VALUES
;
56 static CSSM_RETURN CSSMCLI
cssm_CrlCreateTemplate(CSSM_CL_HANDLE CLHandle
,
57 uint32 NumberOfFields
,
58 const CSSM_FIELD
*CrlTemplate
,
62 findSession
<CLPluginSession
>(CLHandle
).CrlCreateTemplate(NumberOfFields
,
64 CssmData::required(NewCrl
));
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
,
73 CSSM_DATA_PTR SignedCert
)
76 findSession
<CLPluginSession
>(CLHandle
).CertSign(CCHandle
,
77 CssmData::required(CertTemplate
),
80 CssmData::required(SignedCert
));
84 static CSSM_RETURN CSSMCLI
cssm_CrlGetFirstFieldValue(CSSM_CL_HANDLE CLHandle
,
86 const CSSM_OID
*CrlField
,
87 CSSM_HANDLE_PTR ResultsHandle
,
88 uint32
*NumberOfMatchedFields
,
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
;
100 static CSSM_RETURN CSSMCLI
cssm_CrlGetNextFieldValue(CSSM_CL_HANDLE CLHandle
,
101 CSSM_HANDLE ResultsHandle
,
102 CSSM_DATA_PTR
*Value
)
105 if (!findSession
<CLPluginSession
>(CLHandle
).CrlGetNextFieldValue(ResultsHandle
,
107 return CSSMERR_CL_NO_FIELD_VALUES
;
111 static CSSM_RETURN CSSMCLI
cssm_FreeFields(CSSM_CL_HANDLE CLHandle
,
112 uint32 NumberOfFields
,
113 CSSM_FIELD_PTR
*FieldArray
)
116 findSession
<CLPluginSession
>(CLHandle
).FreeFields(NumberOfFields
,
117 Required(FieldArray
));
121 static CSSM_RETURN CSSMCLI
cssm_CrlGetAllFields(CSSM_CL_HANDLE CLHandle
,
122 const CSSM_DATA
*Crl
,
123 uint32
*NumberOfCrlFields
,
124 CSSM_FIELD_PTR
*CrlFields
)
127 findSession
<CLPluginSession
>(CLHandle
).CrlGetAllFields(CssmData::required(Crl
),
128 Required(NumberOfCrlFields
),
129 Required(CrlFields
));
133 static CSSM_RETURN CSSMCLI
cssm_CrlAbortCache(CSSM_CL_HANDLE CLHandle
,
134 CSSM_HANDLE CrlHandle
)
137 findSession
<CLPluginSession
>(CLHandle
).CrlAbortCache(CrlHandle
);
141 static CSSM_RETURN CSSMCLI
cssm_CertGetAllTemplateFields(CSSM_CL_HANDLE CLHandle
,
142 const CSSM_DATA
*CertTemplate
,
143 uint32
*NumberOfFields
,
144 CSSM_FIELD_PTR
*CertFields
)
147 findSession
<CLPluginSession
>(CLHandle
).CertGetAllTemplateFields(CssmData::required(CertTemplate
),
148 Required(NumberOfFields
),
149 Required(CertFields
));
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
)
160 findSession
<CLPluginSession
>(CLHandle
).CrlSetFields(NumberOfFields
,
162 CssmData::required(OldCrl
),
163 CssmData::required(ModifiedCrl
));
167 static CSSM_RETURN CSSMCLI
cssm_CertGetAllFields(CSSM_CL_HANDLE CLHandle
,
168 const CSSM_DATA
*Cert
,
169 uint32
*NumberOfFields
,
170 CSSM_FIELD_PTR
*CertFields
)
173 findSession
<CLPluginSession
>(CLHandle
).CertGetAllFields(CssmData::required(Cert
),
174 Required(NumberOfFields
),
175 Required(CertFields
));
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
)
188 findSession
<CLPluginSession
>(CLHandle
).CrlAddCert(CCHandle
,
189 CssmData::required(Cert
),
192 CssmData::required(OldCrl
),
193 CssmData::required(NewCrl
));
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
)
204 findSession
<CLPluginSession
>(CLHandle
).IsCertInCachedCrl(CssmData::required(Cert
),
207 CssmData::required(CrlRecordIndex
));
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
,
216 CSSM_DATA_PTR SignedCrl
)
219 findSession
<CLPluginSession
>(CLHandle
).CrlSign(CCHandle
,
220 CssmData::required(UnsignedCrl
),
223 CssmData::required(SignedCrl
));
227 static CSSM_RETURN CSSMCLI
cssm_CertAbortQuery(CSSM_CL_HANDLE CLHandle
,
228 CSSM_HANDLE ResultsHandle
)
231 findSession
<CLPluginSession
>(CLHandle
).CertAbortQuery(ResultsHandle
);
235 static CSSM_RETURN CSSMCLI
cssm_CertGetNextFieldValue(CSSM_CL_HANDLE CLHandle
,
236 CSSM_HANDLE ResultsHandle
,
237 CSSM_DATA_PTR
*Value
)
240 if (!findSession
<CLPluginSession
>(CLHandle
).CertGetNextFieldValue(ResultsHandle
,
242 return CSSMERR_CL_NO_FIELD_VALUES
;
246 static CSSM_RETURN CSSMCLI
cssm_CertCreateTemplate(CSSM_CL_HANDLE CLHandle
,
247 uint32 NumberOfFields
,
248 const CSSM_FIELD
*CertFields
,
249 CSSM_DATA_PTR CertTemplate
)
252 findSession
<CLPluginSession
>(CLHandle
).CertCreateTemplate(NumberOfFields
,
254 CssmData::required(CertTemplate
));
258 static CSSM_RETURN CSSMCLI
cssm_CertCache(CSSM_CL_HANDLE CLHandle
,
259 const CSSM_DATA
*Cert
,
260 CSSM_HANDLE_PTR CertHandle
)
263 findSession
<CLPluginSession
>(CLHandle
).CertCache(CssmData::required(Cert
),
264 Required(CertHandle
));
268 static CSSM_RETURN CSSMCLI
cssm_CrlVerifyWithKey(CSSM_CL_HANDLE CLHandle
,
269 CSSM_CC_HANDLE CCHandle
,
270 const CSSM_DATA
*CrlToBeVerified
)
273 findSession
<CLPluginSession
>(CLHandle
).CrlVerifyWithKey(CCHandle
,
274 CssmData::required(CrlToBeVerified
));
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
)
285 findSession
<CLPluginSession
>(CLHandle
).CrlGetAllCachedRecordFields(CrlHandle
,
286 CssmData::required(CrlRecordIndex
),
287 Required(NumberOfFields
),
288 Required(CrlFields
));
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
)
298 findSession
<CLPluginSession
>(CLHandle
).CrlRemoveCert(CssmData::required(Cert
),
299 CssmData::required(OldCrl
),
300 CssmData::required(NewCrl
));
304 static CSSM_RETURN CSSMCLI
cssm_CertVerifyWithKey(CSSM_CL_HANDLE CLHandle
,
305 CSSM_CC_HANDLE CCHandle
,
306 const CSSM_DATA
*CertToBeVerified
)
309 findSession
<CLPluginSession
>(CLHandle
).CertVerifyWithKey(CCHandle
,
310 CssmData::required(CertToBeVerified
));
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
)
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
;
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
)
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
;
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
,
356 findSession
<CLPluginSession
>(CLHandle
).CertVerify(CCHandle
,
357 CssmData::required(CertToBeVerified
),
358 CssmData::optional(SignerCert
),
364 static CSSM_RETURN CSSMCLI
cssm_CertGetKeyInfo(CSSM_CL_HANDLE CLHandle
,
365 const CSSM_DATA
*Cert
,
369 findSession
<CLPluginSession
>(CLHandle
).CertGetKeyInfo(CssmData::required(Cert
),
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
,
382 findSession
<CLPluginSession
>(CLHandle
).CrlVerify(CCHandle
,
383 CssmData::required(CrlToBeVerified
),
384 CssmData::optional(SignerCert
),
390 static CSSM_RETURN CSSMCLI
cssm_CrlDescribeFormat(CSSM_CL_HANDLE CLHandle
,
391 uint32
*NumberOfFields
,
392 CSSM_OID_PTR
*OidList
)
395 findSession
<CLPluginSession
>(CLHandle
).CrlDescribeFormat(Required(NumberOfFields
),
400 static CSSM_RETURN CSSMCLI
cssm_CrlAbortQuery(CSSM_CL_HANDLE CLHandle
,
401 CSSM_HANDLE ResultsHandle
)
404 findSession
<CLPluginSession
>(CLHandle
).CrlAbortQuery(ResultsHandle
);
408 static CSSM_RETURN CSSMCLI
cssm_CertDescribeFormat(CSSM_CL_HANDLE CLHandle
,
409 uint32
*NumberOfFields
,
410 CSSM_OID_PTR
*OidList
)
413 findSession
<CLPluginSession
>(CLHandle
).CertDescribeFormat(Required(NumberOfFields
),
418 static CSSM_RETURN CSSMCLI
cssm_FreeFieldValue(CSSM_CL_HANDLE CLHandle
,
419 const CSSM_OID
*CertOrCrlOid
,
423 findSession
<CLPluginSession
>(CLHandle
).FreeFieldValue(CssmData::required(CertOrCrlOid
),
424 CssmData::required(Value
));
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
)
435 findSession
<CLPluginSession
>(CLHandle
).CertGroupToSignedBundle(CCHandle
,
436 Required(CertGroupToBundle
),
438 CssmData::required(SignedBundle
));
442 static CSSM_RETURN CSSMCLI
cssm_CertAbortCache(CSSM_CL_HANDLE CLHandle
,
443 CSSM_HANDLE CertHandle
)
446 findSession
<CLPluginSession
>(CLHandle
).CertAbortCache(CertHandle
);
450 static CSSM_RETURN CSSMCLI
cssm_CrlCache(CSSM_CL_HANDLE CLHandle
,
451 const CSSM_DATA
*Crl
,
452 CSSM_HANDLE_PTR CrlHandle
)
455 findSession
<CLPluginSession
>(CLHandle
).CrlCache(CssmData::required(Crl
),
456 Required(CrlHandle
));
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
)
466 findSession
<CLPluginSession
>(CLHandle
).IsCertInCrl(CssmData::required(Cert
),
467 CssmData::required(Crl
),
468 Required(CertFound
));
472 static CSSM_RETURN CSSMCLI
cssm_CrlGetNextCachedFieldValue(CSSM_CL_HANDLE CLHandle
,
473 CSSM_HANDLE ResultsHandle
,
474 CSSM_DATA_PTR
*Value
)
477 if (!findSession
<CLPluginSession
>(CLHandle
).CrlGetNextCachedFieldValue(ResultsHandle
,
479 return CSSMERR_CL_NO_FIELD_VALUES
;
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
)
490 findSession
<CLPluginSession
>(CLHandle
).CertGroupFromVerifiedBundle(CCHandle
,
491 Required(CertBundle
),
492 CssmData::optional(SignerCert
),
493 Required(CertGroup
));
498 static const CSSM_SPI_CL_FUNCS CLFunctionStruct
= {
499 cssm_CertCreateTemplate
,
500 cssm_CertGetAllTemplateFields
,
503 cssm_CertVerifyWithKey
,
504 cssm_CertGetFirstFieldValue
,
505 cssm_CertGetNextFieldValue
,
508 cssm_CertGetAllFields
,
512 cssm_CertGetFirstCachedFieldValue
,
513 cssm_CertGetNextCachedFieldValue
,
515 cssm_CertGroupToSignedBundle
,
516 cssm_CertGroupFromVerifiedBundle
,
517 cssm_CertDescribeFormat
,
518 cssm_CrlCreateTemplate
,
524 cssm_CrlVerifyWithKey
,
526 cssm_CrlGetFirstFieldValue
,
527 cssm_CrlGetNextFieldValue
,
529 cssm_CrlGetAllFields
,
531 cssm_IsCertInCachedCrl
,
532 cssm_CrlGetFirstCachedFieldValue
,
533 cssm_CrlGetNextCachedFieldValue
,
534 cssm_CrlGetAllCachedRecordFields
,
536 cssm_CrlDescribeFormat
,
540 static CSSM_MODULE_FUNCS CLFunctionTable
= {
541 CSSM_SERVICE_CL
, // service type
542 39, // number of functions
543 (const CSSM_PROC_ADDR
*)&CLFunctionStruct
546 CSSM_MODULE_FUNCS_PTR
CLPluginSession::construct()
548 return &CLFunctionTable
;