cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for alternative mbedtls entropy source on STM32F103

Cheye.1
Associate II
 
1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

Good entropy requires a good source, which is given with the TRNG (True Random Number Generator) introduced only from STM32F2 onwards. The TRNG have been tested and confirmed according to NIST (National Institute of Standards and Technology) because they are based on white noise of an analogue source.

Details of this can be found in the AN4230 and the associated Test Suite software STSW-STM32129.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

8 REPLIES 8
Cheye.1
Associate II

Hello,

The STMF103 series do not have the hardware random number generator IP, which are available on STML4 STMF7 and other series...

This answer cannot be more ambiguous as there's one person saying it's possible, another it is not

https://stackoverflow.com/questions/50948597/does-mbedtls-works-on-stm32-f1

so which one is it? Can an ST expert actually answer this question?

If the answer is, yes it should be possible to use another entropy source on STM32F103, then can anyone please advise on how this can be done?

Thanks

Peter BENSCH
ST Employee

Good entropy requires a good source, which is given with the TRNG (True Random Number Generator) introduced only from STM32F2 onwards. The TRNG have been tested and confirmed according to NIST (National Institute of Standards and Technology) because they are based on white noise of an analogue source.

Details of this can be found in the AN4230 and the associated Test Suite software STSW-STM32129.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Cheye.1
Associate II

I have seen this document, but I'm afraid this is not answering my question.

Can we somehow make this work on the STM32F103? Simple yes or no will suffice

Peter BENSCH
ST Employee

The desired short answer: no.

Detailed reasoning: TRNG is a peripheral module that was implemented as hardware after the STM32F1. A good entropy source must therefore only be connected externally to the STM32F1.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Cheye.1
Associate II

I understand this, the STM32F103 itself doesn't provide the desired entropy (lack of HW RNG), but if we somehow manage to do this "externally" ourselves as you mention, then theoretically this can still be achieved.

We can use an ADC, temp sensor, or similar to provide sufficient randomness, and then feed our own callback into the mbedtls_entropy_addd_source function?

Peter BENSCH
ST Employee

Yes, this could be an approach to get entropy into the STM32F1.

However, compared to using a more modern STM32, e.g. STM32F/L4 or STM32F/H7, the effort is very high, at least in terms of external hardware.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Cheye.1
Associate II

OK thanks for the clarification.

We'll just decide whether we want to put in that effort now or migrate to the STML496 on which we have the reference design with GCP working

Peter BENSCH
ST Employee

Good luck!

If the problem is resolved, please mark this topic as answered by selecting Select as best. This will help other users find that answer faster.

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.