[LEDE-DEV] [PATCH opkg] libopkg: fix SHA256 calculation for big endian system
Jo-Philipp Wich
jo at mein.io
Mon Nov 20 01:13:35 PST 2017
On 11/18/2017 01:25 PM, Jonas Gorski wrote:
> The SHA256 implementation relied on WORDS_BIGENDIAN being defined for
> big endian systems, but this was never done. This caused it to produce
> wrong checksums on those systems.
>
> Fix this by replacing the check with a generic check for big endian byte
> order.
>
> Fixes: 84552e64fa6d ("Adding sha256.[ch] Sorry forgot adding them. Thanks for Graham Gower <graham.gower at gmail.com>")
Might be that the initial implementation was okay and that my
autotools->cmake refactoring broke setting WORDS_BIGENDIAN.
> Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
Acked-by: Jo-Philipp Wich <jo at mein.io>
> ---
> libopkg/sha256.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libopkg/sha256.c b/libopkg/sha256.c
> index e0c4e3e0d423..5848799c0260 100644
> --- a/libopkg/sha256.c
> +++ b/libopkg/sha256.c
> @@ -30,7 +30,7 @@
> #include "unlocked-io.h"
> #endif
>
> -#ifdef WORDS_BIGENDIAN
> +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
> #define SWAP(n) (n)
> #else
> #define SWAP(n) \
>
More information about the Lede-dev
mailing list