From 006073ff1a0a7153d0a21603ec840201cc7ba466 Mon Sep 17 00:00:00 2001 From: magnum Date: Wed, 25 Dec 2024 01:46:32 +0000 Subject: [PATCH] Fix BINARY_ALIGN in a few OpenCL formats It's amazing we still have this problem 12 years after introducing the alignment warnings. --- src/opencl_rawmd4_fmt_plug.c | 4 ++-- src/opencl_rawmd5_fmt_plug.c | 4 ++-- src/opencl_solarwinds_fmt_plug.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/opencl_rawmd4_fmt_plug.c b/src/opencl_rawmd4_fmt_plug.c index 45ea907244a..10678c817e8 100644 --- a/src/opencl_rawmd4_fmt_plug.c +++ b/src/opencl_rawmd4_fmt_plug.c @@ -291,12 +291,12 @@ static char *split(char *ciphertext, int index, struct fmt_main *self) static void *get_binary(char *ciphertext) { - static unsigned char out[DIGEST_SIZE]; + static uint32_t out[DIGEST_SIZE]; char *p; int i; p = ciphertext + TAG_LENGTH; for (i = 0; i < sizeof(out); i++) { - out[i] = (atoi16[ARCH_INDEX(*p)] << 4) | atoi16[ARCH_INDEX(p[1])]; + ((uint8_t*)out)[i] = (atoi16[ARCH_INDEX(*p)] << 4) | atoi16[ARCH_INDEX(p[1])]; p += 2; } return out; diff --git a/src/opencl_rawmd5_fmt_plug.c b/src/opencl_rawmd5_fmt_plug.c index 05831442e9e..aa1da31a280 100644 --- a/src/opencl_rawmd5_fmt_plug.c +++ b/src/opencl_rawmd5_fmt_plug.c @@ -316,12 +316,12 @@ static char *split(char *ciphertext, int index, struct fmt_main *self) static void *get_binary(char *ciphertext) { - static unsigned char out[DIGEST_SIZE]; + static uint32_t out[DIGEST_SIZE]; char *p; int i; p = ciphertext + TAG_LENGTH; for (i = 0; i < sizeof(out); i++) { - out[i] = (atoi16[ARCH_INDEX(*p)] << 4) | atoi16[ARCH_INDEX(p[1])]; + ((uint8_t*)out)[i] = (atoi16[ARCH_INDEX(*p)] << 4) | atoi16[ARCH_INDEX(p[1])]; p += 2; } return out; diff --git a/src/opencl_solarwinds_fmt_plug.c b/src/opencl_solarwinds_fmt_plug.c index 49d81d0a619..29f7090eaba 100644 --- a/src/opencl_solarwinds_fmt_plug.c +++ b/src/opencl_solarwinds_fmt_plug.c @@ -42,7 +42,7 @@ john_register_one(&fmt_opencl_solarwinds); #define MAX_KEYS_PER_CRYPT 1 #define BINARY_SIZE 64 -#define BINARY_ALIGN MEM_ALIGN_WORD +#define BINARY_ALIGN 4 #define SALT_SIZE sizeof(*cur_salt) #define SALT_ALIGN MEM_ALIGN_WORD