2 * sha1-ce-core.S - SHA-1 secure hash using ARMv8 Crypto Extensions
4 * Copyright (C) 2015 Linaro Ltd.
5 * Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/linkage.h>
13 #include <asm/assembler.h>
16 .fpu crypto-neon-fp-armv8
38 .macro add_only, op, ev, rc, s0, dg1
40 vadd.u32 tb\ev, q\s0, \rc
44 sha1\op\().32 dg0, dg1a\ev, ta\ev
46 sha1\op\().32 dg0, \dg1, ta\ev
50 .macro add_update, op, ev, rc, s0, s1, s2, s3, dg1
51 sha1su0.32 q\s0, q\s1, q\s2
52 add_only \op, \ev, \rc, \s1, \dg1
58 .word 0x5a827999, 0x5a827999, 0x5a827999, 0x5a827999
59 .word 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1, 0x6ed9eba1
60 .word 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc, 0x8f1bbcdc
61 .word 0xca62c1d6, 0xca62c1d6, 0xca62c1d6, 0xca62c1d6
64 * void sha1_ce_transform(struct sha1_state *sst, u8 const *src,
67 ENTRY(sha1_ce_transform)
68 /* load round constants */
70 vld1.32 {k0-k1}, [ip, :128]!
71 vld1.32 {k2-k3}, [ip, :128]
78 0: vld1.32 {q8-q9}, [r1]!
79 vld1.32 {q10-q11}, [r1]!
82 #ifndef CONFIG_CPU_BIG_ENDIAN
92 add_update c, 0, k0, 8, 9, 10, 11, dgb
93 add_update c, 1, k0, 9, 10, 11, 8
94 add_update c, 0, k0, 10, 11, 8, 9
95 add_update c, 1, k0, 11, 8, 9, 10
96 add_update c, 0, k1, 8, 9, 10, 11
98 add_update p, 1, k1, 9, 10, 11, 8
99 add_update p, 0, k1, 10, 11, 8, 9
100 add_update p, 1, k1, 11, 8, 9, 10
101 add_update p, 0, k1, 8, 9, 10, 11
102 add_update p, 1, k2, 9, 10, 11, 8
104 add_update m, 0, k2, 10, 11, 8, 9
105 add_update m, 1, k2, 11, 8, 9, 10
106 add_update m, 0, k2, 8, 9, 10, 11
107 add_update m, 1, k2, 9, 10, 11, 8
108 add_update m, 0, k3, 10, 11, 8, 9
110 add_update p, 1, k3, 11, 8, 9, 10
112 add_only p, 1, k3, 10
113 add_only p, 0, k3, 11
117 vadd.u32 dga, dga, dg0
118 vadd.u32 dgb, dgb, dg1a0
121 /* store new state */
125 ENDPROC(sha1_ce_transform)