2 * Accelerated GHASH implementation with ARMv8 vmull.p64 instructions.
4 * Copyright (C) 2015 Linaro Ltd. <ard.biesheuvel@linaro.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #include <linux/linkage.h>
12 #include <asm/assembler.h>
36 .fpu crypto-neon-fp-armv8
39 * void pmull_ghash_update(int blocks, u64 dg[], const char *src,
40 * struct ghash_key const *k, const char *head)
42 ENTRY(pmull_ghash_update)
46 vext.8 SHASH2, SHASH, SHASH, #8
47 vshl.u64 MASK, MASK, #57
48 veor SHASH2, SHASH2, SHASH
50 /* do the head block first, if supplied */
58 0: vld1.64 {T1}, [r2]!
61 1: /* multiply XL by SHASH in GF(2^128) */
62 #ifndef CONFIG_CPU_BIG_ENDIAN
66 vext.8 IN1, T1, T1, #8
70 vmull.p64 XH, SHASH_H, XL_H @ a1 * b1
72 vmull.p64 XL, SHASH_L, XL_L @ a0 * b0
73 vmull.p64 XM, SHASH2_L, T1_L @ (a1 + a0)(b1 + b0)
79 vmull.p64 T2, XL_L, MASK_L
86 vmull.p64 XL, XL_L, MASK_L
94 ENDPROC(pmull_ghash_update)