25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.0 KiB

  1. #include <stdio.h>
  2. #include <stdint.h>
  3. #include "../params.h"
  4. #include "../xmss.h"
  5. #ifdef XMSSMT
  6. #define XMSS_STR_TO_OID xmssmt_str_to_oid
  7. #define XMSS_PARSE_OID xmssmt_parse_oid
  8. #define XMSS_KEYPAIR xmssmt_keypair
  9. #else
  10. #define XMSS_STR_TO_OID xmss_str_to_oid
  11. #define XMSS_PARSE_OID xmss_parse_oid
  12. #define XMSS_KEYPAIR xmss_keypair
  13. #endif
  14. int main(int argc, char **argv)
  15. {
  16. xmss_params params;
  17. uint32_t oid;
  18. if (argc != 2) {
  19. fprintf(stderr, "Expected parameter string (e.g. 'XMSS-SHA2_10_256')"
  20. " as only parameter.\n"
  21. "The keypair is written to stdout.\n");
  22. return -1;
  23. }
  24. XMSS_STR_TO_OID(&oid, argv[1]);
  25. XMSS_PARSE_OID(&params, oid);
  26. unsigned char pk[XMSS_OID_LEN + params.pk_bytes];
  27. unsigned char sk[XMSS_OID_LEN + params.sk_bytes];
  28. XMSS_KEYPAIR(pk, sk, oid);
  29. fwrite(pk, 1, XMSS_OID_LEN + params.pk_bytes, stdout);
  30. fwrite(sk, 1, XMSS_OID_LEN + params.sk_bytes, stdout);
  31. fclose(stdout);
  32. }