Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

57 rindas
2.1 KiB

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