~ubuntu-branches/ubuntu/maverick/openssl/maverick

« back to all changes in this revision

Viewing changes to .pc/pic.patch/crypto/x86_64cpuid.pl

  • Committer: Bazaar Package Importer
  • Author(s): Marc Deslauriers
  • Date: 2010-06-14 09:08:29 UTC
  • mfrom: (11.1.14 sid)
  • Revision ID: james.westby@ubuntu.com-20100614090829-nf3nrftn7ly58mxv
Tags: 0.9.8o-1ubuntu1
* Merge from debian unstable, remaining changes (LP: #581167):
  - debian/patches/Bsymbolic-functions.patch: Link using
    -Bsymbolic-functions
  - Ship documentation in openssl-doc, suggested by the package.
  - Use a different priority for libssl0.9.8/restart-services
    depending on whether a desktop, or server dist-upgrade is being
    performed.
  - Display a system restart required notification bubble on libssl0.9.8
    upgrade.
  - Replace duplicate files in the doc directory with symlinks.
  - Move runtime libraries to /lib, for the benefit of wpasupplicant
  - Use host compiler when cross-building (patch from Neil Williams in
    Debian #465248).
  - Don't run 'make test' when cross-building.
  - Create libssl0.9.8-udeb, for the benefit of wget-udeb (LP: #503339).
  - debian/patches/aesni.patch: Backport Intel AES-NI support from
    http://rt.openssl.org/Ticket/Display.html?id=2067 (LP: #485518).
  - debian/patches/perlpath-quilt.patch: Don't change perl #! paths
    under .pc.
* Dropped patches, now upstream:
  - debian/patches/CVE-2009-3245.patch
  - debian/patches/CVE-2010-0740.patch
  - debian/patches/dtls-compatibility.patch
  - debian/patches/CVE-2009-4355.patch
* Dropped "Add support for lpia".
* Dropped "Disable SSLv2 during compile" as this had never actually
  disabled SSLv2.
* Don't disable CVE-2009-3555.patch for Maverick.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env perl
 
2
 
 
3
$output=shift;
 
4
$masm=1 if ($output =~ /\.asm/);
 
5
open STDOUT,">$output" || die "can't open $output: $!";
 
6
 
 
7
print<<___ if(defined($masm));
 
8
_TEXT   SEGMENT
 
9
PUBLIC  OPENSSL_rdtsc
 
10
 
 
11
PUBLIC  OPENSSL_atomic_add
 
12
ALIGN   16
 
13
OPENSSL_atomic_add      PROC
 
14
        mov     eax,DWORD PTR[rcx]
 
15
\$Lspin:        lea     r8,DWORD PTR[rdx+rax]
 
16
lock    cmpxchg DWORD PTR[rcx],r8d
 
17
        jne     \$Lspin
 
18
        mov     eax,r8d
 
19
        cdqe    
 
20
        ret
 
21
OPENSSL_atomic_add      ENDP
 
22
 
 
23
PUBLIC  OPENSSL_wipe_cpu
 
24
ALIGN   16
 
25
OPENSSL_wipe_cpu        PROC
 
26
        pxor    xmm0,xmm0
 
27
        pxor    xmm1,xmm1
 
28
        pxor    xmm2,xmm2
 
29
        pxor    xmm3,xmm3
 
30
        pxor    xmm4,xmm4
 
31
        pxor    xmm5,xmm5
 
32
        xor     rcx,rcx
 
33
        xor     rdx,rdx
 
34
        xor     r8,r8
 
35
        xor     r9,r9
 
36
        xor     r10,r10
 
37
        xor     r11,r11
 
38
        lea     rax,QWORD PTR[rsp+8]
 
39
        ret
 
40
OPENSSL_wipe_cpu        ENDP
 
41
_TEXT   ENDS
 
42
 
 
43
CRT\$XIU        SEGMENT
 
44
EXTRN   OPENSSL_cpuid_setup:PROC
 
45
DQ      OPENSSL_cpuid_setup
 
46
CRT\$XIU        ENDS
 
47
 
 
48
___
 
49
print<<___ if(!defined($masm));
 
50
.text
 
51
 
 
52
.globl  OPENSSL_atomic_add
 
53
.type   OPENSSL_atomic_add,\@function
 
54
.align  16
 
55
OPENSSL_atomic_add:
 
56
        movl    (%rdi),%eax
 
57
.Lspin: leaq    (%rsi,%rax),%r8
 
58
lock;   cmpxchgl        %r8d,(%rdi)
 
59
        jne     .Lspin
 
60
        movl    %r8d,%eax
 
61
        .byte   0x48,0x98
 
62
        ret
 
63
.size   OPENSSL_atomic_add,.-OPENSSL_atomic_add
 
64
 
 
65
.globl  OPENSSL_wipe_cpu
 
66
.type   OPENSSL_wipe_cpu,\@function
 
67
.align  16
 
68
OPENSSL_wipe_cpu:
 
69
        pxor    %xmm0,%xmm0
 
70
        pxor    %xmm1,%xmm1
 
71
        pxor    %xmm2,%xmm2
 
72
        pxor    %xmm3,%xmm3
 
73
        pxor    %xmm4,%xmm4
 
74
        pxor    %xmm5,%xmm5
 
75
        pxor    %xmm6,%xmm6
 
76
        pxor    %xmm7,%xmm7
 
77
        pxor    %xmm8,%xmm8
 
78
        pxor    %xmm9,%xmm9
 
79
        pxor    %xmm10,%xmm10
 
80
        pxor    %xmm11,%xmm11
 
81
        pxor    %xmm12,%xmm12
 
82
        pxor    %xmm13,%xmm13
 
83
        pxor    %xmm14,%xmm14
 
84
        pxor    %xmm15,%xmm15
 
85
        xorq    %rcx,%rcx
 
86
        xorq    %rdx,%rdx
 
87
        xorq    %rsi,%rsi
 
88
        xorq    %rdi,%rdi
 
89
        xorq    %r8,%r8
 
90
        xorq    %r9,%r9
 
91
        xorq    %r10,%r10
 
92
        xorq    %r11,%r11
 
93
        leaq    8(%rsp),%rax
 
94
        ret
 
95
.size   OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
 
96
 
 
97
.section        .init
 
98
        call    OPENSSL_cpuid_setup
 
99
 
 
100
___
 
101
 
 
102
open STDOUT,"| $^X perlasm/x86_64-xlate.pl $output";
 
103
print<<___;
 
104
.text
 
105
 
 
106
.globl  OPENSSL_rdtsc
 
107
.type   OPENSSL_rdtsc,\@abi-omnipotent
 
108
.align  16
 
109
OPENSSL_rdtsc:
 
110
        rdtsc
 
111
        shl     \$32,%rdx
 
112
        or      %rdx,%rax
 
113
        ret
 
114
.size   OPENSSL_rdtsc,.-OPENSSL_rdtsc
 
115
 
 
116
.globl  OPENSSL_ia32_cpuid
 
117
.type   OPENSSL_ia32_cpuid,\@abi-omnipotent
 
118
.align  16
 
119
OPENSSL_ia32_cpuid:
 
120
        mov     %rbx,%r8
 
121
 
 
122
        xor     %eax,%eax
 
123
        cpuid
 
124
        xor     %eax,%eax
 
125
        cmp     \$0x756e6547,%ebx       # "Genu"
 
126
        setne   %al
 
127
        mov     %eax,%r9d
 
128
        cmp     \$0x49656e69,%edx       # "ineI"
 
129
        setne   %al
 
130
        or      %eax,%r9d
 
131
        cmp     \$0x6c65746e,%ecx       # "ntel"
 
132
        setne   %al
 
133
        or      %eax,%r9d
 
134
 
 
135
        mov     \$1,%eax
 
136
        cpuid
 
137
        cmp     \$0,%r9d
 
138
        jne     .Lnotintel
 
139
        or      \$0x00100000,%edx       # use reserved 20th bit to engage RC4_CHAR
 
140
        and     \$15,%ah
 
141
        cmp     \$15,%ah                # examine Family ID
 
142
        je      .Lnotintel
 
143
        or      \$0x40000000,%edx       # use reserved bit to skip unrolled loop
 
144
.Lnotintel:
 
145
        bt      \$28,%edx               # test hyper-threading bit
 
146
        jnc     .Ldone
 
147
        shr     \$16,%ebx
 
148
        cmp     \$1,%bl                 # see if cache is shared
 
149
        ja      .Ldone
 
150
        and     \$0xefffffff,%edx       # ~(1<<28)
 
151
.Ldone:
 
152
        shl     \$32,%rcx
 
153
        mov     %edx,%eax
 
154
        mov     %r8,%rbx
 
155
        or      %rcx,%rax
 
156
        ret
 
157
.size   OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid
 
158
___
 
159
close STDOUT;   # flush