Skip to content

Commit

Permalink
Fix BINARY_ALIGN in a few OpenCL formats
Browse files Browse the repository at this point in the history
It's amazing we still have this problem 12 years after introducing the
alignment warnings.
  • Loading branch information
magnumripper committed Dec 25, 2024
1 parent 55dbabb commit cf7bcbc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/opencl_rawmd4_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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])];
((unsigned char*)out)[i] = (atoi16[ARCH_INDEX(*p)] << 4) | atoi16[ARCH_INDEX(p[1])];
p += 2;
}
return out;
Expand Down
4 changes: 2 additions & 2 deletions src/opencl_rawmd5_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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])];
((unsigned char*)out)[i] = (atoi16[ARCH_INDEX(*p)] << 4) | atoi16[ARCH_INDEX(p[1])];
p += 2;
}
return out;
Expand Down
2 changes: 1 addition & 1 deletion src/opencl_solarwinds_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit cf7bcbc

Please sign in to comment.