keygen.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef KEYGEN_H_
  2. #define KEYGEN_H_
  3. #include <stdint.h>
  4. struct register_internal {
  5. /* Parameters provided from main() to network code. */
  6. const char * user;
  7. char * passwd;
  8. const char * name;
  9. /* State information. */
  10. int donechallenge;
  11. int done;
  12. /* Key used to send challenge response and verify server response. */
  13. uint8_t register_key[32];
  14. /* Data returned by server. */
  15. uint8_t status;
  16. uint64_t machinenum;
  17. };
  18. /**
  19. * keygen_network_register(C):
  20. * Register a new machine key with the Tarsnap server.
  21. */
  22. int keygen_network_register(struct register_internal *);
  23. /**
  24. * Create key files (either new keys or regenerated keys) and
  25. * register with the server. ${C} is general information for
  26. * keygen code. ${keyfilename} is the new key filename.
  27. * ${passphrased} and ${maxmem} are command-line arguments for
  28. * adding a passphrase to the key and how much memory scrypt can
  29. * use, respectively. ${oldkeyfilename} is the old key filename
  30. * for keyregen, and must be NULL for keygen (a new key).
  31. */
  32. int keygen_actual(struct register_internal * C,
  33. const char * keyfilename, const int passphrased,
  34. const uint64_t maxmem, const double maxtime,
  35. const char * oldkeyfilename);
  36. #endif /* !KEYGEN_H_ */