mupq / pqm4

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

size of buffer in kyber768/m4fstack/matacc.c (and probably m4fspeed too) #357

Open marco-palumbi opened 3 months ago

marco-palumbi commented 3 months ago

unsigned char buf[XOF_BLOCKBYTES+2]; could be of size XOF_BLOCKBYTES (see: https://github.com/mupq/pqm4/blob/master/crypto_kem/kyber768/m4fstack/matacc.c#L20)

if I'm not wrong the code relay on XOF_BLOCKBYTES being multiple of 3 (see https://github.com/pq-crystals/kyber/commit/ce492cd3d56bfca61bd941b6a73da3764e799aae) and xof_squeezeblocks() is always called with the address of the first byte of buf (see also https://github.com/mupq/pqm4/blob/master/crypto_kem/kyber768/m4fstack/matacc.i#L101)

buf can then be defined: unsigned char buf[XOF_BLOCKBYTES]; the same should apply to the m4fspeed version. Can please check?