Lines Matching +full:1 +full:- +full:16

1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * aesce-ccm-core.S - AES-CCM transform for ARMv8 with Crypto Extensions
5 * Copyright (C) 2013 - 2017 Linaro Ltd <ard.biesheuvel@linaro.org>
12 .arch armv8-a+crypto
19 ld1 {v0.16b}, [x0] /* load mac */
20 cbz w3, 1f
21 sub w3, w3, #16
22 eor v1.16b, v1.16b, v1.16b
23 0: ldrb w7, [x1], #1 /* get 1 byte of input */
24 subs w2, w2, #1
25 add w3, w3, #1
27 ext v1.16b, v1.16b, v1.16b, #1 /* rotate in the input bytes */
30 eor v0.16b, v0.16b, v1.16b
31 1: ld1 {v3.4s}, [x4] /* load first round key */
34 add x6, x4, #16
38 mov v5.16b, v3.16b
40 2: mov v4.16b, v3.16b
41 ld1 {v5.4s}, [x6], #16 /* load 2nd round key */
42 3: aese v0.16b, v4.16b
43 aesmc v0.16b, v0.16b
44 4: ld1 {v3.4s}, [x6], #16 /* load next round key */
45 aese v0.16b, v5.16b
46 aesmc v0.16b, v0.16b
47 5: ld1 {v4.4s}, [x6], #16 /* load next round key */
49 aese v0.16b, v3.16b
50 aesmc v0.16b, v0.16b
51 ld1 {v5.4s}, [x6], #16 /* load next round key */
53 aese v0.16b, v4.16b
54 subs w2, w2, #16 /* last data? */
55 eor v0.16b, v0.16b, v5.16b /* final round */
57 ld1 {v1.16b}, [x1], #16 /* load next input block */
58 eor v0.16b, v0.16b, v1.16b /* xor with mac */
59 bne 1b
60 6: st1 {v0.16b}, [x0] /* store mac */
62 adds w2, w2, #16
65 7: ldrb w7, [x1], #1
68 strb w6, [x0], #1
69 subs w2, w2, #1
71 ext v0.16b, v0.16b, v0.16b, #1 /* rotate out the mac bytes */
75 add w3, w3, #16
76 9: ext v1.16b, v1.16b, v1.16b, #1
77 adds w7, w7, #1
79 91: eor v0.16b, v0.16b, v1.16b
80 st1 {v0.16b}, [x0]
90 ld1 {v3.4s}, [x2], #16 /* load first round key */
91 ld1 {v0.16b}, [x0] /* load mac */
94 ld1 {v1.16b}, [x1] /* load 1st ctriv */
97 mov v5.16b, v3.16b
99 0: mov v4.16b, v3.16b
100 1: ld1 {v5.4s}, [x2], #16 /* load next round key */
101 aese v0.16b, v4.16b
102 aesmc v0.16b, v0.16b
103 aese v1.16b, v4.16b
104 aesmc v1.16b, v1.16b
105 2: ld1 {v3.4s}, [x2], #16 /* load next round key */
106 aese v0.16b, v5.16b
107 aesmc v0.16b, v0.16b
108 aese v1.16b, v5.16b
109 aesmc v1.16b, v1.16b
110 3: ld1 {v4.4s}, [x2], #16 /* load next round key */
112 aese v0.16b, v3.16b
113 aesmc v0.16b, v0.16b
114 aese v1.16b, v3.16b
115 aesmc v1.16b, v1.16b
116 bpl 1b
117 aese v0.16b, v4.16b
118 aese v1.16b, v4.16b
120 eor v0.16b, v0.16b, v1.16b /* en-/decrypt the mac */
121 st1 {v0.16b}, [x0] /* store result */
128 ld1 {v0.16b}, [x5] /* load mac */
133 add x8, x8, #1
137 ins v1.d[1], x9 /* no carry in lower ctr */
139 add x10, x3, #16
140 bmi 1f
142 mov v5.16b, v3.16b
144 1: mov v4.16b, v3.16b
145 ld1 {v5.4s}, [x10], #16 /* load 2nd round key */
147 aese v0.16b, v4.16b
148 aesmc v0.16b, v0.16b
149 aese v1.16b, v4.16b
150 aesmc v1.16b, v1.16b
151 3: ld1 {v3.4s}, [x10], #16 /* load next round key */
152 aese v0.16b, v5.16b
153 aesmc v0.16b, v0.16b
154 aese v1.16b, v5.16b
155 aesmc v1.16b, v1.16b
156 4: ld1 {v4.4s}, [x10], #16 /* load next round key */
158 aese v0.16b, v3.16b
159 aesmc v0.16b, v0.16b
160 aese v1.16b, v3.16b
161 aesmc v1.16b, v1.16b
162 ld1 {v5.4s}, [x10], #16 /* load next round key */
164 aese v0.16b, v4.16b
165 aese v1.16b, v4.16b
166 subs w2, w2, #16
168 ld1 {v2.16b}, [x1], #16 /* load next input block */
169 .if \enc == 1
170 eor v2.16b, v2.16b, v5.16b /* final round enc+mac */
171 eor v1.16b, v1.16b, v2.16b /* xor with crypted ctr */
173 eor v2.16b, v2.16b, v1.16b /* xor with crypted ctr */
174 eor v1.16b, v2.16b, v5.16b /* final round enc */
176 eor v0.16b, v0.16b, v2.16b /* xor mac with pt ^ rk[last] */
177 st1 {v1.16b}, [x0], #16 /* write output block */
180 st1 {v0.16b}, [x5] /* store mac */
184 6: eor v0.16b, v0.16b, v5.16b /* final round mac */
185 eor v1.16b, v1.16b, v5.16b /* final round enc */
186 st1 {v0.16b}, [x5] /* store mac */
187 add w2, w2, #16 /* process partial tail block */
188 7: ldrb w9, [x1], #1 /* get 1 byte of input */
191 .if \enc == 1
198 strb w9, [x0], #1 /* store out byte */
199 strb w7, [x5], #1 /* store mac byte */
200 subs w2, w2, #1
202 ext v0.16b, v0.16b, v0.16b, #1 /* shift out mac byte */
203 ext v1.16b, v1.16b, v1.16b, #1 /* shift out ctr byte */
216 aes_ccm_do_crypt 1