-O iobs: exempt for all stream ciphers or plain IO
authorAndrey Rys <rys@lynxlynx.ru>
Sun, 16 Jan 2022 10:43:21 +0000 (11:43 +0100)
committerAndrey Rys <rys@lynxlynx.ru>
Sun, 16 Jan 2022 10:43:21 +0000 (11:43 +0100)
VERSION
tfc_misc.c
tfcrypt.c
tfcrypt.h

diff --git a/VERSION b/VERSION
index a8fa06e1be7da01425d2be19da24595de2fa02c2..4b9026d8e2aa237955be84bd9e06954bdd343190 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-62
+63
index 5a6c53b213510b0cbc3867bfe8c5f001cb273066..b140a8247125d616e97d331056ae5a64c43bbb40 100644 (file)
@@ -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;
index 88420817cbf9d4004a226bfa4ba6ce959d144a93..2b2a26f367aed57659c3f0d65f34203857a2ce4a 100644 (file)
--- 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",
index 30e1a5108ffc4374c7827948d80a0e33e76c8806..42088a1c6bbb17863698df0957cedddc3d463090 100644 (file)
--- 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);