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.

xmss.h 2.1 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef XMSS_H
  2. #define XMSS_H
  3. #include <stdint.h>
  4. /**
  5. * Generates a XMSS key pair for a given parameter set.
  6. * Format sk: [OID || (32bit) idx || SK_SEED || SK_PRF || PUB_SEED || root]
  7. * Format pk: [OID || root || PUB_SEED]
  8. */
  9. int xmss_keypair(unsigned char *pk, unsigned char *sk, const uint32_t oid);
  10. /**
  11. * Signs a message using an XMSS secret key.
  12. * Returns
  13. * 1. an array containing the signature followed by the message AND
  14. * 2. an updated secret key!
  15. */
  16. int xmss_sign(unsigned char *sk,
  17. unsigned char *sm, unsigned long long *smlen,
  18. const unsigned char *m, unsigned long long mlen);
  19. /**
  20. * Verifies a given message signature pair using a given public key.
  21. *
  22. * Note: m and mlen are pure outputs which carry the message in case
  23. * verification succeeds. The (input) message is assumed to be contained in sm
  24. * which has the form [signature || message].
  25. */
  26. int xmss_sign_open(unsigned char *m, unsigned long long *mlen,
  27. const unsigned char *sm, unsigned long long smlen,
  28. const unsigned char *pk);
  29. /*
  30. * Generates a XMSSMT key pair for a given parameter set.
  31. * Format sk: [OID || (ceil(h/8) bit) idx || SK_SEED || SK_PRF || PUB_SEED || root]
  32. * Format pk: [OID || root || PUB_SEED]
  33. */
  34. int xmssmt_keypair(unsigned char *pk, unsigned char *sk, const uint32_t oid);
  35. /**
  36. * Signs a message using an XMSSMT secret key.
  37. * Returns
  38. * 1. an array containing the signature followed by the message AND
  39. * 2. an updated secret key!
  40. */
  41. int xmssmt_sign(unsigned char *sk,
  42. unsigned char *sm, unsigned long long *smlen,
  43. const unsigned char *m, unsigned long long mlen);
  44. /**
  45. * Verifies a given message signature pair using a given public key.
  46. *
  47. * Note: m and mlen are pure outputs which carry the message in case
  48. * verification succeeds. The (input) message is assumed to be contained in sm
  49. * which has the form [signature || message].
  50. */
  51. int xmssmt_sign_open(unsigned char *m, unsigned long long *mlen,
  52. const unsigned char *sm, unsigned long long smlen,
  53. const unsigned char *pk);
  54. #endif