tfcrypt.git
8 months ago51 broke -E logic completely, rewise it master
Andrey Rys [Wed, 9 Aug 2023 18:12:10 +0000 (20:12 +0200)]
51 broke -E logic completely, rewise it

17 months agotfcrypt: fix "-M mac -u" failing to decrypt data due to missing ctr.
Andrey Rys [Wed, 9 Nov 2022 19:01:14 +0000 (20:01 +0100)]
tfcrypt: fix "-M mac -u" failing to decrypt data due to missing ctr.

The symptom is that, even if encrypted stream is signed with MAC, and
on decryption says "signature is good", decrypted content is unavailable
and only encrypted garbage is written back.

This is due to unitialized counter (IV). This affects only STREAM mode.

If anyone ran into trouble, simply don't use -u option with -M mac.
Verifying MAC alone or skipping it with -M drop shall be safe.

17 months ago-g, -j: shortcuts for stream ciphers with random counter
Andrey Rys [Sun, 30 Oct 2022 20:30:21 +0000 (21:30 +0100)]
-g, -j: shortcuts for stream ciphers with random counter

19 months ago-X: add simple XOR mode (embedded xor tool)
Andrey Rys [Sun, 28 Aug 2022 13:45:24 +0000 (15:45 +0200)]
-X: add simple XOR mode (embedded xor tool)

19 months agoAdd Propagating CBC (PCBC) mode
Andrey Rys [Sun, 28 Aug 2022 13:20:36 +0000 (15:20 +0200)]
Add Propagating CBC (PCBC) mode

19 months agoremove prefix from base64 builtin
Andrey Rys [Sun, 28 Aug 2022 10:58:18 +0000 (12:58 +0200)]
remove prefix from base64 builtin

19 months agoSync with tfcipher
Andrey Rys [Sun, 28 Aug 2022 10:32:18 +0000 (12:32 +0200)]
Sync with tfcipher

2 years ago-O nobuf: disable IO buffering
Andrey Rys [Sun, 16 Jan 2022 11:21:54 +0000 (12:21 +0100)]
-O nobuf: disable IO buffering

useful for online "as user types" encrypting
cannot use CTR here because CTR increases counter each time message continuation appears

2 years ago-O iobs: exempt for all stream ciphers or plain IO
Andrey Rys [Sun, 16 Jan 2022 10:43:21 +0000 (11:43 +0100)]
-O iobs: exempt for all stream ciphers or plain IO

2 years agotfstream: add separate xor_block function
Andrey Rys [Sat, 15 Jan 2022 15:22:11 +0000 (16:22 +0100)]
tfstream: add separate xor_block function

2 years agotfe: endian fixes and code optimization
Andrey Rys [Sat, 15 Jan 2022 15:20:53 +0000 (16:20 +0100)]
tfe: endian fixes and code optimization

2 years agoremove OCB mode
Andrey Rys [Sat, 15 Jan 2022 14:38:07 +0000 (15:38 +0100)]
remove OCB mode

2 years agoiotool: allow arbitrary iobs.
Andrey Rys [Mon, 13 Dec 2021 20:09:20 +0000 (21:09 +0100)]
iotool: allow arbitrary iobs.

Most common usage can be resetting it to 1 for byte oriented IO.

2 years ago-O ioseek=: apply iseek and oseek at same time.
Andrey Rys [Sun, 28 Nov 2021 17:05:51 +0000 (18:05 +0100)]
-O ioseek=: apply iseek and oseek at same time.

2 years ago-O ro: readonly files, never write anything (except to standard streams)
Andrey Rys [Sun, 28 Nov 2021 17:00:45 +0000 (18:00 +0100)]
-O ro: readonly files, never write anything (except to standard streams)

2 years ago-O append: append to output flag
Andrey Rys [Sun, 28 Nov 2021 13:57:26 +0000 (14:57 +0100)]
-O append: append to output flag

2 years agofix total size indicator when doing -M mac -u.
Andrey Rys [Sun, 28 Nov 2021 13:51:39 +0000 (14:51 +0100)]
fix total size indicator when doing -M mac -u.

2 years agoanother attempt to fix newline bugs
Andrey Rys [Sun, 28 Nov 2021 13:47:18 +0000 (14:47 +0100)]
another attempt to fix newline bugs

2 years agolift restrictions on partial "window" seeked signature verifying
Andrey Rys [Sun, 28 Nov 2021 13:43:54 +0000 (14:43 +0100)]
lift restrictions on partial "window" seeked signature verifying

