sphincs / sphincsplus

The SPHINCS+ reference code, accompanying the submission to NIST's Post-Quantum Cryptography project
https://sphincs.org
Other
131 stars 44 forks source link

sha3_512_inc_finalize in consistent-basew branch setting only 32 bytes instead of 64 bytes #57

Closed DogeProtocol closed 11 months ago

DogeProtocol commented 11 months ago

https://github.com/sphincs/sphincsplus/blob/c8116bc9936f431b5c08ff61ac646e86c57e8ae7/ref/fips202.c#L735

In above file, in consistent-basew branch, in sha3_512_inc_finalize function, should the value in the for loop need to be 64? In similar code in https://github.com/PQClean/PQClean/blob/master/common/fips202.c it is 64 bytes (512)

`void sha3_512_inc_finalize(uint8_t output, uint64_t s_inc) { uint8_t t[SHA3_512_RATE]; keccak_inc_finalize(s_inc, SHA3_512_RATE, 0x06);

keccak_squeezeblocks(t, 1, s_inc, SHA3_512_RATE);

for (size_t i = 0; i < 32; i++) { <--------------------- needs to be 64?
    output[i] = t[i];
}

}`

bwesterb commented 11 months ago

You're right, it's incorrect. But it's also not used, and has been removed in master via this PR. I'll rebase the branch in a bit.

bwesterb commented 11 months ago

Done.