summaryrefslogtreecommitdiff
path: root/crc/sha256.c
diff options
context:
space:
mode:
Diffstat (limited to 'crc/sha256.c')
-rw-r--r--crc/sha256.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/crc/sha256.c b/crc/sha256.c
index 8ec29432..fe08ab3a 100644
--- a/crc/sha256.c
+++ b/crc/sha256.c
@@ -18,13 +18,21 @@
*/
#include <string.h>
#include <inttypes.h>
-#include <byteswap.h>
-#include <endian.h>
#include "sha256.h"
#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define __be32_to_cpu(x) __bswap_32(x)
+static int __be32_to_cpu(uint32_t val)
+{
+ uint32_t c1, c2, c3, c4;
+
+ c1 = (val >> 24) & 0xff;
+ c2 = (val >> 16) & 0xff;
+ c3 = (val >> 8) & 0xff;
+ c4 = val & 0xff;
+
+ return c1 | c2 << 8 | c3 << 16 | c4 << 24;
+}
#else
#define __be32_to_cpu(x) (x)
#endif