Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

58 rader
1.7 KiB

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