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.

wots.h 1.6 KiB

9 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef WOTS_H
  2. #define WOTS_H
  3. #include "params.h"
  4. /**
  5. * WOTS parameter set
  6. *
  7. * Meaning as defined in draft-irtf-cfrg-xmss-hash-based-signatures-02
  8. */
  9. typedef struct{
  10. int len_1;
  11. int len_2;
  12. int len;
  13. int m;
  14. int n;
  15. int w;
  16. int log_w;
  17. int keysize;
  18. } wots_params;
  19. /**
  20. * Set the WOTS parameters,
  21. * only m, n, w are required as inputs,
  22. * len, len_1, and len_2 are computed from those.
  23. *
  24. * Assumes w is a power of 2
  25. */
  26. void wots_set_params(wots_params *params, int m, int n, int w);
  27. /**
  28. * WOTS key generation. Takes a 32byte seed for the secret key, expands it to a full WOTS secret key and computes the corresponding public key.
  29. * For this it takes the seed pub_seed which is used to generate bitmasks and hash keys and the address of this WOTS key pair addr
  30. *
  31. * params, must have been initialized before using wots_set params for params ! This is not done in this function
  32. *
  33. * Places the computed public key at address pk.
  34. */
  35. void wots_pkgen(unsigned char *pk, const unsigned char *sk, wots_params *params, const unsigned char *pub_seed, unsigned char addr[16]);
  36. /**
  37. * Takes a m-byte message and the 32-byte seed for the secret key to compute a signature that is placed at "sig".
  38. *
  39. */
  40. void wots_sign(unsigned char *sig, const unsigned char *msg, const unsigned char *sk, wots_params *params, const unsigned char *pub_seed, unsigned char addr[16]);
  41. /**
  42. * Takes a WOTS signature, a m-byte message and computes a WOTS public key that it places at pk.
  43. *
  44. */
  45. void wots_pkFromSig(unsigned char *pk, const unsigned char *sig, const unsigned char *msg, wots_params *params, const unsigned char *pub_seed, unsigned char addr[16]);
  46. #endif