aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware-utils
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2014-06-24 18:13:00 +0000
committerJohn Crispin <john@openwrt.org>2014-06-24 18:13:00 +0000
commitea137d37353c958bca38e37de77621263b30f418 (patch)
treecc926c0e2e97674b54ab29058fdecf16a692897c /tools/firmware-utils
parent8a82c2cd36aa7b8b1ce6c0662e57c7d96c84c43e (diff)
downloadupstream-ea137d37353c958bca38e37de77621263b30f418.tar.gz
upstream-ea137d37353c958bca38e37de77621263b30f418.tar.bz2
upstream-ea137d37353c958bca38e37de77621263b30f418.zip
firmware-utils/mkdir615h1: fix magic XOR calculation
Signed-off-by: Forest Crossman <cyrozap@gmail.com> SVN-Revision: 41314
Diffstat (limited to 'tools/firmware-utils')
-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