1 (edited by cachristiansen 2022-07-05 06:29:28)

Topic: Creating TRNG with Renesas RX65 TSIP

Hello,
I am trying to create a true random number. By looking at these sites it should be possible when i have a Renesas RX65 with TSIP.

https://www.wolfssl.com/true-random-vs- … eneration/
https://www.wolfssl.com/docs/wolfssl-renesas-tsip/

Do you have any documentation/example code ?

Currently i am using this code by calling "wc_InitRng" but it this the proper way? and do i need to call wc_RNG_GenerateBlock also ? Because this site says that "wc_RNG_GenerateBlock " create pseudorandom and i want to make TRNG: https://www.wolfssl.com/doxygen/group__ … 743020f83c ("Copies a sz bytes of pseudorandom data to output. Will reseed rng if needed (blocking). ")

#elif defined(WOLFSSL_RENESAS_TSIP)
#if defined(WOLFSSL_RENESA_TSIP_IAREWRX)
   #include "r_bsp/mcu/all/r_rx_compiler.h"
#endif
   #include "r_bsp/platform.h"
    #include "r_tsip_rx_if.h"

    int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
    {
        int ret = 0;
        word32 buffer[4];

        while (sz > 0) {
            word32 len = sizeof(buffer);

            if (sz < len) {
                len = sz;
            }
            /* return 4 words random number*/
            ret = R_TSIP_GenerateRandomNumber(buffer);
            if(ret == TSIP_SUCCESS) {
                XMEMCPY(output, &buffer, len);
                output += len;
                sz -= len;
            } else
                return ret;
        }
        return ret;
    }

BR

Share

Re: Creating TRNG with Renesas RX65 TSIP

Hello cachristiansen

Thanks for joining the forum. In order to provide highest priority support, we recommend emailing support@wolfssl.com with your questions.

The default implementation of wc_RNG_GenerateBlock will use the TSIP RNG via the seed operation. You can implement you r own block RNG function by defining CUSTOM_RAND_GENERATE_BLOCK.

Thanks,
Eric @ wolfSSL Support