1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-23 07:59:01 +00:00
pqcrypto/crypto_sign/sphincs-sha256-192f-robust/clean/sha256.h
Thom Wiggers aa4611a4d1 Eliminate the global state
This PR sacrifices passing some extra arguments to get rid of the global
state.

* Haraka needs state in all hash calls, this results in changes to the
  hash functions specified in `hash.h`.  The extra pointers passed would
  not be necessary for SHA256 or SHAKE256.
* SHAKE256 did not have global state, but uniformity in the implementations
  requires us to pass  around the new state context anyway. Otherwise,
  @joostrijneveld's SPHINCS+ generator doesn't really work anymore).

We introduce a new header file called `primitive.h` which defines the
required state type for the generic functions. I did not go into
replacing _all_ occurrences of state variables by the new `hash_state`
macro.
2019-07-16 15:46:27 -04:00

22 lines
636 B
C

#ifndef SPX_SHA256_H
#define SPX_SHA256_H
#define SPX_SHA256_BLOCK_BYTES 64
#define SPX_SHA256_OUTPUT_BYTES 32 /* This does not necessarily equal SPX_N */
#define SPX_SHA256_ADDR_BYTES 22
#include <stddef.h>
#include <stdint.h>
#include "sha2.h"
void PQCLEAN_SPHINCSSHA256192FROBUST_CLEAN_compress_address(unsigned char *out, const uint32_t addr[8]);
void PQCLEAN_SPHINCSSHA256192FROBUST_CLEAN_mgf1(
unsigned char *out, unsigned long outlen,
unsigned char *input_plus_four_bytes, unsigned long inlen);
void PQCLEAN_SPHINCSSHA256192FROBUST_CLEAN_seed_state(sha256ctx *state_seeded, const unsigned char *pub_seed);
#endif