append openssl, sqlite, streamripper
[vuplus_openvuplus_3.0] / meta-openvuplus / recipes-enigma2 / openssl / openssl-0.9.8x / debian / pic.patch
1 Upstream-Status: Backport [debian]
2
3 Index: openssl-0.9.8o/crypto/Makefile
4 ===================================================================
5 --- openssl-0.9.8o.orig/crypto/Makefile 2008-09-17 17:10:55.000000000 +0000
6 +++ openssl-0.9.8o/crypto/Makefile      2010-06-06 13:09:28.000000000 +0000
7 @@ -57,7 +57,7 @@
8         echo "  #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
9         echo '#endif' ) >buildinf.h
10  
11 -x86cpuid-elf.s:        x86cpuid.pl perlasm/x86asm.pl
12 +x86cpuid-elf.S:        x86cpuid.pl perlasm/x86asm.pl
13         $(PERL) x86cpuid.pl elf $(CFLAGS) $(PROCESSOR) > $@
14  x86cpuid-cof.s: x86cpuid.pl perlasm/x86asm.pl
15         $(PERL) x86cpuid.pl coff $(CFLAGS) $(PROCESSOR) > $@
16 @@ -70,7 +70,7 @@
17  uplink-cof.s:  ../ms/uplink.pl
18         $(PERL) ../ms/uplink.pl coff > $@
19  
20 -x86_64cpuid.s: x86_64cpuid.pl
21 +x86_64cpuid.S: x86_64cpuid.pl
22         $(PERL) x86_64cpuid.pl $@
23  ia64cpuid.s: ia64cpuid.S
24         $(CC) $(CFLAGS) -E ia64cpuid.S > $@
25 Index: openssl-0.9.8o/crypto/x86_64cpuid.pl
26 ===================================================================
27 --- openssl-0.9.8o.orig/crypto/x86_64cpuid.pl   2007-11-11 16:25:00.000000000 +0000
28 +++ openssl-0.9.8o/crypto/x86_64cpuid.pl        2010-06-06 13:09:28.000000000 +0000
29 @@ -95,7 +95,11 @@
30  .size  OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
31  
32  .section       .init
33 +#ifdef OPENSSL_PIC
34 +       call    OPENSSL_cpuid_setup\@PLT
35 +#else
36         call    OPENSSL_cpuid_setup
37 +#endif
38  
39  ___
40  
41 Index: openssl-0.9.8o/crypto/md5/Makefile
42 ===================================================================
43 --- openssl-0.9.8o.orig/crypto/md5/Makefile     2008-09-17 17:11:02.000000000 +0000
44 +++ openssl-0.9.8o/crypto/md5/Makefile  2010-06-06 13:09:28.000000000 +0000
45 @@ -52,7 +52,8 @@
46  mx86-out.s: asm/md5-586.pl ../perlasm/x86asm.pl
47         (cd asm; $(PERL) md5-586.pl a.out $(CFLAGS) > ../$@)
48  
49 -md5-x86_64.s:  asm/md5-x86_64.pl;      $(PERL) asm/md5-x86_64.pl $@
50 +md5-x86_64.s:  asm/md5-x86_64.pl
51 +       $(PERL) asm/md5-x86_64.pl $@
52  
53  files:
54         $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
55 Index: openssl-0.9.8o/crypto/des/asm/desboth.pl
56 ===================================================================
57 --- openssl-0.9.8o.orig/crypto/des/asm/desboth.pl       2001-10-24 21:20:56.000000000 +0000
58 +++ openssl-0.9.8o/crypto/des/asm/desboth.pl    2010-06-06 13:09:28.000000000 +0000
59 @@ -16,6 +16,11 @@
60  
61         &push("edi");
62  
63 +       &call   (&label("pic_point0"));
64 +       &set_label("pic_point0");
65 +       &blindpop("ebp");
66 +       &add    ("ebp", "\$_GLOBAL_OFFSET_TABLE_+[.-" . &label("pic_point0") . "]");
67 +
68         &comment("");
69         &comment("Load the data words");
70         &mov($L,&DWP(0,"ebx","",0));
71 @@ -47,15 +52,21 @@
72         &mov(&swtmp(2), (DWC(($enc)?"1":"0")));
73         &mov(&swtmp(1), "eax");
74         &mov(&swtmp(0), "ebx");
75 -       &call("DES_encrypt2");
76 +       &exch("ebx", "ebp");
77 +       &call("DES_encrypt2\@PLT");
78 +       &exch("ebx", "ebp");
79         &mov(&swtmp(2), (DWC(($enc)?"0":"1")));
80         &mov(&swtmp(1), "edi");
81         &mov(&swtmp(0), "ebx");
82 -       &call("DES_encrypt2");
83 +       &exch("ebx", "ebp");
84 +       &call("DES_encrypt2\@PLT");
85 +       &exch("ebx", "ebp");
86         &mov(&swtmp(2), (DWC(($enc)?"1":"0")));
87         &mov(&swtmp(1), "esi");
88         &mov(&swtmp(0), "ebx");
89 -       &call("DES_encrypt2");
90 +       &exch("ebx", "ebp");
91 +       &call("DES_encrypt2\@PLT");
92 +       &exch("ebx", "ebp");
93  
94         &stack_pop(3);
95         &mov($L,&DWP(0,"ebx","",0));
96 Index: openssl-0.9.8o/crypto/rc4/Makefile
97 ===================================================================
98 --- openssl-0.9.8o.orig/crypto/rc4/Makefile     2008-11-19 16:03:50.000000000 +0000
99 +++ openssl-0.9.8o/crypto/rc4/Makefile  2010-06-06 13:09:28.000000000 +0000
100 @@ -51,7 +51,7 @@
101  rx86-out.s: asm/rc4-586.pl ../perlasm/x86asm.pl
102         (cd asm; $(PERL) rc4-586.pl a.out $(CFLAGS) > ../$@)
103  
104 -rc4-x86_64.s: asm/rc4-x86_64.pl;       $(PERL) asm/rc4-x86_64.pl $@
105 +rc4-x86_64.S: asm/rc4-x86_64.pl;       $(PERL) asm/rc4-x86_64.pl $@
106  
107  rc4-ia64.s: asm/rc4-ia64.S
108         @case `awk '/^#define RC4_INT/{print$$NF}' $(TOP)/include/openssl/opensslconf.h` in \
109 Index: openssl-0.9.8o/crypto/rc4/asm/rc4-x86_64.pl
110 ===================================================================
111 --- openssl-0.9.8o.orig/crypto/rc4/asm/rc4-x86_64.pl    2008-09-16 10:47:27.000000000 +0000
112 +++ openssl-0.9.8o/crypto/rc4/asm/rc4-x86_64.pl 2010-06-06 13:09:28.000000000 +0000
113 @@ -270,7 +270,11 @@
114         xor     %r10,%r10
115         xor     %r11,%r11
116  
117 +#ifdef OPENSSL_PIC
118 +       mov     OPENSSL_ia32cap_P\@GOTPCREL(%rip),$idx#d
119 +#else
120         mov     OPENSSL_ia32cap_P(%rip),$idx#d
121 +#endif
122         bt      \$20,$idx#d
123         jnc     .Lw1stloop
124         bt      \$30,$idx#d
125 @@ -338,7 +342,11 @@
126  RC4_options:
127         .picmeup %rax
128         lea     .Lopts-.(%rax),%rax
129 +#ifdef OPENSSL_PIC
130 +       mov     OPENSSL_ia32cap_P\@GOTPCREL(%rip),%edx
131 +#else
132         mov     OPENSSL_ia32cap_P(%rip),%edx
133 +#endif
134         bt      \$20,%edx
135         jnc     .Ldone
136         add     \$12,%rax
137 Index: openssl-0.9.8o/crypto/perlasm/x86unix.pl
138 ===================================================================
139 --- openssl-0.9.8o.orig/crypto/perlasm/x86unix.pl       2008-05-01 23:11:32.000000000 +0000
140 +++ openssl-0.9.8o/crypto/perlasm/x86unix.pl    2010-06-06 13:09:28.000000000 +0000
141 @@ -400,6 +400,29 @@
142         $stack=4;
143         }
144  
145 +sub main'function_begin_B_static
146 +       {
147 +       local($func,$extra)=@_;
148 +
149 +       &main'external_label($func);
150 +       $func=$under.$func;
151 +
152 +       local($tmp)=<<"EOF";
153 +.text
154 +EOF
155 +       push(@out,$tmp);
156 +       if ($main'cpp)
157 +               { push(@out,"TYPE($func,\@function)\n"); }
158 +       elsif ($main'coff)
159 +               { $tmp=push(@out,".def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); }
160 +       elsif ($main'aout and !$main'pic)
161 +               { }
162 +       else    { push(@out,".type      $func,\@function\n"); }
163 +       push(@out,".align\t$align\n");
164 +       push(@out,"$func:\n");
165 +       $stack=4;
166 +       }
167 +
168  sub main'function_end
169         {
170         local($func)=@_;
171 @@ -694,7 +717,17 @@
172                 {
173                 $tmp=<<___;
174  .section       .init
175 +#ifdef OPENSSL_PIC
176 +       pushl   %ebx
177 +       call    .pic_point0
178 +.pic_point0:
179 +       popl    %ebx
180 +       addl    \$_GLOBAL_OFFSET_TABLE_+[.-.pic_point0],%ebx
181 +       call    $under$f\@PLT
182 +       popl    %ebx
183 +#else
184         call    $under$f
185 +#endif
186         jmp     .Linitalign
187  .align $align
188  .Linitalign:
189 Index: openssl-0.9.8o/crypto/perlasm/cbc.pl
190 ===================================================================
191 --- openssl-0.9.8o.orig/crypto/perlasm/cbc.pl   2005-05-09 21:48:00.000000000 +0000
192 +++ openssl-0.9.8o/crypto/perlasm/cbc.pl        2010-06-06 13:09:28.000000000 +0000
193 @@ -122,7 +122,11 @@
194         &mov(&DWP($data_off,"esp","",0),        "eax"); # put in array for call
195         &mov(&DWP($data_off+4,"esp","",0),      "ebx"); #
196  
197 -       &call($enc_func);
198 +       &call   (&label("pic_point0"));
199 +       &set_label("pic_point0");
200 +       &blindpop("ebx");
201 +       &add    ("ebx", "\$_GLOBAL_OFFSET_TABLE_+[.-" . &label("pic_point0") . "]");
202 +       &call("$enc_func\@PLT");
203  
204         &mov("eax",     &DWP($data_off,"esp","",0));
205         &mov("ebx",     &DWP($data_off+4,"esp","",0));
206 @@ -187,7 +191,11 @@
207         &mov(&DWP($data_off,"esp","",0),        "eax"); # put in array for call
208         &mov(&DWP($data_off+4,"esp","",0),      "ebx"); #
209  
210 -       &call($enc_func);
211 +       &call   (&label("pic_point1"));
212 +       &set_label("pic_point1");
213 +       &blindpop("ebx");
214 +       &add    ("ebx", "\$_GLOBAL_OFFSET_TABLE_+[.-" . &label("pic_point1") . "]");
215 +       &call("$enc_func\@PLT");
216  
217         &mov("eax",     &DWP($data_off,"esp","",0));
218         &mov("ebx",     &DWP($data_off+4,"esp","",0));
219 @@ -220,7 +228,11 @@
220         &mov(&DWP($data_off,"esp","",0),        "eax"); # put back
221         &mov(&DWP($data_off+4,"esp","",0),      "ebx"); #
222  
223 -       &call($dec_func);
224 +       &call   (&label("pic_point2"));
225 +       &set_label("pic_point2");
226 +       &blindpop("ebx");
227 +       &add    ("ebx", "\$_GLOBAL_OFFSET_TABLE_+[.-" . &label("pic_point2") . "]");
228 +       &call("$dec_func\@PLT");
229  
230         &mov("eax",     &DWP($data_off,"esp","",0));    # get return
231         &mov("ebx",     &DWP($data_off+4,"esp","",0));  #
232 @@ -263,7 +275,11 @@
233         &mov(&DWP($data_off,"esp","",0),        "eax"); # put back
234         &mov(&DWP($data_off+4,"esp","",0),      "ebx"); #
235  
236 -       &call($dec_func);
237 +       &call   (&label("pic_point3"));
238 +       &set_label("pic_point3");
239 +       &blindpop("ebx");
240 +       &add    ("ebx", "\$_GLOBAL_OFFSET_TABLE_+[.-" . &label("pic_point3") . "]");
241 +       &call("$dec_func\@PLT");
242  
243         &mov("eax",     &DWP($data_off,"esp","",0));    # get return
244         &mov("ebx",     &DWP($data_off+4,"esp","",0));  #
245 Index: openssl-0.9.8o/crypto/perlasm/x86_64-xlate.pl
246 ===================================================================
247 --- openssl-0.9.8o.orig/crypto/perlasm/x86_64-xlate.pl  2010-06-06 13:09:00.000000000 +0000
248 +++ openssl-0.9.8o/crypto/perlasm/x86_64-xlate.pl       2010-06-06 13:09:28.000000000 +0000
249 @@ -435,7 +435,7 @@
250  
251      chomp($line);
252  
253 -    $line =~ s|[#!].*$||;      # get rid of asm-style comments...
254 +#    $line =~ s|[#!].*$||;     # get rid of asm-style comments...
255      $line =~ s|/\*.*\*/||;     # ... and C-style comments...
256      $line =~ s|^\s+||;         # ... and skip white spaces in beginning
257  
258 Index: openssl-0.9.8o/crypto/aes/asm/aes-586.pl
259 ===================================================================
260 --- openssl-0.9.8o.orig/crypto/aes/asm/aes-586.pl       2008-12-17 14:14:51.000000000 +0000
261 +++ openssl-0.9.8o/crypto/aes/asm/aes-586.pl    2010-06-06 13:09:28.000000000 +0000
262 @@ -250,7 +250,7 @@
263  sub _data_word() { my $i; while(defined($i=shift)) { &data_word($i,$i); } }
264  
265  &public_label("AES_Te");
266 -&function_begin_B("_x86_AES_encrypt");
267 +&function_begin_B_static("_x86_AES_encrypt");
268         if ($vertical_spin) {
269                 # I need high parts of volatile registers to be accessible...
270                 &exch   ($s1="edi",$key="ebx");
271 @@ -539,7 +539,7 @@
272  }
273  
274  &public_label("AES_Td");
275 -&function_begin_B("_x86_AES_decrypt");
276 +&function_begin_B_static("_x86_AES_decrypt");
277         # note that caller is expected to allocate stack frame for me!
278         &mov    (&DWP(12,"esp"),$key);          # save key
279  
280 @@ -1461,15 +1461,22 @@
281  &public_label("AES_Td");
282  &public_label("AES_Te");
283  &function_begin_B("AES_set_decrypt_key");
284 +       &push   ("ebx");
285         &mov    ("eax",&wparam(0));
286         &mov    ("ecx",&wparam(1));
287         &mov    ("edx",&wparam(2));
288         &sub    ("esp",12);
289 +
290 +       &call   (&label("pic_point0")); 
291 +       &set_label("pic_point0");
292 +       &blindpop("ebx");
293 +       &add    ("ebx", "\$_GLOBAL_OFFSET_TABLE_+[.-" . &label("pic_point0") . "]");
294         &mov    (&DWP(0,"esp"),"eax");
295         &mov    (&DWP(4,"esp"),"ecx");
296         &mov    (&DWP(8,"esp"),"edx");
297 -       &call   ("AES_set_encrypt_key");
298 +       &call   ("AES_set_encrypt_key\@PLT");
299         &add    ("esp",12);
300 +       &pop    ("ebx");
301         &cmp    ("eax",0);
302         &je     (&label("proceed"));
303         &ret    ();