mupq / pqm4

Post-quantum crypto library for the ARM Cortex-M4
291 stars 75 forks source link

OS problem #334

Open rickyhsyk opened 8 months ago

rickyhsyk commented 8 months ago

Hi, I'm using cw308t-stm32f3 as by targetboard, I'm trying to connect with simpleserial on chipwhisperer, but the problem occurs when it goes to randombytes.c:

/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: objdir-CW308_STM32F3/pqm4/randombytes.o: in function PQCLEAN_randombytes': /home/cwuser777/Desktop/chipwhisperer/hardware/victims/firmware/simpleserial-pqm4/pqm4/randombytes.c:336: undefined reference torandombytes_linux_randombytes_getrandom' collect2: error: ld returned 1 exit status make[1]: [.././Makefile.inc:486: kyber768-CW308_STM32F3.elf] Error 1 make: [.././Makefile.inc:338: all] Error 2

It seems like it didn't figure out that my OS is on linux, however I remove the #if and #elif, it can't call the function on sys like "sys/syscall.h" or "poll.h", is there anyway to solve it?

rpls commented 8 months ago

I assume, you just used the sources of a single scheme and try to build it with your own build-system (probably the CW Makefile buildsystem)? And it seems like you're using a randombytes.c implementation (from the pqclean repo from the look of it?) that is not meant for the STM32F303 chip (which does not have a TRNG).

rickyhsyk commented 8 months ago

Oh I see, I did built it with CW Makefile and use the randombytes.c from the pqlean implementation. So I got that it doesn't support STM32F303, then which one is meant for it?

rpls commented 8 months ago

Use this one. You might have to adapt it, but the fallback implementation in there should be fine.