No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

59 líneas
2.1 KiB

  1. #ifndef XMSS_CORE_H
  2. #define XMSS_CORE_H
  3. #include "params.h"
  4. /*
  5. * Generates a XMSS key pair for a given parameter set.
  6. * Format sk: [(32bit) index || SK_SEED || SK_PRF || PUB_SEED || root]
  7. * Format pk: [root || PUB_SEED], omitting algorithm OID.
  8. */
  9. int xmss_core_keypair(const xmss_params *params,
  10. unsigned char *pk, unsigned char *sk);
  11. /**
  12. * Signs a message. Returns an array containing the signature followed by the
  13. * message and an updated secret key.
  14. */
  15. int xmss_core_sign(const xmss_params *params,
  16. 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 under a given public key.
  21. * Note that this assumes a pk without an OID, i.e. [root || PUB_SEED]
  22. */
  23. int xmss_core_sign_open(const xmss_params *params,
  24. unsigned char *m, unsigned long long *mlen,
  25. const unsigned char *sm, unsigned long long smlen,
  26. const unsigned char *pk);
  27. /*
  28. * Generates a XMSSMT key pair for a given parameter set.
  29. * Format sk: [(ceil(h/8) bit) index || SK_SEED || SK_PRF || PUB_SEED]
  30. * Format pk: [root || PUB_SEED] omitting algorithm OID.
  31. */
  32. int xmssmt_core_keypair(const xmss_params *params,
  33. unsigned char *pk, unsigned char *sk);
  34. /**
  35. * Signs a message. Returns an array containing the signature followed by the
  36. * message and an updated secret key.
  37. */
  38. int xmssmt_core_sign(const xmss_params *params,
  39. unsigned char *sk,
  40. unsigned char *sm, unsigned long long *smlen,
  41. const unsigned char *m, unsigned long long mlen);
  42. /**
  43. * Verifies a given message signature pair under a given public key.
  44. * Note that this assumes a pk without an OID, i.e. [root || PUB_SEED]
  45. */
  46. int xmssmt_core_sign_open(const xmss_params *params,
  47. unsigned char *m, unsigned long long *mlen,
  48. const unsigned char *sm, unsigned long long smlen,
  49. const unsigned char *pk);
  50. #endif