David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 1 | #include <linux/linkage.h> |
| 2 | #include <asm/visasm.h> |
| 3 | |
| 4 | #define F3F(x,y,z) (((x)<<30)|((y)<<19)|((z)<<5)) |
| 5 | |
| 6 | #define FPD_ENCODE(x) (((x) >> 5) | ((x) & ~(0x20))) |
| 7 | |
| 8 | #define RS1(x) (FPD_ENCODE(x) << 14) |
| 9 | #define RS2(x) (FPD_ENCODE(x) << 0) |
| 10 | #define RS3(x) (FPD_ENCODE(x) << 9) |
| 11 | #define RD(x) (FPD_ENCODE(x) << 25) |
| 12 | #define IMM5(x) ((x) << 9) |
| 13 | |
| 14 | #define AES_EROUND01(a,b,c,d) \ |
| 15 | .word (F3F(2, 0x19, 0)|RS1(a)|RS2(b)|RS3(c)|RD(d)); |
| 16 | #define AES_EROUND23(a,b,c,d) \ |
| 17 | .word (F3F(2, 0x19, 1)|RS1(a)|RS2(b)|RS3(c)|RD(d)); |
| 18 | #define AES_DROUND01(a,b,c,d) \ |
| 19 | .word (F3F(2, 0x19, 2)|RS1(a)|RS2(b)|RS3(c)|RD(d)); |
| 20 | #define AES_DROUND23(a,b,c,d) \ |
| 21 | .word (F3F(2, 0x19, 3)|RS1(a)|RS2(b)|RS3(c)|RD(d)); |
| 22 | #define AES_EROUND01_L(a,b,c,d) \ |
| 23 | .word (F3F(2, 0x19, 4)|RS1(a)|RS2(b)|RS3(c)|RD(d)); |
| 24 | #define AES_EROUND23_L(a,b,c,d) \ |
| 25 | .word (F3F(2, 0x19, 5)|RS1(a)|RS2(b)|RS3(c)|RD(d)); |
| 26 | #define AES_DROUND01_L(a,b,c,d) \ |
| 27 | .word (F3F(2, 0x19, 6)|RS1(a)|RS2(b)|RS3(c)|RD(d)); |
| 28 | #define AES_DROUND23_L(a,b,c,d) \ |
| 29 | .word (F3F(2, 0x19, 7)|RS1(a)|RS2(b)|RS3(c)|RD(d)); |
| 30 | #define AES_KEXPAND1(a,b,c,d) \ |
| 31 | .word (F3F(2, 0x19, 8)|RS1(a)|RS2(b)|IMM5(c)|RD(d)); |
| 32 | #define AES_KEXPAND0(a,b,c) \ |
| 33 | .word (F3F(2, 0x36, 0x130)|RS1(a)|RS2(b)|RD(c)); |
| 34 | #define AES_KEXPAND2(a,b,c) \ |
| 35 | .word (F3F(2, 0x36, 0x131)|RS1(a)|RS2(b)|RD(c)); |
| 36 | |
| 37 | #define MOVXTOD_G3_F4 \ |
| 38 | .word 0x89b02303; |
| 39 | #define MOVXTOD_G7_F6 \ |
| 40 | .word 0x8db02307; |
| 41 | #define MOVXTOD_G3_F0 \ |
| 42 | .word 0x81b02303; |
| 43 | #define MOVXTOD_G7_F2 \ |
| 44 | .word 0x85b02307; |
| 45 | #define MOVXTOD_O0_F0 \ |
| 46 | .word 0x81b02308; |
David S. Miller | 9fd130e | 2012-08-29 14:49:23 -0700 | [diff] [blame^] | 47 | #define MOVXTOD_O5_F0 \ |
| 48 | .word 0x81b0230d; |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 49 | #define MOVXTOD_O5_F2 \ |
| 50 | .word 0x85b0230d; |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 51 | |
| 52 | #define ENCRYPT_TWO_ROUNDS(KEY_BASE, I0, I1, T0, T1) \ |
| 53 | AES_EROUND01(KEY_BASE + 0, I0, I1, T0) \ |
| 54 | AES_EROUND23(KEY_BASE + 2, I0, I1, T1) \ |
| 55 | AES_EROUND01(KEY_BASE + 4, T0, T1, I0) \ |
| 56 | AES_EROUND23(KEY_BASE + 6, T0, T1, I1) |
| 57 | |
| 58 | #define ENCRYPT_TWO_ROUNDS_LAST(KEY_BASE, I0, I1, T0, T1) \ |
| 59 | AES_EROUND01(KEY_BASE + 0, I0, I1, T0) \ |
| 60 | AES_EROUND23(KEY_BASE + 2, I0, I1, T1) \ |
| 61 | AES_EROUND01_L(KEY_BASE + 4, T0, T1, I0) \ |
| 62 | AES_EROUND23_L(KEY_BASE + 6, T0, T1, I1) |
| 63 | |
| 64 | /* 10 rounds */ |
| 65 | #define ENCRYPT_128(KEY_BASE, I0, I1, T0, T1) \ |
| 66 | ENCRYPT_TWO_ROUNDS(KEY_BASE + 0, I0, I1, T0, T1) \ |
| 67 | ENCRYPT_TWO_ROUNDS(KEY_BASE + 8, I0, I1, T0, T1) \ |
| 68 | ENCRYPT_TWO_ROUNDS(KEY_BASE + 16, I0, I1, T0, T1) \ |
| 69 | ENCRYPT_TWO_ROUNDS(KEY_BASE + 24, I0, I1, T0, T1) \ |
| 70 | ENCRYPT_TWO_ROUNDS_LAST(KEY_BASE + 32, I0, I1, T0, T1) |
| 71 | |
| 72 | /* 12 rounds */ |
| 73 | #define ENCRYPT_192(KEY_BASE, I0, I1, T0, T1) \ |
| 74 | ENCRYPT_TWO_ROUNDS(KEY_BASE + 0, I0, I1, T0, T1) \ |
| 75 | ENCRYPT_TWO_ROUNDS(KEY_BASE + 8, I0, I1, T0, T1) \ |
| 76 | ENCRYPT_TWO_ROUNDS(KEY_BASE + 16, I0, I1, T0, T1) \ |
| 77 | ENCRYPT_TWO_ROUNDS(KEY_BASE + 24, I0, I1, T0, T1) \ |
| 78 | ENCRYPT_TWO_ROUNDS(KEY_BASE + 32, I0, I1, T0, T1) \ |
| 79 | ENCRYPT_TWO_ROUNDS_LAST(KEY_BASE + 40, I0, I1, T0, T1) |
| 80 | |
| 81 | /* 14 rounds */ |
| 82 | #define ENCRYPT_256(KEY_BASE, I0, I1, T0, T1) \ |
| 83 | ENCRYPT_TWO_ROUNDS(KEY_BASE + 0, I0, I1, T0, T1) \ |
| 84 | ENCRYPT_TWO_ROUNDS(KEY_BASE + 8, I0, I1, T0, T1) \ |
| 85 | ENCRYPT_TWO_ROUNDS(KEY_BASE + 16, I0, I1, T0, T1) \ |
| 86 | ENCRYPT_TWO_ROUNDS(KEY_BASE + 24, I0, I1, T0, T1) \ |
| 87 | ENCRYPT_TWO_ROUNDS(KEY_BASE + 32, I0, I1, T0, T1) \ |
| 88 | ENCRYPT_TWO_ROUNDS(KEY_BASE + 40, I0, I1, T0, T1) \ |
| 89 | ENCRYPT_TWO_ROUNDS_LAST(KEY_BASE + 48, I0, I1, T0, T1) |
| 90 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 91 | #define DECRYPT_TWO_ROUNDS(KEY_BASE, I0, I1, T0, T1) \ |
| 92 | AES_DROUND23(KEY_BASE + 0, I0, I1, T1) \ |
| 93 | AES_DROUND01(KEY_BASE + 2, I0, I1, T0) \ |
| 94 | AES_DROUND23(KEY_BASE + 4, T0, T1, I1) \ |
| 95 | AES_DROUND01(KEY_BASE + 6, T0, T1, I0) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 96 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 97 | #define DECRYPT_TWO_ROUNDS_LAST(KEY_BASE, I0, I1, T0, T1) \ |
| 98 | AES_DROUND23(KEY_BASE + 0, I0, I1, T1) \ |
| 99 | AES_DROUND01(KEY_BASE + 2, I0, I1, T0) \ |
| 100 | AES_DROUND23_L(KEY_BASE + 4, T0, T1, I1) \ |
| 101 | AES_DROUND01_L(KEY_BASE + 6, T0, T1, I0) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 102 | |
| 103 | /* 10 rounds */ |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 104 | #define DECRYPT_128(KEY_BASE, I0, I1, T0, T1) \ |
| 105 | DECRYPT_TWO_ROUNDS(KEY_BASE + 0, I0, I1, T0, T1) \ |
| 106 | DECRYPT_TWO_ROUNDS(KEY_BASE + 8, I0, I1, T0, T1) \ |
| 107 | DECRYPT_TWO_ROUNDS(KEY_BASE + 16, I0, I1, T0, T1) \ |
| 108 | DECRYPT_TWO_ROUNDS(KEY_BASE + 24, I0, I1, T0, T1) \ |
| 109 | DECRYPT_TWO_ROUNDS_LAST(KEY_BASE + 32, I0, I1, T0, T1) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 110 | |
| 111 | /* 12 rounds */ |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 112 | #define DECRYPT_192(KEY_BASE, I0, I1, T0, T1) \ |
| 113 | DECRYPT_TWO_ROUNDS(KEY_BASE + 0, I0, I1, T0, T1) \ |
| 114 | DECRYPT_TWO_ROUNDS(KEY_BASE + 8, I0, I1, T0, T1) \ |
| 115 | DECRYPT_TWO_ROUNDS(KEY_BASE + 16, I0, I1, T0, T1) \ |
| 116 | DECRYPT_TWO_ROUNDS(KEY_BASE + 24, I0, I1, T0, T1) \ |
| 117 | DECRYPT_TWO_ROUNDS(KEY_BASE + 32, I0, I1, T0, T1) \ |
| 118 | DECRYPT_TWO_ROUNDS_LAST(KEY_BASE + 40, I0, I1, T0, T1) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 119 | |
| 120 | /* 14 rounds */ |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 121 | #define DECRYPT_256(KEY_BASE, I0, I1, T0, T1) \ |
| 122 | DECRYPT_TWO_ROUNDS(KEY_BASE + 0, I0, I1, T0, T1) \ |
| 123 | DECRYPT_TWO_ROUNDS(KEY_BASE + 8, I0, I1, T0, T1) \ |
| 124 | DECRYPT_TWO_ROUNDS(KEY_BASE + 16, I0, I1, T0, T1) \ |
| 125 | DECRYPT_TWO_ROUNDS(KEY_BASE + 24, I0, I1, T0, T1) \ |
| 126 | DECRYPT_TWO_ROUNDS(KEY_BASE + 32, I0, I1, T0, T1) \ |
| 127 | DECRYPT_TWO_ROUNDS(KEY_BASE + 40, I0, I1, T0, T1) \ |
| 128 | DECRYPT_TWO_ROUNDS_LAST(KEY_BASE + 48, I0, I1, T0, T1) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 129 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 130 | .align 32 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 131 | ENTRY(aes_sparc64_key_expand) |
| 132 | /* %o0=input_key, %o1=output_key, %o2=key_len */ |
| 133 | VISEntry |
| 134 | ld [%o0 + 0x00], %f0 |
| 135 | ld [%o0 + 0x04], %f1 |
| 136 | ld [%o0 + 0x08], %f2 |
| 137 | ld [%o0 + 0x0c], %f3 |
| 138 | |
| 139 | std %f0, [%o1 + 0x00] |
| 140 | std %f2, [%o1 + 0x08] |
| 141 | add %o1, 0x10, %o1 |
| 142 | |
| 143 | cmp %o2, 24 |
| 144 | bl 2f |
| 145 | nop |
| 146 | |
| 147 | be 1f |
| 148 | nop |
| 149 | |
| 150 | /* 256-bit key expansion */ |
| 151 | ld [%o0 + 0x10], %f4 |
| 152 | ld [%o0 + 0x14], %f5 |
| 153 | ld [%o0 + 0x18], %f6 |
| 154 | ld [%o0 + 0x1c], %f7 |
| 155 | |
| 156 | std %f4, [%o1 + 0x00] |
| 157 | std %f6, [%o1 + 0x08] |
| 158 | add %o1, 0x10, %o1 |
| 159 | |
| 160 | AES_KEXPAND1(0, 6, 0x0, 8) |
| 161 | AES_KEXPAND2(2, 8, 10) |
| 162 | AES_KEXPAND0(4, 10, 12) |
| 163 | AES_KEXPAND2(6, 12, 14) |
| 164 | AES_KEXPAND1(8, 14, 0x1, 16) |
| 165 | AES_KEXPAND2(10, 16, 18) |
| 166 | AES_KEXPAND0(12, 18, 20) |
| 167 | AES_KEXPAND2(14, 20, 22) |
| 168 | AES_KEXPAND1(16, 22, 0x2, 24) |
| 169 | AES_KEXPAND2(18, 24, 26) |
| 170 | AES_KEXPAND0(20, 26, 28) |
| 171 | AES_KEXPAND2(22, 28, 30) |
| 172 | AES_KEXPAND1(24, 30, 0x3, 32) |
| 173 | AES_KEXPAND2(26, 32, 34) |
| 174 | AES_KEXPAND0(28, 34, 36) |
| 175 | AES_KEXPAND2(30, 36, 38) |
| 176 | AES_KEXPAND1(32, 38, 0x4, 40) |
| 177 | AES_KEXPAND2(34, 40, 42) |
| 178 | AES_KEXPAND0(36, 42, 44) |
| 179 | AES_KEXPAND2(38, 44, 46) |
| 180 | AES_KEXPAND1(40, 46, 0x5, 48) |
| 181 | AES_KEXPAND2(42, 48, 50) |
| 182 | AES_KEXPAND0(44, 50, 52) |
| 183 | AES_KEXPAND2(46, 52, 54) |
| 184 | AES_KEXPAND1(48, 54, 0x6, 56) |
| 185 | AES_KEXPAND2(50, 56, 58) |
| 186 | |
| 187 | std %f8, [%o1 + 0x00] |
| 188 | std %f10, [%o1 + 0x08] |
| 189 | std %f12, [%o1 + 0x10] |
| 190 | std %f14, [%o1 + 0x18] |
| 191 | std %f16, [%o1 + 0x20] |
| 192 | std %f18, [%o1 + 0x28] |
| 193 | std %f20, [%o1 + 0x30] |
| 194 | std %f22, [%o1 + 0x38] |
| 195 | std %f24, [%o1 + 0x40] |
| 196 | std %f26, [%o1 + 0x48] |
| 197 | std %f28, [%o1 + 0x50] |
| 198 | std %f30, [%o1 + 0x58] |
| 199 | std %f32, [%o1 + 0x60] |
| 200 | std %f34, [%o1 + 0x68] |
| 201 | std %f36, [%o1 + 0x70] |
| 202 | std %f38, [%o1 + 0x78] |
| 203 | std %f40, [%o1 + 0x80] |
| 204 | std %f42, [%o1 + 0x88] |
| 205 | std %f44, [%o1 + 0x90] |
| 206 | std %f46, [%o1 + 0x98] |
| 207 | std %f48, [%o1 + 0xa0] |
| 208 | std %f50, [%o1 + 0xa8] |
| 209 | std %f52, [%o1 + 0xb0] |
| 210 | std %f54, [%o1 + 0xb8] |
| 211 | std %f56, [%o1 + 0xc0] |
| 212 | ba,pt %xcc, 80f |
| 213 | std %f58, [%o1 + 0xc8] |
| 214 | |
| 215 | 1: |
| 216 | /* 192-bit key expansion */ |
| 217 | ld [%o0 + 0x10], %f4 |
| 218 | ld [%o0 + 0x14], %f5 |
| 219 | |
| 220 | std %f4, [%o1 + 0x00] |
| 221 | add %o1, 0x08, %o1 |
| 222 | |
| 223 | AES_KEXPAND1(0, 4, 0x0, 6) |
| 224 | AES_KEXPAND2(2, 6, 8) |
| 225 | AES_KEXPAND2(4, 8, 10) |
| 226 | AES_KEXPAND1(6, 10, 0x1, 12) |
| 227 | AES_KEXPAND2(8, 12, 14) |
| 228 | AES_KEXPAND2(10, 14, 16) |
| 229 | AES_KEXPAND1(12, 16, 0x2, 18) |
| 230 | AES_KEXPAND2(14, 18, 20) |
| 231 | AES_KEXPAND2(16, 20, 22) |
| 232 | AES_KEXPAND1(18, 22, 0x3, 24) |
| 233 | AES_KEXPAND2(20, 24, 26) |
| 234 | AES_KEXPAND2(22, 26, 28) |
| 235 | AES_KEXPAND1(24, 28, 0x4, 30) |
| 236 | AES_KEXPAND2(26, 30, 32) |
| 237 | AES_KEXPAND2(28, 32, 34) |
| 238 | AES_KEXPAND1(30, 34, 0x5, 36) |
| 239 | AES_KEXPAND2(32, 36, 38) |
| 240 | AES_KEXPAND2(34, 38, 40) |
| 241 | AES_KEXPAND1(36, 40, 0x6, 42) |
| 242 | AES_KEXPAND2(38, 42, 44) |
| 243 | AES_KEXPAND2(40, 44, 46) |
| 244 | AES_KEXPAND1(42, 46, 0x7, 48) |
| 245 | AES_KEXPAND2(44, 48, 50) |
| 246 | |
| 247 | std %f6, [%o1 + 0x00] |
| 248 | std %f8, [%o1 + 0x08] |
| 249 | std %f10, [%o1 + 0x10] |
| 250 | std %f12, [%o1 + 0x18] |
| 251 | std %f14, [%o1 + 0x20] |
| 252 | std %f16, [%o1 + 0x28] |
| 253 | std %f18, [%o1 + 0x30] |
| 254 | std %f20, [%o1 + 0x38] |
| 255 | std %f22, [%o1 + 0x40] |
| 256 | std %f24, [%o1 + 0x48] |
| 257 | std %f26, [%o1 + 0x50] |
| 258 | std %f28, [%o1 + 0x58] |
| 259 | std %f30, [%o1 + 0x60] |
| 260 | std %f32, [%o1 + 0x68] |
| 261 | std %f34, [%o1 + 0x70] |
| 262 | std %f36, [%o1 + 0x78] |
| 263 | std %f38, [%o1 + 0x80] |
| 264 | std %f40, [%o1 + 0x88] |
| 265 | std %f42, [%o1 + 0x90] |
| 266 | std %f44, [%o1 + 0x98] |
| 267 | std %f46, [%o1 + 0xa0] |
| 268 | std %f48, [%o1 + 0xa8] |
| 269 | ba,pt %xcc, 80f |
| 270 | std %f50, [%o1 + 0xb0] |
| 271 | |
| 272 | 2: |
| 273 | /* 128-bit key expansion */ |
| 274 | AES_KEXPAND1(0, 2, 0x0, 4) |
| 275 | AES_KEXPAND2(2, 4, 6) |
| 276 | AES_KEXPAND1(4, 6, 0x1, 8) |
| 277 | AES_KEXPAND2(6, 8, 10) |
| 278 | AES_KEXPAND1(8, 10, 0x2, 12) |
| 279 | AES_KEXPAND2(10, 12, 14) |
| 280 | AES_KEXPAND1(12, 14, 0x3, 16) |
| 281 | AES_KEXPAND2(14, 16, 18) |
| 282 | AES_KEXPAND1(16, 18, 0x4, 20) |
| 283 | AES_KEXPAND2(18, 20, 22) |
| 284 | AES_KEXPAND1(20, 22, 0x5, 24) |
| 285 | AES_KEXPAND2(22, 24, 26) |
| 286 | AES_KEXPAND1(24, 26, 0x6, 28) |
| 287 | AES_KEXPAND2(26, 28, 30) |
| 288 | AES_KEXPAND1(28, 30, 0x7, 32) |
| 289 | AES_KEXPAND2(30, 32, 34) |
| 290 | AES_KEXPAND1(32, 34, 0x8, 36) |
| 291 | AES_KEXPAND2(34, 36, 38) |
| 292 | AES_KEXPAND1(36, 38, 0x9, 40) |
| 293 | AES_KEXPAND2(38, 40, 42) |
| 294 | |
| 295 | std %f4, [%o1 + 0x00] |
| 296 | std %f6, [%o1 + 0x08] |
| 297 | std %f8, [%o1 + 0x10] |
| 298 | std %f10, [%o1 + 0x18] |
| 299 | std %f12, [%o1 + 0x20] |
| 300 | std %f14, [%o1 + 0x28] |
| 301 | std %f16, [%o1 + 0x30] |
| 302 | std %f18, [%o1 + 0x38] |
| 303 | std %f20, [%o1 + 0x40] |
| 304 | std %f22, [%o1 + 0x48] |
| 305 | std %f24, [%o1 + 0x50] |
| 306 | std %f26, [%o1 + 0x58] |
| 307 | std %f28, [%o1 + 0x60] |
| 308 | std %f30, [%o1 + 0x68] |
| 309 | std %f32, [%o1 + 0x70] |
| 310 | std %f34, [%o1 + 0x78] |
| 311 | std %f36, [%o1 + 0x80] |
| 312 | std %f38, [%o1 + 0x88] |
| 313 | std %f40, [%o1 + 0x90] |
| 314 | std %f42, [%o1 + 0x98] |
| 315 | 80: |
| 316 | retl |
| 317 | VISExit |
| 318 | ENDPROC(aes_sparc64_key_expand) |
| 319 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 320 | .align 32 |
| 321 | ENTRY(aes_sparc64_encrypt_128) |
| 322 | /* %o0=key, %o1=input, %o2=output */ |
| 323 | VISEntry |
| 324 | ld [%o1 + 0x00], %f4 |
| 325 | ld [%o1 + 0x04], %f5 |
| 326 | ld [%o1 + 0x08], %f6 |
| 327 | ld [%o1 + 0x0c], %f7 |
| 328 | ldd [%o0 + 0x00], %f8 |
| 329 | ldd [%o0 + 0x08], %f10 |
| 330 | ldd [%o0 + 0x10], %f12 |
| 331 | ldd [%o0 + 0x18], %f14 |
| 332 | ldd [%o0 + 0x20], %f16 |
| 333 | ldd [%o0 + 0x28], %f18 |
| 334 | ldd [%o0 + 0x30], %f20 |
| 335 | ldd [%o0 + 0x38], %f22 |
| 336 | ldd [%o0 + 0x40], %f24 |
| 337 | ldd [%o0 + 0x48], %f26 |
| 338 | ldd [%o0 + 0x50], %f28 |
| 339 | ldd [%o0 + 0x58], %f30 |
| 340 | ldd [%o0 + 0x60], %f32 |
| 341 | ldd [%o0 + 0x68], %f34 |
| 342 | ldd [%o0 + 0x70], %f36 |
| 343 | ldd [%o0 + 0x78], %f38 |
| 344 | ldd [%o0 + 0x80], %f40 |
| 345 | ldd [%o0 + 0x88], %f42 |
| 346 | ldd [%o0 + 0x90], %f44 |
| 347 | ldd [%o0 + 0x98], %f46 |
| 348 | ldd [%o0 + 0xa0], %f48 |
| 349 | ldd [%o0 + 0xa8], %f50 |
| 350 | fxor %f8, %f4, %f4 |
| 351 | fxor %f10, %f6, %f6 |
| 352 | ENCRYPT_128(12, 4, 6, 0, 2) |
| 353 | st %f4, [%o2 + 0x00] |
| 354 | st %f5, [%o2 + 0x04] |
| 355 | st %f6, [%o2 + 0x08] |
| 356 | st %f7, [%o2 + 0x0c] |
| 357 | retl |
| 358 | VISExit |
| 359 | ENDPROC(aes_sparc64_encrypt_128) |
| 360 | |
| 361 | .align 32 |
| 362 | ENTRY(aes_sparc64_encrypt_192) |
| 363 | /* %o0=key, %o1=input, %o2=output */ |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 364 | VISEntry |
| 365 | ld [%o1 + 0x00], %f4 |
| 366 | ld [%o1 + 0x04], %f5 |
| 367 | ld [%o1 + 0x08], %f6 |
| 368 | ld [%o1 + 0x0c], %f7 |
| 369 | |
| 370 | ldd [%o0 + 0x00], %f8 |
| 371 | ldd [%o0 + 0x08], %f10 |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 372 | |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 373 | fxor %f8, %f4, %f4 |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 374 | fxor %f10, %f6, %f6 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 375 | |
| 376 | ldd [%o0 + 0x10], %f8 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 377 | ldd [%o0 + 0x18], %f10 |
| 378 | ldd [%o0 + 0x20], %f12 |
| 379 | ldd [%o0 + 0x28], %f14 |
| 380 | add %o0, 0x20, %o0 |
| 381 | |
| 382 | ENCRYPT_TWO_ROUNDS(8, 4, 6, 0, 2) |
| 383 | |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 384 | ldd [%o0 + 0x10], %f12 |
| 385 | ldd [%o0 + 0x18], %f14 |
| 386 | ldd [%o0 + 0x20], %f16 |
| 387 | ldd [%o0 + 0x28], %f18 |
| 388 | ldd [%o0 + 0x30], %f20 |
| 389 | ldd [%o0 + 0x38], %f22 |
| 390 | ldd [%o0 + 0x40], %f24 |
| 391 | ldd [%o0 + 0x48], %f26 |
| 392 | ldd [%o0 + 0x50], %f28 |
| 393 | ldd [%o0 + 0x58], %f30 |
| 394 | ldd [%o0 + 0x60], %f32 |
| 395 | ldd [%o0 + 0x68], %f34 |
| 396 | ldd [%o0 + 0x70], %f36 |
| 397 | ldd [%o0 + 0x78], %f38 |
| 398 | ldd [%o0 + 0x80], %f40 |
| 399 | ldd [%o0 + 0x88], %f42 |
| 400 | ldd [%o0 + 0x90], %f44 |
| 401 | ldd [%o0 + 0x98], %f46 |
| 402 | ldd [%o0 + 0xa0], %f48 |
| 403 | ldd [%o0 + 0xa8], %f50 |
| 404 | |
| 405 | |
| 406 | ENCRYPT_128(12, 4, 6, 0, 2) |
| 407 | |
| 408 | st %f4, [%o2 + 0x00] |
| 409 | st %f5, [%o2 + 0x04] |
| 410 | st %f6, [%o2 + 0x08] |
| 411 | st %f7, [%o2 + 0x0c] |
| 412 | |
| 413 | retl |
| 414 | VISExit |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 415 | ENDPROC(aes_sparc64_encrypt_192) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 416 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 417 | .align 32 |
| 418 | ENTRY(aes_sparc64_encrypt_256) |
| 419 | /* %o0=key, %o1=input, %o2=output */ |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 420 | VISEntry |
| 421 | ld [%o1 + 0x00], %f4 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 422 | ld [%o1 + 0x04], %f5 |
| 423 | ld [%o1 + 0x08], %f6 |
| 424 | ld [%o1 + 0x0c], %f7 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 425 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 426 | ldd [%o0 + 0x00], %f8 |
| 427 | ldd [%o0 + 0x08], %f10 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 428 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 429 | fxor %f8, %f4, %f4 |
| 430 | fxor %f10, %f6, %f6 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 431 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 432 | ldd [%o0 + 0x10], %f8 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 433 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 434 | ldd [%o0 + 0x18], %f10 |
| 435 | ldd [%o0 + 0x20], %f12 |
| 436 | ldd [%o0 + 0x28], %f14 |
| 437 | add %o0, 0x20, %o0 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 438 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 439 | ENCRYPT_TWO_ROUNDS(8, 4, 6, 0, 2) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 440 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 441 | ldd [%o0 + 0x10], %f8 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 442 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 443 | ldd [%o0 + 0x18], %f10 |
| 444 | ldd [%o0 + 0x20], %f12 |
| 445 | ldd [%o0 + 0x28], %f14 |
| 446 | add %o0, 0x20, %o0 |
| 447 | |
| 448 | ENCRYPT_TWO_ROUNDS(8, 4, 6, 0, 2) |
| 449 | |
| 450 | ldd [%o0 + 0x10], %f12 |
| 451 | ldd [%o0 + 0x18], %f14 |
| 452 | ldd [%o0 + 0x20], %f16 |
| 453 | ldd [%o0 + 0x28], %f18 |
| 454 | ldd [%o0 + 0x30], %f20 |
| 455 | ldd [%o0 + 0x38], %f22 |
| 456 | ldd [%o0 + 0x40], %f24 |
| 457 | ldd [%o0 + 0x48], %f26 |
| 458 | ldd [%o0 + 0x50], %f28 |
| 459 | ldd [%o0 + 0x58], %f30 |
| 460 | ldd [%o0 + 0x60], %f32 |
| 461 | ldd [%o0 + 0x68], %f34 |
| 462 | ldd [%o0 + 0x70], %f36 |
| 463 | ldd [%o0 + 0x78], %f38 |
| 464 | ldd [%o0 + 0x80], %f40 |
| 465 | ldd [%o0 + 0x88], %f42 |
| 466 | ldd [%o0 + 0x90], %f44 |
| 467 | ldd [%o0 + 0x98], %f46 |
| 468 | ldd [%o0 + 0xa0], %f48 |
| 469 | ldd [%o0 + 0xa8], %f50 |
| 470 | |
| 471 | ENCRYPT_128(12, 4, 6, 0, 2) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 472 | |
| 473 | st %f4, [%o2 + 0x00] |
| 474 | st %f5, [%o2 + 0x04] |
| 475 | st %f6, [%o2 + 0x08] |
| 476 | st %f7, [%o2 + 0x0c] |
| 477 | |
| 478 | retl |
| 479 | VISExit |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 480 | ENDPROC(aes_sparc64_encrypt_256) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 481 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 482 | .align 32 |
| 483 | ENTRY(aes_sparc64_decrypt_128) |
| 484 | /* %o0=key, %o1=input, %o2=output */ |
| 485 | VISEntry |
| 486 | ld [%o1 + 0x00], %f4 |
| 487 | ld [%o1 + 0x04], %f5 |
| 488 | ld [%o1 + 0x08], %f6 |
| 489 | ld [%o1 + 0x0c], %f7 |
| 490 | ldd [%o0 + 0xa0], %f8 |
| 491 | ldd [%o0 + 0xa8], %f10 |
| 492 | ldd [%o0 + 0x98], %f12 |
| 493 | ldd [%o0 + 0x90], %f14 |
| 494 | ldd [%o0 + 0x88], %f16 |
| 495 | ldd [%o0 + 0x80], %f18 |
| 496 | ldd [%o0 + 0x78], %f20 |
| 497 | ldd [%o0 + 0x70], %f22 |
| 498 | ldd [%o0 + 0x68], %f24 |
| 499 | ldd [%o0 + 0x60], %f26 |
| 500 | ldd [%o0 + 0x58], %f28 |
| 501 | ldd [%o0 + 0x50], %f30 |
| 502 | ldd [%o0 + 0x48], %f32 |
| 503 | ldd [%o0 + 0x40], %f34 |
| 504 | ldd [%o0 + 0x38], %f36 |
| 505 | ldd [%o0 + 0x30], %f38 |
| 506 | ldd [%o0 + 0x28], %f40 |
| 507 | ldd [%o0 + 0x20], %f42 |
| 508 | ldd [%o0 + 0x18], %f44 |
| 509 | ldd [%o0 + 0x10], %f46 |
| 510 | ldd [%o0 + 0x08], %f48 |
| 511 | ldd [%o0 + 0x00], %f50 |
| 512 | fxor %f8, %f4, %f4 |
| 513 | fxor %f10, %f6, %f6 |
| 514 | DECRYPT_128(12, 4, 6, 0, 2) |
| 515 | st %f4, [%o2 + 0x00] |
| 516 | st %f5, [%o2 + 0x04] |
| 517 | st %f6, [%o2 + 0x08] |
| 518 | st %f7, [%o2 + 0x0c] |
| 519 | retl |
| 520 | VISExit |
| 521 | ENDPROC(aes_sparc64_decrypt_128) |
| 522 | |
| 523 | .align 32 |
| 524 | ENTRY(aes_sparc64_decrypt_192) |
| 525 | /* %o0=key, %o1=input, %o2=output */ |
| 526 | VISEntry |
| 527 | ld [%o1 + 0x00], %f4 |
| 528 | ld [%o1 + 0x04], %f5 |
| 529 | ld [%o1 + 0x08], %f6 |
| 530 | ld [%o1 + 0x0c], %f7 |
| 531 | ldd [%o0 + 0xc0], %f8 |
| 532 | ldd [%o0 + 0xc8], %f10 |
| 533 | ldd [%o0 + 0xb8], %f12 |
| 534 | ldd [%o0 + 0xb0], %f14 |
| 535 | ldd [%o0 + 0xa8], %f16 |
| 536 | ldd [%o0 + 0xa0], %f18 |
| 537 | fxor %f8, %f4, %f4 |
| 538 | fxor %f10, %f6, %f6 |
| 539 | ldd [%o0 + 0x98], %f20 |
| 540 | ldd [%o0 + 0x90], %f22 |
| 541 | ldd [%o0 + 0x88], %f24 |
| 542 | ldd [%o0 + 0x80], %f26 |
| 543 | DECRYPT_TWO_ROUNDS(12, 4, 6, 0, 2) |
| 544 | ldd [%o0 + 0x78], %f28 |
| 545 | ldd [%o0 + 0x70], %f30 |
| 546 | ldd [%o0 + 0x68], %f32 |
| 547 | ldd [%o0 + 0x60], %f34 |
| 548 | ldd [%o0 + 0x58], %f36 |
| 549 | ldd [%o0 + 0x50], %f38 |
| 550 | ldd [%o0 + 0x48], %f40 |
| 551 | ldd [%o0 + 0x40], %f42 |
| 552 | ldd [%o0 + 0x38], %f44 |
| 553 | ldd [%o0 + 0x30], %f46 |
| 554 | ldd [%o0 + 0x28], %f48 |
| 555 | ldd [%o0 + 0x20], %f50 |
| 556 | ldd [%o0 + 0x18], %f52 |
| 557 | ldd [%o0 + 0x10], %f54 |
| 558 | ldd [%o0 + 0x08], %f56 |
| 559 | ldd [%o0 + 0x00], %f58 |
| 560 | DECRYPT_128(20, 4, 6, 0, 2) |
| 561 | st %f4, [%o2 + 0x00] |
| 562 | st %f5, [%o2 + 0x04] |
| 563 | st %f6, [%o2 + 0x08] |
| 564 | st %f7, [%o2 + 0x0c] |
| 565 | retl |
| 566 | VISExit |
| 567 | ENDPROC(aes_sparc64_decrypt_192) |
| 568 | |
| 569 | .align 32 |
| 570 | ENTRY(aes_sparc64_decrypt_256) |
| 571 | /* %o0=key, %o1=input, %o2=output */ |
| 572 | VISEntry |
| 573 | ld [%o1 + 0x00], %f4 |
| 574 | ld [%o1 + 0x04], %f5 |
| 575 | ld [%o1 + 0x08], %f6 |
| 576 | ld [%o1 + 0x0c], %f7 |
| 577 | ldd [%o0 + 0xe0], %f8 |
| 578 | ldd [%o0 + 0xe8], %f10 |
| 579 | ldd [%o0 + 0xd8], %f12 |
| 580 | ldd [%o0 + 0xd0], %f14 |
| 581 | ldd [%o0 + 0xc8], %f16 |
| 582 | fxor %f8, %f4, %f4 |
| 583 | ldd [%o0 + 0xc0], %f18 |
| 584 | fxor %f10, %f6, %f6 |
| 585 | ldd [%o0 + 0xb8], %f20 |
| 586 | AES_DROUND23(12, 4, 6, 2) |
| 587 | ldd [%o0 + 0xb0], %f22 |
| 588 | AES_DROUND01(14, 4, 6, 0) |
| 589 | ldd [%o0 + 0xa8], %f24 |
| 590 | AES_DROUND23(16, 0, 2, 6) |
| 591 | ldd [%o0 + 0xa0], %f26 |
| 592 | AES_DROUND01(18, 0, 2, 4) |
| 593 | ldd [%o0 + 0x98], %f12 |
| 594 | AES_DROUND23(20, 4, 6, 2) |
| 595 | ldd [%o0 + 0x90], %f14 |
| 596 | AES_DROUND01(22, 4, 6, 0) |
| 597 | ldd [%o0 + 0x88], %f16 |
| 598 | AES_DROUND23(24, 0, 2, 6) |
| 599 | ldd [%o0 + 0x80], %f18 |
| 600 | AES_DROUND01(26, 0, 2, 4) |
| 601 | ldd [%o0 + 0x78], %f20 |
| 602 | AES_DROUND23(12, 4, 6, 2) |
| 603 | ldd [%o0 + 0x70], %f22 |
| 604 | AES_DROUND01(14, 4, 6, 0) |
| 605 | ldd [%o0 + 0x68], %f24 |
| 606 | AES_DROUND23(16, 0, 2, 6) |
| 607 | ldd [%o0 + 0x60], %f26 |
| 608 | AES_DROUND01(18, 0, 2, 4) |
| 609 | ldd [%o0 + 0x58], %f28 |
| 610 | AES_DROUND23(20, 4, 6, 2) |
| 611 | ldd [%o0 + 0x50], %f30 |
| 612 | AES_DROUND01(22, 4, 6, 0) |
| 613 | ldd [%o0 + 0x48], %f32 |
| 614 | AES_DROUND23(24, 0, 2, 6) |
| 615 | ldd [%o0 + 0x40], %f34 |
| 616 | AES_DROUND01(26, 0, 2, 4) |
| 617 | ldd [%o0 + 0x38], %f36 |
| 618 | AES_DROUND23(28, 4, 6, 2) |
| 619 | ldd [%o0 + 0x30], %f38 |
| 620 | AES_DROUND01(30, 4, 6, 0) |
| 621 | ldd [%o0 + 0x28], %f40 |
| 622 | AES_DROUND23(32, 0, 2, 6) |
| 623 | ldd [%o0 + 0x20], %f42 |
| 624 | AES_DROUND01(34, 0, 2, 4) |
| 625 | ldd [%o0 + 0x18], %f44 |
| 626 | AES_DROUND23(36, 4, 6, 2) |
| 627 | ldd [%o0 + 0x10], %f46 |
| 628 | AES_DROUND01(38, 4, 6, 0) |
| 629 | ldd [%o0 + 0x08], %f48 |
| 630 | AES_DROUND23(40, 0, 2, 6) |
| 631 | ldd [%o0 + 0x00], %f50 |
| 632 | AES_DROUND01(42, 0, 2, 4) |
| 633 | AES_DROUND23(44, 4, 6, 2) |
| 634 | AES_DROUND01(46, 4, 6, 0) |
| 635 | AES_DROUND23_L(48, 0, 2, 6) |
| 636 | AES_DROUND01_L(50, 0, 2, 4) |
| 637 | st %f4, [%o2 + 0x00] |
| 638 | st %f5, [%o2 + 0x04] |
| 639 | st %f6, [%o2 + 0x08] |
| 640 | st %f7, [%o2 + 0x0c] |
| 641 | retl |
| 642 | VISExit |
| 643 | ENDPROC(aes_sparc64_decrypt_256) |
| 644 | |
| 645 | .align 32 |
| 646 | ENTRY(aes_sparc64_load_encrypt_keys_128) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 647 | /* %o0=key */ |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 648 | VISEntry |
| 649 | ldd [%o0 + 0x10], %f8 |
| 650 | ldd [%o0 + 0x18], %f10 |
| 651 | ldd [%o0 + 0x20], %f12 |
| 652 | ldd [%o0 + 0x28], %f14 |
| 653 | ldd [%o0 + 0x30], %f16 |
| 654 | ldd [%o0 + 0x38], %f18 |
| 655 | ldd [%o0 + 0x40], %f20 |
| 656 | ldd [%o0 + 0x48], %f22 |
| 657 | ldd [%o0 + 0x50], %f24 |
| 658 | ldd [%o0 + 0x58], %f26 |
| 659 | ldd [%o0 + 0x60], %f28 |
| 660 | ldd [%o0 + 0x68], %f30 |
| 661 | ldd [%o0 + 0x70], %f32 |
| 662 | ldd [%o0 + 0x78], %f34 |
| 663 | ldd [%o0 + 0x80], %f36 |
| 664 | ldd [%o0 + 0x88], %f38 |
| 665 | ldd [%o0 + 0x90], %f40 |
| 666 | ldd [%o0 + 0x98], %f42 |
| 667 | ldd [%o0 + 0xa0], %f44 |
| 668 | retl |
| 669 | ldd [%o0 + 0xa8], %f46 |
| 670 | ENDPROC(aes_sparc64_load_encrypt_keys_128) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 671 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 672 | .align 32 |
| 673 | ENTRY(aes_sparc64_load_encrypt_keys_192) |
| 674 | /* %o0=key */ |
| 675 | VISEntry |
| 676 | ldd [%o0 + 0x10], %f8 |
| 677 | ldd [%o0 + 0x18], %f10 |
| 678 | ldd [%o0 + 0x20], %f12 |
| 679 | ldd [%o0 + 0x28], %f14 |
| 680 | ldd [%o0 + 0x30], %f16 |
| 681 | ldd [%o0 + 0x38], %f18 |
| 682 | ldd [%o0 + 0x40], %f20 |
| 683 | ldd [%o0 + 0x48], %f22 |
| 684 | ldd [%o0 + 0x50], %f24 |
| 685 | ldd [%o0 + 0x58], %f26 |
| 686 | ldd [%o0 + 0x60], %f28 |
| 687 | ldd [%o0 + 0x68], %f30 |
| 688 | ldd [%o0 + 0x70], %f32 |
| 689 | ldd [%o0 + 0x78], %f34 |
| 690 | ldd [%o0 + 0x80], %f36 |
| 691 | ldd [%o0 + 0x88], %f38 |
| 692 | ldd [%o0 + 0x90], %f40 |
| 693 | ldd [%o0 + 0x98], %f42 |
| 694 | ldd [%o0 + 0xa0], %f44 |
| 695 | ldd [%o0 + 0xa8], %f46 |
| 696 | ldd [%o0 + 0xb0], %f48 |
| 697 | ldd [%o0 + 0xb8], %f50 |
| 698 | ldd [%o0 + 0xc0], %f52 |
| 699 | retl |
| 700 | ldd [%o0 + 0xc8], %f54 |
| 701 | ENDPROC(aes_sparc64_load_encrypt_keys_192) |
| 702 | |
| 703 | .align 32 |
| 704 | ENTRY(aes_sparc64_load_encrypt_keys_256) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 705 | /* %o0=key */ |
| 706 | VISEntry |
| 707 | ldd [%o0 + 0x10], %f8 |
| 708 | ldd [%o0 + 0x18], %f10 |
| 709 | ldd [%o0 + 0x20], %f12 |
| 710 | ldd [%o0 + 0x28], %f14 |
| 711 | ldd [%o0 + 0x30], %f16 |
| 712 | ldd [%o0 + 0x38], %f18 |
| 713 | ldd [%o0 + 0x40], %f20 |
| 714 | ldd [%o0 + 0x48], %f22 |
| 715 | ldd [%o0 + 0x50], %f24 |
| 716 | ldd [%o0 + 0x58], %f26 |
| 717 | ldd [%o0 + 0x60], %f28 |
| 718 | ldd [%o0 + 0x68], %f30 |
| 719 | ldd [%o0 + 0x70], %f32 |
| 720 | ldd [%o0 + 0x78], %f34 |
| 721 | ldd [%o0 + 0x80], %f36 |
| 722 | ldd [%o0 + 0x88], %f38 |
| 723 | ldd [%o0 + 0x90], %f40 |
| 724 | ldd [%o0 + 0x98], %f42 |
| 725 | ldd [%o0 + 0xa0], %f44 |
| 726 | ldd [%o0 + 0xa8], %f46 |
| 727 | ldd [%o0 + 0xb0], %f48 |
| 728 | ldd [%o0 + 0xb8], %f50 |
| 729 | ldd [%o0 + 0xc0], %f52 |
| 730 | ldd [%o0 + 0xc8], %f54 |
| 731 | ldd [%o0 + 0xd0], %f56 |
| 732 | ldd [%o0 + 0xd8], %f58 |
| 733 | ldd [%o0 + 0xe0], %f60 |
| 734 | retl |
| 735 | ldd [%o0 + 0xe8], %f62 |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 736 | ENDPROC(aes_sparc64_load_encrypt_keys_256) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 737 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 738 | .align 32 |
| 739 | ENTRY(aes_sparc64_load_decrypt_keys_128) |
| 740 | /* %o0=key */ |
| 741 | VISEntry |
| 742 | ldd [%o0 + 0x98], %f8 |
| 743 | ldd [%o0 + 0x90], %f10 |
| 744 | ldd [%o0 + 0x88], %f12 |
| 745 | ldd [%o0 + 0x80], %f14 |
| 746 | ldd [%o0 + 0x78], %f16 |
| 747 | ldd [%o0 + 0x70], %f18 |
| 748 | ldd [%o0 + 0x68], %f20 |
| 749 | ldd [%o0 + 0x60], %f22 |
| 750 | ldd [%o0 + 0x58], %f24 |
| 751 | ldd [%o0 + 0x50], %f26 |
| 752 | ldd [%o0 + 0x48], %f28 |
| 753 | ldd [%o0 + 0x40], %f30 |
| 754 | ldd [%o0 + 0x38], %f32 |
| 755 | ldd [%o0 + 0x30], %f34 |
| 756 | ldd [%o0 + 0x28], %f36 |
| 757 | ldd [%o0 + 0x20], %f38 |
| 758 | ldd [%o0 + 0x18], %f40 |
| 759 | ldd [%o0 + 0x10], %f42 |
| 760 | ldd [%o0 + 0x08], %f44 |
| 761 | retl |
| 762 | ldd [%o0 + 0x00], %f46 |
| 763 | ENDPROC(aes_sparc64_load_decrypt_keys_128) |
| 764 | |
| 765 | .align 32 |
| 766 | ENTRY(aes_sparc64_load_decrypt_keys_192) |
| 767 | /* %o0=key */ |
| 768 | VISEntry |
| 769 | ldd [%o0 + 0xb8], %f8 |
| 770 | ldd [%o0 + 0xb0], %f10 |
| 771 | ldd [%o0 + 0xa8], %f12 |
| 772 | ldd [%o0 + 0xa0], %f14 |
| 773 | ldd [%o0 + 0x98], %f16 |
| 774 | ldd [%o0 + 0x90], %f18 |
| 775 | ldd [%o0 + 0x88], %f20 |
| 776 | ldd [%o0 + 0x80], %f22 |
| 777 | ldd [%o0 + 0x78], %f24 |
| 778 | ldd [%o0 + 0x70], %f26 |
| 779 | ldd [%o0 + 0x68], %f28 |
| 780 | ldd [%o0 + 0x60], %f30 |
| 781 | ldd [%o0 + 0x58], %f32 |
| 782 | ldd [%o0 + 0x50], %f34 |
| 783 | ldd [%o0 + 0x48], %f36 |
| 784 | ldd [%o0 + 0x40], %f38 |
| 785 | ldd [%o0 + 0x38], %f40 |
| 786 | ldd [%o0 + 0x30], %f42 |
| 787 | ldd [%o0 + 0x28], %f44 |
| 788 | ldd [%o0 + 0x20], %f46 |
| 789 | ldd [%o0 + 0x18], %f48 |
| 790 | ldd [%o0 + 0x10], %f50 |
| 791 | ldd [%o0 + 0x08], %f52 |
| 792 | retl |
| 793 | ldd [%o0 + 0x00], %f54 |
| 794 | ENDPROC(aes_sparc64_load_decrypt_keys_192) |
| 795 | |
| 796 | .align 32 |
| 797 | ENTRY(aes_sparc64_load_decrypt_keys_256) |
| 798 | /* %o0=key */ |
| 799 | VISEntry |
| 800 | ldd [%o0 + 0xd8], %f8 |
| 801 | ldd [%o0 + 0xd0], %f10 |
| 802 | ldd [%o0 + 0xc8], %f12 |
| 803 | ldd [%o0 + 0xc0], %f14 |
| 804 | ldd [%o0 + 0xb8], %f16 |
| 805 | ldd [%o0 + 0xb0], %f18 |
| 806 | ldd [%o0 + 0xa8], %f20 |
| 807 | ldd [%o0 + 0xa0], %f22 |
| 808 | ldd [%o0 + 0x98], %f24 |
| 809 | ldd [%o0 + 0x90], %f26 |
| 810 | ldd [%o0 + 0x88], %f28 |
| 811 | ldd [%o0 + 0x80], %f30 |
| 812 | ldd [%o0 + 0x78], %f32 |
| 813 | ldd [%o0 + 0x70], %f34 |
| 814 | ldd [%o0 + 0x68], %f36 |
| 815 | ldd [%o0 + 0x60], %f38 |
| 816 | ldd [%o0 + 0x58], %f40 |
| 817 | ldd [%o0 + 0x50], %f42 |
| 818 | ldd [%o0 + 0x48], %f44 |
| 819 | ldd [%o0 + 0x40], %f46 |
| 820 | ldd [%o0 + 0x38], %f48 |
| 821 | ldd [%o0 + 0x30], %f50 |
| 822 | ldd [%o0 + 0x28], %f52 |
| 823 | ldd [%o0 + 0x20], %f54 |
| 824 | ldd [%o0 + 0x18], %f56 |
| 825 | ldd [%o0 + 0x10], %f58 |
| 826 | ldd [%o0 + 0x08], %f60 |
| 827 | retl |
| 828 | ldd [%o0 + 0x00], %f62 |
| 829 | ENDPROC(aes_sparc64_load_decrypt_keys_256) |
| 830 | |
| 831 | .align 32 |
| 832 | ENTRY(aes_sparc64_ecb_encrypt_128) |
| 833 | /* %o0=key, %o1=input, %o2=output, %o3=len */ |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 834 | ldx [%o0 + 0x00], %g1 |
| 835 | ldx [%o0 + 0x08], %g2 |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 836 | 1: ldx [%o1 + 0x00], %g3 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 837 | ldx [%o1 + 0x08], %g7 |
| 838 | add %o1, 0x10, %o1 |
| 839 | xor %g1, %g3, %g3 |
| 840 | xor %g2, %g7, %g7 |
| 841 | MOVXTOD_G3_F4 |
| 842 | MOVXTOD_G7_F6 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 843 | ENCRYPT_128(8, 4, 6, 0, 2) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 844 | std %f4, [%o2 + 0x00] |
| 845 | std %f6, [%o2 + 0x08] |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 846 | subcc %o3, 0x10, %o3 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 847 | bne,pt %xcc, 1b |
| 848 | add %o2, 0x10, %o2 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 849 | retl |
| 850 | nop |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 851 | ENDPROC(aes_sparc64_ecb_encrypt_128) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 852 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 853 | .align 32 |
| 854 | ENTRY(aes_sparc64_ecb_encrypt_192) |
| 855 | /* %o0=key, %o1=input, %o2=output, %o3=len */ |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 856 | ldx [%o0 + 0x00], %g1 |
| 857 | ldx [%o0 + 0x08], %g2 |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 858 | 1: ldx [%o1 + 0x00], %g3 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 859 | ldx [%o1 + 0x08], %g7 |
| 860 | add %o1, 0x10, %o1 |
| 861 | xor %g1, %g3, %g3 |
| 862 | xor %g2, %g7, %g7 |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 863 | MOVXTOD_G3_F4 |
| 864 | MOVXTOD_G7_F6 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 865 | ENCRYPT_192(8, 4, 6, 0, 2) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 866 | std %f4, [%o2 + 0x00] |
| 867 | std %f6, [%o2 + 0x08] |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 868 | subcc %o3, 0x10, %o3 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 869 | bne,pt %xcc, 1b |
| 870 | add %o2, 0x10, %o2 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 871 | retl |
| 872 | nop |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 873 | ENDPROC(aes_sparc64_ecb_encrypt_192) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 874 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 875 | .align 32 |
| 876 | ENTRY(aes_sparc64_ecb_encrypt_256) |
| 877 | /* %o0=key, %o1=input, %o2=output, %o3=len */ |
| 878 | ldx [%o0 + 0x00], %g1 |
| 879 | ldx [%o0 + 0x08], %g2 |
| 880 | 1: ldx [%o1 + 0x00], %g3 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 881 | ldx [%o1 + 0x08], %g7 |
| 882 | add %o1, 0x10, %o1 |
| 883 | xor %g1, %g3, %g3 |
| 884 | xor %g2, %g7, %g7 |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 885 | MOVXTOD_G3_F4 |
| 886 | MOVXTOD_G7_F6 |
| 887 | ENCRYPT_256(8, 4, 6, 0, 2) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 888 | std %f4, [%o2 + 0x00] |
| 889 | std %f6, [%o2 + 0x08] |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 890 | subcc %o3, 0x10, %o3 |
| 891 | bne,pt %xcc, 1b |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 892 | add %o2, 0x10, %o2 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 893 | retl |
| 894 | nop |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 895 | ENDPROC(aes_sparc64_ecb_encrypt_256) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 896 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 897 | .align 32 |
| 898 | ENTRY(aes_sparc64_ecb_decrypt_128) |
| 899 | /* %o0=&key[key_len], %o1=input, %o2=output, %o3=len */ |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 900 | ldx [%o0 - 0x10], %g1 |
| 901 | ldx [%o0 - 0x08], %g2 |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 902 | 1: ldx [%o1 + 0x00], %g3 |
| 903 | ldx [%o1 + 0x08], %g7 |
| 904 | add %o1, 0x10, %o1 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 905 | xor %g1, %g3, %g3 |
| 906 | xor %g2, %g7, %g7 |
| 907 | MOVXTOD_G3_F4 |
| 908 | MOVXTOD_G7_F6 |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 909 | DECRYPT_128(8, 4, 6, 0, 2) |
| 910 | std %f4, [%o2 + 0x00] |
| 911 | std %f6, [%o2 + 0x08] |
| 912 | subcc %o3, 0x10, %o3 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 913 | bne,pt %xcc, 1b |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 914 | add %o2, 0x10, %o2 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 915 | retl |
| 916 | nop |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 917 | ENDPROC(aes_sparc64_ecb_decrypt_128) |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 918 | |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 919 | .align 32 |
| 920 | ENTRY(aes_sparc64_ecb_decrypt_192) |
| 921 | /* %o0=&key[key_len], %o1=input, %o2=output, %o3=len */ |
| 922 | ldx [%o0 - 0x10], %g1 |
| 923 | ldx [%o0 - 0x08], %g2 |
| 924 | 1: ldx [%o1 + 0x00], %g3 |
| 925 | ldx [%o1 + 0x08], %g7 |
| 926 | add %o1, 0x10, %o1 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 927 | xor %g1, %g3, %g3 |
| 928 | xor %g2, %g7, %g7 |
| 929 | MOVXTOD_G3_F4 |
| 930 | MOVXTOD_G7_F6 |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 931 | DECRYPT_192(8, 4, 6, 0, 2) |
| 932 | std %f4, [%o2 + 0x00] |
| 933 | std %f6, [%o2 + 0x08] |
| 934 | subcc %o3, 0x10, %o3 |
| 935 | bne,pt %xcc, 1b |
| 936 | add %o2, 0x10, %o2 |
David S. Miller | 9bf4852 | 2012-08-21 03:58:13 -0700 | [diff] [blame] | 937 | retl |
| 938 | nop |
David S. Miller | 0bdcaf7 | 2012-08-29 12:50:16 -0700 | [diff] [blame] | 939 | ENDPROC(aes_sparc64_ecb_decrypt_192) |
| 940 | |
| 941 | .align 32 |
| 942 | ENTRY(aes_sparc64_ecb_decrypt_256) |
| 943 | /* %o0=&key[key_len], %o1=input, %o2=output, %o3=len */ |
| 944 | ldx [%o0 - 0x10], %g1 |
| 945 | ldx [%o0 - 0x08], %g2 |
| 946 | 1: ldx [%o1 + 0x00], %g3 |
| 947 | ldx [%o1 + 0x08], %g7 |
| 948 | add %o1, 0x10, %o1 |
| 949 | xor %g1, %g3, %g3 |
| 950 | xor %g2, %g7, %g7 |
| 951 | MOVXTOD_G3_F4 |
| 952 | MOVXTOD_G7_F6 |
| 953 | DECRYPT_256(8, 4, 6, 0, 2) |
| 954 | std %f4, [%o2 + 0x00] |
| 955 | std %f6, [%o2 + 0x08] |
| 956 | subcc %o3, 0x10, %o3 |
| 957 | bne,pt %xcc, 1b |
| 958 | add %o2, 0x10, %o2 |
| 959 | retl |
| 960 | nop |
| 961 | ENDPROC(aes_sparc64_ecb_decrypt_256) |
| 962 | |
| 963 | .align 32 |
| 964 | ENTRY(aes_sparc64_cbc_encrypt_128) |
| 965 | /* %o0=key, %o1=input, %o2=output, %o3=len, %o4=IV */ |
| 966 | ldd [%o4 + 0x00], %f4 |
| 967 | ldd [%o4 + 0x08], %f6 |
| 968 | ldx [%o0 + 0x00], %g1 |
| 969 | ldx [%o0 + 0x08], %g2 |
| 970 | 1: ldx [%o1 + 0x00], %g3 |
| 971 | ldx [%o1 + 0x08], %g7 |
| 972 | add %o1, 0x10, %o1 |
| 973 | xor %g1, %g3, %g3 |
| 974 | xor %g2, %g7, %g7 |
| 975 | MOVXTOD_G3_F0 |
| 976 | MOVXTOD_G7_F2 |
| 977 | fxor %f4, %f0, %f4 |
| 978 | fxor %f6, %f2, %f6 |
| 979 | ENCRYPT_128(8, 4, 6, 0, 2) |
| 980 | std %f4, [%o2 + 0x00] |
| 981 | std %f6, [%o2 + 0x08] |
| 982 | subcc %o3, 0x10, %o3 |
| 983 | bne,pt %xcc, 1b |
| 984 | add %o2, 0x10, %o2 |
| 985 | std %f4, [%o4 + 0x00] |
| 986 | std %f6, [%o4 + 0x08] |
| 987 | retl |
| 988 | nop |
| 989 | ENDPROC(aes_sparc64_cbc_encrypt_128) |
| 990 | |
| 991 | .align 32 |
| 992 | ENTRY(aes_sparc64_cbc_encrypt_192) |
| 993 | /* %o0=key, %o1=input, %o2=output, %o3=len, %o4=IV */ |
| 994 | ldd [%o4 + 0x00], %f4 |
| 995 | ldd [%o4 + 0x08], %f6 |
| 996 | ldx [%o0 + 0x00], %g1 |
| 997 | ldx [%o0 + 0x08], %g2 |
| 998 | 1: ldx [%o1 + 0x00], %g3 |
| 999 | ldx [%o1 + 0x08], %g7 |
| 1000 | add %o1, 0x10, %o1 |
| 1001 | xor %g1, %g3, %g3 |
| 1002 | xor %g2, %g7, %g7 |
| 1003 | MOVXTOD_G3_F0 |
| 1004 | MOVXTOD_G7_F2 |
| 1005 | fxor %f4, %f0, %f4 |
| 1006 | fxor %f6, %f2, %f6 |
| 1007 | ENCRYPT_192(8, 4, 6, 0, 2) |
| 1008 | std %f4, [%o2 + 0x00] |
| 1009 | std %f6, [%o2 + 0x08] |
| 1010 | subcc %o3, 0x10, %o3 |
| 1011 | bne,pt %xcc, 1b |
| 1012 | add %o2, 0x10, %o2 |
| 1013 | std %f4, [%o4 + 0x00] |
| 1014 | std %f6, [%o4 + 0x08] |
| 1015 | retl |
| 1016 | nop |
| 1017 | ENDPROC(aes_sparc64_cbc_encrypt_192) |
| 1018 | |
| 1019 | .align 32 |
| 1020 | ENTRY(aes_sparc64_cbc_encrypt_256) |
| 1021 | /* %o0=key, %o1=input, %o2=output, %o3=len, %o4=IV */ |
| 1022 | ldd [%o4 + 0x00], %f4 |
| 1023 | ldd [%o4 + 0x08], %f6 |
| 1024 | ldx [%o0 + 0x00], %g1 |
| 1025 | ldx [%o0 + 0x08], %g2 |
| 1026 | 1: ldx [%o1 + 0x00], %g3 |
| 1027 | ldx [%o1 + 0x08], %g7 |
| 1028 | add %o1, 0x10, %o1 |
| 1029 | xor %g1, %g3, %g3 |
| 1030 | xor %g2, %g7, %g7 |
| 1031 | MOVXTOD_G3_F0 |
| 1032 | MOVXTOD_G7_F2 |
| 1033 | fxor %f4, %f0, %f4 |
| 1034 | fxor %f6, %f2, %f6 |
| 1035 | ENCRYPT_256(8, 4, 6, 0, 2) |
| 1036 | std %f4, [%o2 + 0x00] |
| 1037 | std %f6, [%o2 + 0x08] |
| 1038 | subcc %o3, 0x10, %o3 |
| 1039 | bne,pt %xcc, 1b |
| 1040 | add %o2, 0x10, %o2 |
| 1041 | std %f4, [%o4 + 0x00] |
| 1042 | std %f6, [%o4 + 0x08] |
| 1043 | retl |
| 1044 | nop |
| 1045 | ENDPROC(aes_sparc64_cbc_encrypt_256) |
| 1046 | |
| 1047 | .align 32 |
| 1048 | ENTRY(aes_sparc64_cbc_decrypt_128) |
| 1049 | /* %o0=&key[key_len], %o1=input, %o2=output, %o3=len, %o4=iv */ |
| 1050 | ldx [%o0 - 0x10], %g1 |
| 1051 | ldx [%o0 - 0x08], %g2 |
| 1052 | ldx [%o4 + 0x00], %o0 |
| 1053 | ldx [%o4 + 0x08], %o5 |
| 1054 | 1: ldx [%o1 + 0x00], %g3 |
| 1055 | ldx [%o1 + 0x08], %g7 |
| 1056 | add %o1, 0x10, %o1 |
| 1057 | xor %g1, %g3, %g3 |
| 1058 | xor %g2, %g7, %g7 |
| 1059 | MOVXTOD_G3_F4 |
| 1060 | MOVXTOD_G7_F6 |
| 1061 | DECRYPT_128(8, 4, 6, 0, 2) |
| 1062 | MOVXTOD_O0_F0 |
| 1063 | MOVXTOD_O5_F2 |
| 1064 | xor %g1, %g3, %o0 |
| 1065 | xor %g2, %g7, %o5 |
| 1066 | fxor %f4, %f0, %f4 |
| 1067 | fxor %f6, %f2, %f6 |
| 1068 | std %f4, [%o2 + 0x00] |
| 1069 | std %f6, [%o2 + 0x08] |
| 1070 | subcc %o3, 0x10, %o3 |
| 1071 | bne,pt %xcc, 1b |
| 1072 | add %o2, 0x10, %o2 |
| 1073 | stx %o0, [%o4 + 0x00] |
| 1074 | stx %o5, [%o4 + 0x08] |
| 1075 | retl |
| 1076 | nop |
| 1077 | ENDPROC(aes_sparc64_cbc_decrypt_128) |
| 1078 | |
| 1079 | .align 32 |
| 1080 | ENTRY(aes_sparc64_cbc_decrypt_192) |
| 1081 | /* %o0=&key[key_len], %o1=input, %o2=output, %o3=len, %o4=iv */ |
| 1082 | ldx [%o0 - 0x10], %g1 |
| 1083 | ldx [%o0 - 0x08], %g2 |
| 1084 | ldx [%o4 + 0x00], %o0 |
| 1085 | ldx [%o4 + 0x08], %o5 |
| 1086 | 1: ldx [%o1 + 0x00], %g3 |
| 1087 | ldx [%o1 + 0x08], %g7 |
| 1088 | add %o1, 0x10, %o1 |
| 1089 | xor %g1, %g3, %g3 |
| 1090 | xor %g2, %g7, %g7 |
| 1091 | MOVXTOD_G3_F4 |
| 1092 | MOVXTOD_G7_F6 |
| 1093 | DECRYPT_192(8, 4, 6, 0, 2) |
| 1094 | MOVXTOD_O0_F0 |
| 1095 | MOVXTOD_O5_F2 |
| 1096 | xor %g1, %g3, %o0 |
| 1097 | xor %g2, %g7, %o5 |
| 1098 | fxor %f4, %f0, %f4 |
| 1099 | fxor %f6, %f2, %f6 |
| 1100 | std %f4, [%o2 + 0x00] |
| 1101 | std %f6, [%o2 + 0x08] |
| 1102 | subcc %o3, 0x10, %o3 |
| 1103 | bne,pt %xcc, 1b |
| 1104 | add %o2, 0x10, %o2 |
| 1105 | stx %o0, [%o4 + 0x00] |
| 1106 | stx %o5, [%o4 + 0x08] |
| 1107 | retl |
| 1108 | nop |
| 1109 | ENDPROC(aes_sparc64_cbc_decrypt_192) |
| 1110 | |
| 1111 | .align 32 |
| 1112 | ENTRY(aes_sparc64_cbc_decrypt_256) |
| 1113 | /* %o0=&key[key_len], %o1=input, %o2=output, %o3=len, %o4=iv */ |
| 1114 | ldx [%o0 - 0x10], %g1 |
| 1115 | ldx [%o0 - 0x08], %g2 |
| 1116 | ldx [%o4 + 0x00], %o0 |
| 1117 | ldx [%o4 + 0x08], %o5 |
| 1118 | 1: ldx [%o1 + 0x00], %g3 |
| 1119 | ldx [%o1 + 0x08], %g7 |
| 1120 | add %o1, 0x10, %o1 |
| 1121 | xor %g1, %g3, %g3 |
| 1122 | xor %g2, %g7, %g7 |
| 1123 | MOVXTOD_G3_F4 |
| 1124 | MOVXTOD_G7_F6 |
| 1125 | DECRYPT_256(8, 4, 6, 0, 2) |
| 1126 | MOVXTOD_O0_F0 |
| 1127 | MOVXTOD_O5_F2 |
| 1128 | xor %g1, %g3, %o0 |
| 1129 | xor %g2, %g7, %o5 |
| 1130 | fxor %f4, %f0, %f4 |
| 1131 | fxor %f6, %f2, %f6 |
| 1132 | std %f4, [%o2 + 0x00] |
| 1133 | std %f6, [%o2 + 0x08] |
| 1134 | subcc %o3, 0x10, %o3 |
| 1135 | bne,pt %xcc, 1b |
| 1136 | add %o2, 0x10, %o2 |
| 1137 | stx %o0, [%o4 + 0x00] |
| 1138 | stx %o5, [%o4 + 0x08] |
| 1139 | retl |
| 1140 | nop |
| 1141 | ENDPROC(aes_sparc64_cbc_decrypt_256) |
David S. Miller | 9fd130e | 2012-08-29 14:49:23 -0700 | [diff] [blame^] | 1142 | |
| 1143 | .align 32 |
| 1144 | ENTRY(aes_sparc64_ctr_crypt_128) |
| 1145 | /* %o0=key, %o1=input, %o2=output, %o3=len, %o4=IV */ |
| 1146 | ldx [%o4 + 0x00], %g3 |
| 1147 | ldx [%o4 + 0x08], %g7 |
| 1148 | ldx [%o0 + 0x00], %g1 |
| 1149 | ldx [%o0 + 0x08], %g2 |
| 1150 | 1: xor %g1, %g3, %o5 |
| 1151 | MOVXTOD_O5_F0 |
| 1152 | xor %g2, %g7, %o5 |
| 1153 | MOVXTOD_O5_F2 |
| 1154 | add %g7, 1, %g7 |
| 1155 | add %g3, 1, %o5 |
| 1156 | movrz %g7, %o5, %g3 |
| 1157 | ENCRYPT_128(8, 0, 2, 4, 6) |
| 1158 | ldd [%o1 + 0x00], %f4 |
| 1159 | ldd [%o1 + 0x08], %f6 |
| 1160 | fxor %f4, %f0, %f4 |
| 1161 | fxor %f6, %f2, %f6 |
| 1162 | std %f4, [%o2 + 0x00] |
| 1163 | std %f6, [%o2 + 0x08] |
| 1164 | subcc %o3, 0x10, %o3 |
| 1165 | add %o1, 0x10, %o1 |
| 1166 | bne,pt %xcc, 1b |
| 1167 | add %o2, 0x10, %o2 |
| 1168 | stx %g3, [%o4 + 0x00] |
| 1169 | stx %g7, [%o4 + 0x08] |
| 1170 | retl |
| 1171 | nop |
| 1172 | ENDPROC(aes_sparc64_ctr_crypt_128) |
| 1173 | |
| 1174 | .align 32 |
| 1175 | ENTRY(aes_sparc64_ctr_crypt_192) |
| 1176 | /* %o0=key, %o1=input, %o2=output, %o3=len, %o4=IV */ |
| 1177 | ldx [%o4 + 0x00], %g3 |
| 1178 | ldx [%o4 + 0x08], %g7 |
| 1179 | ldx [%o0 + 0x00], %g1 |
| 1180 | ldx [%o0 + 0x08], %g2 |
| 1181 | 1: xor %g1, %g3, %o5 |
| 1182 | MOVXTOD_O5_F0 |
| 1183 | xor %g2, %g7, %o5 |
| 1184 | MOVXTOD_O5_F2 |
| 1185 | add %g7, 1, %g7 |
| 1186 | add %g3, 1, %o5 |
| 1187 | movrz %g7, %o5, %g3 |
| 1188 | ENCRYPT_192(8, 0, 2, 4, 6) |
| 1189 | ldd [%o1 + 0x00], %f4 |
| 1190 | ldd [%o1 + 0x08], %f6 |
| 1191 | fxor %f4, %f0, %f4 |
| 1192 | fxor %f6, %f2, %f6 |
| 1193 | std %f4, [%o2 + 0x00] |
| 1194 | std %f6, [%o2 + 0x08] |
| 1195 | subcc %o3, 0x10, %o3 |
| 1196 | add %o1, 0x10, %o1 |
| 1197 | bne,pt %xcc, 1b |
| 1198 | add %o2, 0x10, %o2 |
| 1199 | stx %g3, [%o4 + 0x00] |
| 1200 | stx %g7, [%o4 + 0x08] |
| 1201 | retl |
| 1202 | nop |
| 1203 | ENDPROC(aes_sparc64_ctr_crypt_192) |
| 1204 | |
| 1205 | .align 32 |
| 1206 | ENTRY(aes_sparc64_ctr_crypt_256) |
| 1207 | /* %o0=key, %o1=input, %o2=output, %o3=len, %o4=IV */ |
| 1208 | ldx [%o4 + 0x00], %g3 |
| 1209 | ldx [%o4 + 0x08], %g7 |
| 1210 | ldx [%o0 + 0x00], %g1 |
| 1211 | ldx [%o0 + 0x08], %g2 |
| 1212 | 1: xor %g1, %g3, %o5 |
| 1213 | MOVXTOD_O5_F0 |
| 1214 | xor %g2, %g7, %o5 |
| 1215 | MOVXTOD_O5_F2 |
| 1216 | add %g7, 1, %g7 |
| 1217 | add %g3, 1, %o5 |
| 1218 | movrz %g7, %o5, %g3 |
| 1219 | ENCRYPT_256(8, 0, 2, 4, 6) |
| 1220 | ldd [%o1 + 0x00], %f4 |
| 1221 | ldd [%o1 + 0x08], %f6 |
| 1222 | fxor %f4, %f0, %f4 |
| 1223 | fxor %f6, %f2, %f6 |
| 1224 | std %f4, [%o2 + 0x00] |
| 1225 | std %f6, [%o2 + 0x08] |
| 1226 | subcc %o3, 0x10, %o3 |
| 1227 | add %o1, 0x10, %o1 |
| 1228 | bne,pt %xcc, 1b |
| 1229 | add %o2, 0x10, %o2 |
| 1230 | stx %g3, [%o4 + 0x00] |
| 1231 | stx %g7, [%o4 + 0x08] |
| 1232 | retl |
| 1233 | nop |
| 1234 | ENDPROC(aes_sparc64_ctr_crypt_256) |