#ifndef __SIGN_H
#define __SIGN_H

#include <types.h>

struct sign_s
{

};

/*
  sign_ctx_init function initializes the signature context

  @return void * pointer to the context
 */
#define SIGN_INIT(x) error_t (x)(struct sign_s *sign);
typedef SIGN_INIT(sign_init_t);

#warning clean up
void *sign_ctx_init();

/*
  sign_gen_init function initializes the signature

  @return void * pointer to signature
 */

void *sign_gen_init();

/*
  sign_ref_init function initializes the ref signature

  @return void * pointer to ref signature
 */
void *sign_ref_init();

/*
  sign_update function updates the signature, uses addr and size as block to 
  generate a part of the signature

  @param ctx void * pointer to the signature context
  @param addr uint32_t *block address for generating signature
  @param size size_t block size
 */
#define SIGN_UPDATE(x) error_t (x)(struct sign_s *sign, uintptr_t addr, size_t size);
typedef SIGN_UPDATE(sign_update_t);

#warning clean up
void sign_update(void *ctx, uint32_t *addr, size_t size);

/*
  sign_set function gives back the signature 
  
  @param ctx void * pointer to the signature context
  @param sign void * pointer to the signature
 */
void sign_set(void *ctx, void *sign);

/*
  sign_free function releases the memory used by the signature functions

  @param ctx void * pointer to the signature context
  @param sign void * pointer to the signature
 */
#define SIGN_FREE(x) error_t (x)(struct sign_s *sign);
typedef SIGN_FREE(sign_free_t);

#warning clean up
void sign_free(void *ctx, void *sign);


/*
  sign_get_ref function gives the original signature

  @param sign void * pointer to the original signature
 */
void sign_get_ref(void *sign);

/*
  sign_compare function compares 2 signatures

  @param sign_ref void * pointer to the first signature
  @param sign_gen void * pointer to the second signature
  @return true if the signatures match
          false if not
 */
#define SIGN_CMP(x) bool (x)(struct sign_s *sign);
typedef SIGN_CMP(sign_cmp_t);

#warning clean up
bool sign_compare(void *sign_ref, void *sign_gen);

#endif
