In this example, the pack and unpack routines that are used internally
to the CL module are exposed for use by applications through the passthrough
mechanism.
typedef enum cl_custom_function_id {
CL_CUSTOMID_PACK_CERTIFICATE&tab;= 0,
CL_CUSTOMID_UNPACK_CERTIFICATE&tab;= 1,
} CL_CUSTOM_FUNCTION_ID;
/*-------------------------------------------------------------------------
* Name: CL_PassThrough
*
* Description:
* This function allows applications to call OCSF CL module-specific operations.
* The OCSF CL module-specific operations include:
* cl_PackCertificate
* cl_UnpackCertificate
*
* Parameters:
* CCHandle (input) : Handle identifying a Cryptographic Context which
* may be used by the passthrough function
* PassThroughId (input) : An identifier assigned by the OCSF CL module
* to indicate the exported function to perform.
* InputParams (input) : Parameters to be interpreted in a
* function-specific manner by the OCSF CL module.
*
* Return value:
* Output from the passthrough function.
* The output data must be interpreted by the calling application
* based on externally available information.
*
* Error codes:
* CSSM_CL_INVALID_CL_HANDLE
* CSSM_CL_INVALID_CC_HANDLE
* CSSM_CL_INVALID_DATA_POINTER
* CSSM_CL_UNSUPPORTED_OPERATION
* CSSM_CL_PASS_THROUGH_FAIL
*-----------------------------------------------------------------------*/
CSSM_DATA_PTR CSSMAPI CL_PassThrough (CSSM_CL_HANDLE CLHandle,
CSSM_CC_HANDLE CCHandle,
uint32 PassThroughId,
const CSSM_DATA_PTR InputParams)
{
/* Initializations */
/* Check inputs */
/* Check that this is a recognized PassThroughId */
/* Call the requested function */
switch ( PassThroughId ) {
case CL_CUSTOMID_PACK_CERTIFICATE:&tab;
return cl_PackCertificate( InputParams );
case CL_CUSTOMID_UNPACK_CERTIFICATE:
return cl_UnpackCertificate( InputParams );
default:
CSSM_SetError(&my_clm_guid, CSSM_CL_UNSUPPORTED_OPERATION);
return NULL;