⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vlapi.c

📁 Next BIOS Source code : Extensible Firmware Interface
💻 C
📖 第 1 页 / 共 2 页
字号:
CSSM_VL_SIGNATURE_INFO_PTR CSSMAPI CSSM_VL_GetFirstSignatureInfo
                                    (CSSM_VL_HANDLE VLHandle, 
                                     CSSM_VO_HANDLE VOHandle,
                                     CSSM_HANDLE *SignerIteratorHandle)
{
    CSSM_SPI_VL_FUNCS_PTR CallBack = NULL;

    /* CheckInit & ClearError are done in cssm_GetModuleRecord */
    /* Get the callback pointers associated with the specified handle */
    if (cssm_GetModuleRecord (VLHandle, CSSM_SERVICE_VL, 
                              (CSSM_SPI_VL_FUNCS_PTR *)&CallBack) == NULL)
        return NULL;

    /*
     * Call the callback function. 
     */
    if (CallBack->GetFirstSignatureInfo) {
        return CallBack->GetFirstSignatureInfo (VLHandle, VOHandle, SignerIteratorHandle);
    } else {
        CSSM_SetError (&CssmGUID, CSSM_FUNCTION_NOT_IMPLEMENTED);
        return NULL;
    }
}

/*---------------------------------------------------------------
 *Name: CSSM_VL_AbortScan
 *
 *Description:
 *  This function aborts the Vo query identified by IteratorHandle.
 *
 *Parameters: 
 *  VLHandle (input) - Handle to the VLModule to perform this operation.
 *  IteratorHandle (input) - Handle identifying a signature query.
 *
 *Returns:
 *  CSSM_OK - The abort was successful.
 *  CSSM_FAIL - an error occurred.
 *
 *----------------------------------------------------------------*/
CSSM_RETURN CSSMAPI CSSM_VL_AbortScan
                                    (CSSM_VL_HANDLE VLHandle, 
                                     CSSM_HANDLE IteratorHandle)
{
    CSSM_SPI_VL_FUNCS_PTR CallBack = NULL;

    /* CheckInit & ClearError are done in cssm_GetModuleRecord */
    /* Get the callback pointers associated with the specified handle */
    if (cssm_GetModuleRecord (VLHandle, CSSM_SERVICE_VL, 
                              (CSSM_SPI_VL_FUNCS_PTR *)&CallBack) == NULL)
        return CSSM_FAIL;

    /*
     * Call the callback function. 
     */
    if (CallBack->AbortScan) {
        return CallBack->AbortScan (VLHandle, IteratorHandle);
    } else {
        CSSM_SetError (&CssmGUID, CSSM_FUNCTION_NOT_IMPLEMENTED);
        return CSSM_FAIL;
    }
}


/*---------------------------------------------------------------
 *Name: CSSM_VL_FreeSignatureInfo
 *
 *Description:
 *  This function frees the input structure.
 *
 *Parameters: 
 *  VLHandle (input) - Handle to the VLModule to perform this operation.
 *  SignatureInfo (input) - The structure to be freed.
 *
 *Returns:
 *  CSSM_OK - The free was successful.
 *  CSSM_FAIL - an error occurred.
 *
 *----------------------------------------------------------------*/
CSSM_RETURN CSSMAPI CSSM_VL_FreeSignatureInfo
                                    (CSSM_VL_HANDLE VLHandle,
                                     CSSM_VL_SIGNATURE_INFO_PTR SignatureInfo)
{
    CSSM_SPI_VL_FUNCS_PTR CallBack = NULL;

    /* CheckInit & ClearError are done in cssm_GetModuleRecord */
    /* Get the callback pointers associated with the specified handle */
    if (cssm_GetModuleRecord (VLHandle, CSSM_SERVICE_VL, 
                              (CSSM_SPI_VL_FUNCS_PTR *)&CallBack) == NULL)
        return CSSM_FAIL;

    /*
     * Call the callback function. 
     */
    if (CallBack->FreeSignatureInfo) {
        return CallBack->FreeSignatureInfo (VLHandle, SignatureInfo);
    } else {
        CSSM_SetError (&CssmGUID, CSSM_FUNCTION_NOT_IMPLEMENTED);
        return CSSM_FAIL;
    }
}

/*---------------------------------------------------------------
 *Name: CSSM_VL_SetDoLMapEntries
 *
 *Description:
 *  This function sets the data object locations for the specified Vo
 *
 *Parameters: 
 *  VLHandle (input) - Handle to the VLModule to perform this operation.
 *  VOHandle (input) - Handle to the Vo whose DoLocationMap should be set.
 *  NewLocationEntries (input) - The new data object locations.
 *
 *Returns:
 *  CSSM_OK - The new locations were successfully set.
 *  CSSM_FAIL - An error occurred.
 *
 *----------------------------------------------------------------*/
