| .. | .. |
|---|
| 19 | 19 | #include <crypto/internal/simd.h> |
|---|
| 20 | 20 | #include <asm/cpu_device_id.h> |
|---|
| 21 | 21 | #include <asm/simd.h> |
|---|
| 22 | +#include <asm/unaligned.h> |
|---|
| 22 | 23 | |
|---|
| 23 | 24 | #define GHASH_BLOCK_SIZE 16 |
|---|
| 24 | 25 | #define GHASH_DIGEST_SIZE 16 |
|---|
| .. | .. |
|---|
| 54 | 55 | const u8 *key, unsigned int keylen) |
|---|
| 55 | 56 | { |
|---|
| 56 | 57 | struct ghash_ctx *ctx = crypto_shash_ctx(tfm); |
|---|
| 57 | | - be128 *x = (be128 *)key; |
|---|
| 58 | 58 | u64 a, b; |
|---|
| 59 | 59 | |
|---|
| 60 | 60 | if (keylen != GHASH_BLOCK_SIZE) |
|---|
| 61 | 61 | return -EINVAL; |
|---|
| 62 | 62 | |
|---|
| 63 | 63 | /* 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); |
|---|
| 66 | 66 | |
|---|
| 67 | 67 | ctx->shash.a = (b << 1) | (a >> 63); |
|---|
| 68 | 68 | ctx->shash.b = (a << 1) | (b >> 63); |
|---|