keyfile.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef KEYFILE_H_
  2. #define KEYFILE_H_
  3. #include <stdint.h>
  4. #include <stdio.h>
  5. #include "passphrase_entry.h"
  6. /**
  7. * keyfile_read(filename, machinenum, keys, force, passphrase_entry,
  8. * passphrase_arg):
  9. * Read keys from a tarsnap key file; and return the machine # via the
  10. * provided pointer. Ignore any keys not specified in the ${keys} mask.
  11. * If ${force} is 1, do not check whether decryption will exceed
  12. * the estimated available memory or time. Use the ${passphrase_entry}
  13. * method to read the passphrase, using ${passphrase_arg} if applicable.
  14. */
  15. int keyfile_read(const char *, uint64_t *, int, int, enum passphrase_entry,
  16. const char *);
  17. /**
  18. * keyfile_write(filename, machinenum, keys, passphrase, maxmem, cputime):
  19. * Write a key file for the specified machine containing the specified keys.
  20. * If ${passphrase} is non-NULL, use up to ${cputime} seconds and ${maxmem}
  21. * bytes of memory to encrypt the key file.
  22. */
  23. int keyfile_write(const char *, uint64_t, int, char *, size_t, double);
  24. /**
  25. * keyfile_write_open(filename):
  26. * Open a key file for writing. Avoid race conditions. Return a FILE *.
  27. */
  28. FILE * keyfile_write_open(const char *);
  29. /**
  30. * keyfile_write_file(f, machinenum, keys, passphrase, maxmem, cputime):
  31. * Write a key file for the specified machine containing the specified keys.
  32. * If ${passphrase} is non-NULL, use up to ${cputime} seconds and ${maxmem}
  33. * bytes of memory to encrypt the key file.
  34. */
  35. int keyfile_write_file(FILE *, uint64_t, int, char *, size_t, double);
  36. #endif /* !KEYFILE_H_ */