symm/hmac-def.h: Fix the NMAC and SSLMAC classes.
[catacomb] / progs / catcrypt.c
index 6e0db1d..5879ecb 100644 (file)
@@ -44,6 +44,7 @@
 #include <mLib/sub.h>
 
 #include "buf.h"
+#include "ct.h"
 #include "rand.h"
 #include "noise.h"
 #include "mprand.h"
@@ -206,7 +207,7 @@ static int encrypt(int argc, char *argv[])
     ofp = stdout;
   else if ((ofp = fopen(of, eo->wmode)) == 0) {
     die(EXIT_FAILURE, "couldn't open file `%s' for output: %s",
-       ofp, strerror(errno));
+       of, strerror(errno));
   }
 
   dstr_reset(&d);
@@ -506,7 +507,7 @@ static int decrypt(int argc, char *argv[])
     if ((ofp = fopen(of, "wb")) == 0) {
       if (f & f_progress) fprogress_done(&ff);
       die(EXIT_FAILURE, "couldn't open file `%s' for output: %s",
-         ofp, strerror(errno));
+         of, strerror(errno));
     }
     rfp = ofp;
   } else if ((rfp = tmpfile()) == 0) {
@@ -534,7 +535,7 @@ static int decrypt(int argc, char *argv[])
       exit(EXIT_FAILURE);
     }
     GH_HASH(h, BCUR(&b), BLEFT(&b));
-    if (memcmp(tag, GH_DONE(h, 0), GM_CLASS(m)->hashsz) != 0) {
+    if (!ct_memeq(tag, GH_DONE(h, 0), GM_CLASS(m)->hashsz)) {
       if (f & f_progress) fprogress_done(&ff);
       if (verb)
        printf("FAIL bad ciphertext chunk: authentication failure\n");