-X: add simple XOR mode (embedded xor tool)
[tfcrypt.git] / tfc_error.c
index ba36658baa08838904bb5c4619b8d496ff3cb38c..953ba0725a648f1079be4d5cd0ac2ec76f63a5c6 100644 (file)
@@ -114,7 +114,7 @@ void usage(void)
 
        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));
@@ -148,9 +148,11 @@ void usage(void)
                tfc_say("  -a: shortcut of -O xtime.");
                tfc_say("  -l length: read only these first bytes of source.");
                tfc_say("  -O opts: set options (comma separated list):");
+               tfc_say("    ro: open all files only for reading, even those intended for writing,");
                tfc_say("    sync: request a synchronous I/O for a output,");
                tfc_say("    fsync: on each write() call a corresponding fsync(fd),");
                tfc_say("    trunc: open(O_WRONLY) will truncate output file to zero size.");
+               tfc_say("    append: open(O_APPEND) will append data to output file.");
                tfc_say("    pad: pad incomplete (l.t. %u bytes) block with zeroes.", TFC_U(TF_BLOCK_SIZE));
                tfc_say("    xtime: copy timestamps from source to destination files.");
                tfc_say("    gibsize: use SI units of size: 1k = 1000. Applies only to size prefixes.");
@@ -160,8 +162,11 @@ void usage(void)
                tfc_say("    when the whole status line width is smaller than tty width.");
                tfc_say("    statless: emit less information in status line (only processed data).");
                tfc_say("    iobs=val: set IO block size value. Must not exceed %u bytes.", TFC_U(TFC_BLKSIZE));
+               tfc_say("    nobuf: disable IO buffering, write as soon as data received (only for stream ciphers!)");
                tfc_say("    iseek=val: seek source file/device by these val bytes.");
                tfc_say("    oseek=val: seek destination file/device by these val bytes.");
+               tfc_say("    ioseek=val: seek both source and destination.");
+               tfc_say("    ioseek is equal to iseek and oseek.");
                tfc_say("    count=val: process only these val bytes, both input and output.");
                tfc_say("    ftrunc=val: truncate output file to these val bytes before closing it.");
                tfc_say("    ftrunc=tail: truncate output's tail, leaving only processed data.");
@@ -195,7 +200,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");
@@ -205,6 +210,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);
@@ -241,7 +262,7 @@ void usage(void)
        tfc_say("  -w: overwrite source file. If not file, ignored.");
        tfc_say("  -n TURNS: number of turns to perform in Skein function.");
        tfc_say("    Default is always defined when building tfcrypt.");
-       tfc_say("  -C mode: mode of operation: CTR, STREAM, XTS, ECB, CBC, OCB.");
+       tfc_say("  -C mode: mode of operation: CTR, STREAM, XTS, ECB, CBC.");
        tfc_say("    Default encryption mode can be changed when building tfcrypt.");
        tfc_say("  -c opt: initial CTR value initialisation mode:");
        tfc_say("    show: do default action, then dump CTR value to stderr,");
@@ -314,9 +335,11 @@ void usage(void)
        tfc_say("    Multiple -E specifiers may be given in separate options.");
        tfc_say("  -o logfile: redirect all messages to logfile instead of stderr.");
        tfc_say("  -O opts: set options (comma separated list):");
+       tfc_say("    ro: open all files only for reading, even those intended for writing,");
        tfc_say("    sync: request a synchronous I/O for a output,");
        tfc_say("    fsync: on each write() call a corresponding fsync(fd),");
        tfc_say("    trunc: open(O_WRONLY) will truncate output file to zero size.");
+       tfc_say("    append: open(O_APPEND) will append data to output file.");
        tfc_say("    pad: pad incomplete (l.t. %u bytes) block with zeroes.", TFC_U(TF_BLOCK_SIZE));
        tfc_say("    xtime: copy timestamps from source to destination files.");
        tfc_say("    gibsize: use SI units of size: 1k = 1000. Applies only to size prefixes.");
@@ -335,6 +358,7 @@ void usage(void)
        tfc_say("    shorthex: with -H, do not print printable characters, dump only hex string.");
        tfc_say("    logfile: (same as -o) redirect all messages to logfile instead of stderr.");
        tfc_say("    iobs=val: set IO block size value. Must not exceed %u bytes.", TFC_U(TFC_BLKSIZE));
+       tfc_say("    nobuf: disable IO buffering, write as soon as data received (only for stream ciphers!)");
        tfc_say("    xtsblocks=val: use these nr of TF blocks per XTS block. Default is %u.", TFC_U(TFC_XTSBLOCKS));
        tfc_say("    iseek=val: seek source file/device by these val bytes.");
        tfc_say("    Initial counter is adjusted automatically.");
@@ -346,6 +370,8 @@ void usage(void)
        tfc_say("    ixctr=val: Increment initial counter by this val bytes.");
        tfc_say("    Internally this number is translated into number of %u byte blocks.", TFC_U(TF_BLOCK_SIZE));
        tfc_say("    oseek=val: seek destination file/device by these val bytes.");
+       tfc_say("    ioseek=val: seek both source and destination.");
+       tfc_say("    ioseek is equal to iseek and oseek.");
        tfc_say("    count=val: process only these val bytes, both input and output.");
        tfc_say("    ftrunc=val: truncate output file to these val bytes before closing it.");
        tfc_say("    ftrunc=tail: truncate output's tail, leaving only processed data.");
@@ -354,6 +380,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");