/** * @brief This function is used to end the RC4 processing session. * It is the last function called for the RC4 process. * * * @param[in] ContextID_ptr - A pointer to the RC4 context buffer allocated by the user that * is used for the RC4 machine operation. This should be the * same context as was used for the previous call of this session. * * * @return CRYSError_t - CRYS_OK, * CRYS_RC4_INVALID_USER_CONTEXT_POINTER_ERROR, */ CIMPORT_C CRYSError_t CRYS_RC4_Free(CRYS_RC4UserContext_t *ContextID_ptr ) { /* The return error identifiers */ CRYSError_t Error = CRYS_OK; /* ............... checking the parameters validity ................... */ /* -------------------------------------------------------------------- */ /* if the users context ID pointer is DX_NULL return an error */ if (ContextID_ptr == DX_NULL) { return CRYS_RC4_INVALID_USER_CONTEXT_POINTER_ERROR; } /* check validity for priv */ if (DxCcAcl_IsBuffAccessOk(ACCESS_READ_WRITE, ContextID_ptr, sizeof(CRYS_RC4UserContext_t))) { return CRYS_RC4_ILLEGAL_PARAMS_ERROR; } /* .............. clearing the users context .......................... */ /* -------------------------------------------------------------------- */ DX_PAL_MemSetZero(ContextID_ptr, sizeof(CRYS_RC4UserContext_t)); return Error; }
/*! * This function initializes the completion counter event, clears the * state structure and sets completion counter "0" as the first available * counter to be used when calling "AllocCounter". * * \return int one of the error codes defined in err.h */ int InitCompletionPlat(void) { uint8_t dummy; int qid; /* Clear completion fifo */ for ( qid=0; qid < MAX_NUM_HW_QUEUES; qid++ ) { /* Clear FIFO head/tail */ gCompletionFifoHead[qid] = 0; gCompletionFifoTail[qid] = 0; /* The global AXI write counter is reset only once */ gAxiWriteCompleted[qid] = 0; gCompletionCount[qid] = 0; gExpectedAxiWrites[qid] = 0; gCompletionCtx[qid] = COMPLETION_INVALID; DX_PAL_MemSetZero( gCompletionFifo, MAX_NUM_HW_QUEUES*COMPLETION_FIFO_LEN ); /* Clear all past AXI completion counters */ /* Actual bus values of AXI IDs for queues (0-3) DMA are 8, 9, A, B */ dummy = DX_HAL_ReadCcRegister(DX_CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_COMP8) + QID_TO_AXI_ID(qid)*sizeof(uint32_t)); DX_PAL_LOG_DEBUG("Initial AXI_MON_COMP%d value=0x%08X\n", (int)qid, (unsigned int)dummy); dummy = dummy; /*avoid compiler warning*/ } return DX_RET_OK; }
/** * @brief This function clears the hash context * * @param[in] ContextID_ptr - a pointer to the HMAC context * buffer allocated by the user that is * used for the HMAC machine operation. * This should be the same context that * was used on the previous call of this * session. * * @return CRYSError_t - On success CRYS_OK is returned, on failure a * value MODULE_* crys_hash_error.h */ CEXPORT_C CRYSError_t CRYS_HMAC_Free(CRYS_HMACUserContext_t *ContextID_ptr) { if ( ContextID_ptr == DX_NULL ) { return CRYS_HMAC_INVALID_USER_CONTEXT_POINTER_ERROR; } /* check validity for priv */ if (DxCcAcl_IsBuffAccessOk(ACCESS_READ_WRITE, ContextID_ptr, sizeof(CRYS_HMACUserContext_t))) { return CRYS_HMAC_ILLEGAL_PARAMS_ERROR; } DX_PAL_MemSetZero(ContextID_ptr, sizeof(CRYS_HMACUserContext_t)); return CRYS_OK; }
/** * @brief This function clears the hash context * * @param[in] ContextID_ptr - a pointer to the HASH context * buffer allocated by the user that is * used for the HASH machine operation. * This should be the same context that * was used on the previous call of this * session. * * @return CRYSError_t - On success CRYS_OK is returned, on failure a * value MODULE_* crys_hash_error.h */ CEXPORT_C CRYSError_t CRYS_HASH_Free( CRYS_HASHUserContext_t *ContextID_ptr ) { // PRINT_INFO("--->NOW into CRYS_HASH_Free\n"); if ( ContextID_ptr == DX_NULL ) { return CRYS_HASH_INVALID_USER_CONTEXT_POINTER_ERROR; } /* check validity for priv */ if (DxCcAcl_IsBuffAccessOk(ACCESS_READ_WRITE, ContextID_ptr, sizeof(CRYS_HASHUserContext_t))) { return CRYS_HASH_ILLEGAL_PARAMS_ERROR; } DX_PAL_MemSetZero(ContextID_ptr, sizeof(CRYS_HASHUserContext_t)); //PRINT_INFO("--->NOW leave CRYS_HASH_Free\n"); return CRYS_OK; }
/** * @brief This function is used to end the DES processing session. * It is the last function called for the DES process. * * * @param[in] ContextID_ptr - A pointer to the DES context buffer allocated by the user that * is used for the DES machine operation. this should be the * same context that was used on the previous call of this session. * * @return CRYSError_t - On success the value CRYS_OK is returned, * and on failure a value from crys_error.h */ CIMPORT_C CRYSError_t CRYS_DES_Free(CRYS_DESUserContext_t *ContextID_ptr) { /* if the users context ID pointer is DX_NULL return an error */ if( ContextID_ptr == DX_NULL ) { return CRYS_DES_INVALID_USER_CONTEXT_POINTER_ERROR; } /* check validity for priv */ if (DxCcAcl_IsBuffAccessOk(ACCESS_READ_WRITE, ContextID_ptr, sizeof(CRYS_DESUserContext_t))) { return CRYS_DES_ILLEGAL_PARAMS_ERROR; } DX_PAL_MemSetZero(ContextID_ptr, sizeof(CRYS_DESUserContext_t)); return CRYS_OK; }
/*! * Clears the configuration nodes. * * \param pConfig A pointer to the configuration scheme array */ CIMPORT_C void CrysCombinedConfigInit(CrysCombinedConfig_t *pConfig) { DX_PAL_MemSetZero(pConfig, sizeof(CrysCombinedConfig_t)); }