-c zero: assume zero counter value.
authorAndrey Rys <rys@lynxlynx.ru>
Fri, 22 Mar 2019 09:44:19 +0000 (16:44 +0700)
committerAndrey Rys <rys@lynxlynx.ru>
Fri, 22 Mar 2019 09:44:19 +0000 (16:44 +0700)
VERSION
tfc_error.c
tfcrypt.c
tfcrypt.h

diff --git a/VERSION b/VERSION
index 3c032078a4a21c5c51d3c93d91717c1dabbb8cd0..d6b24041cf04154f8f902651969675021f4d93a5 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-18
+19
index 001273e1caed36d3b6b6730c73cd9980f2df4b69..b90b1087f659d4d656490c639b71586b713319ad 100644 (file)
@@ -171,6 +171,7 @@ void usage(void)
        tfc_say("    show: do default action, then dump CTR value to stderr,");
        tfc_say("    head: when decrypting, read CTR from beginning of stream,");
        tfc_say("    rand: generate random CTR and write it to beginning of stream,");
+       tfc_say("    zero: assume zero CTR is used, do not read from and write it to stream,");
        tfc_say("    <file>: read CTR from given file (both when encrypting/decrypting).");
        tfc_say("      default is to derive CTR from user provided password or keyfile with");
        tfc_say("      a single Skein function turn over derived, %u byte raw key", TFC_U(TF_KEY_SIZE));
index 8d01618ce361abcbf6821ff77ea7bc106bc1538c..01173fb691a214f7e666fb0f48552072b4c59756 100644 (file)
--- a/tfcrypt.c
+++ b/tfcrypt.c
@@ -91,6 +91,8 @@ _baddfname:
                                        counter_opt = TFC_CTR_HEAD;
                                else if (!strcasecmp(optarg, "rand"))
                                        counter_opt = TFC_CTR_RAND;
+                               else if (!strcasecmp(optarg, "zero"))
+                                       counter_opt = TFC_CTR_ZERO;
                                else counter_file = sksum_hashlist_file = optarg;
                                break;
                        case 'C':
@@ -929,6 +931,7 @@ _xts2genkey:        if (xwrite(krfd, pblk, TF_FROM_BITS(TFC_KEY_BITS)) == NOSIZE) xerro
                        }
                        break;
                case TFC_CTR_RAND: tfc_getrandom(ctr, ctrsz); break;
+               case TFC_CTR_ZERO: memset(ctr, 0, ctrsz); break;
        }
 
 _ctrskip2:
index 649fc06063707c2465912049edd254ea1f2b6f0d..c41f38d7203dd91db8bdfd6d000529ba5fbbecb1 100644 (file)
--- a/tfcrypt.h
+++ b/tfcrypt.h
@@ -226,6 +226,6 @@ enum {
        TFC_MODE_SKSUM = -2, TFC_MODE_PLAIN = -1, TFC_MODE_CTR = 1,
        TFC_MODE_STREAM, TFC_MODE_XTS, TFC_MODE_ECB, TFC_MODE_CBC, TFC_MODE_OCB
 };
-enum { TFC_CTR_SHOW = 1, TFC_CTR_HEAD, TFC_CTR_RAND };
+enum { TFC_CTR_SHOW = 1, TFC_CTR_HEAD, TFC_CTR_RAND, TFC_CTR_ZERO };
 
 #endif