X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;ds=sidebyside;f=tfcrypt.c;h=aac2e68e5116da44c74763f31ba13d8130d91826;hb=5faadb0da4b63d4aa3359cfd97953738ee59a90d;hp=e6d422dbe25277dbf231633021e4f318fac14ee4;hpb=ba5ce99d77078a8629779641e8506b74e50fe6af;p=tfcrypt.git diff --git a/tfcrypt.c b/tfcrypt.c index e6d422d..aac2e68 100644 --- a/tfcrypt.c +++ b/tfcrypt.c @@ -364,7 +364,7 @@ _baddfname: "%s: invalid block size value", s); } else blksize = (size_t)tfc_modifysize((tfc_fsize)blksize, strchr(s, ':')); - if (blksize < TF_BLOCK_SIZE) xerror(NO, YES, YES, + if (do_edcrypt != TFC_DO_PLAIN && 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", @@ -456,6 +456,33 @@ _baddfname: } else oseek = tfc_modifysize(oseek, strchr(s, ':')); } + else if (!strncmp(s, "ioseek", 6) && *(s+6) == '=') { + s += 7; + + iseek = tfc_humanfsize(s, &stoi); + if (!str_empty(stoi)) { + iseek = tfc_fnamesize(s, YES); + iseek = tfc_modifysize(iseek, strchr(s, ':')); + if (iseek == NOFSIZE) xerror(NO, YES, YES, + "%s: invalid iseek value", s); + } + else iseek = tfc_modifysize(iseek, strchr(s, ':')); + if (ctr_mode != TFC_MODE_PLAIN && iseek % TF_BLOCK_SIZE) + xerror(NO, YES, YES, + "%s: not round to TF block size " + "of %u bytes", + s, TFC_U(TF_BLOCK_SIZE)); + iseek_blocks = iseek / TF_BLOCK_SIZE; + + oseek = tfc_humanfsize(s, &stoi); + if (!str_empty(stoi)) { + oseek = tfc_fnamesize(s, YES); + oseek = tfc_modifysize(oseek, strchr(s, ':')); + if (oseek == NOFSIZE) xerror(NO, YES, YES, + "%s: invalid oseek value", s); + } + else oseek = tfc_modifysize(oseek, strchr(s, ':')); + } else if (!strncmp(s, "count", 5) && *(s+5) == '=') { s += 6; maxlen = tfc_humanfsize(s, &stoi);