I was wanting to use the TRNG (true random number generator) which should be a trivial matter. However, the SCE7 chapter in the user manual for the RA6M3 and RA6M2 contains no useful information explaining how to use these functions. When I add the MbedTLS (Crypto Only) module then the code that is produced does not compile (threading_alt.h not found) and if I look at how RM_PSA_CRYPTO_TRNG_Read is implemented then I find some of the worst code I have ever seen, full of magic identifiers and numbers. A small snippet:
SCE->REG_84H = 0x00002001U; SCE->REG_108H = 0x00000000U; HW_SCE_p_func100(0xa4cc89c7U, 0xcf20cb7aU, 0x61930afaU, 0xbbd24bbdU); HW_SCE_p_func103(); SCE->REG_104H = 0x00000052U; SCE->REG_C4H = 0x01000c84U;
Is this a deliberate attempt to obfuscate the security features of the device? We expect to be able to access all features of the Renesas micro without the FSP as we, for various reasons, do not intend to use it, so why is the SCE7 undocumented? If this is about preventing hacking then it seems pretty OTT to me. Not very impressed.
Renesas engineer dont have access to SCE's registers. We had to reply on the codes provided.. That's how it is going to be and we trust they undergo tests to achieve NIST CAVP certification.
Here is a link to test report. NIST SP800-22r1a Random Number Statistical Test Report for RA6M2 – Application Note (renesas.com)