CSSM_RETURN CSSMAPI CSSM_VL_SetDoLMapEntries
                                    (CSSM_VL_HANDLE VLHandle,
                                     CSSM_VO_HANDLE VOHandle,
                                     const CSSM_VL_DO_LMAP_PTR NewLocationEntries)
{
    CSSM_SPI_VL_FUNCS_PTR CallBack = NULL;

    /* CheckInit & ClearError are done in cssm_GetModuleRecord */
    /* Get the callback pointers associated with the specified handle */
    if (cssm_GetModuleRecord (VLHandle, CSSM_SERVICE_VL, 
                              (CSSM_SPI_VL_FUNCS_PTR *)&CallBack) == NULL)
        return CSSM_FAIL;

    /*
     * Call the callback function. 
     */
    if (CallBack->SetDoLMapEntries) {
        return CallBack->SetDoLMapEntries (VLHandle, VOHandle, NewLocationEntries);
    } else {
        CSSM_SetError (&CssmGUID, CSSM_FUNCTION_NOT_IMPLEMENTED);
        return CSSM_FAIL;
    }
}

/*---------------------------------------------------------------
 *Name: CSSM_VL_VerifyRootCredentialsDataAndContainment
 *
 *Description:
 *  This function verifies the specified Vo and the data objects it covers.
 *  It also verifies that the input containment points are within 
 *  the appropriate objects.
 *
 *Parameters: 
 *  VLHandle (input) - Handle to the VLModule to perform this operation.
 *  VOHandle (input) - Handle to the Vo to verify.
 *  SignerCertificate (input) - The signature to verify
 *  NumberOfPreferredCsps (input) - Length of the PreferredCsps array
 *  PreferredCsps (input) - CSPs to use in verification.
 *  NumberOfContainments (input) - Length of the ContainmentsToVerify array
 *  ContainmentsToVerify (input) - Containment points to be verified.
 *
 *Returns:
 *  non 0 - The credentials, data objects and containments verified 
 *  0 - The credentials, data objects or containments did not verify 
 *      or an error occurred
 *
 *----------------------------------------------------------------*/
CSSM_VL_VERIFICATION_HANDLE CSSMAPI CSSM_VL_VerifyRootCredentialsDataAndContainment
                                    (CSSM_VL_HANDLE VLHandle,
                                     CSSM_VO_HANDLE VOHandle,
                                     const CSSM_DATA_PTR SignerCertificate,
                                     uint32 NumberOfPreferredCsps, 
                                     const CSSM_VL_PREFERRED_CSP_PTR PreferredCSPs,
                                     uint32 NumberOfContainments,
                                     const CSSM_VL_DO_CONTAINMENT_LOCATION_PTR ContainmentsToVerify)
{
    CSSM_SPI_VL_FUNCS_PTR CallBack = NULL;

    /* CheckInit & ClearError are done in cssm_GetModuleRecord */
    /* Get the callback pointers associated with the specified handle */
    if (cssm_GetModuleRecord (VLHandle, CSSM_SERVICE_VL, 
                              (CSSM_SPI_VL_FUNCS_PTR *)&CallBack) == NULL)
        return CSSM_INVALID_HANDLE;

    /*
     * Call the callback function. 
     */
    if (CallBack->VerifyRootCredentialsDataAndContainment) {
        return CallBack->VerifyRootCredentialsDataAndContainment (VLHandle, VOHandle, 
                                    SignerCertificate, NumberOfPreferredCsps, PreferredCSPs, 
                                    NumberOfContainments, ContainmentsToVerify);
    } else {
        CSSM_SetError (&CssmGUID, CSSM_FUNCTION_NOT_IMPLEMENTED);
        return CSSM_INVALID_HANDLE;
    }
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name:
//   CSSM_VL_SelfVerifyCertificate
//
// Description:
//   This procedure performs a syntax verification of the passed certificate.  The intent is to do the
//   same verification that would be performed if the certificate were used to sign a signed manifest
//   and the signed manifest were passed to VL_VerifyRootCredentialsDataAndContainment.  The tests
//   do not include testing the signature of the certificate, since the issuer's public key is generally
//   not readily available.
//
// Parameters:
//   VLHandle    - Handle to the Verifiable Object Library that does the operation.
//   Certificate - The certificate to be verified
//
// Returns:
//   ISL_OK - if the verification succeeds
//   other  - if the verification fails


uint32 CSSMAPI CSSM_VL_SelfVerifyCertificate(
    CSSM_VL_HANDLE       VLHandle,
    const CSSM_DATA_PTR  Certificate
    )
{
    CSSM_SPI_VL_FUNCS_PTR CallBack = NULL;

    /* CheckInit & ClearError are done in cssm_GetModuleRecord */
    /* Get the callback pointers associated with the specified handle */
    if (cssm_GetModuleRecord (VLHandle, CSSM_SERVICE_VL, 
                              (CSSM_SPI_VL_FUNCS_PTR *)&CallBack) == NULL)
        return CSSM_INVALID_HANDLE;

    /*
     * Call the callback function. 
     */
    if (CallBack->SelfVerifyCertificate) {
        return CallBack->SelfVerifyCertificate (VLHandle, Certificate);
    } else {
        CSSM_SetError (&CssmGUID, CSSM_FUNCTION_NOT_IMPLEMENTED);
        return CSSM_INVALID_HANDLE;
    }
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -