Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <stdio.h>
  2. #include <stdint.h>
  3. #include <string.h>
  4. #include "../wots.h"
  5. #include "../randombytes.h"
  6. #include "../params.h"
  7. int main()
  8. {
  9. xmss_params params;
  10. // TODO test more different OIDs
  11. uint32_t oid = 0x00000001;
  12. /* For WOTS it doesn't matter if we use XMSS or XMSSMT. */
  13. xmss_parse_oid(&params, oid);
  14. unsigned char seed[params.n];
  15. unsigned char pub_seed[params.n];
  16. unsigned char pk1[params.wots_sig_bytes];
  17. unsigned char pk2[params.wots_sig_bytes];
  18. unsigned char sig[params.wots_sig_bytes];
  19. unsigned char m[params.n];
  20. uint32_t addr[8] = {0};
  21. randombytes(seed, params.n);
  22. randombytes(pub_seed, params.n);
  23. randombytes(m, params.n);
  24. randombytes((unsigned char *)addr, 8 * sizeof(uint32_t));
  25. printf("Testing WOTS signature and PK derivation.. ");
  26. wots_pkgen(&params, pk1, seed, pub_seed, addr);
  27. wots_sign(&params, sig, m, seed, pub_seed, addr);
  28. wots_pk_from_sig(&params, pk2, sig, m, pub_seed, addr);
  29. if (memcmp(pk1, pk2, params.wots_sig_bytes)) {
  30. printf("failed!\n");
  31. return -1;
  32. }
  33. printf("successful.\n");
  34. return 0;
  35. }