/** * * @param None * * @return None * ******************************************************************************/ u32 XFsbl_Authentication(XFsblPs * FsblInstancePtr, u64 PartitionOffset, u32 PartitionLen, u64 AcOffset, u32 HashLen, u32 PartitionNum) { u32 Status = XFSBL_SUCCESS; XFsbl_Printf(DEBUG_INFO, "Auth: Partition Offset %0x, PartitionLen %0x," " AcOffset %0x, HashLen %0x\r\n", (PTRSIZE )PartitionOffset, PartitionLen, (PTRSIZE )AcOffset, HashLen); /* Do SPK Signature verification using PPK */ Status = XFsbl_SpkVer(FsblInstancePtr, AcOffset, HashLen, PartitionNum); if(XFSBL_SUCCESS != Status) { goto END; } /* Do Partition Signature verification using SPK */ Status = XFsbl_PartitionSignVer(FsblInstancePtr, PartitionOffset, PartitionLen, AcOffset, HashLen, PartitionNum); if(XFSBL_SUCCESS != Status) { goto END; } END: return Status; }
/****************************************************************************** * * This function performs authentication and reauthentication of block * * @param PartitionParams is a pointer to XFsblPs_PlPartition * @param SrcAddress holds the start address of block * @param Length of the block * @param AuthCer holds authentication certificate. * * @return * - Error code on failure * - Success on success * * @note None. * ******************************************************************************/ static u32 XFsbl_PlBlockAuthentication(XFsblPs * FsblInstancePtr, XFsblPs_PlPartition *PartitionParams, UINTPTR SrcAddress, u32 Length, u8 *AuthCer) { u32 Status; u32 NoOfChunks; if (Length > PartitionParams->ChunkSize) { NoOfChunks = Length/PartitionParams->ChunkSize; if (Length%PartitionParams->ChunkSize > 0) { NoOfChunks++; } } else { /* If length of block equal to Chunk Size */ NoOfChunks = 1; } /* Check for Hash storage buffer availability */ if (NoOfChunks > PartitionParams->PlAuth.NoOfHashs) { XFsbl_Printf(DEBUG_GENERAL, "XFsbl_PlPartition:" "XFSBL_ERROR_PROVIDED_BUF_HASH_STORE Required " "hashs = %d \t provided = %d\r\n", NoOfChunks, PartitionParams->PlAuth.NoOfHashs); return XFSBL_ERROR_PROVIDED_BUF_HASH_STORE; } /* Do SPK Signature verification using PPK */ Status = XFsbl_SpkVer((UINTPTR)AuthCer, PartitionParams->PlAuth.AuthType); if (XFSBL_SUCCESS != Status) { goto END; } /* * Do Partition Signature verification * of block in chunks and store each chunk's hash */ Status = XFsbl_PlSignVer(PartitionParams, SrcAddress, Length, AuthCer, NoOfChunks); if (XFSBL_SUCCESS != Status) { goto END; } /* * Re-Authentication of block calculates the hash on * chunks and compares with stored hashs * If decryption is enabled data is been sent to AES * and if decryption is disabled * data is written to PCAP with CSU DMA */ Status = XFsbl_ReAuthenticationBlock(PartitionParams, SrcAddress, Length, NoOfChunks); if (Status != XFSBL_SUCCESS) { goto END; } END: return Status; }