Lines Matching refs:pCmd
142 static MV_STATUS mvCesaCtrModePrepare(MV_CESA_COMMAND *pCtrModeCmd, MV_CESA_COMMAND *pCmd);
143 static MV_STATUS mvCesaCtrModeComplete(MV_CESA_COMMAND *pOrgCmd, MV_CESA_COMMAND *pCmd);
144 static void mvCesaCtrModeFinish(MV_CESA_COMMAND *pCmd);
149 static INLINE MV_STATUS mvCesaParamCheck(MV_CESA_SA* pSA, MV_CESA_COMMAND *pCmd, MV_U8* pFixOffset);
150 static INLINE MV_STATUS mvCesaFragParamCheck(MV_CESA_SA* pSA, MV_CESA_COMMAND *pCmd);
840 * MV_CESA_COMMAND *pCmd - pointer to new CESA request.
863 MV_STATUS mvCesaAction (MV_CESA_COMMAND *pCmd)
867 int sid = pCmd->sessionId;
897 pReq->pOrgCmd = pCmd;
898 /* Allocate temporary pCmd structure for Key stream */
899 pCmd = mvCesaCtrModeInit();
900 if(pCmd == NULL)
904 mvCesaCtrModePrepare(pCmd, pReq->pOrgCmd);
910 status = mvCesaParamCheck(pSA, pCmd, &pReq->fixOffset);
916 pReq->pCmd = pCmd;
919 if(pCmd->pSrc->mbufSize <= sizeof(cesaSramVirtPtr->buf) )
942 status = mvCesaFragParamCheck(pSA, pCmd);
1134 pSA = &pCesaSAD[pReq->pCmd->sessionId];
1155 mvCesaMbufCacheUnmap(pReq->pCmd->pDst, 0, pReq->pCmd->pDst->mbufSize);
1161 int macDataSize = pReq->pCmd->macLength - pReq->frags.macSize;
1171 status = mvCesaCopyToMbuf(pNewDigest, pReq->pCmd->pDst,
1172 pReq->pCmd->digestOffset, pSA->digestSize);
1198 mvCesaMbufCacheUnmap(pReq->pCmd->pDst, 0, pReq->pCmd->pDst->mbufSize);
1227 pResult->pReqPrv = pReq->pCmd->pReqPrv;
1228 pResult->sessionId = pReq->pCmd->sessionId;
1237 mvCesaCtrModeComplete(pReq->pOrgCmd, pReq->pCmd);
1238 mvCesaCtrModeFinish(pReq->pCmd);
1595 MV_CESA_COMMAND* pCmd = pReq->pCmd;
1605 sid = pReq->pCmd->sessionId;
1625 /* For FIRST fragment crypto and mac offsets are taken from pCmd */
1626 cryptoOffset = pCmd->cryptoOffset;
1627 macOffset = pCmd->macOffset;
1648 if( (pCmd->ivFromUser) &&
1657 i += mvCesaDmaCopyPrepare(pCmd->pSrc, cesaSramVirtPtr->cryptoIV, &pDmaDesc[i],
1658 MV_FALSE, pCmd->ivOffset, pSA->cryptoIvSize, pCmd->skipFlush);
1662 if(pCmd->ivOffset > (copySize - pSA->cryptoIvSize))
1667 /* For Decryption: Copy IV value from pCmd->ivOffset to Special SRAM place */
1671 i += mvCesaDmaCopyPrepare(pCmd->pSrc, cesaSramVirtPtr->tempCryptoIV, &pDmaDesc[i],
1672 MV_FALSE, pCmd->ivOffset, pSA->cryptoIvSize, pCmd->skipFlush);
1677 /* Copy IV from SRAM to buffer (pCmd->ivOffset) */
1678 if(pCmd->ivFromUser == 0)
1680 /* copy IV value from cryptoIV to Buffer (pCmd->ivOffset) */
1681 i += mvCesaDmaCopyPrepare(pCmd->pSrc, cesaSramVirtPtr->cryptoIV, &pDmaDesc[i],
1682 MV_TRUE, pCmd->ivOffset, pSA->cryptoIvSize, pCmd->skipFlush);
1688 cryptoIvOffset = pCmd->ivOffset;
1700 /* Save digest from pCmd->digestOffset */
1702 pCmd->pSrc, pCmd->digestOffset, pSA->digestSize);
1704 /* If pCmd->digestOffset is not located on the first */
1705 if(pCmd->digestOffset > (copySize - pSA->digestSize))
1709 /* Set zeros to pCmd->digestOffset (DRAM) */
1711 mvCesaCopyToMbuf(digestZero, pCmd->pSrc, pCmd->digestOffset, pSA->digestSize);
1718 digestOffset = pCmd->digestOffset;
1737 if( (pCmd->pSrc->mbufSize - pReq->frags.bufOffset) <= sizeof(cesaSramVirtPtr->buf))
1742 copySize = pCmd->pSrc->mbufSize - pReq->frags.bufOffset;
1747 macDataSize = pCmd->macLength - pReq->frags.macSize;
1749 /* If pCmd->digestOffset is not located on last fragment */
1750 if(pCmd->digestOffset < pReq->frags.bufOffset)
1757 digestOffset = pCmd->digestOffset - pReq->frags.bufOffset;
1760 macTotalLen = pCmd->macLength;
1771 (pCmd->macLength >= (1 << 14)) ) )
1779 cryptoDataSize = pCmd->cryptoLength - pReq->frags.cryptoSize;
1809 pMbuf = pCmd->pSrc;
1811 MV_FALSE, pReq->frags.bufOffset, copySize, pCmd->skipFlush);
1828 pMbuf = pCmd->pDst;
1830 MV_TRUE, pReq->frags.bufOffset, copySize, pCmd->skipFlush);
1869 MV_CESA_COMMAND *pCmd = pReq->pCmd;
1873 sid = pCmd->sessionId;
1889 (pCmd->ivFromUser) )
1895 i += mvCesaDmaCopyPrepare(pCmd->pSrc, cesaSramVirtPtr->cryptoIV, &pDmaDesc[i],
1896 MV_FALSE, pCmd->ivOffset, pSA->cryptoIvSize, pCmd->skipFlush);
1907 pMbuf = pCmd->pSrc;
1909 MV_FALSE, 0, pMbuf->mbufSize, pCmd->skipFlush);
1912 mvCesaSramDescrBuild(pSA->config, 0, pCmd->cryptoOffset + fixOffset,
1913 pCmd->ivOffset + fixOffset, pCmd->cryptoLength,
1914 pCmd->macOffset + fixOffset, pCmd->digestOffset + fixOffset,
1915 pCmd->macLength, pCmd->macLength, pReq, &pDmaDesc[i]);
1925 pMbuf = pCmd->pDst;
1927 MV_TRUE, 0, pMbuf->mbufSize, pCmd->skipFlush);
2547 MV_CESA_COMMAND* pCmd = pReq->pCmd;
2553 if(pCmd->pSrc != pCmd->pDst)
2555 mvCesaMbufCopy(pCmd->pDst, pReq->frags.bufOffset,
2556 pCmd->pSrc, pReq->frags.bufOffset, macDataSize);
2560 mvCesaCopyFromMbuf(cesaSramVirtPtr->buf[0], pCmd->pSrc, pReq->frags.bufOffset, macDataSize);
2561 mvCesaCopyToMbuf(cesaSramVirtPtr->buf[0], pCmd->pDst, pReq->frags.bufOffset, macDataSize);
2568 macDataSize, pCmd->macLength, pCmd->digestOffset, macMode);
2576 mvCesaFragMd5Complete(pCmd->pDst, pReq->frags.bufOffset, pOuterIV,
2577 macDataSize, pCmd->macLength, pDigest);
2584 mvCesaFragSha1Complete(pCmd->pDst, pReq->frags.bufOffset, pOuterIV,
2585 macDataSize, pCmd->macLength, pDigest);
2612 MV_CESA_COMMAND *pCmd;
2622 pCmd = (MV_CESA_COMMAND*)pBuf;
2631 pCmd->pSrc = pMbuf;
2632 pCmd->pDst = pMbuf;
2634 mvOsPrintf("CtrModeInit: pCmd=%p, pSrc=%p, pDst=%p, pFrags=%p\n",
2635 pCmd, pCmd->pSrc, pCmd->pDst,
2638 return pCmd;
2648 * MV_CESA_COMMAND *pCtrModeCmd, MV_CESA_COMMAND *pCmd
2654 static MV_STATUS mvCesaCtrModePrepare(MV_CESA_COMMAND *pCtrModeCmd, MV_CESA_COMMAND *pCmd)
2659 int cryptoSize = MV_ALIGN_UP(pCmd->cryptoLength, MV_CESA_AES_BLOCK_SIZE);
2661 mvOsPrintf("CtrModePrepare: pCmd=%p, pCtrSrc=%p, pCtrDst=%p, pOrgCmd=%p, pOrgSrc=%p, pOrgDst=%p\n",
2662 pCmd, pCmd->pSrc, pCmd->pDst,
2683 pCtrModeCmd->pReqPrv = pCmd->pReqPrv;
2684 pCtrModeCmd->sessionId = pCmd->sessionId;
2692 mvCesaCopyFromMbuf(pBuf, pCmd->pSrc, pCmd->ivOffset, MV_CESA_AES_BLOCK_SIZE);
2720 * MV_CESA_COMMAND *pOrgCmd, MV_CESA_COMMAND *pCmd
2726 static MV_STATUS mvCesaCtrModeComplete(MV_CESA_COMMAND *pOrgCmd, MV_CESA_COMMAND *pCmd)
2729 int cryptoSize = pCmd->cryptoLength;
2733 mvOsPrintf("CtrModeComplete: pCmd=%p, pCtrSrc=%p, pCtrDst=%p, pOrgCmd=%p, pOrgSrc=%p, pOrgDst=%p\n",
2734 pCmd, pCmd->pSrc, pCmd->pDst,
2738 pKey = pCmd->pDst->pFrags[0].bufVirtPtr;
2811 mvOsIoCachedFree(cesaOsHandle,pCmd->pDst->pFrags[0].bufSize,
2812 pCmd->pDst->pFrags[0].bufPhysAddr,
2813 pCmd->pDst->pFrags[0].bufVirtPtr,
2814 pCmd->pDst->pFrags[0].memHandle);
2826 * MV_CESA_COMMAND* pCmd
2832 static void mvCesaCtrModeFinish(MV_CESA_COMMAND* pCmd)
2834 mvOsFree(pCmd);
2844 * MV_CESA_SA* pSA, MV_CESA_COMMAND *pCmd, MV_U8* pFixOffset
2850 static MV_STATUS mvCesaParamCheck(MV_CESA_SA* pSA, MV_CESA_COMMAND *pCmd,
2860 if( MV_IS_NOT_ALIGN(pCmd->macOffset, 4) )
2863 pCmd->macOffset);
2867 if( MV_IS_NOT_ALIGN(pCmd->digestOffset, 4) )
2870 pCmd->digestOffset);
2876 fixOffset = (pCmd->macOffset % 8);
2880 if( (pCmd->macOffset % 8) != fixOffset)
2883 pCmd->macOffset, fixOffset);
2887 if( (pCmd->digestOffset % 8) != fixOffset)
2890 pCmd->digestOffset, fixOffset);
2899 if( MV_IS_NOT_ALIGN(pCmd->cryptoOffset, 4) )
2902 pCmd->cryptoOffset);
2906 if( MV_IS_NOT_ALIGN(pCmd->cryptoLength, pSA->cryptoBlockSize) )
2909 pCmd->cryptoLength, pSA->cryptoBlockSize);
2914 fixOffset = (pCmd->cryptoOffset % 8);
2919 if( (pCmd->cryptoOffset % 8) != fixOffset)
2922 pCmd->cryptoOffset, fixOffset);
2931 if( ((pCmd->ivOffset + pSA->cryptoIvSize) > pCmd->cryptoOffset) &&
2932 (pCmd->ivOffset < (pCmd->cryptoOffset + pCmd->cryptoLength)) )
2935 pCmd->ivOffset, pCmd->macOffset, pCmd->macLength);
2940 if( MV_IS_NOT_ALIGN(pCmd->ivOffset, 4) )
2943 pCmd->ivOffset);
2947 if( (pCmd->ivOffset % 8) != fixOffset)
2950 pCmd->ivOffset, fixOffset);
2965 * MV_CESA_SA* pSA, MV_CESA_COMMAND *pCmd
2971 static MV_STATUS mvCesaFragParamCheck(MV_CESA_SA* pSA, MV_CESA_COMMAND *pCmd)
2979 if(pCmd->macOffset > (sizeof(cesaSramVirtPtr->buf) - MV_CESA_AUTH_BLOCK_SIZE))
2982 pCmd->macOffset);
2986 if( ((pCmd->macOffset + pCmd->macLength) > pCmd->pSrc->mbufSize) ||
2987 ((pCmd->pSrc->mbufSize - (pCmd->macOffset + pCmd->macLength)) >=
2991 pCmd->macLength, pCmd->pSrc->mbufSize);
3001 if( (pCmd->cryptoOffset + 4) > (sizeof(cesaSramVirtPtr->buf) - pSA->cryptoBlockSize))
3004 pCmd->cryptoOffset);
3009 if( ((pCmd->cryptoOffset + pCmd->cryptoLength) > pCmd->pSrc->mbufSize) ||
3010 ((pCmd->pSrc->mbufSize - (pCmd->cryptoOffset + pCmd->cryptoLength)) >=
3014 pCmd->cryptoLength, pCmd->pSrc->mbufSize);
3028 (pCmd->macLength >= (1 << 14)) ) )
3034 if(pCmd->cryptoOffset > pCmd->macOffset)
3036 offset = pCmd->cryptoOffset - pCmd->macOffset;
3040 offset = pCmd->macOffset - pCmd->cryptoOffset;
3052 if( ((pCmd->digestOffset + pSA->digestSize) > pCmd->cryptoOffset) &&
3053 (pCmd->digestOffset < (pCmd->cryptoOffset + pCmd->cryptoLength)) )
3057 pCmd->digestOffset, pCmd->cryptoOffset, pCmd->cryptoLength);
3072 * MV_CESA_SA* pSA, MV_CESA_COMMAND *pCmd,
3086 MV_CESA_COMMAND *pCmd = pReq->pCmd;
3096 (pCmd->cryptoLength - (pReq->frags.cryptoSize + 1)) );
3109 (pCmd->macLength - (pReq->frags.macSize + 1)));