summaryrefslogtreecommitdiffstats
path: root/crypto/sha256_generic.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-10-02 14:52:37 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2014-10-02 14:52:37 +0800
commitbe34c4ef693ff5c10f55606dbd656ddf0b4a8340 (patch)
treeaa8bb25553507ac3cd5454b4c627ab9a5120d3ce /crypto/sha256_generic.c
parent5cfed7b3351ce33b60c4a1d02ffd712cdf4f49cd (diff)
downloadop-kernel-dev-be34c4ef693ff5c10f55606dbd656ddf0b4a8340.zip
op-kernel-dev-be34c4ef693ff5c10f55606dbd656ddf0b4a8340.tar.gz
crypto: sha - Handle unaligned input data in generic sha256 and sha512.
Like SHA1, use get_unaligned_be*() on the raw input data. Reported-by: Bob Picco <bob.picco@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/sha256_generic.c')
-rw-r--r--crypto/sha256_generic.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/sha256_generic.c b/crypto/sha256_generic.c
index 5433667..0bb5583 100644
--- a/crypto/sha256_generic.c
+++ b/crypto/sha256_generic.c
@@ -24,6 +24,7 @@
#include <linux/types.h>
#include <crypto/sha.h>
#include <asm/byteorder.h>
+#include <asm/unaligned.h>
static inline u32 Ch(u32 x, u32 y, u32 z)
{
@@ -42,7 +43,7 @@ static inline u32 Maj(u32 x, u32 y, u32 z)
static inline void LOAD_OP(int I, u32 *W, const u8 *input)
{
- W[I] = __be32_to_cpu( ((__be32*)(input))[I] );
+ W[I] = get_unaligned_be32((__u32 *)input + I);
}
static inline void BLEND_OP(int I, u32 *W)
OpenPOWER on IntegriCloud