| 292 | |
| 293 | #ifdef _MSC_VER |
| 294 | __declspec(naked) |
| 295 | #else |
| 296 | __attribute__ ((noinline)) |
| 297 | #endif |
| 298 | void Blowfish::AsmProcess(const byte* inBlock, byte* outBlock) const |
| 299 | { |
| 300 | PROLOG() |
| 301 | |
| 302 | #ifdef OLD_GCC_OFFSET |
| 303 | AS2( lea edi, [ecx + 60] ) // pbox |
| 304 | #else |
| 305 | AS2( lea edi, [ecx + 56] ) // pbox |
| 306 | #endif |
| 307 | |
| 308 | AS2( mov eax, DWORD PTR [esi] ) |
| 309 | AS2( mov edx, DWORD PTR [edi] ) |
| 310 | AS1( bswap eax ) |
| 311 | |
| 312 | AS2( mov ebx, DWORD PTR [esi + 4] ) |
| 313 | AS2( xor eax, edx ) // left |
| 314 | AS1( bswap ebx ) // right |
| 315 | |
| 316 | |
| 317 | BF_ROUND(ebx, eax, 1) |
| 318 | BF_ROUND(eax, ebx, 2) |
| 319 | BF_ROUND(ebx, eax, 3) |
| 320 | BF_ROUND(eax, ebx, 4) |
| 321 | BF_ROUND(ebx, eax, 5) |
| 322 | BF_ROUND(eax, ebx, 6) |
| 323 | BF_ROUND(ebx, eax, 7) |
| 324 | BF_ROUND(eax, ebx, 8) |
| 325 | BF_ROUND(ebx, eax, 9) |
| 326 | BF_ROUND(eax, ebx, 10) |
| 327 | BF_ROUND(ebx, eax, 11) |
| 328 | BF_ROUND(eax, ebx, 12) |
| 329 | BF_ROUND(ebx, eax, 13) |
| 330 | BF_ROUND(eax, ebx, 14) |
| 331 | BF_ROUND(ebx, eax, 15) |
| 332 | BF_ROUND(eax, ebx, 16) |
| 333 | #if ROUNDS == 20 |
| 334 | BF_ROUND(ebx, eax, 17) |
| 335 | BF_ROUND(eax, ebx, 18) |
| 336 | BF_ROUND(ebx, eax, 19) |
| 337 | BF_ROUND(eax, ebx, 20) |
| 338 | |
| 339 | AS2( xor ebx, [edi + 84] ) // 20 + 1 (x4) |
| 340 | #else |
| 341 | AS2( xor ebx, [edi + 68] ) // 16 + 1 (x4) |
| 342 | #endif |
| 343 | |
| 344 | #ifdef __GNUC__ |
| 345 | AS2( movd edi, mm3 ) // outBlock |
| 346 | #else |
| 347 | AS2( mov edi, [ebp + 12] ) // outBlock |
| 348 | #endif |
| 349 | |
| 350 | AS1( bswap ebx ) |
| 351 | AS1( bswap eax ) |