size_t msg_length, const uint8_t *msg,
size_t digest_size, uint8_t *digest);
-typedef void slh_hash_init_tree_func (union slh_hash_ctx *tree_ctx, const uint8_t *public_seed,
+typedef void slh_hash_init_tree_func (void *tree_ctx, const uint8_t *public_seed,
uint32_t layer, uint64_t tree_idx);
-typedef void slh_hash_init_hash_func (const union slh_hash_ctx *tree_ctx, union slh_hash_ctx *ctx,
+typedef void slh_hash_init_hash_func (const void *tree_ctx, void *ctx,
const struct slh_address_hash *ah);
-typedef void slh_hash_secret_func (const union slh_hash_ctx *tree_ctx,
+typedef void slh_hash_secret_func (const void *tree_ctx,
const struct slh_address_hash *ah,
const uint8_t *secret, uint8_t *out);
-typedef void slh_hash_node_func (const union slh_hash_ctx *tree_ctx,
+typedef void slh_hash_node_func (const void *tree_ctx,
const struct slh_address_hash *ah,
const uint8_t *left, const uint8_t *right,
uint8_t *out);
#define WOTS_SIGNATURE_SIZE (_WOTS_SIGNATURE_LENGTH*_SLH_DSA_128_SIZE)
void
-_wots_gen (const struct slh_hash *hash, const union slh_hash_ctx *tree_ctx,
+_wots_gen (const struct slh_hash *hash, const void *tree_ctx,
const uint8_t *secret_seed,
uint32_t keypair, uint8_t *pub);
void
-_wots_sign (const struct slh_hash *hash, const union slh_hash_ctx *tree_ctx,
+_wots_sign (const struct slh_hash *hash, const void *tree_ctx,
const uint8_t *secret_seed,
unsigned keypair, const uint8_t *msg,
uint8_t *signature, uint8_t *pub);
/* Computes candidate public key from signature. */
void
-_wots_verify (const struct slh_hash *hash, const union slh_hash_ctx *tree_ctx,
+_wots_verify (const struct slh_hash *hash, const void *tree_ctx,
unsigned keypair, const uint8_t *msg, const uint8_t *signature, uint8_t *pub);
/* Merkle tree functions. Could be generalized for other merkle tree
static void
fors_sign_one (const struct slh_merkle_ctx_secret *ctx, unsigned a,
- unsigned idx, uint8_t *signature, union slh_hash_ctx *pub)
+ unsigned idx, uint8_t *signature, void *pub)
{
uint8_t hash[_SLH_DSA_128_SIZE];
static void
fors_verify_one (const struct slh_merkle_ctx_public *ctx, unsigned a,
- unsigned idx, const uint8_t *signature, union slh_hash_ctx *pub)
+ unsigned idx, const uint8_t *signature, void *pub)
{
uint8_t root[_SLH_DSA_128_SIZE];
struct slh_address_hash ah =
dst. For the ah argument, leaves ah->keypair and ah->height_chain
unchanged, but overwrites the other fields. */
static const uint8_t *
-wots_chain (const struct slh_hash *hash, const union slh_hash_ctx *ctx,
+wots_chain (const struct slh_hash *hash, const void *ctx,
struct slh_address_hash *ah,
unsigned i, unsigned s,
const uint8_t *src, uint8_t *dst)
}
static void
-wots_pk_init (const struct slh_hash *hash, const union slh_hash_ctx *tree_ctx,
+wots_pk_init (const struct slh_hash *hash, const void *tree_ctx,
unsigned keypair, struct slh_address_hash *ah,
- union slh_hash_ctx *ctx)
+ void *ctx)
{
ah->type = bswap32_if_le (SLH_WOTS_PK);
ah->keypair = bswap32_if_le (keypair);
}
void
-_wots_gen (const struct slh_hash *hash, const union slh_hash_ctx *tree_ctx,
+_wots_gen (const struct slh_hash *hash, const void *tree_ctx,
const uint8_t *secret_seed,
uint32_t keypair, uint8_t *pub)
{
/* Produces signature hash corresponding to the ith message nybble. Modifies addr. */
static void
-wots_sign_one (const struct slh_hash *hash, const union slh_hash_ctx *tree_ctx,
+wots_sign_one (const struct slh_hash *hash, const void *tree_ctx,
const uint8_t *secret_seed, uint32_t keypair,
unsigned i, uint8_t msg,
- uint8_t *signature, union slh_hash_ctx *ctx)
+ uint8_t *signature, void *ctx)
{
struct slh_address_hash ah;
uint8_t pub[_SLH_DSA_128_SIZE];
}
void
-_wots_sign (const struct slh_hash *hash, const union slh_hash_ctx *tree_ctx,
+_wots_sign (const struct slh_hash *hash, const void *tree_ctx,
const uint8_t *secret_seed, unsigned keypair, const uint8_t *msg,
uint8_t *signature, uint8_t *pub)
{
}
static void
-wots_verify_one (const struct slh_hash *hash, const union slh_hash_ctx *tree_ctx,
+wots_verify_one (const struct slh_hash *hash, const void *tree_ctx,
uint32_t keypair, unsigned i, uint8_t msg,
- const uint8_t *signature, union slh_hash_ctx *ctx)
+ const uint8_t *signature, void *ctx)
{
struct slh_address_hash ah;
uint8_t out[_SLH_DSA_128_SIZE];
}
void
-_wots_verify (const struct slh_hash *hash, const union slh_hash_ctx *tree_ctx,
+_wots_verify (const struct slh_hash *hash, const void *tree_ctx,
unsigned keypair, const uint8_t *msg, const uint8_t *signature, uint8_t *pub)
{
struct slh_address_hash ah;