Hi,
how to call thetrng_acquirefunction right?
I do not know where I get the address foruint8_t *sram_puf.
Isn't there any demo application or reference implementation?
/** **************************************************************************************** * @brief Acquires 128 random bits using uninitialized RAM data. * * @param[out] trng_bits_ptr Pointer to the buffer where random data will be stored. * @note Its address must be aligned to 32 bits. * @param[in] sram_puf Pointer to the base address of the uninitialized SRAM area. * @note Its address must be aligned to 32 bits. * @param[in] sram_puf_blocks Number of 16byte blocks to use (28 minimum). * @return Status code **************************************************************************************** */ uint8_t trng_acquire(uint8_t *trng_bits_ptr, uint8_t *sram_puf, const uint16_t sram_puf_blocks);
Keywords:
Device:
Hi Firefox2005
Please check init_rand_seed_from_trng() that invokes the trng_acquire(). There isn’t any example for this, but why don’t you use the init_rand_seed_from_trng() in order to initialize random number generator seed using random bits acquired from TRNG? The purpose of the trng_aquire() is to seed the random function.
Thanks, PM_Dialog
Hi,
so I missunderstood the function...
In that case I just have toinit_rand_seed_from_trng ();和使用the generated random value to initialize e.g. thesrand(trng_state_val);function and poll some random numbers fromrand();
But I do get always the same random number over and over again if I restart the same firmware build. I do not think this is correct.
When do I have to reinitialize theinit_rand_seed_from_trng ();一遍吗?
Why is thetrng_aquire(...)function than not static if I do not have to use it outside the trng.c?
Thank you so far
Hi There,
What is the same random number that you are getting? Coudl you please share the results?
Thanks, PM_Dialog
I always get the same output if I reload and start the firmware. This should not be in my opinion.
Code:
Console output:
Hi There,
Thanks for your inputs. Let me check the provided code snippet and I'll revert back to you shorlty.
Thanks, PM_Dialog
Hi There,
My apologies for the confusion. If the CFG_TRNG macro is defined in the da1458x_config_advanced.h, then the init_rand_seed_from_trng() is automatically called by the SDK. Please check line 1324 in the arch_system.c file. This means that the SDK will initialize random number generator seed automatically. In case you want to generate random numbers, you should just use the rand() function.
Thanks, PM_Dialog