aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware-utils/src
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-06-24 18:13:00 +0000
committerJohn Crispin <blogic@openwrt.org>2014-06-24 18:13:00 +0000
commita0b76f9456122aa64bcbdca468aa51e006128c3b (patch)
tree1e7e6ab27480db4359dcd67859441995238d3b28 /tools/firmware-utils/src
parentb5f47d40c10d68c41863722dceb3117379d300cc (diff)
downloadupstream-a0b76f9456122aa64bcbdca468aa51e006128c3b.tar.gz
upstream-a0b76f9456122aa64bcbdca468aa51e006128c3b.tar.bz2
upstream-a0b76f9456122aa64bcbdca468aa51e006128c3b.zip
firmware-utils/mkdir615h1: fix magic XOR calculation
Signed-off-by: Forest Crossman <cyrozap@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@41314 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'tools/firmware-utils/src')
-rw-r--r--tools/firmware-utils/src/mkdir615h1.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/firmware-utils/src/mkdir615h1.c b/tools/firmware-utils/src/mkdir615h1.c
index 84692aa3aa..d9fb35c1ec 100644
--- a/tools/firmware-utils/src/mkdir615h1.c
+++ b/tools/firmware-utils/src/mkdir615h1.c
@@ -199,7 +199,7 @@ static int encode_image(const char *input_file_name,
}
for (i = 0; i < bytes_read; i++)
- buf[i] ^= magic >> ((((i >> 60) + i) & 7) - (i >> 60));
+ buf[i] ^= magic >> (i % 8) & 0xff;
fwrite(&buf, bytes_read, 1, fp_output);
}
@@ -254,7 +254,7 @@ int decode_image(const char *input_file_name, const char *output_file_name)
bytes_read = fread(&buf, 1, BUF_SIZE, fp_input);
for (i = 0; i < bytes_read; i++)
- buf[i] ^= header.magic >> ((((i >> 60) + i) & 7) - (i >> 60));
+ buf[i] ^= header.magic >> (i % 8) & 0xff;
/*
* Handle padded source file