X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=tfcrypt.c;h=e8514391b8036b8168c5f85d7ef32e8383c59542;hb=9ac86c906f37b9b9dce4f018c90d420f947e05a9;hp=054e76899bb5891efb418c3d4941652081d2ea8a;hpb=2a9a13e951cb7bcc4d81b3e6f1e23c5185ec77af;p=tfcrypt.git diff --git a/tfcrypt.c b/tfcrypt.c index 054e768..e851439 100644 --- a/tfcrypt.c +++ b/tfcrypt.c @@ -311,6 +311,8 @@ _baddfname: write_flags |= O_SYNC; else if (!strcmp(s, "trunc")) write_flags |= O_TRUNC; + else if (!strcmp(s, "append")) + write_flags |= O_APPEND; else if (!strcmp(s, "fsync")) do_fsync = YES; else if (!strcmp(s, "pad")) @@ -773,7 +775,7 @@ _nokeyfd: } if (sfd == -1) xerror(NO, NO, YES, "%s", argv[idx]); - if ((do_mac >= TFC_MAC_VRFY || do_mac == TFC_MAC_DROP) && !do_mac_file) { + if ((do_mac >= TFC_MAC_VRFY || do_mac <= TFC_MAC_DROP) && !do_mac_file) { maxlen = tfc_fdsize(sfd); if (maxlen == NOFSIZE) xerror(NO, YES, YES, @@ -1125,6 +1127,7 @@ _ctrwagain: lio = xwrite(dfd, pblk, lrem); lrem -= lio; goto _ctrwagain; } + total_written_dst += ldone; total_processed_dst += ldone; delta_processed += ldone; } @@ -1330,7 +1333,8 @@ _macragain: lio = xread(sfd, pblk, lrem); } if (do_mac == TFC_MAC_JUST_VRFY2) { if (verbose) tfc_esay("%s: -u: MAC signature is valid, proceeding with decrypting it again", tfc_format_pid(progname)); - do_mac = TFC_MAC_DROP; + maxlen = total_processed_src - SKEIN_DIGEST_SIZE; + do_mac = TFC_MAC_DROP2; goto _decrypt_again_vrfy2; } } @@ -1347,7 +1351,6 @@ _shortmac: memset(macvrfy, 0, sizeof(macvrfy)); memset(macresult, 0, sizeof(macresult)); memset(tmpdata, 0, sizeof(tmpdata)); } - else if (do_mac == TFC_MAC_SIGN) { if (ctr_mode < TFC_MODE_OCB) skein_final(macresult, &sk); else skein(macresult, macbits, mackey, macresult, TF_FROM_BITS(macbits)); @@ -1373,6 +1376,7 @@ _macwagain: lio = xwrite(dfd, pblk, lrem); lrem -= lio; goto _macwagain; } + total_written_dst += ldone; total_processed_dst += ldone; delta_processed += ldone; } @@ -1404,6 +1408,7 @@ _macwagain: lio = xwrite(dfd, pblk, lrem); memset(macresult, 0, sizeof(macresult)); memset(tmpdata, 0, sizeof(tmpdata)); } + else if (do_mac == TFC_MAC_DROP2) total_processed_src += SKEIN_DIGEST_SIZE; if (verbose || status_timer || (do_stop == YES && quiet == NO)) print_crypt_status(0);