>From e89a5c3f9200d0ba77dad270f960e74f17b06429 Mon Sep 17 00:00:00 2001 From: magnum Date: Tue, 17 Jan 2012 13:27:52 +0100 Subject: [PATCH 1/4] Test: Only check binary/salt alignment if not using fmt_default_* --- src/formats.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/formats.c b/src/formats.c index 16fc1af..31e5f3f 100644 --- a/src/formats.c +++ b/src/formats.c @@ -101,16 +101,23 @@ static char *fmt_self_test_body(struct fmt_main *format, * returned by binary() and salt() only to the declared sizes. */ binary = format->methods.binary(ciphertext); - if (!binary || + if (!binary) + return "binary (NULL)"; + if (format->methods.binary != fmt_default_binary && + format->methods.binary_hash[0] != fmt_default_binary_hash && is_misaligned(binary, format->params.binary_size)) - return "binary"; + return "binary (alignment)"; + memcpy(binary_copy, binary, format->params.binary_size); binary = binary_copy; salt = format->methods.salt(ciphertext); - if (!salt || + if (!salt) + return "salt (NULL)"; + if (format->methods.salt != fmt_default_salt && + format->methods.salt_hash != fmt_default_salt_hash && is_misaligned(salt, format->params.salt_size)) - return "salt"; + return "salt (alignment)"; memcpy(salt_copy, salt, format->params.salt_size); salt = salt_copy; -- 1.7.5.4