2 years ago-O readloops=n: read source repeatedly n times (by default disabled).
Andrey Rys [Sun, 28 Nov 2021 13:42:32 +0000 (14:42 +0100)]
-O readloops=n: read source repeatedly n times (by default disabled).

2 years agochange atexit newline print policy
Andrey Rys [Sun, 28 Nov 2021 13:36:30 +0000 (14:36 +0100)]
change atexit newline print policy

2 years ago-O pid: show/log process id of running tfcrypt.
Andrey Rys [Sun, 28 Nov 2021 13:27:08 +0000 (14:27 +0100)]
-O pid: show/log process id of running tfcrypt.

2 years ago-o: accept "-" as name, do nothing (leave stderr as is)
Andrey Rys [Sun, 28 Nov 2021 13:16:56 +0000 (14:16 +0100)]
-o: accept "-" as name, do nothing (leave stderr as is)

2 years ago-O finished: prepend "finished: " marker when tfcrypt done (useful for logs).
Andrey Rys [Sun, 28 Nov 2021 13:15:49 +0000 (14:15 +0100)]
-O finished: prepend "finished: " marker when tfcrypt done (useful for logs).

2 years agoxexit: do post-crypt work only if exiting by system error or normally.
Andrey Rys [Sun, 28 Nov 2021 13:12:27 +0000 (14:12 +0100)]
xexit: do post-crypt work only if exiting by system error or normally.

2 years agoalways cap first print_crypt_status to less or equal 1 second.
Andrey Rys [Sun, 28 Nov 2021 13:10:01 +0000 (14:10 +0100)]
always cap first print_crypt_status to less or equal 1 second.

2 years agomoving to clock_gettime and add correction of time spent in freezed state.
Andrey Rys [Sun, 28 Nov 2021 13:07:23 +0000 (14:07 +0100)]
moving to clock_gettime and add correction of time spent in freezed state.

2 years ago-o logfile: logging to separate logfile instead of stderr.
Andrey Rys [Sun, 28 Nov 2021 00:53:56 +0000 (01:53 +0100)]
-o logfile: logging to separate logfile instead of stderr.

2 years agofix quiet mode and final reporting when using -O count.
Andrey Rys [Sun, 28 Nov 2021 00:50:05 +0000 (01:50 +0100)]
fix quiet mode and final reporting when using -O count.

2 years agofix time not casted to tfc_useconds incorrectly.
Andrey Rys [Sun, 28 Nov 2021 00:48:10 +0000 (01:48 +0100)]
fix time not casted to tfc_useconds incorrectly.

2 years agoSIGTSTP: fix quiet mode.
Andrey Rys [Sun, 28 Nov 2021 00:47:09 +0000 (01:47 +0100)]
SIGTSTP: fix quiet mode.

2 years agomove atexit code to xexit() and fix ftrunc order for mtime.
Andrey Rys [Sun, 28 Nov 2021 00:42:31 +0000 (01:42 +0100)]
move atexit code to xexit() and fix ftrunc order for mtime.

2 years ago-u: like -m, but decrypt to verify MAC, see if it's valid then decrypt to dst.
Andrey Rys [Sat, 27 Nov 2021 13:24:04 +0000 (14:24 +0100)]
-u: like -m, but decrypt to verify MAC, see if it's valid then decrypt to dst.

Also adds "written" counter to status line to track actually written bytes to dst.

2 years agoSIGTERM, SIGINT: exit immediately, don't try to postprocess even in verbose mode.
Andrey Rys [Sat, 27 Nov 2021 12:02:47 +0000 (13:02 +0100)]
SIGTERM, SIGINT: exit immediately, don't try to postprocess even in verbose mode.

- Just report stats and exit afterwards,
- MAC signing is disabled naturally due to exit path before it happening.

3 years ago-V: fix when used with -P
Andrey Rys [Sun, 2 Aug 2020 17:16:46 +0000 (19:16 +0200)]
-V: fix when used with -P

3 years agoiotool: separate alias to do only plain I/O.
Andrey Rys [Sat, 25 Jul 2020 15:32:51 +0000 (17:32 +0200)]
iotool: separate alias to do only plain I/O.

tfbase64: fix help message for wrong alias.

4 years ago-O ftrunc=tail: trim unused tail after processing actual data.
Andrey Rys [Fri, 13 Dec 2019 23:46:30 +0000 (00:46 +0100)]
-O ftrunc=tail: trim unused tail after processing actual data.

This is a hack actually, it's not much useful in everyday life.
It is for compressing files in place, exploiting stream compressors like this:

        xz -9c -T 4 < file.tar | tfcrypt -P -O ftrunc=tail - file.tar

