X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=tfcrypt.c;h=5630a391a6c1798393308d810599512645f9f69b;hb=92b6bb91a5be9fc1b4d300f99b239cb8e3a6398d;hp=6b21e960dbe93e6e68188a0df0d17a152bf6b666;hpb=44bb43b90d7aad1878b20b6c9df848b998820374;p=tfcrypt.git diff --git a/tfcrypt.c b/tfcrypt.c index 6b21e96..5630a39 100644 --- a/tfcrypt.c +++ b/tfcrypt.c @@ -773,13 +773,7 @@ _nokeyfd: } if (sfd == -1) xerror(NO, NO, YES, "%s", argv[idx]); - if (do_edcrypt == TFC_DO_DECRYPT && do_mac != NO && maxlen != NOFSIZE) { - if (verbose) tfc_esay("%s: disabling signature verification on " - "requested partial decryption.", tfc_format_pid(progname)); - do_mac = NO; - } - - 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, @@ -1026,12 +1020,6 @@ _xts2genkey: if (xwrite(krfd, pblk, TF_FROM_BITS(TFC_KEY_BITS)) == NOSIZE) xerro xexit(0); } - if (iseek_blocks && (do_edcrypt == TFC_DO_DECRYPT && do_mac != NO)) { - if (verbose) tfc_esay("%s: disabling signature verification on " - "requested partial decryption.", tfc_format_pid(progname)); - do_mac = NO; - } - if (do_mac != NO) { if (mackey_opt == TFC_MACKEY_RAWKEY) skein(mackey, TF_MAX_BITS, key, key, TF_FROM_BITS(TFC_KEY_BITS)); if (ctr_mode < TFC_MODE_OCB) { @@ -1137,6 +1125,7 @@ _ctrwagain: lio = xwrite(dfd, pblk, lrem); lrem -= lio; goto _ctrwagain; } + total_written_dst += ldone; total_processed_dst += ldone; delta_processed += ldone; } @@ -1263,6 +1252,8 @@ _nowrite: total_processed_dst += ldone; } } + if (verbose && status_timer && do_statline_dynamic == YES && statline_was_shown == YES) tfc_esay("\n"); + errno = 0; if (do_mac >= TFC_MAC_VRFY) { if (!do_mac_file) { @@ -1340,7 +1331,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; } } @@ -1357,7 +1349,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)); @@ -1383,6 +1374,7 @@ _macwagain: lio = xwrite(dfd, pblk, lrem); lrem -= lio; goto _macwagain; } + total_written_dst += ldone; total_processed_dst += ldone; delta_processed += ldone; } @@ -1414,6 +1406,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);