AM2634: HSM Client TRNG only works once after power up

Part Number: AM2634

Tool/software:

Hi TI Team,

I am facing the same issue. Please check the below logs -

[HSM_CLIENT] New Client Registered with Client Id = 1

>
> 591021127,2844193811,1501736650,2937302301
TRNG: 591021127

>
>
[HSM_CLIENT] Get Random Number request NACKed by HSM server
TRNG: 0

Code Implementation -

void init_trng(void) {

	HsmClient_register(&hsm_client, APP_CLIENT_ID);

    getRNG.DRBGMode = 0x5A;
    getRNG.seedSizeInDWords = SEED_SIZE_IN_DWORDS;
    getRNG.seedValue = (uint32_t *)&RngDrbgSeed;
    getRNG.resultLengthPtr = &rng_length;
    getRNG.resultPtr = (uint8_t *)rng_val;
}

uint32_t generate_trng(void) {
	int32_t status = SystemP_SUCCESS;

	status = HsmClient_gettRandomNum(&hsm_client, &getRNG);

	if (SystemP_SUCCESS == status) {
		UPRINTF("%u,%u,%u,%u\n\r", rng_val[0], rng_val[1], rng_val[2], rng_val[3]);
		return rng_val[0];
	} else {
		return 0;
	}
}

Thanks,
Rahul

  • Hi Rahul,

    Sorry for the delay in response. Is this seen on HS-FS or HS-SE device?

    Thanks and Regards,

    Nikhil Dasan

  • Hi Nikhil,

    It is for HS-SE device. I am using the tifs_am263x_hs_se.release.bin file.

    Thanks,

    Rahul

  • Hi Rahul,

    I apologize as the expert is currently out of office. Please expect a response sometime next week when they return

    Thank you,

    AJ Favela

  • Logs of HSM Service example -

    Starting QSPI Bootloader ...
    KPI_DATA: [BOOTLOADER_PROFILE] Boot Media : NOR SPI FLASH
    KPI_DATA: [BOOTLOADER_PROFILE] Boot Media Clock : 80.000 MHz
    KPI_DATA: [BOOTLOADER_PROFILE] Boot Image Size : 40 KB
    KPI_DATA: [BOOTLOADER_PROFILE] Cores present :
    r5f0-0
    KPI_DATA: [BOOTLOADER PROFILE] System_init : 303us
    KPI_DATA: [BOOTLOADER PROFILE] Drivers_open : 83us
    KPI_DATA: [BOOTLOADER PROFILE] LoadHsmRtFw : 9039us
    KPI_DATA: [BOOTLOADER PROFILE] Board_driversOpen : 49us
    KPI_DATA: [BOOTLOADER PROFILE] CPU load : 2938us
    KPI_DATA: [BOOTLOADER PROFILE] SBL End : 2384us
    KPI_DATA: [BOOTLOADER_PROFILE] SBL Total Time Taken : 14799us

    Image loading done, switching to application ...

    [HSM CLIENT] Sending UID Request to HSM Server..
    [HSM CLIENT] Device UID Successfully retrived from the HSM Server.

    [HSM CLIENT_PROFILE] Time taken by GetUID Request : 47us

    [HSM CLIENT] Device UID is : 1686C4B362F67028D5A3BBD60F298B3BDD19C18A0E6BF46D384A7F017DCB06BB5CCA50C6B9A55DD30D13FE20063C38C8A67239FB950B26DA7C3BD78854D55D78[HSM CLIENT] TIFS-MCU 64bit version string = 0

    [HSM CLIENT] TIFS-MCU Information
    [Soc Type] = AM263x
    [Device Type] = HS-FS
    [HSM Type] = HSM_V1
    [Bin Type] = STANDARD
    [TIFS-MCU Version] = 10.0.0

    RNG output word -- 0xB96F8BFE
    RNG output word -- 0x3C4EA0E6
    RNG output word -- 0x445E988D
    RNG output word -- 0x83E8656A


    [HSM CLIENT_PROFILE] Time taken by get RNG request : 451us

    [HSM_CLIENT] Get Random Number request NACKed by HSM server
    ASSERT: 0.80674s: ../trng_service_app.c:HsmRngApp_start:75: status == SystemP_SUCCESS failed !!!

  • Hi,

    Sorry for the delay here. 

    Can you share me the source code for the above for me to check the way the service is called in the SBL code?

    Thanks and Regards,

    Nikhil Dasan

  • Hi Nikhil,

    I am using the TI example code located at:
    C:\ti\mcu_plus_sdk_am263x_10_01_00_31\examples\drivers\hsmclient\hsm_services

    In the hsm_client_app.c file, the function HsmRngApp_start(&gHSMClient); is called twice. On the second call, the following error occurs:
    [HSM_CLIENT] Get Random Number request NACKed by HSM server

    /* Demo Application code on R5 */
    void HsmClientApp_start(void)
    {
        /*Function call to the desired services*/
        getUIDApp(&gHSMClient);
        getVersionApp(&gHSMClient);
        HsmRngApp_start(&gHSMClient);
    	HsmRngApp_start(&gHSMClient);
        HsmFirewallApp(&gHSMClient);
    }

    Thanks,
    Rahul