, or more safer way (since tfcrypt does not buffer):

        tfcrypt -P file.tar | xz -9c -T 4 | tfcrypt -P -O ftrunc=tail - file.tar

4 years agotfc_signal: add elapsed time counter.
Andrey Rys [Sun, 6 Oct 2019 12:14:50 +0000 (14:14 +0200)]
tfc_signal: add elapsed time counter.

4 years agotfe: fix endianness with blocks smaller than TF_BLOCK_SIZE.
Andrey Rys [Sun, 18 Aug 2019 10:47:28 +0000 (12:47 +0200)]
tfe: fix endianness with blocks smaller than TF_BLOCK_SIZE.

4 years agoUpdate copyright year.
Andrey Rys [Mon, 29 Apr 2019 15:54:43 +0000 (22:54 +0700)]
Update copyright year.

4 years ago-c: pattern fill support.
Andrey Rys [Mon, 29 Apr 2019 15:48:37 +0000 (22:48 +0700)]
-c: pattern fill support.

The syntax is:

        -c hexc:nr[,hexc:nr,...]

As example, filling with 16 byte counter with following:

        ffffffff3333337a7a7a7a88882a0b0c

is possible with following pattern:

        -c ff:4,33:3,7a:4,88:2,2a:1,0b:1,0c:1

To fill with zeroes (or any other static byte) is simple:

        -c 0:16

Note that any bytes that tend to overflow counter space are dropped, and any
unused bytes not filled by pattern are set to zeroes.

5 years agoDisplay hash of current defaults.
Andrey Rys [Wed, 24 Apr 2019 20:22:02 +0000 (03:22 +0700)]
Display hash of current defaults.

5 years ago-q: remove ASCII reprint of hexdump.
Andrey Rys [Sun, 21 Apr 2019 12:02:09 +0000 (19:02 +0700)]
-q: remove ASCII reprint of hexdump.

5 years agoAdd password hints to every password asking function.
Andrey Rys [Sun, 21 Apr 2019 11:49:20 +0000 (18:49 +0700)]
Add password hints to every password asking function.

Activated with -v command line option.

5 years agotfprng: expose range formula in form of macros to build custom range generators.
Andrey Rys [Wed, 10 Apr 2019 05:27:30 +0000 (12:27 +0700)]
tfprng: expose range formula in form of macros to build custom range generators.

5 years ago"-O ftrunc=": implement file truncations (without sanity checks).
Andrey Rys [Sat, 6 Apr 2019 11:49:54 +0000 (18:49 +0700)]
"-O ftrunc=": implement file truncations (without sanity checks).

5 years agofix counter adjustment on "-c zero -O iseek=".
Andrey Rys [Sat, 6 Apr 2019 07:54:52 +0000 (14:54 +0700)]
fix counter adjustment on "-c zero -O iseek=".

5 years ago-O showsecrets: display passwords in plaintext.
Andrey Rys [Thu, 4 Apr 2019 13:32:29 +0000 (20:32 +0700)]
-O showsecrets: display passwords in plaintext.

5 years agofix usage, add -O fullkey to extend key size.
Andrey Rys [Sat, 23 Mar 2019 12:37:14 +0000 (19:37 +0700)]
fix usage, add -O fullkey to extend key size.

5 years agotfc_conf: nr_turns: do not apply to sksum turns.
Andrey Rys [Sat, 23 Mar 2019 11:49:05 +0000 (18:49 +0700)]
tfc_conf: nr_turns: do not apply to sksum turns.

5 years agoSwitch to old tfcrypt1 mode by default.
Andrey Rys [Sat, 23 Mar 2019 11:07:02 +0000 (18:07 +0700)]
Switch to old tfcrypt1 mode by default.

5 years agoReplace ugly tweak size computation with explicit tweak clean API.
Andrey Rys [Sat, 23 Mar 2019 10:54:53 +0000 (17:54 +0700)]
Replace ugly tweak size computation with explicit tweak clean API.

5 years ago-c zero: assume zero counter value.
Andrey Rys [Fri, 22 Mar 2019 09:44:19 +0000 (16:44 +0700)]
-c zero: assume zero counter value.

5 years agofix -C stream -c rand regression.
Andrey Rys [Fri, 22 Mar 2019 09:30:17 +0000 (16:30 +0700)]
fix -C stream -c rand regression.

Because "STREAM" mode has separate init function and separate encryption function,
I had a mistake to put it into a wrong place at the first time I'd ported code to
tfcipher codebase. If you did encryptions with -C stream -c rand options applied in
the past, then, to decrypt such streams you must use zero counter value together with
omitting first counter bytes from stream.

This is especially disasterous if multiple encryptions were performed with same key
since STREAM here is effectively an OFB mode of operation.
Given that this mode encourages such usage patterns, I feel sorry for such a mistake.

Still, CTR mode is better than STREAM mode because it is seekable.
From CTR, STREAM differs only in being a nonseekable mode of operation, nothing more.

5 years agofix mhexdump machine detection.
Andrey Rys [Thu, 21 Mar 2019 09:27:16 +0000 (16:27 +0700)]
fix mhexdump machine detection.

5 years agoAmend previous commit.
Andrey Rys [Wed, 20 Mar 2019 11:51:54 +0000 (18:51 +0700)]
Amend previous commit.

5 years agoSupport loading tfcrypt_defs.h variables from file.
Andrey Rys [Sat, 16 Mar 2019 10:02:42 +0000 (17:02 +0700)]
Support loading tfcrypt_defs.h variables from file.

5 years agotfprng: use tf_prng_datasize even if no one uses it.
Andrey Rys [Fri, 15 Mar 2019 10:27:56 +0000 (17:27 +0700)]
tfprng: use tf_prng_datasize even if no one uses it.

5 years agoFix endianness issues.
Andrey Rys [Fri, 15 Mar 2019 10:15:50 +0000 (17:15 +0700)]
Fix endianness issues.

tfctrapi: do not post convert, do preconversion of both arguments instead, then add.
tfe: remove endianness converters, caller must do conversion.

5 years agoctr_add: replace dead with working code.
Andrey Rys [Wed, 27 Feb 2019 08:54:12 +0000 (15:54 +0700)]
ctr_add: replace dead with working code.

ctr_add came directly from 2012, and it was always broken.
The original purpose is to add two very large integers.
Still, there is no much to worry about: Threefish 64 bit integers
make it very hard to trigger the old buggy code, and it was only
used to rewind the counter. But it is time to finally fix it.

5 years agotfprng: remove legacy functions.
Andrey Rys [Mon, 18 Feb 2019 07:24:14 +0000 (14:24 +0700)]
tfprng: remove legacy functions.

5 years agoChange default seek behavior: error out, allow to ignore errors with -E xseek.
Andrey Rys [Sat, 9 Feb 2019 07:15:16 +0000 (14:15 +0700)]
Change default seek behavior: error out, allow to ignore errors with -E xseek.

5 years ago-O okey=val: offset into key (useful for block device keys, such as USB sticks).
Andrey Rys [Mon, 4 Feb 2019 15:18:00 +0000 (22:18 +0700)]
-O okey=val: offset into key (useful for block device keys, such as USB sticks).

sksum: now honors -O iseek= too to seek into source.

5 years agoDefine _DEFAULT_SOURCE.
Andrey Rys [Sat, 2 Feb 2019 12:51:44 +0000 (19:51 +0700)]
Define _DEFAULT_SOURCE.

5 years agotfc_io: xread and xwrite, which transparently handle EINTR case.
Andrey Rys [Sat, 26 Jan 2019 12:32:41 +0000 (19:32 +0700)]
tfc_io: xread and xwrite, which transparently handle EINTR case.

5 years agotfc_random: proper write error handling plus handling -E option.
Andrey Rys [Sat, 26 Jan 2019 10:15:54 +0000 (17:15 +0700)]
tfc_random: proper write error handling plus handling -E option.

5 years agoDefine _FILE_OFFSET_BITS=64
Andrey Rys [Fri, 25 Jan 2019 09:57:44 +0000 (16:57 +0700)]
Define _FILE_OFFSET_BITS=64

5 years ago-E sync: reform logic. Prequery file position, jump over error hole.
Andrey Rys [Fri, 25 Jan 2019 08:45:51 +0000 (15:45 +0700)]
-E sync: reform logic. Prequery file position, jump over error hole.

Add -E lsync to turn on older version.
tfc_fdsize: properly return NOFSIZE on errors.

5 years agoSalt user keys or passwords.
Andrey Rys [Thu, 29 Nov 2018 07:46:28 +0000 (14:46 +0700)]
Salt user keys or passwords.

Secretizing turns value was not enough, so it was decided
to add salt value which maybe hardcoded or loaded before key generation.

5 years agotfcrypt: fixing hash output stream.
Andrey Rys [Sun, 25 Nov 2018 07:43:02 +0000 (14:43 +0700)]
tfcrypt: fixing hash output stream.

5 years agotfcrypt 1.
Andrey Rys [Mon, 12 Nov 2018 05:58:34 +0000 (12:58 +0700)]
tfcrypt 1.