Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 1 | #if defined(__i386__) |
| 2 | .file "vpaes-x86.S" |
| 3 | .text |
| 4 | .align 6,0x90 |
| 5 | L_vpaes_consts: |
| 6 | .long 218628480,235210255,168496130,67568393 |
| 7 | .long 252381056,17041926,33884169,51187212 |
| 8 | .long 252645135,252645135,252645135,252645135 |
| 9 | .long 1512730624,3266504856,1377990664,3401244816 |
| 10 | .long 830229760,1275146365,2969422977,3447763452 |
| 11 | .long 3411033600,2979783055,338359620,2782886510 |
| 12 | .long 4209124096,907596821,221174255,1006095553 |
| 13 | .long 191964160,3799684038,3164090317,1589111125 |
| 14 | .long 182528256,1777043520,2877432650,3265356744 |
| 15 | .long 1874708224,3503451415,3305285752,363511674 |
| 16 | .long 1606117888,3487855781,1093350906,2384367825 |
| 17 | .long 197121,67569157,134941193,202313229 |
| 18 | .long 67569157,134941193,202313229,197121 |
| 19 | .long 134941193,202313229,197121,67569157 |
| 20 | .long 202313229,197121,67569157,134941193 |
| 21 | .long 33619971,100992007,168364043,235736079 |
| 22 | .long 235736079,33619971,100992007,168364043 |
| 23 | .long 168364043,235736079,33619971,100992007 |
| 24 | .long 100992007,168364043,235736079,33619971 |
| 25 | .long 50462976,117835012,185207048,252579084 |
| 26 | .long 252314880,51251460,117574920,184942860 |
| 27 | .long 184682752,252054788,50987272,118359308 |
| 28 | .long 118099200,185467140,251790600,50727180 |
| 29 | .long 2946363062,528716217,1300004225,1881839624 |
| 30 | .long 1532713819,1532713819,1532713819,1532713819 |
| 31 | .long 3602276352,4288629033,3737020424,4153884961 |
| 32 | .long 1354558464,32357713,2958822624,3775749553 |
| 33 | .long 1201988352,132424512,1572796698,503232858 |
| 34 | .long 2213177600,1597421020,4103937655,675398315 |
| 35 | .long 2749646592,4273543773,1511898873,121693092 |
| 36 | .long 3040248576,1103263732,2871565598,1608280554 |
| 37 | .long 2236667136,2588920351,482954393,64377734 |
| 38 | .long 3069987328,291237287,2117370568,3650299247 |
| 39 | .long 533321216,3573750986,2572112006,1401264716 |
| 40 | .long 1339849704,2721158661,548607111,3445553514 |
| 41 | .long 2128193280,3054596040,2183486460,1257083700 |
| 42 | .long 655635200,1165381986,3923443150,2344132524 |
| 43 | .long 190078720,256924420,290342170,357187870 |
| 44 | .long 1610966272,2263057382,4103205268,309794674 |
| 45 | .long 2592527872,2233205587,1335446729,3402964816 |
| 46 | .long 3973531904,3225098121,3002836325,1918774430 |
| 47 | .long 3870401024,2102906079,2284471353,4117666579 |
| 48 | .long 617007872,1021508343,366931923,691083277 |
| 49 | .long 2528395776,3491914898,2968704004,1613121270 |
| 50 | .long 3445188352,3247741094,844474987,4093578302 |
| 51 | .long 651481088,1190302358,1689581232,574775300 |
| 52 | .long 4289380608,206939853,2555985458,2489840491 |
| 53 | .long 2130264064,327674451,3566485037,3349835193 |
| 54 | .long 2470714624,316102159,3636825756,3393945945 |
| 55 | .byte 86,101,99,116,111,114,32,80,101,114,109,117,116,97,116,105 |
| 56 | .byte 111,110,32,65,69,83,32,102,111,114,32,120,56,54,47,83 |
| 57 | .byte 83,83,69,51,44,32,77,105,107,101,32,72,97,109,98,117 |
| 58 | .byte 114,103,32,40,83,116,97,110,102,111,114,100,32,85,110,105 |
| 59 | .byte 118,101,114,115,105,116,121,41,0 |
| 60 | .align 6,0x90 |
| 61 | .private_extern __vpaes_preheat |
| 62 | .align 4 |
| 63 | __vpaes_preheat: |
| 64 | addl (%esp),%ebp |
| 65 | movdqa -48(%ebp),%xmm7 |
| 66 | movdqa -16(%ebp),%xmm6 |
| 67 | ret |
| 68 | .private_extern __vpaes_encrypt_core |
| 69 | .align 4 |
| 70 | __vpaes_encrypt_core: |
| 71 | movl $16,%ecx |
| 72 | movl 240(%edx),%eax |
| 73 | movdqa %xmm6,%xmm1 |
| 74 | movdqa (%ebp),%xmm2 |
| 75 | pandn %xmm0,%xmm1 |
| 76 | pand %xmm6,%xmm0 |
| 77 | movdqu (%edx),%xmm5 |
| 78 | .byte 102,15,56,0,208 |
| 79 | movdqa 16(%ebp),%xmm0 |
| 80 | pxor %xmm5,%xmm2 |
| 81 | psrld $4,%xmm1 |
| 82 | addl $16,%edx |
| 83 | .byte 102,15,56,0,193 |
| 84 | leal 192(%ebp),%ebx |
| 85 | pxor %xmm2,%xmm0 |
| 86 | jmp L000enc_entry |
| 87 | .align 4,0x90 |
| 88 | L001enc_loop: |
| 89 | movdqa 32(%ebp),%xmm4 |
| 90 | movdqa 48(%ebp),%xmm0 |
| 91 | .byte 102,15,56,0,226 |
| 92 | .byte 102,15,56,0,195 |
| 93 | pxor %xmm5,%xmm4 |
| 94 | movdqa 64(%ebp),%xmm5 |
| 95 | pxor %xmm4,%xmm0 |
| 96 | movdqa -64(%ebx,%ecx,1),%xmm1 |
| 97 | .byte 102,15,56,0,234 |
| 98 | movdqa 80(%ebp),%xmm2 |
| 99 | movdqa (%ebx,%ecx,1),%xmm4 |
| 100 | .byte 102,15,56,0,211 |
| 101 | movdqa %xmm0,%xmm3 |
| 102 | pxor %xmm5,%xmm2 |
| 103 | .byte 102,15,56,0,193 |
| 104 | addl $16,%edx |
| 105 | pxor %xmm2,%xmm0 |
| 106 | .byte 102,15,56,0,220 |
| 107 | addl $16,%ecx |
| 108 | pxor %xmm0,%xmm3 |
| 109 | .byte 102,15,56,0,193 |
| 110 | andl $48,%ecx |
| 111 | subl $1,%eax |
| 112 | pxor %xmm3,%xmm0 |
| 113 | L000enc_entry: |
| 114 | movdqa %xmm6,%xmm1 |
| 115 | movdqa -32(%ebp),%xmm5 |
| 116 | pandn %xmm0,%xmm1 |
| 117 | psrld $4,%xmm1 |
| 118 | pand %xmm6,%xmm0 |
| 119 | .byte 102,15,56,0,232 |
| 120 | movdqa %xmm7,%xmm3 |
| 121 | pxor %xmm1,%xmm0 |
| 122 | .byte 102,15,56,0,217 |
| 123 | movdqa %xmm7,%xmm4 |
| 124 | pxor %xmm5,%xmm3 |
| 125 | .byte 102,15,56,0,224 |
| 126 | movdqa %xmm7,%xmm2 |
| 127 | pxor %xmm5,%xmm4 |
| 128 | .byte 102,15,56,0,211 |
| 129 | movdqa %xmm7,%xmm3 |
| 130 | pxor %xmm0,%xmm2 |
| 131 | .byte 102,15,56,0,220 |
| 132 | movdqu (%edx),%xmm5 |
| 133 | pxor %xmm1,%xmm3 |
| 134 | jnz L001enc_loop |
| 135 | movdqa 96(%ebp),%xmm4 |
| 136 | movdqa 112(%ebp),%xmm0 |
| 137 | .byte 102,15,56,0,226 |
| 138 | pxor %xmm5,%xmm4 |
| 139 | .byte 102,15,56,0,195 |
| 140 | movdqa 64(%ebx,%ecx,1),%xmm1 |
| 141 | pxor %xmm4,%xmm0 |
| 142 | .byte 102,15,56,0,193 |
| 143 | ret |
| 144 | .private_extern __vpaes_decrypt_core |
| 145 | .align 4 |
| 146 | __vpaes_decrypt_core: |
| 147 | leal 608(%ebp),%ebx |
| 148 | movl 240(%edx),%eax |
| 149 | movdqa %xmm6,%xmm1 |
| 150 | movdqa -64(%ebx),%xmm2 |
| 151 | pandn %xmm0,%xmm1 |
| 152 | movl %eax,%ecx |
| 153 | psrld $4,%xmm1 |
| 154 | movdqu (%edx),%xmm5 |
| 155 | shll $4,%ecx |
| 156 | pand %xmm6,%xmm0 |
| 157 | .byte 102,15,56,0,208 |
| 158 | movdqa -48(%ebx),%xmm0 |
| 159 | xorl $48,%ecx |
| 160 | .byte 102,15,56,0,193 |
| 161 | andl $48,%ecx |
| 162 | pxor %xmm5,%xmm2 |
| 163 | movdqa 176(%ebp),%xmm5 |
| 164 | pxor %xmm2,%xmm0 |
| 165 | addl $16,%edx |
| 166 | leal -352(%ebx,%ecx,1),%ecx |
| 167 | jmp L002dec_entry |
| 168 | .align 4,0x90 |
| 169 | L003dec_loop: |
| 170 | movdqa -32(%ebx),%xmm4 |
| 171 | movdqa -16(%ebx),%xmm1 |
| 172 | .byte 102,15,56,0,226 |
| 173 | .byte 102,15,56,0,203 |
| 174 | pxor %xmm4,%xmm0 |
| 175 | movdqa (%ebx),%xmm4 |
| 176 | pxor %xmm1,%xmm0 |
| 177 | movdqa 16(%ebx),%xmm1 |
| 178 | .byte 102,15,56,0,226 |
| 179 | .byte 102,15,56,0,197 |
| 180 | .byte 102,15,56,0,203 |
| 181 | pxor %xmm4,%xmm0 |
| 182 | movdqa 32(%ebx),%xmm4 |
| 183 | pxor %xmm1,%xmm0 |
| 184 | movdqa 48(%ebx),%xmm1 |
| 185 | .byte 102,15,56,0,226 |
| 186 | .byte 102,15,56,0,197 |
| 187 | .byte 102,15,56,0,203 |
| 188 | pxor %xmm4,%xmm0 |
| 189 | movdqa 64(%ebx),%xmm4 |
| 190 | pxor %xmm1,%xmm0 |
| 191 | movdqa 80(%ebx),%xmm1 |
| 192 | .byte 102,15,56,0,226 |
| 193 | .byte 102,15,56,0,197 |
| 194 | .byte 102,15,56,0,203 |
| 195 | pxor %xmm4,%xmm0 |
| 196 | addl $16,%edx |
| 197 | .byte 102,15,58,15,237,12 |
| 198 | pxor %xmm1,%xmm0 |
| 199 | subl $1,%eax |
| 200 | L002dec_entry: |
| 201 | movdqa %xmm6,%xmm1 |
| 202 | movdqa -32(%ebp),%xmm2 |
| 203 | pandn %xmm0,%xmm1 |
| 204 | pand %xmm6,%xmm0 |
| 205 | psrld $4,%xmm1 |
| 206 | .byte 102,15,56,0,208 |
| 207 | movdqa %xmm7,%xmm3 |
| 208 | pxor %xmm1,%xmm0 |
| 209 | .byte 102,15,56,0,217 |
| 210 | movdqa %xmm7,%xmm4 |
| 211 | pxor %xmm2,%xmm3 |
| 212 | .byte 102,15,56,0,224 |
| 213 | pxor %xmm2,%xmm4 |
| 214 | movdqa %xmm7,%xmm2 |
| 215 | .byte 102,15,56,0,211 |
| 216 | movdqa %xmm7,%xmm3 |
| 217 | pxor %xmm0,%xmm2 |
| 218 | .byte 102,15,56,0,220 |
| 219 | movdqu (%edx),%xmm0 |
| 220 | pxor %xmm1,%xmm3 |
| 221 | jnz L003dec_loop |
| 222 | movdqa 96(%ebx),%xmm4 |
| 223 | .byte 102,15,56,0,226 |
| 224 | pxor %xmm0,%xmm4 |
| 225 | movdqa 112(%ebx),%xmm0 |
| 226 | movdqa (%ecx),%xmm2 |
| 227 | .byte 102,15,56,0,195 |
| 228 | pxor %xmm4,%xmm0 |
| 229 | .byte 102,15,56,0,194 |
| 230 | ret |
| 231 | .private_extern __vpaes_schedule_core |
| 232 | .align 4 |
| 233 | __vpaes_schedule_core: |
| 234 | addl (%esp),%ebp |
| 235 | movdqu (%esi),%xmm0 |
| 236 | movdqa 320(%ebp),%xmm2 |
| 237 | movdqa %xmm0,%xmm3 |
| 238 | leal (%ebp),%ebx |
| 239 | movdqa %xmm2,4(%esp) |
| 240 | call __vpaes_schedule_transform |
| 241 | movdqa %xmm0,%xmm7 |
| 242 | testl %edi,%edi |
| 243 | jnz L004schedule_am_decrypting |
| 244 | movdqu %xmm0,(%edx) |
| 245 | jmp L005schedule_go |
| 246 | L004schedule_am_decrypting: |
| 247 | movdqa 256(%ebp,%ecx,1),%xmm1 |
| 248 | .byte 102,15,56,0,217 |
| 249 | movdqu %xmm3,(%edx) |
| 250 | xorl $48,%ecx |
| 251 | L005schedule_go: |
| 252 | cmpl $192,%eax |
| 253 | ja L006schedule_256 |
| 254 | je L007schedule_192 |
| 255 | L008schedule_128: |
| 256 | movl $10,%eax |
| 257 | L009loop_schedule_128: |
| 258 | call __vpaes_schedule_round |
| 259 | decl %eax |
| 260 | jz L010schedule_mangle_last |
| 261 | call __vpaes_schedule_mangle |
| 262 | jmp L009loop_schedule_128 |
| 263 | .align 4,0x90 |
| 264 | L007schedule_192: |
| 265 | movdqu 8(%esi),%xmm0 |
| 266 | call __vpaes_schedule_transform |
| 267 | movdqa %xmm0,%xmm6 |
| 268 | pxor %xmm4,%xmm4 |
| 269 | movhlps %xmm4,%xmm6 |
| 270 | movl $4,%eax |
| 271 | L011loop_schedule_192: |
| 272 | call __vpaes_schedule_round |
| 273 | .byte 102,15,58,15,198,8 |
| 274 | call __vpaes_schedule_mangle |
| 275 | call __vpaes_schedule_192_smear |
| 276 | call __vpaes_schedule_mangle |
| 277 | call __vpaes_schedule_round |
| 278 | decl %eax |
| 279 | jz L010schedule_mangle_last |
| 280 | call __vpaes_schedule_mangle |
| 281 | call __vpaes_schedule_192_smear |
| 282 | jmp L011loop_schedule_192 |
| 283 | .align 4,0x90 |
| 284 | L006schedule_256: |
| 285 | movdqu 16(%esi),%xmm0 |
| 286 | call __vpaes_schedule_transform |
| 287 | movl $7,%eax |
| 288 | L012loop_schedule_256: |
| 289 | call __vpaes_schedule_mangle |
| 290 | movdqa %xmm0,%xmm6 |
| 291 | call __vpaes_schedule_round |
| 292 | decl %eax |
| 293 | jz L010schedule_mangle_last |
| 294 | call __vpaes_schedule_mangle |
| 295 | pshufd $255,%xmm0,%xmm0 |
| 296 | movdqa %xmm7,20(%esp) |
| 297 | movdqa %xmm6,%xmm7 |
| 298 | call L_vpaes_schedule_low_round |
| 299 | movdqa 20(%esp),%xmm7 |
| 300 | jmp L012loop_schedule_256 |
| 301 | .align 4,0x90 |
| 302 | L010schedule_mangle_last: |
| 303 | leal 384(%ebp),%ebx |
| 304 | testl %edi,%edi |
| 305 | jnz L013schedule_mangle_last_dec |
| 306 | movdqa 256(%ebp,%ecx,1),%xmm1 |
| 307 | .byte 102,15,56,0,193 |
| 308 | leal 352(%ebp),%ebx |
| 309 | addl $32,%edx |
| 310 | L013schedule_mangle_last_dec: |
| 311 | addl $-16,%edx |
| 312 | pxor 336(%ebp),%xmm0 |
| 313 | call __vpaes_schedule_transform |
| 314 | movdqu %xmm0,(%edx) |
| 315 | pxor %xmm0,%xmm0 |
| 316 | pxor %xmm1,%xmm1 |
| 317 | pxor %xmm2,%xmm2 |
| 318 | pxor %xmm3,%xmm3 |
| 319 | pxor %xmm4,%xmm4 |
| 320 | pxor %xmm5,%xmm5 |
| 321 | pxor %xmm6,%xmm6 |
| 322 | pxor %xmm7,%xmm7 |
| 323 | ret |
| 324 | .private_extern __vpaes_schedule_192_smear |
| 325 | .align 4 |
| 326 | __vpaes_schedule_192_smear: |
| 327 | pshufd $128,%xmm6,%xmm1 |
| 328 | pshufd $254,%xmm7,%xmm0 |
| 329 | pxor %xmm1,%xmm6 |
| 330 | pxor %xmm1,%xmm1 |
| 331 | pxor %xmm0,%xmm6 |
| 332 | movdqa %xmm6,%xmm0 |
| 333 | movhlps %xmm1,%xmm6 |
| 334 | ret |
| 335 | .private_extern __vpaes_schedule_round |
| 336 | .align 4 |
| 337 | __vpaes_schedule_round: |
| 338 | movdqa 8(%esp),%xmm2 |
| 339 | pxor %xmm1,%xmm1 |
| 340 | .byte 102,15,58,15,202,15 |
| 341 | .byte 102,15,58,15,210,15 |
| 342 | pxor %xmm1,%xmm7 |
| 343 | pshufd $255,%xmm0,%xmm0 |
| 344 | .byte 102,15,58,15,192,1 |
| 345 | movdqa %xmm2,8(%esp) |
| 346 | L_vpaes_schedule_low_round: |
| 347 | movdqa %xmm7,%xmm1 |
| 348 | pslldq $4,%xmm7 |
| 349 | pxor %xmm1,%xmm7 |
| 350 | movdqa %xmm7,%xmm1 |
| 351 | pslldq $8,%xmm7 |
| 352 | pxor %xmm1,%xmm7 |
| 353 | pxor 336(%ebp),%xmm7 |
| 354 | movdqa -16(%ebp),%xmm4 |
| 355 | movdqa -48(%ebp),%xmm5 |
| 356 | movdqa %xmm4,%xmm1 |
| 357 | pandn %xmm0,%xmm1 |
| 358 | psrld $4,%xmm1 |
| 359 | pand %xmm4,%xmm0 |
| 360 | movdqa -32(%ebp),%xmm2 |
| 361 | .byte 102,15,56,0,208 |
| 362 | pxor %xmm1,%xmm0 |
| 363 | movdqa %xmm5,%xmm3 |
| 364 | .byte 102,15,56,0,217 |
| 365 | pxor %xmm2,%xmm3 |
| 366 | movdqa %xmm5,%xmm4 |
| 367 | .byte 102,15,56,0,224 |
| 368 | pxor %xmm2,%xmm4 |
| 369 | movdqa %xmm5,%xmm2 |
| 370 | .byte 102,15,56,0,211 |
| 371 | pxor %xmm0,%xmm2 |
| 372 | movdqa %xmm5,%xmm3 |
| 373 | .byte 102,15,56,0,220 |
| 374 | pxor %xmm1,%xmm3 |
| 375 | movdqa 32(%ebp),%xmm4 |
| 376 | .byte 102,15,56,0,226 |
| 377 | movdqa 48(%ebp),%xmm0 |
| 378 | .byte 102,15,56,0,195 |
| 379 | pxor %xmm4,%xmm0 |
| 380 | pxor %xmm7,%xmm0 |
| 381 | movdqa %xmm0,%xmm7 |
| 382 | ret |
| 383 | .private_extern __vpaes_schedule_transform |
| 384 | .align 4 |
| 385 | __vpaes_schedule_transform: |
| 386 | movdqa -16(%ebp),%xmm2 |
| 387 | movdqa %xmm2,%xmm1 |
| 388 | pandn %xmm0,%xmm1 |
| 389 | psrld $4,%xmm1 |
| 390 | pand %xmm2,%xmm0 |
| 391 | movdqa (%ebx),%xmm2 |
| 392 | .byte 102,15,56,0,208 |
| 393 | movdqa 16(%ebx),%xmm0 |
| 394 | .byte 102,15,56,0,193 |
| 395 | pxor %xmm2,%xmm0 |
| 396 | ret |
| 397 | .private_extern __vpaes_schedule_mangle |
| 398 | .align 4 |
| 399 | __vpaes_schedule_mangle: |
| 400 | movdqa %xmm0,%xmm4 |
| 401 | movdqa 128(%ebp),%xmm5 |
| 402 | testl %edi,%edi |
| 403 | jnz L014schedule_mangle_dec |
| 404 | addl $16,%edx |
| 405 | pxor 336(%ebp),%xmm4 |
| 406 | .byte 102,15,56,0,229 |
| 407 | movdqa %xmm4,%xmm3 |
| 408 | .byte 102,15,56,0,229 |
| 409 | pxor %xmm4,%xmm3 |
| 410 | .byte 102,15,56,0,229 |
| 411 | pxor %xmm4,%xmm3 |
| 412 | jmp L015schedule_mangle_both |
| 413 | .align 4,0x90 |
| 414 | L014schedule_mangle_dec: |
| 415 | movdqa -16(%ebp),%xmm2 |
| 416 | leal 416(%ebp),%esi |
| 417 | movdqa %xmm2,%xmm1 |
| 418 | pandn %xmm4,%xmm1 |
| 419 | psrld $4,%xmm1 |
| 420 | pand %xmm2,%xmm4 |
| 421 | movdqa (%esi),%xmm2 |
| 422 | .byte 102,15,56,0,212 |
| 423 | movdqa 16(%esi),%xmm3 |
| 424 | .byte 102,15,56,0,217 |
| 425 | pxor %xmm2,%xmm3 |
| 426 | .byte 102,15,56,0,221 |
| 427 | movdqa 32(%esi),%xmm2 |
| 428 | .byte 102,15,56,0,212 |
| 429 | pxor %xmm3,%xmm2 |
| 430 | movdqa 48(%esi),%xmm3 |
| 431 | .byte 102,15,56,0,217 |
| 432 | pxor %xmm2,%xmm3 |
| 433 | .byte 102,15,56,0,221 |
| 434 | movdqa 64(%esi),%xmm2 |
| 435 | .byte 102,15,56,0,212 |
| 436 | pxor %xmm3,%xmm2 |
| 437 | movdqa 80(%esi),%xmm3 |
| 438 | .byte 102,15,56,0,217 |
| 439 | pxor %xmm2,%xmm3 |
| 440 | .byte 102,15,56,0,221 |
| 441 | movdqa 96(%esi),%xmm2 |
| 442 | .byte 102,15,56,0,212 |
| 443 | pxor %xmm3,%xmm2 |
| 444 | movdqa 112(%esi),%xmm3 |
| 445 | .byte 102,15,56,0,217 |
| 446 | pxor %xmm2,%xmm3 |
| 447 | addl $-16,%edx |
| 448 | L015schedule_mangle_both: |
| 449 | movdqa 256(%ebp,%ecx,1),%xmm1 |
| 450 | .byte 102,15,56,0,217 |
| 451 | addl $-16,%ecx |
| 452 | andl $48,%ecx |
| 453 | movdqu %xmm3,(%edx) |
| 454 | ret |
| 455 | .globl _vpaes_set_encrypt_key |
| 456 | .private_extern _vpaes_set_encrypt_key |
| 457 | .align 4 |
| 458 | _vpaes_set_encrypt_key: |
| 459 | L_vpaes_set_encrypt_key_begin: |
| 460 | pushl %ebp |
| 461 | pushl %ebx |
| 462 | pushl %esi |
| 463 | pushl %edi |
| 464 | movl 20(%esp),%esi |
| 465 | leal -56(%esp),%ebx |
| 466 | movl 24(%esp),%eax |
| 467 | andl $-16,%ebx |
| 468 | movl 28(%esp),%edx |
| 469 | xchgl %esp,%ebx |
| 470 | movl %ebx,48(%esp) |
| 471 | movl %eax,%ebx |
| 472 | shrl $5,%ebx |
| 473 | addl $5,%ebx |
| 474 | movl %ebx,240(%edx) |
| 475 | movl $48,%ecx |
| 476 | movl $0,%edi |
| 477 | leal L_vpaes_consts+0x30-L016pic_point,%ebp |
| 478 | call __vpaes_schedule_core |
| 479 | L016pic_point: |
| 480 | movl 48(%esp),%esp |
| 481 | xorl %eax,%eax |
| 482 | popl %edi |
| 483 | popl %esi |
| 484 | popl %ebx |
| 485 | popl %ebp |
| 486 | ret |
| 487 | .globl _vpaes_set_decrypt_key |
| 488 | .private_extern _vpaes_set_decrypt_key |
| 489 | .align 4 |
| 490 | _vpaes_set_decrypt_key: |
| 491 | L_vpaes_set_decrypt_key_begin: |
| 492 | pushl %ebp |
| 493 | pushl %ebx |
| 494 | pushl %esi |
| 495 | pushl %edi |
| 496 | movl 20(%esp),%esi |
| 497 | leal -56(%esp),%ebx |
| 498 | movl 24(%esp),%eax |
| 499 | andl $-16,%ebx |
| 500 | movl 28(%esp),%edx |
| 501 | xchgl %esp,%ebx |
| 502 | movl %ebx,48(%esp) |
| 503 | movl %eax,%ebx |
| 504 | shrl $5,%ebx |
| 505 | addl $5,%ebx |
| 506 | movl %ebx,240(%edx) |
| 507 | shll $4,%ebx |
| 508 | leal 16(%edx,%ebx,1),%edx |
| 509 | movl $1,%edi |
| 510 | movl %eax,%ecx |
| 511 | shrl $1,%ecx |
| 512 | andl $32,%ecx |
| 513 | xorl $32,%ecx |
| 514 | leal L_vpaes_consts+0x30-L017pic_point,%ebp |
| 515 | call __vpaes_schedule_core |
| 516 | L017pic_point: |
| 517 | movl 48(%esp),%esp |
| 518 | xorl %eax,%eax |
| 519 | popl %edi |
| 520 | popl %esi |
| 521 | popl %ebx |
| 522 | popl %ebp |
| 523 | ret |
| 524 | .globl _vpaes_encrypt |
| 525 | .private_extern _vpaes_encrypt |
| 526 | .align 4 |
| 527 | _vpaes_encrypt: |
| 528 | L_vpaes_encrypt_begin: |
| 529 | pushl %ebp |
| 530 | pushl %ebx |
| 531 | pushl %esi |
| 532 | pushl %edi |
| 533 | leal L_vpaes_consts+0x30-L018pic_point,%ebp |
| 534 | call __vpaes_preheat |
| 535 | L018pic_point: |
| 536 | movl 20(%esp),%esi |
| 537 | leal -56(%esp),%ebx |
| 538 | movl 24(%esp),%edi |
| 539 | andl $-16,%ebx |
| 540 | movl 28(%esp),%edx |
| 541 | xchgl %esp,%ebx |
| 542 | movl %ebx,48(%esp) |
| 543 | movdqu (%esi),%xmm0 |
| 544 | call __vpaes_encrypt_core |
| 545 | movdqu %xmm0,(%edi) |
| 546 | movl 48(%esp),%esp |
| 547 | popl %edi |
| 548 | popl %esi |
| 549 | popl %ebx |
| 550 | popl %ebp |
| 551 | ret |
| 552 | .globl _vpaes_decrypt |
| 553 | .private_extern _vpaes_decrypt |
| 554 | .align 4 |
| 555 | _vpaes_decrypt: |
| 556 | L_vpaes_decrypt_begin: |
| 557 | pushl %ebp |
| 558 | pushl %ebx |
| 559 | pushl %esi |
| 560 | pushl %edi |
| 561 | leal L_vpaes_consts+0x30-L019pic_point,%ebp |
| 562 | call __vpaes_preheat |
| 563 | L019pic_point: |
| 564 | movl 20(%esp),%esi |
| 565 | leal -56(%esp),%ebx |
| 566 | movl 24(%esp),%edi |
| 567 | andl $-16,%ebx |
| 568 | movl 28(%esp),%edx |
| 569 | xchgl %esp,%ebx |
| 570 | movl %ebx,48(%esp) |
| 571 | movdqu (%esi),%xmm0 |
| 572 | call __vpaes_decrypt_core |
| 573 | movdqu %xmm0,(%edi) |
| 574 | movl 48(%esp),%esp |
| 575 | popl %edi |
| 576 | popl %esi |
| 577 | popl %ebx |
| 578 | popl %ebp |
| 579 | ret |
| 580 | .globl _vpaes_cbc_encrypt |
| 581 | .private_extern _vpaes_cbc_encrypt |
| 582 | .align 4 |
| 583 | _vpaes_cbc_encrypt: |
| 584 | L_vpaes_cbc_encrypt_begin: |
| 585 | pushl %ebp |
| 586 | pushl %ebx |
| 587 | pushl %esi |
| 588 | pushl %edi |
| 589 | movl 20(%esp),%esi |
| 590 | movl 24(%esp),%edi |
| 591 | movl 28(%esp),%eax |
| 592 | movl 32(%esp),%edx |
| 593 | subl $16,%eax |
| 594 | jc L020cbc_abort |
| 595 | leal -56(%esp),%ebx |
| 596 | movl 36(%esp),%ebp |
| 597 | andl $-16,%ebx |
| 598 | movl 40(%esp),%ecx |
| 599 | xchgl %esp,%ebx |
| 600 | movdqu (%ebp),%xmm1 |
| 601 | subl %esi,%edi |
| 602 | movl %ebx,48(%esp) |
| 603 | movl %edi,(%esp) |
| 604 | movl %edx,4(%esp) |
| 605 | movl %ebp,8(%esp) |
| 606 | movl %eax,%edi |
| 607 | leal L_vpaes_consts+0x30-L021pic_point,%ebp |
| 608 | call __vpaes_preheat |
| 609 | L021pic_point: |
| 610 | cmpl $0,%ecx |
| 611 | je L022cbc_dec_loop |
| 612 | jmp L023cbc_enc_loop |
| 613 | .align 4,0x90 |
| 614 | L023cbc_enc_loop: |
| 615 | movdqu (%esi),%xmm0 |
| 616 | pxor %xmm1,%xmm0 |
| 617 | call __vpaes_encrypt_core |
| 618 | movl (%esp),%ebx |
| 619 | movl 4(%esp),%edx |
| 620 | movdqa %xmm0,%xmm1 |
| 621 | movdqu %xmm0,(%ebx,%esi,1) |
| 622 | leal 16(%esi),%esi |
| 623 | subl $16,%edi |
| 624 | jnc L023cbc_enc_loop |
| 625 | jmp L024cbc_done |
| 626 | .align 4,0x90 |
| 627 | L022cbc_dec_loop: |
| 628 | movdqu (%esi),%xmm0 |
| 629 | movdqa %xmm1,16(%esp) |
| 630 | movdqa %xmm0,32(%esp) |
| 631 | call __vpaes_decrypt_core |
| 632 | movl (%esp),%ebx |
| 633 | movl 4(%esp),%edx |
| 634 | pxor 16(%esp),%xmm0 |
| 635 | movdqa 32(%esp),%xmm1 |
| 636 | movdqu %xmm0,(%ebx,%esi,1) |
| 637 | leal 16(%esi),%esi |
| 638 | subl $16,%edi |
| 639 | jnc L022cbc_dec_loop |
| 640 | L024cbc_done: |
| 641 | movl 8(%esp),%ebx |
| 642 | movl 48(%esp),%esp |
| 643 | movdqu %xmm1,(%ebx) |
| 644 | L020cbc_abort: |
| 645 | popl %edi |
| 646 | popl %esi |
| 647 | popl %ebx |
| 648 | popl %ebp |
| 649 | ret |
| 650 | #endif |