KULeuven-COSIC / Masked-Comparison

MIT License
5 stars 2 forks source link

Adaption to STM32F3 #1

Open Catherinecyj opened 2 years ago

Catherinecyj commented 2 years ago

Hi,

I have read your paper recently and wanted to reproduce your experiment. But I only got an STM32F303 board with a CW308UFO borad. Due to the lack of RNG in STM32F3, it is impossible to make the bin file with the change of DEVICE in Makefile. It will be really helpful for telling me whether it is possible to adapt your implementation on my device?

Thank you so much for your reply.

mvanbeirendonck commented 2 years ago

Hi, thank you for your interest in our work!

In our leakage evaluation, we actually used a ChipWhisperer-Lite target with a STM32F303 chip. Have a look at the jupyter folder for that.

For our performance measurements, we stuck to the STM32F407G-DISC1 board. That said, it is probably not too hard to adapt the code for the STM32F303. The first step is indeed to change DEVICE in the Makefile; this will take care of a lot of the differences for you. You will also need to change the TRNG to a PRNG. We already have a PRNG that we use when running on a host laptop, have a look at randombytes.c for that. Finally, you may want to have a look at hal.c to remove anything that is specific to the STM32F4.

Let us know if you face any more issues.

-- Michiel

Catherinecyj commented 2 years ago

Hi Michiel,

Thank you so much for your reply. I tried these days but I still got some problems here.

I changed DEVICE in the Makefile and used PRNG instead of TRNG. But in https://github.com/KULeuven-COSIC/Masked-Comparison/tree/main/common/hal.c I still got some errors. It was almost about the rcc_clock which was quite different in STM32F3 and STM32F4. I tried to solve these errors but failed that many parameters are missing in STM32F3. I am wondering if it is correct to remove these settings ? fe43fef69022afab7d8d50278a10b16

Thanks again for your patience.

--Catherine

mvanbeirendonck commented 2 years ago

Hi,

Yes, the clock configs for the STM32F3 and STM32F4 are different. You'll have to look into the documentation and examples of libopencm3 to learn about that.

If you want to get started quickly, you can also have a look at some previous code that we published. This file has clock configs for both types of boards.

-- Michiel