mupq / pqm4

Post-quantum crypto library for the ARM Cortex-M4
280 stars 68 forks source link

Region 'ram' overflowed by 419416 (!) bytes #336

Closed digneludvig closed 4 months ago

digneludvig commented 4 months ago

Im trying to build the library with make -j2 PLATFORM=nucleo-l476rg. This eventually results in the following errors:

/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: elf/crypto_sign_ov-Ip_m4f_stack.elf section `.bss' will not fit in region `ram'
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: region `ram' overflowed by 419416 bytes
collect2: error: ld returned 1 exit status
make: *** [mupq/mk/schemes.mk:148: elf/crypto_sign_ov-Ip_m4f_stack.elf] Error 1
make: *** Waiting for unfinished jobs....

As you saw, the board I'm using is a Nucleo-L476RG, which is said to be a compatible board in the README, but a 419416 byte overflow seem like an absurd overflow for any board. Any ideas what is going on here and what to do about it?

mkannwischer commented 4 months ago

OV-Ip should not run on that board because it OV needs more than 500 KiB of RAM and the board only has 128 KiB of RAM. Let me add that to the EXCLUDED_SCHEMES in https://github.com/mupq/pqm4/blob/master/mk/nucleo-l476rg.mk. brb.

mkannwischer commented 4 months ago

https://github.com/mupq/pqm4/commit/82c6d7aea48b511b7e0ac10523cadcc0aa6a1676 should fix it. Can you try again please?

digneludvig commented 4 months ago

82c6d7a should fix it. Can you try again please?

Thanks, it fixed the previous issue it seems, but instead I get the overflow below when building the exact same way:

/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: elf/mupq_crypto_sign_snova-37-8-16-4-esk_ref_stack.elf section `.bss' will not fit in region `ram'
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: region `ram' overflowed by 35192 bytes
collect2: error: ld returned 1 exit status
make: *** [mupq/mk/schemes.mk:148: elf/mupq_crypto_sign_snova-37-8-16-4-esk_ref_stack.elf] Error 1
make: *** Waiting for unfinished jobs....
mkannwischer commented 4 months ago

Sorry about that. I added CI for this platform and hopefully fixed all the problems for this platform now: https://github.com/mupq/pqm4/pull/337 Can you try that version, please?

Some other platforms also have problems, so it will take a little longer before we can merge it to master.

digneludvig commented 4 months ago

Thanks, it builds now, although I do get a bunch of warnings during the build process, often related to unused parameters or comparisons of expressions. These may not pose issues though?

mkannwischer commented 4 months ago

Thanks! Yes, these are warnings in the implementations written by other people. I'm not going to fix all these as it's way too many.