/* Merkle tree operations, using an RFC 9162 Merkle tree. */

#ifndef SIGSUM_MERKLE_H_INCLUDED
#define SIGSUM_MERKLE_H_INCLUDED

#include <stdbool.h>

#include "crypto.h"

struct sigsum_tree_head
{
  sigsum_size_t size;
  struct sigsum_hash root_hash;
};

bool
sigsum_verify_inclusion (const struct sigsum_hash *leaf_hash, sigsum_size_t leaf_index,
			 const struct sigsum_tree_head *tree_head, unsigned path_length,
			 const struct sigsum_hash *path);

bool
sigsum_verify_consistency (const struct sigsum_tree_head *first_tree,
			   const struct sigsum_tree_head *second_tree,
			   unsigned path_length,
			   const struct sigsum_hash *path);

#endif /* SIGSUM_MERKLE_H_INCLUDED */
