X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;ds=sidebyside;f=tfcrypt.c;h=4ba1dd530cd179dd269abfa4cca8033c347f853b;hb=7843812e68ebd194667b244cdd6f6cbd45beb3a5;hp=7e9ef8c16915ddb15f7a718516f0ca9cdd518730;hpb=72672c5cb76597fdc07cbc9bc190394d1c1d3ee1;p=tfcrypt.git diff --git a/tfcrypt.c b/tfcrypt.c index 7e9ef8c..4ba1dd5 100644 --- a/tfcrypt.c +++ b/tfcrypt.c @@ -149,6 +149,29 @@ _baddfname: counter_opt = TFC_CTR_RAND; else if (!strcasecmp(optarg, "zero")) counter_opt = TFC_CTR_ZERO; + else if (strchr(optarg, ':')) { + char *ss, chr; + + counter_opt = TFC_CTR_SSET; + n = sizeof(ctr); + + s = d = optarg; t = NULL; + while ((s = strtok_r(d, ",", &t))) { + if (d) d = NULL; + + if (n == 0) break; + ss = strchr(s, ':'); + if (!ss) continue; + *ss = 0; ss++; + chr = (char)strtoul(s, &stoi, 16); + if (!str_empty(stoi)) continue; + x = (size_t)strtoul(ss, &stoi, 10); + if (!str_empty(stoi)) continue; + if (x > n) x = n; + memset(ctr+(sizeof(ctr)-n), (int)chr, x); + n -= x; + } + } else counter_file = sksum_hashlist_file = optarg; break; case 'C':