hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/arch/x86/crypto/ghash-clmulni-intel_glue.c
....@@ -19,6 +19,7 @@
1919 #include <crypto/internal/simd.h>
2020 #include <asm/cpu_device_id.h>
2121 #include <asm/simd.h>
22
+#include <asm/unaligned.h>
2223
2324 #define GHASH_BLOCK_SIZE 16
2425 #define GHASH_DIGEST_SIZE 16
....@@ -54,15 +55,14 @@
5455 const u8 *key, unsigned int keylen)
5556 {
5657 struct ghash_ctx *ctx = crypto_shash_ctx(tfm);
57
- be128 *x = (be128 *)key;
5858 u64 a, b;
5959
6060 if (keylen != GHASH_BLOCK_SIZE)
6161 return -EINVAL;
6262
6363 /* perform multiplication by 'x' in GF(2^128) */
64
- a = be64_to_cpu(x->a);
65
- b = be64_to_cpu(x->b);
64
+ a = get_unaligned_be64(key);
65
+ b = get_unaligned_be64(key + 8);
6666
6767 ctx->shash.a = (b << 1) | (a >> 63);
6868 ctx->shash.b = (a << 1) | (b >> 63);