summaryrefslogtreecommitdiffstats
path: root/src/crypto/modes/gcm_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/modes/gcm_test.c')
-rw-r--r--src/crypto/modes/gcm_test.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/crypto/modes/gcm_test.c b/src/crypto/modes/gcm_test.c
index 89ed792..a8819ea 100644
--- a/src/crypto/modes/gcm_test.c
+++ b/src/crypto/modes/gcm_test.c
@@ -55,7 +55,6 @@
#include <openssl/modes.h>
#include "internal.h"
-#include "../test/test_util.h"
struct test_case {
@@ -299,6 +298,17 @@ err:
return 0;
}
+void hexdump(const char *msg, const void *in, size_t len) {
+ const uint8_t *data = in;
+ size_t i;
+
+ fprintf(stderr, "%s: ", msg);
+ for (i = 0; i < len; i++) {
+ fprintf(stderr, "%02x", data[i]);
+ }
+ fprintf(stderr, "\n");
+}
+
static int run_test_case(unsigned test_num, const struct test_case *test) {
size_t key_len, plaintext_len, additional_data_len, nonce_len, ciphertext_len,
tag_len;
@@ -357,8 +367,8 @@ static int run_test_case(unsigned test_num, const struct test_case *test) {
if (!CRYPTO_gcm128_finish(&ctx, tag, tag_len) ||
(ciphertext && memcmp(out, ciphertext, plaintext_len) != 0)) {
fprintf(stderr, "%u: encrypt failed.\n", test_num);
- hexdump(stderr, "got :", out, plaintext_len);
- hexdump(stderr, "want:", ciphertext, plaintext_len);
+ hexdump("got ", out, plaintext_len);
+ hexdump("want", ciphertext, plaintext_len);
goto out;
}