#ifndef SPX_SHA2_H
#define SPX_SHA2_H

#include "params.h"

#define SPX_SHA256_BLOCK_BYTES 64
#define SPX_SHA256_OUTPUT_BYTES 32  /* This does not necessarily equal SPX_N */

#define SPX_SHA512_BLOCK_BYTES 128
#define SPX_SHA512_OUTPUT_BYTES 64

#if SPX_SHA256_OUTPUT_BYTES < SPX_N
    #error Linking against SHA-256 with N larger than 32 bytes is not supported
#endif

#define SPX_SHA256_ADDR_BYTES 22

#include <Library/UefiLib.h>
#include <Library/BaseLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseMemoryLib.h>
#include <Uefi.h>

VOID sha256_inc_init(UINT8 *state);
VOID sha256_inc_blocks(UINT8 *state, const UINT8 *in, UINTN inblocks);
VOID sha256_inc_finalize(UINT8 *out, UINT8 *state, const UINT8 *in, UINTN inlen);
VOID sha256(UINT8 *out, const UINT8 *in, UINTN inlen);

VOID sha512_inc_init(UINT8 *state);
VOID sha512_inc_blocks(UINT8 *state, const UINT8 *in, UINTN inblocks);
VOID sha512_inc_finalize(UINT8 *out, UINT8 *state, const UINT8 *in, UINTN inlen);
VOID sha512(UINT8 *out, const UINT8 *in, UINTN inlen);

#define mgf1_256 SPX_NAMESPACE(mgf1_256)
VOID mgf1_256(UINT8 *out, UINTN outlen,
          const UINT8 *in, UINTN inlen);

#define mgf1_512 SPX_NAMESPACE(mgf1_512)
VOID mgf1_512(UINT8 *out, UINTN outlen,
          const UINT8 *in, UINTN inlen);

#define seed_state SPX_NAMESPACE(seed_state)
VOID seed_state(spx_ctx *ctx);


#endif
