本文整理汇总了C++中PH_CHECK_SUCCESS_FCT函数的典型用法代码示例。如果您正苦于以下问题:C++ PH_CHECK_SUCCESS_FCT函数的具体用法?C++ PH_CHECK_SUCCESS_FCT怎么用?C++ PH_CHECK_SUCCESS_FCT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PH_CHECK_SUCCESS_FCT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: phalMfp_SamAV2_X_WritePerso
phStatus_t phalMfp_SamAV2_X_WritePerso(
phalMfp_SamAV2_X_DataParams_t * pDataParams,
uint8_t bLayer4Comm,
uint16_t wBlockNr,
uint8_t * pValue
)
{
phStatus_t PH_MEMLOC_REM status;
phStatus_t PH_MEMLOC_REM statusTmp;
uint8_t PH_MEMLOC_REM pEntryPair[2 + PHAL_MFP_MIFARE_BLOCK_SIZE];
uint8_t PH_MEMLOC_REM bResponseCode;
/* Sam natively only supprots L4 WRITE Perso writing*/
if (bLayer4Comm)
{
pEntryPair[0] = (uint8_t)(wBlockNr);
pEntryPair[1] = (uint8_t)(wBlockNr >> 8);
memcpy(&pEntryPair[2], pValue, PHAL_MFP_MIFARE_BLOCK_SIZE); /* PRQA S 3200 */
status = phhalHw_SamAV2_Cmd_MfpWritePerso(
pDataParams->pHalDataParams,
pEntryPair,
2 + PHAL_MFP_MIFARE_BLOCK_SIZE,
&bResponseCode);
/* Convert HAL status codes to palMifare status codes */
PH_CHECK_SUCCESS_FCT(statusTmp, phalMfp_SamAV2_X_ConvertNak(status));
/* Check Card response*/
PH_CHECK_SUCCESS_FCT(statusTmp, phalMfp_Int_ComputeErrorResponse(1, bResponseCode, bLayer4Comm));
}
else
{
示例2: phalVca_SamAV2_DeselectVc
phStatus_t phalVca_SamAV2_DeselectVc(
phalVca_SamAV2_DataParams_t * pDataParams
)
{
/* local variables */
phStatus_t PH_MEMLOC_REM statusTmp;
uint8_t PH_MEMLOC_REM aCommand[1 /* command code */];
uint8_t * PH_MEMLOC_REM pResponse;
uint16_t PH_MEMLOC_REM wRxLength;
/* command code */
aCommand[0] = PHAL_VCA_CMD_DVC;
/* command exchange */
PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4(
pDataParams->pPalMifareDataParams,
PH_EXCHANGE_DEFAULT,
aCommand,
1,
&pResponse,
&wRxLength));
/* check response */
PH_CHECK_SUCCESS_FCT(statusTmp, phalVca_Int_ComputeErrorResponse(wRxLength, pResponse[0]));
/* check response length */
if (wRxLength != 1 /* STATUS */)
{
return PH_ADD_COMPCODE(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_VCA);
}
return PH_ADD_COMPCODE(PH_ERR_SUCCESS, PH_COMP_AL_VCA);
}
示例3: phalVca_SamAV2_SelectVc
phStatus_t phalVca_SamAV2_SelectVc(
phalVca_SamAV2_DataParams_t * pDataParams,
uint16_t wValidIidIndex,
uint16_t wKeyNumber,
uint16_t wKeyVersion
)
{
/* local variables */
phStatus_t PH_MEMLOC_REM status;
phStatus_t PH_MEMLOC_REM statusTmp;
uint8_t PH_MEMLOC_REM aCommand[9];
uint8_t * PH_MEMLOC_REM pResponse;
uint16_t PH_MEMLOC_REM wRxLength;
status = phalVca_SamAV2_Int_ResolveValidIndex(
pDataParams,
wValidIidIndex,
&wValidIidIndex);
/* for the case of an overflow we always send the first random number to the SAM */
if ((status & PH_ERR_MASK) == PH_ERR_INVALID_PARAMETER)
{
wValidIidIndex = 0;
}
else
{
PH_CHECK_SUCCESS(status);
}
aCommand[0] = PHAL_VCA_CMD_SVC;
/* Prepare Buffer */
PH_CHECK_SUCCESS_FCT(statusTmp, phhalHw_SamAV2_Cmd_SAM_SelectVirtualCardMfp(
pDataParams->pSamHal,
(uint8_t)wKeyNumber,
(uint8_t)wKeyVersion,
&pDataParams->pRndq[wValidIidIndex * 12],
NULL,
0,
&aCommand[1]));
/* command exchange */
PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4(
pDataParams->pPalMifareDataParams,
PH_EXCHANGE_DEFAULT,
aCommand,
9,
&pResponse,
&wRxLength));
PH_CHECK_SUCCESS_FCT(statusTmp, phalVca_Int_ComputeErrorResponse(wRxLength, pResponse[0]));
/* check response length */
if (wRxLength != 1 /* STATUS */)
{
return PH_ADD_COMPCODE(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_VCA);
}
return PH_ADD_COMPCODE(PH_ERR_SUCCESS, PH_COMP_AL_VCA);
}
示例4: phalVca_SamAV2_StartCardSelection
phStatus_t phalVca_SamAV2_StartCardSelection (
phalVca_SamAV2_DataParams_t * pDataParams
)
{
phStatus_t PH_MEMLOC_REM statusTmp;
uint8_t PH_MEMLOC_REM wIndex;
/* Obtain Random Numbers */
PH_CHECK_SUCCESS_FCT(statusTmp, phhalHw_SamAV2_Cmd_SAM_GetChallenge(pDataParams->pSamHal, (uint8_t)(12 * pDataParams->wNumCardTableEntries), pDataParams->pRndq));
/* Send the complete stream to the SAM */
PH_CHECK_SUCCESS_FCT(statusTmp, phhalHw_SamAV2_Cmd_SAM_VirtualCardSupportMfp(
pDataParams->pSamHal,
PH_EXCHANGE_BUFFER_FIRST,
NULL,
0,
NULL,
0,
NULL,
NULL));
pDataParams->wCurrentCardTablePos = 0;
for (wIndex = 0; wIndex < pDataParams->wNumCardTableEntries; ++wIndex)
{
pDataParams->pCardTable[wIndex].bNumKeyDuos = 0;
pDataParams->pCardTable[wIndex].wIidIndex = 0xFF;
}
return PH_ADD_COMPCODE(PH_ERR_SUCCESS, PH_COMP_AL_VCA);
}
示例5: phKeyStore_Sw_GetKey
phStatus_t phKeyStore_Sw_GetKey(
phKeyStore_Sw_DataParams_t * pDataParams,
uint16_t wKeyNo,
uint16_t wKeyVersion,
uint8_t bKeyBufSize,
uint8_t * pKey,
uint16_t * pKeyType
)
{
phStatus_t statusTmp;
uint16_t wKeySize;
phKeyStore_Sw_KeyVersionPair_t * pKeyVersion;
PH_CHECK_SUCCESS_FCT(statusTmp, phKeyStore_Sw_GetKeyValuePtrVersion(pDataParams,wKeyNo,wKeyVersion,&pKeyVersion));
/* Check for Counter overflow */
PH_CHECK_SUCCESS_FCT(statusTmp, phKeyStore_Sw_CheckUpdateKUC(pDataParams,pDataParams->pKeyEntries[wKeyNo].wRefNoKUC));
/* check buffer size */
wKeySize = phKeyStore_GetKeySize(pDataParams->pKeyEntries[wKeyNo].wKeyType);
if (bKeyBufSize < wKeySize)
{
return PH_ADD_COMPCODE(PH_ERR_BUFFER_OVERFLOW, PH_COMP_KEYSTORE);
}
/* copy the key */
memcpy(pKey, pKeyVersion->pKey, wKeySize); /* PRQA S 3200 */
*pKeyType = pDataParams->pKeyEntries[wKeyNo].wKeyType;
return PH_ADD_COMPCODE(PH_ERR_SUCCESS, PH_COMP_KEYSTORE);
}
示例6: readSector
phStatus_t readSector(uint8_t sector_id, uint8_t * key, uint8_t key_type, uint8_t * bUid, uint8_t * data) {
uint8_t block = sector_id << 2;
PH_CHECK_SUCCESS_FCT(status,
phhalHw_MfcAuthenticate(&hal, block, key_type, key, bUid));
PH_CHECK_SUCCESS_FCT(status, phalMfc_Read(&alMfc, block + 0, &data[0 * 16]));
PH_CHECK_SUCCESS_FCT(status, phalMfc_Read(&alMfc, block + 1, &data[1 * 16]));
PH_CHECK_SUCCESS_FCT(status, phalMfc_Read(&alMfc, block + 2, &data[2 * 16]));
PH_CHECK_SUCCESS_FCT(status, phalMfc_Read(&alMfc, block + 3, &data[3 * 16]));
return PH_ERR_SUCCESS;
}
示例7: search_card
phStatus_t search_card(uint8_t * pUid, uint8_t * pLength, uint8_t * pSak, uint8_t * pNbCards) {
PH_CHECK_SUCCESS_FCT(status, phhalHw_FieldReset(&hal));
PH_CHECK_SUCCESS_FCT(status, phhalHw_ApplyProtocolSettings(&hal,
PHHAL_HW_CARDTYPE_ISO14443A));
PH_CHECK_SUCCESS_FCT(status, phpalI14443p3a_ActivateCard(&palI14443p3a, NULL, 0x00, pUid,
pLength, pSak, pNbCards));
return PH_ERR_SUCCESS;
}
示例8: phalMfc_Sw_RestoreTransfer
phStatus_t phalMfc_Sw_RestoreTransfer(
phalMfc_Sw_DataParams_t * pDataParams,
uint8_t bSrcBlockNo,
uint8_t bDstBlockNo
)
{
phStatus_t PH_MEMLOC_REM statusTmp;
PH_CHECK_SUCCESS_FCT(statusTmp, phalMfc_Sw_Restore(pDataParams, bSrcBlockNo));
PH_CHECK_SUCCESS_FCT(statusTmp, phalMfc_Sw_Transfer(pDataParams, bDstBlockNo));
return PH_ADD_COMPCODE(PH_ERR_SUCCESS, PH_COMP_AL_MFC);
}
示例9: phalI15693_Sw_WriteSingleBlock
phStatus_t phalI15693_Sw_WriteSingleBlock(
phalI15693_Sw_DataParams_t * pDataParams,
uint8_t bOption,
uint8_t bBlockNo,
uint8_t * pTxBuffer,
uint16_t wTxLength
)
{
phStatus_t PH_MEMLOC_REM statusTmp;
phStatus_t PH_MEMLOC_REM status;
uint8_t PH_MEMLOC_REM bCommand[2];
uint8_t * PH_MEMLOC_REM pRxBuffer;
uint16_t PH_MEMLOC_REM bRxLength;
/* Build command */
bCommand[0] = PHAL_I15693_SW_CMD_WRITE_SINGLE_BLOCK;
bCommand[1] = bBlockNo;
/* Set or clear the flags option bit indicated by bOption. */
PH_CHECK_SUCCESS_FCT(statusTmp, phalI15693_Sw_Int_SetOptionBit(pDataParams, bOption));
/* Set long timeout. */
PH_CHECK_SUCCESS_FCT(statusTmp, phpalSli15693_SetConfig(
pDataParams->pPalSli15693DataParams,
PHPAL_SLI15693_CONFIG_TIMEOUT_US,
PHPAL_SLI15693_TIMEOUT_LONG_US));
/* Proceed with the command in lower layers */
PH_CHECK_SUCCESS_FCT(statusTmp, phpalSli15693_Exchange(
pDataParams->pPalSli15693DataParams,
PH_EXCHANGE_BUFFER_FIRST,
bCommand,
2,
NULL,
NULL));
/* Append given data */
status = phpalSli15693_Exchange(
pDataParams->pPalSli15693DataParams,
PH_EXCHANGE_BUFFER_LAST,
pTxBuffer,
wTxLength,
&pRxBuffer,
&bRxLength);
/* Write-alike handling */
if (bOption != PHAL_I15693_OPTION_OFF)
{
return phalI15693_Sw_WriteAlikeHandling(pDataParams, status);
}
return status;
}
示例10: phalI15693_Sw_ReadSingleBlock
phStatus_t phalI15693_Sw_ReadSingleBlock(
phalI15693_Sw_DataParams_t * pDataParams,
uint8_t bOption,
uint8_t bBlockNo,
uint8_t ** ppRxBuffer,
uint16_t * pRxLength
)
{
phStatus_t PH_MEMLOC_REM statusTmp;
uint8_t PH_MEMLOC_REM bCommand[2];
/* Build command */
bCommand[0] = PHAL_I15693_SW_CMD_READ_SINGLE_BLOCK;
bCommand[1] = bBlockNo;
/* Set or clear the flags option bit indicated by bOption. */
PH_CHECK_SUCCESS_FCT(statusTmp, phalI15693_Sw_Int_SetOptionBit(pDataParams, bOption));
/* Set short timeout. */
PH_CHECK_SUCCESS_FCT(statusTmp, phpalSli15693_SetConfig(
pDataParams->pPalSli15693DataParams,
PHPAL_SLI15693_CONFIG_TIMEOUT_US,
PHPAL_SLI15693_TIMEOUT_SHORT_US));
/* Proceed with the command in lower layers */
PH_CHECK_SUCCESS_FCT(statusTmp, phpalSli15693_Exchange(
pDataParams->pPalSli15693DataParams,
PH_EXCHANGE_DEFAULT,
bCommand,
2,
ppRxBuffer,
pRxLength));
/* Length check */
if (bOption != PHAL_I15693_OPTION_OFF)
{
if (*pRxLength < 2)
{
return PH_ADD_COMPCODE(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_I15693);
}
}
else
{
if (*pRxLength == 0)
{
return PH_ADD_COMPCODE(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_I15693);
}
}
return PH_ADD_COMPCODE(PH_ERR_SUCCESS, PH_COMP_AL_I15693);
}
示例11: phalI15693_Sw_GetMultipleBlockSecurityStatus
phStatus_t phalI15693_Sw_GetMultipleBlockSecurityStatus(
phalI15693_Sw_DataParams_t * pDataParams,
uint8_t bBlockNo,
uint16_t wNumBlocks,
uint8_t ** ppRxBuffer,
uint16_t * pRxLength
)
{
phStatus_t PH_MEMLOC_REM statusTmp;
uint8_t PH_MEMLOC_REM bCommand[3];
/* Number of wNumBlocks can't be zero */
if (wNumBlocks == 0)
{
return PH_ADD_COMPCODE(PH_ERR_INVALID_PARAMETER, PH_COMP_AL_I15693);
}
/* adjust number of blocks. */
--wNumBlocks;
/* Check number of blocks doesn't exceed 256 */
if (((uint16_t)bBlockNo + wNumBlocks) >= 0x100)
{
return PH_ADD_COMPCODE(PH_ERR_INVALID_PARAMETER, PH_COMP_AL_I15693);
}
/* Clear Option bit */
PH_CHECK_SUCCESS_FCT(statusTmp, phalI15693_Sw_Int_SetOptionBit(pDataParams, PHAL_I15693_OPTION_OFF));
/* Build command */
bCommand[0] = PHAL_I15693_SW_CMD_GET_MULTIPLE_BLOCK_SEC;
bCommand[1] = bBlockNo;
bCommand[2] = (uint8_t)wNumBlocks;
/* Set short timeout. */
PH_CHECK_SUCCESS_FCT(statusTmp, phpalSli15693_SetConfig(
pDataParams->pPalSli15693DataParams,
PHPAL_SLI15693_CONFIG_TIMEOUT_US,
PHPAL_SLI15693_TIMEOUT_SHORT_US));
/* Proceed with the command in lower layers */
PH_CHECK_SUCCESS_FCT(statusTmp, phpalSli15693_Exchange(
pDataParams->pPalSli15693DataParams,
PH_EXCHANGE_DEFAULT,
bCommand,
3,
ppRxBuffer,
pRxLength));
return PH_ADD_COMPCODE(PH_ERR_SUCCESS, PH_COMP_AL_I15693);
}
示例12: phCryptoRng_Sw_Reseed
phStatus_t phCryptoRng_Sw_Reseed(
phCryptoRng_Sw_DataParams_t * pDataParams,
uint8_t * pEntropyInput,
uint16_t wEntropyInputLength,
uint8_t * pAdditionalInput,
uint8_t bAdditionalInputLength
)
{
phStatus_t PH_MEMLOC_REM statusTmp;
uint8_t PH_MEMLOC_REM aSeedMaterial[PHCRYPTORNG_SW_SEEDLEN];
/* Check for operational state */
if (pDataParams->bState != PHCRYPTORNG_SW_STATE_WORKING)
{
return PH_ADD_COMPCODE(PH_ERR_USE_CONDITION, PH_COMP_CRYPTORNG);
}
/* Comment: Ensure that the length of the seed_material is exactly seedlen bits. */
if (PHCRYPTORNG_SW_SEEDLEN != (wEntropyInputLength + bAdditionalInputLength))
{
return PH_ADD_COMPCODE(PH_ERR_INVALID_PARAMETER, PH_COMP_CRYPTORNG);
}
/* Prepare seed Material */
/* 1. seed_material = entropy_input || additional_input. */
memcpy(aSeedMaterial, pEntropyInput, wEntropyInputLength); /* PRQA S 3200 */
memcpy(&aSeedMaterial[wEntropyInputLength], pAdditionalInput, bAdditionalInputLength); /* PRQA S 3200 */
/* Encrypt the seed value */
/* 2. seed_material = Block_Cipher_df (seed_material, seedlen). */
PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoRng_Sw_BlockCipherDf(
pDataParams,
aSeedMaterial));
/* Update using aSeedMaterial as the personalization string. */
/* 3. (Key, V) = Update (seed_material, Key, V). */
PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoRng_Sw_Update(pDataParams, aSeedMaterial));
/* Set the counter again to 1. */
/* 4. reseed_counter = 1. */
pDataParams->dwRequestCounter = 1;
/* 5. Return V, Key, and reseed_counter as the new_working_state. */
/* Clear seed material for security reasons */
memset(aSeedMaterial, 0x00, sizeof(aSeedMaterial)); /* PRQA S 3200 */
return PH_ADD_COMPCODE(PH_ERR_SUCCESS, PH_COMP_CRYPTORNG);
}
示例13: phKeyStore_Rc632_SetFullKeyEntry
phStatus_t phKeyStore_Rc632_SetFullKeyEntry(
phKeyStore_Rc632_DataParams_t * pDataParams,
uint16_t wNoOfKeys,
uint16_t wKeyNo,
uint16_t wNewRefNoKUC,
uint16_t wNewKeyType,
uint8_t * pNewKeys,
uint16_t * pNewKeyVersionList
)
{
phStatus_t PH_MEMLOC_REM statusTmp;
uint16_t PH_MEMLOC_REM wKeyVersion = 0;
uint16_t PH_MEMLOC_COUNT i;
/* satisfy compiler */
if (pNewKeyVersionList || wNewRefNoKUC);
/* check wNoOfKeys */
if (wNoOfKeys > PH_KEYSTORE_RC632_NUM_VERSIONS)
{
return PH_ADD_COMPCODE(PH_ERR_INVALID_PARAMETER, PH_COMP_KEYSTORE);
}
/* set keys */
for (i = 0; i < wNoOfKeys; ++i)
{
PH_CHECK_SUCCESS_FCT(statusTmp, phKeyStore_Rc632_SetKeyAtPos(pDataParams, wKeyNo, i, wNewKeyType, &pNewKeys[i*PH_KEYSTORE_KEY_TYPE_MIFARE_SIZE], wKeyVersion));
}
return PH_ADD_COMPCODE(PH_ERR_SUCCESS, PH_COMP_KEYSTORE);
}
示例14: phalVca_SamAV2_GetIidInfo
phStatus_t phalVca_SamAV2_GetIidInfo(
phalVca_SamAV2_DataParams_t * pDataParams,
uint16_t wValidIidIndex,
uint16_t * pIidIndex,
uint8_t * pVcUidSize,
uint8_t * pVcUid,
uint8_t * pInfo,
uint8_t * pPdCapabilities
)
{
phStatus_t PH_MEMLOC_REM statusTmp;
PH_CHECK_SUCCESS_FCT(statusTmp, phalVca_SamAV2_Int_ResolveValidIndex(
pDataParams,
wValidIidIndex,
&wValidIidIndex));
*pIidIndex = pDataParams->pCardTable[wValidIidIndex].wIidIndex;
*pInfo = pDataParams->pCardTable[wValidIidIndex].pCardData[0];
pPdCapabilities[0] = pDataParams->pCardTable[wValidIidIndex].pCardData[1];
pPdCapabilities[1] = pDataParams->pCardTable[wValidIidIndex].pCardData[2];
if (*pInfo & 0x80)
{
*pVcUidSize = 4;
memcpy(pVcUid, &pDataParams->pCardTable[wValidIidIndex].pCardData[3], 4); /* PRQA S 3200 */
}
else
{
*pVcUidSize = 7;
memcpy(pVcUid, &pDataParams->pCardTable[wValidIidIndex].pCardData[3], 7); /* PRQA S 3200 */
}
return PH_ADD_COMPCODE(PH_ERR_SUCCESS, PH_COMP_AL_VCA);
}
示例15: phKeyStore_Sw_GetKeyEntry
phStatus_t phKeyStore_Sw_GetKeyEntry(
phKeyStore_Sw_DataParams_t * pDataParams,
uint16_t wKeyNo,
uint16_t wKeyVersionBufSize,
uint16_t * wKeyVersion,
uint16_t * wKeyVersionLength,
uint16_t * pKeyType
)
{
phStatus_t statusTmp;
uint16_t i;
phKeyStore_Sw_KeyVersionPair_t * pKeyVersion;
/* Check for overflow */
if (wKeyVersionBufSize < (sizeof(uint16_t) * pDataParams->wNoOfVersions))
{
return PH_ADD_COMPCODE(PH_ERR_BUFFER_OVERFLOW, PH_COMP_KEYSTORE);
}
for (i = 0; i < pDataParams->wNoOfVersions; i++)
{
PH_CHECK_SUCCESS_FCT(statusTmp, phKeyStore_Sw_GetKeyValuePtrPos(pDataParams,wKeyNo,i,&pKeyVersion));
wKeyVersion[i] = pKeyVersion->wVersion;
}
*wKeyVersionLength = pDataParams->wNoOfVersions;
*pKeyType = pDataParams->pKeyEntries[wKeyNo].wKeyType;
return PH_ADD_COMPCODE(PH_ERR_SUCCESS, PH_COMP_KEYSTORE);
}