summaryrefslogtreecommitdiff
path: root/crypto/tgr192.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2019-01-10 12:17:58 -0800
committerHerbert Xu <herbert@gondor.apana.org.au>2019-01-18 18:43:43 +0800
commit0be3ba59bf4f32feedf17749e583def76e49e6fc (patch)
tree5f5ad4904ddf28765310a600f2fc9ba049d409cc /crypto/tgr192.c
parente642983ff39a364c6250444d582544b7d4158d9f (diff)
downloadlinux-crypto-0be3ba59bf4f32feedf17749e583def76e49e6fc.tar.gz
linux-crypto-0be3ba59bf4f32feedf17749e583def76e49e6fc.zip
crypto: tgr192 - fix unaligned memory access
Fix an unaligned memory access in tgr192_transform() by using the unaligned access helpers. Fixes: cbbf485e2e5d ("[CRYPTO] Use standard byte order macros wherever possible") Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--crypto/tgr192.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/tgr192.c b/crypto/tgr192.c
index 022d3dd7..f8e1d9f9 100644
--- a/crypto/tgr192.c
+++ b/crypto/tgr192.c
@@ -25,8 +25,9 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mm.h>
-#include <asm/byteorder.h>
#include <linux/types.h>
+#include <asm/byteorder.h>
+#include <asm/unaligned.h>
#define TGR192_DIGEST_SIZE 24
#define TGR160_DIGEST_SIZE 20
@@ -468,10 +469,9 @@ static void tgr192_transform(struct tgr192_ctx *tctx, const u8 * data)
u64 a, b, c, aa, bb, cc;
u64 x[8];
int i;
- const __le64 *ptr = (const __le64 *)data;
for (i = 0; i < 8; i++)
- x[i] = le64_to_cpu(ptr[i]);
+ x[i] = get_unaligned_le64(data + i * sizeof(__le64));
/* save */
a = aa = tctx->a;