X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=tfc_error.c;h=b8cc4323b00e610768a5eaf2ce62039a27aaf8d1;hb=370a18a4c47e236b51ad8dee1957c40e11346b96;hp=2b50807f6071cedbafd386cb3bfcbda51967e0e5;hpb=c0d678824537239f5e17822cd8473ac32f1ed251;p=tfcrypt.git diff --git a/tfc_error.c b/tfc_error.c index 2b50807..b8cc432 100644 --- a/tfc_error.c +++ b/tfc_error.c @@ -28,8 +28,6 @@ #include "tfcrypt.h" -tfc_yesno xexit_no_nl; - void xerror(tfc_yesno noexit, tfc_yesno noerrno, tfc_yesno nostats, const char *fmt, ...) { va_list ap; @@ -39,7 +37,7 @@ void xerror(tfc_yesno noexit, tfc_yesno noerrno, tfc_yesno nostats, const char * va_start(ap, fmt); - if (statline_was_shown == YES && do_statline_dynamic == YES) tfc_esay("\n"); + if (noexit == YES && (statline_was_shown == YES && do_statline_dynamic == YES)) tfc_esay("\n"); tfc_nfsay(stderr, "%s: ", tfc_format_pid(progname)); tfc_vfsay(stderr, NO, fmt, ap); @@ -52,12 +50,9 @@ void xerror(tfc_yesno noexit, tfc_yesno noerrno, tfc_yesno nostats, const char * va_end(ap); if (nostats == NO) { - print_crypt_status(-1); - tfc_esay("\n"); + print_crypt_status(TFC_SIGERR); } - xexit_no_nl = YES; - _do_sil_exit: if (noexit == YES) { errno = 0; @@ -102,7 +97,6 @@ _do_clean_and_exit: memset(pwdask, 0, sizeof(pwdask)); memset(pwdagain, 0, sizeof(pwdagain)); - if (xexit_no_nl == NO) tfc_esay("\n"); exit(status); } @@ -110,11 +104,9 @@ void usage(void) { tfc_yesno is_embedded_prog = NO; - xexit_no_nl = YES; - if (optopt == 'V') { tfc_say("tfcrypt toolkit, version %s.", _TFCRYPT_VERSION); - if (ctr_mode != TFC_MODE_PLAIN) { + if (do_edcrypt != TFC_DO_PLAIN) { char shash[64]; hash_defaults(shash, sizeof(shash)); @@ -200,7 +192,7 @@ void usage(void) tfc_say("them is specified as \"-\", then reads are performed from stdin."); tfc_say("\n"); } - else if (!strcmp(progname, "tfbase64")) { + else if (!strcmp(progname, "base64")) { is_embedded_prog = YES; tfc_say("usage: %s [-ed] [source] [output]", progname); tfc_say("\n"); @@ -210,6 +202,22 @@ void usage(void) tfc_say("no error checking is performed."); tfc_say("\n"); } + else if (!strcmp(progname, "xor")) { + is_embedded_prog = YES; + tfc_say("usage: %s [sourceX] [sourceY] [output]", progname); + tfc_say("\n"); + tfc_say("tfcrypt embedded high performance XOR tool."); + tfc_say("It does XOR (multiply modulo 2) of each byte from sourceX"); + tfc_say("each byte of sourceY and writes output."); + tfc_say("If filenames omitted, it is assumed to operate over"); + tfc_say("standard in to standard out."); + tfc_say("If any of source files is shorter than another,"); + tfc_say("then output is truncated to length of the shortest one."); + tfc_say("\n"); + tfc_say("No error checking is performed."); + tfc_say("Please use iotool options there."); + tfc_say("\n"); + } else if (!strcmp(progname, "tfbench")) { is_embedded_prog = YES; tfc_say("usage: %s seconds", progname); @@ -265,6 +273,8 @@ void usage(void) tfc_say(" -v: print number of read and written encrypted bytes, and explain stages."); tfc_say(" -V seconds: activate timer that will repeatedly print statistics to stderr."); tfc_say(" -a: shortcut of -O xtime."); + tfc_say(" -g: same as '-e -C stream -c rand' or '-d -C stream -c head', depending on mode."); + tfc_say(" -j: same as '-e -C ctr -c rand' or '-d -C ctr -c head', depending on mode."); tfc_say(" -l length: read only these first bytes of source."); tfc_say(" -r : specify random source instead of /dev/urandom."); tfc_say(" -R nr_bytes: generate nr_bytes of random bytes suitable for use as key data."); @@ -364,6 +374,7 @@ void usage(void) tfc_say(" xctr=val: specify size in bytes of initial counter prepended or read."); tfc_say(" fullkey: occupy tweak space by key space, extending key size by 256 bits."); tfc_say(" -P: plain IO mode: disable encryption/decryption code at all."); + tfc_say(" -X: XOR IO mode: same as -P but do XOR of two streams."); tfc_say("\n"); tfc_say("Default is to ask for password, then encrypt stdin into stdout."); tfc_say("Some cmdline parameters may be mutually exclusive, or they can");