mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
crypto: ghash-clmulni-intel - Use u128 instead of be128 for internal key
The internal key isn't actually in big-endian format so let's switch to u128 which also happens to allow us to remove a sparse warning. Based on suggestion by Ard Biesheuvel. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
This commit is contained in:
parent
59ecc26004
commit
0ea481466d
2 changed files with 8 additions and 8 deletions
|
@ -92,7 +92,7 @@ __clmul_gf128mul_ble:
|
|||
ret
|
||||
ENDPROC(__clmul_gf128mul_ble)
|
||||
|
||||
/* void clmul_ghash_mul(char *dst, const be128 *shash) */
|
||||
/* void clmul_ghash_mul(char *dst, const u128 *shash) */
|
||||
ENTRY(clmul_ghash_mul)
|
||||
movups (%rdi), DATA
|
||||
movups (%rsi), SHASH
|
||||
|
@ -106,7 +106,7 @@ ENDPROC(clmul_ghash_mul)
|
|||
|
||||
/*
|
||||
* void clmul_ghash_update(char *dst, const char *src, unsigned int srclen,
|
||||
* const be128 *shash);
|
||||
* const u128 *shash);
|
||||
*/
|
||||
ENTRY(clmul_ghash_update)
|
||||
cmp $16, %rdx
|
||||
|
|
|
@ -25,17 +25,17 @@
|
|||
#define GHASH_BLOCK_SIZE 16
|
||||
#define GHASH_DIGEST_SIZE 16
|
||||
|
||||
void clmul_ghash_mul(char *dst, const be128 *shash);
|
||||
void clmul_ghash_mul(char *dst, const u128 *shash);
|
||||
|
||||
void clmul_ghash_update(char *dst, const char *src, unsigned int srclen,
|
||||
const be128 *shash);
|
||||
const u128 *shash);
|
||||
|
||||
struct ghash_async_ctx {
|
||||
struct cryptd_ahash *cryptd_tfm;
|
||||
};
|
||||
|
||||
struct ghash_ctx {
|
||||
be128 shash;
|
||||
u128 shash;
|
||||
};
|
||||
|
||||
struct ghash_desc_ctx {
|
||||
|
@ -68,11 +68,11 @@ static int ghash_setkey(struct crypto_shash *tfm,
|
|||
a = be64_to_cpu(x->a);
|
||||
b = be64_to_cpu(x->b);
|
||||
|
||||
ctx->shash.a = (__be64)((b << 1) | (a >> 63));
|
||||
ctx->shash.b = (__be64)((a << 1) | (b >> 63));
|
||||
ctx->shash.a = (b << 1) | (a >> 63);
|
||||
ctx->shash.b = (a << 1) | (b >> 63);
|
||||
|
||||
if (a >> 63)
|
||||
ctx->shash.b ^= cpu_to_be64(0xc2);
|
||||
ctx->shash.b ^= ((u64)0xc2) << 56;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue