From: Andrey Rys Date: Sun, 16 Jan 2022 10:43:21 +0000 (+0100) Subject: -O iobs: exempt for all stream ciphers or plain IO X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=28fd79bfc51ba3ca72caf78fcaacecfc1a19f19c;p=tfcrypt.git -O iobs: exempt for all stream ciphers or plain IO --- diff --git a/VERSION b/VERSION index a8fa06e..4b9026d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -62 +63 diff --git a/tfc_misc.c b/tfc_misc.c index 5a6c53b..b140a82 100644 --- a/tfc_misc.c +++ b/tfc_misc.c @@ -102,6 +102,17 @@ const char *tfc_modename(int mode) return NULL; } +tfc_yesno tfc_is_stream(int mode) +{ + switch (mode) { + case TFC_MODE_PLAIN: + case TFC_MODE_CTR: + case TFC_MODE_STREAM: return YES; + } + + return NO; +} + void tfc_getcurtime(tfc_useconds *tx) { struct timespec t; diff --git a/tfcrypt.c b/tfcrypt.c index 8842081..2b2a26f 100644 --- a/tfcrypt.c +++ b/tfcrypt.c @@ -362,7 +362,7 @@ _baddfname: "%s: invalid block size value", s); } else blksize = (size_t)tfc_modifysize((tfc_fsize)blksize, strchr(s, ':')); - if (do_edcrypt != TFC_DO_PLAIN && blksize < TF_BLOCK_SIZE) xerror(NO, YES, YES, + if (!tfc_is_stream(ctr_mode) && blksize < TF_BLOCK_SIZE) xerror(NO, YES, YES, "%s: block size is lesser than TF_BLOCK_SIZE (%u bytes)", s, TFC_U(TF_BLOCK_SIZE)); if (blksize > TFC_BLKSIZE) xerror(NO, YES, YES, "%s: block size exceeds %u bytes", diff --git a/tfcrypt.h b/tfcrypt.h index 30e1a51..42088a1 100644 --- a/tfcrypt.h +++ b/tfcrypt.h @@ -193,6 +193,7 @@ int xxopen(tfc_yesno noerr, const char *pathname, int flags); int xopen(const char *pathname, int flags); void xclose(int fd); const char *tfc_modename(int mode); +tfc_yesno tfc_is_stream(int mode); void tfc_getcurtime(tfc_useconds *tx); char *tfc_format_time(tfc_useconds t); char *tfc_format_pid(const char *str);