-E sync: reform logic. Prequery file position, jump over error hole.
[tfcrypt.git] / tfcrypt.h
index 9b1caf05180f13a047154cf306e1882bff599913..6efb5e3c841ecb9cb834c321f24fe4ffeda84cfa 100644 (file)
--- a/tfcrypt.h
+++ b/tfcrypt.h
@@ -72,18 +72,14 @@ typedef TF_BYTE_TYPE tfc_byte;
 typedef unsigned long long tfc_fsize;
 typedef unsigned long long tfc_useconds;
 
-#ifndef TFC_NR_TURNS
-#define TFC_NR_TURNS 262144
-#endif
-
-#ifndef TFC_CTR_MODE
-#define TFC_CTR_MODE TFC_MODE_XTS
-#endif
-
 #ifndef TFC_BLKSIZE
 #define TFC_BLKSIZE 65536
 #endif
 
+#ifndef TFC_MAX_SALT
+#define TFC_MAX_SALT (2048 + TF_KEY_SIZE)
+#endif
+
 #ifndef TFC_XTSBLOCKS
 #define TFC_XTSBLOCKS 32
 #endif
@@ -117,11 +113,14 @@ int xmhexdump(int to, const void *data, size_t szdata, int hgroup, int hexstr, i
 #define mhexdump(data, szdata, group, newline) xmhexdump(1, data, szdata, group, do_full_hexdump, newline)
 #define mehexdump(data, szdata, group, newline) xmhexdump(2, data, szdata, group, do_full_hexdump, newline)
 
-extern char *progname;
-extern int exitcode;
 extern size_t nr_turns;
 extern int ctr_mode;
 extern size_t macbits;
+extern size_t tfc_saltsz;
+extern tfc_byte tfc_salt[TFC_MAX_SALT];
+
+extern char *progname;
+extern int exitcode;
 extern tfc_byte key[TF_KEY_SIZE], ctr[TF_BLOCK_SIZE], xtskey[TF_KEY_SIZE], mackey[TF_FROM_BITS(TF_MAX_BITS)];
 extern struct skein sk;
 extern struct tfe_stream tfe;
@@ -133,6 +132,7 @@ extern tfc_fsize iseek_blocks, iseek, oseek, maxlen;
 extern tfc_fsize total_processed_src, total_processed_dst;
 extern tfc_fsize delta_processed;
 extern tfc_fsize genrandom_nr_bytes, genzero_nr_bytes;
+extern tfc_fsize rdpos;
 extern int sfd, kfd, dfd;
 extern struct stat s_stat;
 extern size_t blksize, xtsblocks;
@@ -148,7 +148,7 @@ extern tfc_yesno catch_all_errors, password, overwrite_source, do_fsync, do_pad,
 extern tfc_yesno do_preserve_time, do_stats_in_gibs, do_statline_dynamic, do_less_stats;
 extern tfc_yesno no_repeat, do_full_hexdump, verbose, statline_was_shown;
 extern char *srcfname, *dstfname, *do_mac_file, *counter_file, *sksum_hashlist_file;
-extern char *genkeyf, *mackeyf, *tweakf;
+extern char *saltf, *genkeyf, *mackeyf, *tweakf;
 extern char *pw_prompt, *mac_pw_prompt;
 extern tfc_useconds status_timer, bench_timer;
 extern tfc_useconds current_time, delta_time;
@@ -175,6 +175,7 @@ void xclose(int fd);
 const char *tfc_modename(int mode);
 void tfc_getcurtime(tfc_useconds *tx);
 tfc_fsize tfc_fdsize(int fd);
+tfc_fsize tfc_fdgetpos(int fd);
 tfc_fsize tfc_fnamesize(char *fname, tfc_yesno noexit);
 tfc_fsize tfc_modifysize(tfc_fsize szmodify, const char *szspec);
 void fcopy_matime(int fd, const struct stat *st);
@@ -199,7 +200,7 @@ void do_benchmark(tfc_useconds useconds, double dseconds);
 
 enum { NO, YES };
 
-enum { TFC_ERRACT_EXIT, TFC_ERRACT_CONT, TFC_ERRACT_SYNC };
+enum { TFC_ERRACT_EXIT, TFC_ERRACT_CONT, TFC_ERRACT_SYNC, TFC_ERRACT_LSYNC };
 enum { TFC_STOP_BEGAN = 1, TFC_STOP_FULL };
 enum { TFC_DO_PLAIN, TFC_DO_ENCRYPT, TFC_DO_DECRYPT };
 enum { TFC_MAC_DROP = -1, TFC_MAC_SIGN = 1, TFC_MAC_VRFY, TFC_MAC_JUST_VRFY };