Arm Mbed OS support forum

NV Random Number Generator

Hello:

I’m doing a piece of software that requires to have the same random generated item in two independent machines. I was thinking on performing a Non-Volatile Random Number Generator, and to achieve that porpoise I wrote a file called “seedfile” with some text and configure the system as told in how_to_integrate_nv_seed to use the standard libc functions.

But when I try the function mbedtls_entropy_self_test I got the error output.

Besides, if I try to get use a seed from a personalized string using mbedtls_ctr_drbg_seed (that I think I could also fit my requirements) I got the error -0x34 This error happens with and without the NV seed configuration.

After this attempt of getting a seed, I’m able to execute mbedtls_ctr_drbg_random but it always print the same output without any consideration to the personalized string used.

The config-symmetric-only.h has been used to compile mbedtls v3.0.0

A few lines of code are shown to clarify the explanation:

mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_entropy_init(&entropy);
mbedtls_ctr_drbg_seed( &ctr_drbg , mbedtls_entropy_func, &entropy,
                 (const unsigned char *) &personalization,  sizeof(personalization)  );
mbedtls_ctr_drbg_random ( &ctr_drbg , output, 1);

I get the same error code executing the random example program from the repository

Am I missing something? With the default config file the random generation works perfectly with the same code but I would like to use the symmetric-only configuration.

Thank you!