From: Andrey Rys Date: Fri, 22 Mar 2019 09:44:19 +0000 (+0700) Subject: -c zero: assume zero counter value. X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=0b911d4a813fe164d62ef6ef132c5a4f9a441d57;p=tfcrypt.git -c zero: assume zero counter value. --- diff --git a/VERSION b/VERSION index 3c03207..d6b2404 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -18 +19 diff --git a/tfc_error.c b/tfc_error.c index 001273e..b90b108 100644 --- a/tfc_error.c +++ b/tfc_error.c @@ -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(" : 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)); diff --git a/tfcrypt.c b/tfcrypt.c index 8d01618..01173fb 100644 --- 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: diff --git a/tfcrypt.h b/tfcrypt.h index 649fc06..c41f38d 100644 --- 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