25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 

70 satır
2.5 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 int outlen,
  9. unsigned long long in);
  10. /**
  11. * Converts the inlen bytes in 'in' from big-endian byte order to an integer.
  12. */
  13. unsigned long long bytes_to_ull(const unsigned char *in, unsigned int inlen);
  14. /**
  15. * Computes the leaf at a given address. First generates the WOTS key pair,
  16. * then computes leaf using l_tree. As this happens position independent, we
  17. * only require that addr encodes the right ltree-address.
  18. */
  19. void gen_leaf_wots(const xmss_params *params, unsigned char *leaf,
  20. const unsigned char *sk_seed, const unsigned char *pub_seed,
  21. uint32_t ltree_addr[8], uint32_t ots_addr[8]);
  22. /**
  23. * Used for pseudo-random key generation.
  24. * Generates the seed for the WOTS key pair at address 'addr'.
  25. *
  26. * Takes n-byte sk_seed and returns n-byte seed using 32 byte address 'addr'.
  27. */
  28. void get_seed(const xmss_params *params, unsigned char *seed,
  29. const unsigned char *sk_seed, uint32_t addr[8]);
  30. /**
  31. * Computes a leaf node from a WOTS public key using an L-tree.
  32. * Note that the WOTS public key is destroyed.
  33. */
  34. void l_tree(const xmss_params *params,
  35. unsigned char *leaf, unsigned char *wots_pk,
  36. const unsigned char *pub_seed, uint32_t addr[8]);
  37. /**
  38. * Computes the randomized message hash.
  39. */
  40. void hash_message(const xmss_params *params, unsigned char *mhash,
  41. const unsigned char *R, const unsigned char *root,
  42. unsigned long long idx,
  43. const unsigned char *m, unsigned long long mlen);
  44. /**
  45. * Verifies a given message signature pair under a given public key.
  46. * Note that this assumes a pk without an OID, i.e. [root || PUB_SEED]
  47. */
  48. int xmss_core_sign_open(const xmss_params *params,
  49. unsigned char *m, unsigned long long *mlen,
  50. const unsigned char *sm, unsigned long long smlen,
  51. const unsigned char *pk);
  52. /**
  53. * Verifies a given message signature pair under a given public key.
  54. * Note that this assumes a pk without an OID, i.e. [root || PUB_SEED]
  55. */
  56. int xmssmt_core_sign_open(const xmss_params *params,
  57. unsigned char *m, unsigned long long *mlen,
  58. const unsigned char *sm, unsigned long long smlen,
  59. const unsigned char *pk);
  60. #endif