]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
(test_cipher_cbc): Print more info when failing.
authorNiels Möller <nisse@lysator.liu.se>
Thu, 30 Sep 2010 11:38:30 +0000 (13:38 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Thu, 30 Sep 2010 11:38:30 +0000 (13:38 +0200)
Rev: nettle/testsuite/testutils.c:1.10

testsuite/testutils.c

index eea8037b6cf45ff5e1fb18338011f24d25397650..65a4ac154e5a4bed538449d44eeec69b39126b0c 100644 (file)
@@ -225,8 +225,16 @@ test_cipher_cbc(const struct nettle_cipher *cipher,
              length, data, cleartext);
 
   if (!MEMEQ(length, data, ciphertext))
-    FAIL();
-
+    {
+      fprintf(stderr, "CBC encrypt failed:\nInput:");
+      print_hex(length, cleartext);
+      fprintf(stderr, "\nOutput: ");
+      print_hex(length, data);
+      fprintf(stderr, "\nExpected:");
+      print_hex(length, ciphertext);
+      fprintf(stderr, "\n");
+      FAIL();
+    }
   cipher->set_decrypt_key(ctx, key_length, key);
   memcpy(iv, iiv, cipher->block_size);
 
@@ -235,8 +243,16 @@ test_cipher_cbc(const struct nettle_cipher *cipher,
              length, data, data);
 
   if (!MEMEQ(length, data, cleartext))
-    FAIL();
-
+    {
+      fprintf(stderr, "CBC decrypt failed:\nInput:");
+      print_hex(length, ciphertext);
+      fprintf(stderr, "\nOutput: ");
+      print_hex(length, data);
+      fprintf(stderr, "\nExpected:");
+      print_hex(length, cleartext);
+      fprintf(stderr, "\n");
+      FAIL();
+    }
   free(ctx);
   free(data);
   free(iv);