perfromes time of RSA & import key in s32k312

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

perfromes time of RSA & import key in s32k312

157 Views
JasonChou
Contributor II

hi nxp,

I  do an experiment on the S32K312 board with RTOS, running RSA and import key operations simultaneously. 

And, RSA operation for MU#0, channel 2, import key operation for MU#0, channel 1

I found that the import key operation time was impacted by the RSA operation.

Also, I checked Section (5.4.1 Service execution order)of the HSE Reference Manual(RM00286), and it seems that only AES/HASH/MAC could be able to interrupt the RSA operation and response.

 

How can I ensure that import key operation is not affected by RSA?

And How should I imporve RSA operation or time?

HSE version: 0.2.40.0

 

Here is same log

RSA(207) and import key(104) operation at the same time.

 

 

HSE srvId:104, RSR:0, FSR:3600006
HSE srvId:207, RSR:0, FSR:3600006
srvID:207, time_diff: 742
srvID:104, time_diff: 637

 

 

 

only RSA(207) operation 

 

 

HSE srvId:207, RSR:0, FSR:3600004
srvID:207, time_diff: 736

 

 

 

only import key(104) operation 

 

 

HSE srvId:104, RSR:0, FSR:3600002
srvID:104, time_diff: 144

 

 

 

code snippet

 

 

hseSrvResponse_t Hse_Ip_ServiceRequest
(
    uint8               u8MuInstance,
    uint8               u8MuChannel,
    Hse_Ip_ReqType*     pRequest,
    hseSrvDescriptor_t* pHseSrvDesc
)
{
    hseSrvResponse_t    HseResponse     = HSE_SRV_RSP_OK;
    uint32              u32ElapsedTicks = 0U;
    Hse_Ip_MuStateType* pHseIpMuState;
    uint32              u32TimeoutTicks;
    uint32              u32CurrentTicks;
    uint32              RSR,FSR;

    /* Keep a pointer to MuState to optimize a bit the code for accessing it */
    pHseIpMuState = Hse_Ip_apMuState[u8MuInstance];

    /* Save the reference to the request. This is used to mark the channel as processing a request and is also used to filter out spurious interrupts */
    pHseIpMuState->apChannelRequest[u8MuChannel] = pRequest;

    if (HSE_IP_REQTYPE_SYNC == pRequest->eReqType)
    {
        /* Convert from microseconds to ticks */
        u32TimeoutTicks = OsIf_MicrosToTicks(pRequest->u32Timeout, (OsIf_CounterType)HSE_IP_TIMEOUT_OSIF_COUNTER_TYPE);
        /* Send the service request to HSE */
        uint32_t  str_tick = osKernelGetTickCount();
        Mu_Ip_SetTxRegister(Hse_Ip_apMuBase[u8MuInstance], u8MuChannel, (uint32)pHseSrvDesc);
        /* Read the current value of the counter */
        u32CurrentTicks = OsIf_GetCounter((OsIf_CounterType)HSE_IP_TIMEOUT_OSIF_COUNTER_TYPE);
        /* Wait for the HSE response */
        while ((FALSE == Mu_Ip_IsResponseReady(Hse_Ip_apMuBase[u8MuInstance], u8MuChannel)) && (u32ElapsedTicks < u32TimeoutTicks))
        {
            /* Update the elapsed ticks, current ticks will be updated too by the OsIf function */
            u32ElapsedTicks += OsIf_GetElapsed(&u32CurrentTicks, (OsIf_CounterType)HSE_IP_TIMEOUT_OSIF_COUNTER_TYPE);
            if((u32ElapsedTicks % (uint32)DEBUG_PRINT_TIMEOUT_REMINDER) == 0)
            {
                RSR = Mu_Ip_GetRxStatusRegister(Hse_Ip_apMuBase[u8MuInstance]);
                FSR = Mu_Ip_GetFlagStatusRegister(Hse_Ip_apMuBase[u8MuInstance]);
                debug_print("HSE srvId:%x, RSR:%x, FSR:%x",E_MG0CB7,pHseSrvDesc->srvId,E_MG0CB8,RSR,E_MG0CB9,FSR);
            }
        }
        /* If timeout expired - return timeout error */
        if (u32ElapsedTicks >= u32TimeoutTicks)
        {
            HseResponse = HSE_IP_SRV_RSP_NO_RESPONSE;
        }
        else
        {
            /* Read the response */
            HseResponse = Mu_Ip_GetRxRegister(Hse_Ip_apMuBase[u8MuInstance], u8MuChannel);
            uint32_t  end_tick = osKernelGetTickCount();
            debug_print("srvID:%x, time_diff: %u", pHseSrvDesc->srvId, sys_get_timediff(str_tick,end_tick));
        }
        /* Release the allocated channel */
        Hse_Ip_ReleaseChannel(u8MuInstance, u8MuChannel);
    }
    else
    {
        /* Enable the Rx interrupt if the request is async irq */
        if (HSE_IP_REQTYPE_ASYNC_IRQ == pRequest->eReqType)
        {
            Hse_Ip_EnableRxIrq(u8MuInstance, u8MuChannel);
        }
        /* Send the service request to HSE */
        Mu_Ip_SetTxRegister(Hse_Ip_apMuBase[u8MuInstance], u8MuChannel, (uint32)pHseSrvDesc);
    }
    return HseResponse;
}

 

 

 

 
0 Kudos
Reply
1 Reply

123 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

I have forwarded your question to HSE experts. I will let you know when I am able.

0 Kudos
Reply