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

Thread safety #19

Closed bwesterb closed 2 years ago

bwesterb commented 3 years ago

We should get rid of the global variables so that it's thread safe.

bwesterb commented 3 years ago

@thomwiggers Perhaps we should coordinate to prevent even more double work :).

thomwiggers commented 3 years ago

For reference: the problem: https://github.com/sphincs/sphincsplus/blob/master/ref/hash_haraka.c#L11-L15

bwesterb commented 3 years ago

There are more, such as state_seed for sha256-avx.

thomwiggers commented 3 years ago

Yeah that's the other one — but it's just initialize_hash_function that's the problem because that's the only place where state_seed is called AFAIK.

bwesterb commented 3 years ago

Proposal: carry around a pointer to a context structure, which contains the formerly global state. We can also move in pub_seed, sk_seed, etc.