~ubuntu-branches/ubuntu/utopic/mariadb-5.5/utopic-security

« back to all changes in this revision

Viewing changes to extra/yassl/taocrypt/src/des.cpp

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2014-04-17 20:55:22 UTC
  • mfrom: (2.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20140417205522-wof4l36nxhlkn89m
* New upstream release, fixing the following security issues:
  * Corresponding MariaDB CVEs for Oracle SPU April 2014 (Closes: #745330)
    - CVE-2014-0384 
    - CVE-2014-2419 
    - CVE-2014-2430 
    - CVE-2014-2431 
    - CVE-2014-2432 
    - CVE-2014-2436 
    - CVE-2014-2438 
    - CVE-2014-2440
* Re-enabled TokuDB with "if arch amd64" in d/rules
* Applied patch to log init output better
  (Closes https://mariadb.atlassian.net/browse/MDEV-5957)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
   Copyright (C) 2000-2007 MySQL AB
 
3
   Use is subject to license terms
3
4
 
4
5
   This program is free software; you can redistribute it and/or modify
5
6
   it under the terms of the GNU General Public License as published by
473
474
 
474
475
   uses ecx
475
476
*/
476
 
#define AsmIPERM() {\
 
477
#define AsmIPERM() \
477
478
    AS2(    rol   ebx, 4                        )   \
478
479
    AS2(    mov   ecx, eax                      )   \
479
480
    AS2(    xor   ecx, ebx                      )   \
504
505
    AS2(    and   ecx, 0xaaaaaaaa               )   \
505
506
    AS2(    xor   eax, ecx                      )   \
506
507
    AS2(    rol   eax, 1                        )   \
507
 
    AS2(    xor   ebx, ecx                      ) }
 
508
    AS2(    xor   ebx, ecx                      )
508
509
 
509
510
 
510
511
/* Uses FPERM algorithm from above
514
515
 
515
516
   uses ecx
516
517
*/
517
 
#define AsmFPERM()    {\
 
518
#define AsmFPERM()    \
518
519
    AS2(    ror  ebx, 1                     )    \
519
520
    AS2(    mov  ecx, eax                   )    \
520
521
    AS2(    xor  ecx, ebx                   )    \
545
546
    AS2(    and  ecx, 0xf0f0f0f0            )    \
546
547
    AS2(    xor  eax, ecx                   )    \
547
548
    AS2(    xor  ebx, ecx                   )    \
548
 
    AS2(    ror  eax, 4                     ) }
 
549
    AS2(    ror  eax, 4                     )
549
550
 
550
551
 
551
552
 
641
642
 
642
643
 
643
644
#ifdef _MSC_VER
644
 
    __declspec(naked) 
 
645
    __declspec(naked)
 
646
#else
 
647
    __attribute__ ((noinline)) 
645
648
#endif
646
649
void DES_EDE3::AsmProcess(const byte* in, byte* out, void* box) const
647
650
{
648
651
#ifdef __GNUC__
649
 
    #define AS1(x)    asm(#x);
650
 
    #define AS2(x, y) asm(#x ", " #y);
651
 
 
652
 
    asm(".intel_syntax noprefix");
 
652
    #define AS1(x)    #x ";"
 
653
    #define AS2(x, y) #x ", " #y ";"
653
654
 
654
655
    #define PROLOG()  \
655
 
        AS2(    movd  mm3, edi                      )   \
656
 
        AS2(    movd  mm4, ebx                      )   \
657
 
        AS2(    movd  mm5, esi                      )   \
658
 
        AS2(    movd  mm6, ebp                      )   \
659
 
        AS2(    mov   edx, DWORD PTR [ebp +  8]     )   \
660
 
        AS2(    mov   esi, DWORD PTR [ebp + 12]     )   \
661
 
        AS2(    mov   ebp, DWORD PTR [ebp + 20]     )
662
 
 
663
 
    // ebp restored at end
664
 
    #define EPILOG()    \
665
 
        AS2(    movd  edi, mm3                      )   \
666
 
        AS2(    movd  ebx, mm4                      )   \
667
 
        AS2(    movd  esi, mm5                      )   \
668
 
        AS1(    emms                                )   \
669
 
        asm(".att_syntax");
 
656
    __asm__ __volatile__ \
 
657
    ( \
 
658
        ".intel_syntax noprefix;" \
 
659
        "push ebx;" \
 
660
        "push ebp;" \
 
661
        "movd mm6, ebp;" \
 
662
        "movd mm7, ecx;" \
 
663
        "mov  ebp, eax;"
 
664
    #define EPILOG()  \
 
665
        "pop ebp;" \
 
666
        "pop ebx;" \
 
667
               "emms;" \
 
668
               ".att_syntax;" \
 
669
            :  \
 
670
            : "d" (this), "S" (in), "a" (box), "c" (out) \
 
671
            : "%edi", "memory", "cc" \
 
672
    );
670
673
 
671
674
#else
672
675
    #define AS1(x)      __asm x
756
759
    AS1(    bswap eax                           )
757
760
 
758
761
#ifdef __GNUC__
759
 
    AS2(    mov   esi, DWORD PTR [ebp +  16]    )   // outBlock
 
762
    AS2(    movd  esi, mm7   )   // outBlock
760
763
#else
761
764
    AS2(    mov   esi, DWORD PTR [ebp +  12]    )   // outBlock
762
765
#endif