From 2b73688b7cd2162cffb9762c2d2d7edf2b77f391 Mon Sep 17 00:00:00 2001 From: Andreas Date: Tue, 16 Feb 2016 19:24:12 +0100 Subject: [PATCH] fixed endianess for toByte and base_w --- wots.c | 2 +- xmss_commons.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wots.c b/wots.c index 6df49ff..bed5bc0 100644 --- a/wots.c +++ b/wots.c @@ -71,7 +71,7 @@ static void base_w(int *output, const unsigned char *input, int in_len, const wo for (consumed = 0; consumed < 8 * in_len; consumed += params->log_w) { if (bits == 0) { - total = input[in_len - 1 - in]; + total = input[in]; in++; bits += 8; } diff --git a/xmss_commons.c b/xmss_commons.c index ce8a465..4c97b79 100644 --- a/xmss_commons.c +++ b/xmss_commons.c @@ -12,7 +12,7 @@ Public domain. void to_byte(unsigned char *out, unsigned int in, int bytes) { int i; - for (i = 0; i < bytes; i++) { + for (i = bytes-1; i >= 0; i--) { out[i] = in & 0xff; in = in >> 8; }