#ifndef SPX_ADDRESS_H
#define SPX_ADDRESS_H

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

/* The hash types that are passed to set_type */
#define SPX_ADDR_TYPE_WOTS 0
#define SPX_ADDR_TYPE_WOTSPK 1
#define SPX_ADDR_TYPE_HASHTREE 2
#define SPX_ADDR_TYPE_FORSTREE 3
#define SPX_ADDR_TYPE_FORSPK 4
#define SPX_ADDR_TYPE_WOTSPRF 5
#define SPX_ADDR_TYPE_FORSPRF 6

#define set_layer_addr SPX_NAMESPACE(set_layer_addr)
VOID set_layer_addr(UINT32 addr[8], UINT32 layer);

#define set_tree_addr SPX_NAMESPACE(set_tree_addr)
VOID set_tree_addr(UINT32 addr[8], UINT64 tree);

#define set_type SPX_NAMESPACE(set_type)
VOID set_type(UINT32 addr[8], UINT32 type);

/* Copies the layer and tree part of one address into the other */
#define copy_subtree_addr SPX_NAMESPACE(copy_subtree_addr)
VOID copy_subtree_addr(UINT32 out[8], const UINT32 in[8]);

/* These functions are used for WOTS and FORS addresses. */

#define set_keypair_addr SPX_NAMESPACE(set_keypair_addr)
VOID set_keypair_addr(UINT32 addr[8], UINT32 keypair);

#define set_chain_addr SPX_NAMESPACE(set_chain_addr)
VOID set_chain_addr(UINT32 addr[8], UINT32 chain);

#define set_hash_addr SPX_NAMESPACE(set_hash_addr)
VOID set_hash_addr(UINT32 addr[8], UINT32 hash);

#define copy_keypair_addr SPX_NAMESPACE(copy_keypair_addr)
VOID copy_keypair_addr(UINT32 out[8], const UINT32 in[8]);

/* These functions are used for all hash tree addresses (including FORS). */

#define set_tree_height SPX_NAMESPACE(set_tree_height)
VOID set_tree_height(UINT32 addr[8], UINT32 tree_height);

#define set_tree_index SPX_NAMESPACE(set_tree_index)
VOID set_tree_index(UINT32 addr[8], UINT32 tree_index);

#endif
