sha1.c: annotate load which may be unaligned
authorEric Biggers <ebiggers3@gmail.com>
Sat, 30 May 2015 20:48:14 +0000 (15:48 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Fri, 5 Jun 2015 03:05:37 +0000 (22:05 -0500)
src/sha1.c

index 1b2abb2f226a3b293a55347c5ec541b2cbc26f9e..24f9b68292afb001ceaee802620cc2aa913e96ca 100644 (file)
@@ -51,7 +51,7 @@ sprint_hash(const u8 hash[SHA1_HASH_SIZE], tchar strbuf[SHA1_HASH_SIZE * 2 + 1])
 
 #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
 
-#define blk0(i) (tmp[i] = be32_to_cpu(((const be32 *)block)[i]))
+#define blk0(i) (tmp[i] = be32_to_cpu(load_be32_unaligned(&(block)[(i) * 4])))
 
 #define blk(i) (tmp[i & 15] = rol(tmp[(i + 13) & 15] ^ \
                                  tmp[(i +  8) & 15] ^ \