You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xmss_commons.h 1.9 KiB

9 years ago
9 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef XMSS_COMMONS_H
  2. #define XMSS_COMMONS_H
  3. #include <stdint.h>
  4. #include "params.h"
  5. /**
  6. * Computes the leaf at a given address. First generates the WOTS key pair,
  7. * then computes leaf using l_tree. As this happens position independent, we
  8. * only require that addr encodes the right ltree-address.
  9. */
  10. void gen_leaf_wots(const xmss_params *params, unsigned char *leaf,
  11. const unsigned char *sk_seed, const unsigned char *pub_seed,
  12. uint32_t ltree_addr[8], uint32_t ots_addr[8]);
  13. /**
  14. * Used for pseudo-random key generation.
  15. * Generates the seed for the WOTS key pair at address 'addr'.
  16. *
  17. * Takes n-byte sk_seed and returns n-byte seed using 32 byte address 'addr'.
  18. */
  19. void get_seed(const xmss_params *params, unsigned char *seed,
  20. const unsigned char *sk_seed, uint32_t addr[8]);
  21. /**
  22. * Computes a leaf node from a WOTS public key using an L-tree.
  23. * Note that the WOTS public key is destroyed.
  24. */
  25. void l_tree(const xmss_params *params,
  26. unsigned char *leaf, unsigned char *wots_pk,
  27. const unsigned char *pub_seed, uint32_t addr[8]);
  28. /**
  29. * Verifies a given message signature pair under a given public key.
  30. * Note that this assumes a pk without an OID, i.e. [root || PUB_SEED]
  31. */
  32. int xmss_core_sign_open(const xmss_params *params,
  33. unsigned char *m, unsigned long long *mlen,
  34. const unsigned char *sm, unsigned long long smlen,
  35. const unsigned char *pk);
  36. /**
  37. * Verifies a given message signature pair under a given public key.
  38. * Note that this assumes a pk without an OID, i.e. [root || PUB_SEED]
  39. */
  40. int xmssmt_core_sign_open(const xmss_params *params,
  41. unsigned char *m, unsigned long long *mlen,
  42. const unsigned char *sm, unsigned long long smlen,
  43. const unsigned char *pk);
  44. #endif