summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ripemd
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ripemd')
-rw-r--r--src/lib/libcrypto/ripemd/README15
-rw-r--r--src/lib/libcrypto/ripemd/asm/rmd-586.pl590
-rw-r--r--src/lib/libcrypto/ripemd/ripemd.h103
-rw-r--r--src/lib/libcrypto/ripemd/rmd_dgst.c494
-rw-r--r--src/lib/libcrypto/ripemd/rmd_locl.h160
-rw-r--r--src/lib/libcrypto/ripemd/rmd_one.c77
-rw-r--r--src/lib/libcrypto/ripemd/rmdconst.h399
7 files changed, 0 insertions, 1838 deletions
diff --git a/src/lib/libcrypto/ripemd/README b/src/lib/libcrypto/ripemd/README
deleted file mode 100644
index 7097707264..0000000000
--- a/src/lib/libcrypto/ripemd/README
+++ /dev/null
@@ -1,15 +0,0 @@
1RIPEMD-160
2http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html
3
4This is my implementation of RIPEMD-160. The pentium assember is a little
5off the pace since I only get 1050 cycles, while the best is 1013.
6I have a few ideas for how to get another 20 or so cycles, but at
7this point I will not bother right now. I belive the trick will be
8to remove my 'copy X array onto stack' until inside the RIP1() finctions the
9first time round. To do this I need another register and will only have one
10temporary one. A bit tricky.... I can also cleanup the saving of the 5 words
11after the first half of the calculation. I should read the origional
12value, add then write. Currently I just save the new and read the origioal.
13I then read both at the end. Bad.
14
15eric (20-Jan-1998)
diff --git a/src/lib/libcrypto/ripemd/asm/rmd-586.pl b/src/lib/libcrypto/ripemd/asm/rmd-586.pl
deleted file mode 100644
index 0ab6f76bff..0000000000
--- a/src/lib/libcrypto/ripemd/asm/rmd-586.pl
+++ /dev/null
@@ -1,590 +0,0 @@
1#!/usr/local/bin/perl
2
3# Normal is the
4# ripemd160_block_asm_host_order(RIPEMD160_CTX *c, ULONG *X,int blocks);
5
6$normal=0;
7
8push(@INC,"perlasm","../../perlasm");
9require "x86asm.pl";
10
11&asm_init($ARGV[0],$0);
12
13$A="ecx";
14$B="esi";
15$C="edi";
16$D="ebx";
17$E="ebp";
18$tmp1="eax";
19$tmp2="edx";
20
21$KL1=0x5A827999;
22$KL2=0x6ED9EBA1;
23$KL3=0x8F1BBCDC;
24$KL4=0xA953FD4E;
25$KR0=0x50A28BE6;
26$KR1=0x5C4DD124;
27$KR2=0x6D703EF3;
28$KR3=0x7A6D76E9;
29
30
31@wl=( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,
32 7, 4,13, 1,10, 6,15, 3,12, 0, 9, 5, 2,14,11, 8,
33 3,10,14, 4, 9,15, 8, 1, 2, 7, 0, 6,13,11, 5,12,
34 1, 9,11,10, 0, 8,12, 4,13, 3, 7,15,14, 5, 6, 2,
35 4, 0, 5, 9, 7,12, 2,10,14, 1, 3, 8,11, 6,15,13,
36 );
37
38@wr=( 5,14, 7, 0, 9, 2,11, 4,13, 6,15, 8, 1,10, 3,12,
39 6,11, 3, 7, 0,13, 5,10,14,15, 8,12, 4, 9, 1, 2,
40 15, 5, 1, 3, 7,14, 6, 9,11, 8,12, 2,10, 0, 4,13,
41 8, 6, 4, 1, 3,11,15, 0, 5,12, 2,13, 9, 7,10,14,
42 12,15,10, 4, 1, 5, 8, 7, 6, 2,13,14, 0, 3, 9,11,
43 );
44
45@sl=( 11,14,15,12, 5, 8, 7, 9,11,13,14,15, 6, 7, 9, 8,
46 7, 6, 8,13,11, 9, 7,15, 7,12,15, 9,11, 7,13,12,
47 11,13, 6, 7,14, 9,13,15,14, 8,13, 6, 5,12, 7, 5,
48 11,12,14,15,14,15, 9, 8, 9,14, 5, 6, 8, 6, 5,12,
49 9,15, 5,11, 6, 8,13,12, 5,12,13,14,11, 8, 5, 6,
50 );
51
52@sr=( 8, 9, 9,11,13,15,15, 5, 7, 7, 8,11,14,14,12, 6,
53 9,13,15, 7,12, 8, 9,11, 7, 7,12, 7, 6,15,13,11,
54 9, 7,15,11, 8, 6, 6,14,12,13, 5,14,13,13, 7, 5,
55 15, 5, 8,11,14,14, 6,14, 6, 9,12, 9,12, 5,15, 8,
56 8, 5,12, 9,12, 5,14, 6, 8,13, 6, 5,15,13,11,11,
57 );
58
59&ripemd160_block("ripemd160_block_asm_host_order");
60&asm_finish();
61
62sub Xv
63 {
64 local($n)=@_;
65 return(&swtmp($n));
66 # tmp on stack
67 }
68
69sub Np
70 {
71 local($p)=@_;
72 local(%n)=($A,$E,$B,$A,$C,$B,$D,$C,$E,$D);
73 return($n{$p});
74 }
75
76sub RIP1
77 {
78 local($a,$b,$c,$d,$e,$pos,$s,$o,$pos2)=@_;
79
80 &comment($p++);
81 if ($p & 1)
82 {
83 #&mov($tmp1, $c) if $o == -1;
84 &xor($tmp1, $d) if $o == -1;
85 &mov($tmp2, &Xv($pos));
86 &xor($tmp1, $b);
87 &add($a, $tmp2);
88 &rotl($c, 10);
89 &add($a, $tmp1);
90 &mov($tmp1, &Np($c)); # NEXT
91 # XXX
92 &rotl($a, $s);
93 &add($a, $e);
94 }
95 else
96 {
97 &xor($tmp1, $d);
98 &mov($tmp2, &Xv($pos));
99 &xor($tmp1, $b);
100 &add($a, $tmp1);
101 &mov($tmp1, &Np($c)) if $o <= 0;
102 &mov($tmp1, -1) if $o == 1;
103 # XXX if $o == 2;
104 &rotl($c, 10);
105 &add($a, $tmp2);
106 &xor($tmp1, &Np($d)) if $o <= 0;
107 &mov($tmp2, &Xv($pos2)) if $o == 1;
108 &mov($tmp2, &wparam(0)) if $o == 2;
109 &rotl($a, $s);
110 &add($a, $e);
111 }
112 }
113
114sub RIP2
115 {
116 local($a,$b,$c,$d,$e,$pos,$pos2,$s,$K,$o)=@_;
117
118# XXXXXX
119 &comment($p++);
120 if ($p & 1)
121 {
122# &mov($tmp2, &Xv($pos)) if $o < -1;
123# &mov($tmp1, -1) if $o < -1;
124
125 &add($a, $tmp2);
126 &mov($tmp2, $c);
127 &sub($tmp1, $b);
128 &and($tmp2, $b);
129 &and($tmp1, $d);
130 &or($tmp2, $tmp1);
131 &mov($tmp1, &Xv($pos2)) if $o <= 0; # XXXXXXXXXXXXXX
132 # XXX
133 &rotl($c, 10);
134 &lea($a, &DWP($K,$a,$tmp2,1));
135 &mov($tmp2, -1) if $o <= 0;
136 # XXX
137 &rotl($a, $s);
138 &add($a, $e);
139 }
140 else
141 {
142 # XXX
143 &add($a, $tmp1);
144 &mov($tmp1, $c);
145 &sub($tmp2, $b);
146 &and($tmp1, $b);
147 &and($tmp2, $d);
148 if ($o != 2)
149 {
150 &or($tmp1, $tmp2);
151 &mov($tmp2, &Xv($pos2)) if $o <= 0;
152 &mov($tmp2, -1) if $o == 1;
153 &rotl($c, 10);
154 &lea($a, &DWP($K,$a,$tmp1,1));
155 &mov($tmp1, -1) if $o <= 0;
156 &sub($tmp2, &Np($c)) if $o == 1;
157 } else {
158 &or($tmp2, $tmp1);
159 &mov($tmp1, &Np($c));
160 &rotl($c, 10);
161 &lea($a, &DWP($K,$a,$tmp2,1));
162 &xor($tmp1, &Np($d));
163 }
164 &rotl($a, $s);
165 &add($a, $e);
166 }
167 }
168
169sub RIP3
170 {
171 local($a,$b,$c,$d,$e,$pos,$s,$K,$o,$pos2)=@_;
172
173 &comment($p++);
174 if ($p & 1)
175 {
176# &mov($tmp2, -1) if $o < -1;
177# &sub($tmp2, $c) if $o < -1;
178 &mov($tmp1, &Xv($pos));
179 &or($tmp2, $b);
180 &add($a, $tmp1);
181 &xor($tmp2, $d);
182 &mov($tmp1, -1) if $o <= 0; # NEXT
183 # XXX
184 &rotl($c, 10);
185 &lea($a, &DWP($K,$a,$tmp2,1));
186 &sub($tmp1, &Np($c)) if $o <= 0; # NEXT
187 # XXX
188 &rotl($a, $s);
189 &add($a, $e);
190 }
191 else
192 {
193 &mov($tmp2, &Xv($pos));
194 &or($tmp1, $b);
195 &add($a, $tmp2);
196 &xor($tmp1, $d);
197 &mov($tmp2, -1) if $o <= 0; # NEXT
198 &mov($tmp2, -1) if $o == 1;
199 &mov($tmp2, &Xv($pos2)) if $o == 2;
200 &rotl($c, 10);
201 &lea($a, &DWP($K,$a,$tmp1,1));
202 &sub($tmp2, &Np($c)) if $o <= 0; # NEXT
203 &mov($tmp1, &Np($d)) if $o == 1;
204 &mov($tmp1, -1) if $o == 2;
205 &rotl($a, $s);
206 &add($a, $e);
207 }
208 }
209
210sub RIP4
211 {
212 local($a,$b,$c,$d,$e,$pos,$s,$K,$o)=@_;
213
214 &comment($p++);
215 if ($p & 1)
216 {
217# &mov($tmp2, -1) if $o == -2;
218# &mov($tmp1, $d) if $o == -2;
219 &sub($tmp2, $d);
220 &and($tmp1, $b);
221 &and($tmp2, $c);
222 &or($tmp2, $tmp1);
223 &mov($tmp1, &Xv($pos));
224 &rotl($c, 10);
225 &lea($a, &DWP($K,$a,$tmp2));
226 &mov($tmp2, -1) unless $o > 0; # NEXT
227 # XXX
228 &add($a, $tmp1);
229 &mov($tmp1, &Np($d)) unless $o > 0; # NEXT
230 # XXX
231 &rotl($a, $s);
232 &add($a, $e);
233 }
234 else
235 {
236 &sub($tmp2, $d);
237 &and($tmp1, $b);
238 &and($tmp2, $c);
239 &or($tmp2, $tmp1);
240 &mov($tmp1, &Xv($pos));
241 &rotl($c, 10);
242 &lea($a, &DWP($K,$a,$tmp2));
243 &mov($tmp2, -1) if $o == 0; # NEXT
244 &mov($tmp2, -1) if $o == 1;
245 &mov($tmp2, -1) if $o == 2;
246 # XXX
247 &add($a, $tmp1);
248 &mov($tmp1, &Np($d)) if $o == 0; # NEXT
249 &sub($tmp2, &Np($d)) if $o == 1;
250 &sub($tmp2, &Np($c)) if $o == 2;
251 # XXX
252 &rotl($a, $s);
253 &add($a, $e);
254 }
255 }
256
257sub RIP5
258 {
259 local($a,$b,$c,$d,$e,$pos,$s,$K,$o)=@_;
260
261 &comment($p++);
262 if ($p & 1)
263 {
264 &mov($tmp2, -1) if $o == -2;
265 &sub($tmp2, $d) if $o == -2;
266 &mov($tmp1, &Xv($pos));
267 &or($tmp2, $c);
268 &add($a, $tmp1);
269 &xor($tmp2, $b);
270 &mov($tmp1, -1) if $o <= 0;
271 # XXX
272 &rotl($c, 10);
273 &lea($a, &DWP($K,$a,$tmp2,1));
274 &sub($tmp1, &Np($d)) if $o <= 0;
275 # XXX
276 &rotl($a, $s);
277 &add($a, $e);
278 }
279 else
280 {
281 &mov($tmp2, &Xv($pos));
282 &or($tmp1, $c);
283 &add($a, $tmp2);
284 &xor($tmp1, $b);
285 &mov($tmp2, -1) if $o <= 0;
286 &mov($tmp2, &wparam(0)) if $o == 1; # Middle code
287 &mov($tmp2, -1) if $o == 2;
288 &rotl($c, 10);
289 &lea($a, &DWP($K,$a,$tmp1,1));
290 &sub($tmp2, &Np($d)) if $o <= 0;
291 &mov(&swtmp(16), $A) if $o == 1;
292 &mov($tmp1, &Np($d)) if $o == 2;
293 &rotl($a, $s);
294 &add($a, $e);
295 }
296 }
297
298sub ripemd160_block
299 {
300 local($name)=@_;
301
302 &function_begin_B($name,"",3);
303
304 # parameter 1 is the RIPEMD160_CTX structure.
305 # A 0
306 # B 4
307 # C 8
308 # D 12
309 # E 16
310
311 &mov($tmp2, &wparam(0));
312 &mov($tmp1, &wparam(1));
313 &push("esi");
314 &mov($A, &DWP( 0,$tmp2,"",0));
315 &push("edi");
316 &mov($B, &DWP( 4,$tmp2,"",0));
317 &push("ebp");
318 &mov($C, &DWP( 8,$tmp2,"",0));
319 &push("ebx");
320 &stack_push(16+5+6);
321 # Special comment about the figure of 6.
322 # Idea is to pad the current frame so
323 # that the top of the stack gets fairly
324 # aligned. Well, as you realize it would
325 # always depend on how the frame below is
326 # aligned. The good news are that gcc-2.95
327 # and later does keep first argument at
328 # least double-wise aligned.
329 # <appro@fy.chalmers.se>
330
331 &set_label("start") unless $normal;
332 &comment("");
333
334 # &mov($tmp1, &wparam(1)); # Done at end of loop
335 # &mov($tmp2, &wparam(0)); # Done at end of loop
336
337 for ($z=0; $z<16; $z+=2)
338 {
339 &mov($D, &DWP( $z*4,$tmp1,"",0));
340 &mov($E, &DWP( ($z+1)*4,$tmp1,"",0));
341 &mov(&swtmp($z), $D);
342 &mov(&swtmp($z+1), $E);
343 }
344 &mov($tmp1, $C);
345 &mov($D, &DWP(12,$tmp2,"",0));
346 &mov($E, &DWP(16,$tmp2,"",0));
347
348 &RIP1($A,$B,$C,$D,$E,$wl[ 0],$sl[ 0],-1);
349 &RIP1($E,$A,$B,$C,$D,$wl[ 1],$sl[ 1],0);
350 &RIP1($D,$E,$A,$B,$C,$wl[ 2],$sl[ 2],0);
351 &RIP1($C,$D,$E,$A,$B,$wl[ 3],$sl[ 3],0);
352 &RIP1($B,$C,$D,$E,$A,$wl[ 4],$sl[ 4],0);
353 &RIP1($A,$B,$C,$D,$E,$wl[ 5],$sl[ 5],0);
354 &RIP1($E,$A,$B,$C,$D,$wl[ 6],$sl[ 6],0);
355 &RIP1($D,$E,$A,$B,$C,$wl[ 7],$sl[ 7],0);
356 &RIP1($C,$D,$E,$A,$B,$wl[ 8],$sl[ 8],0);
357 &RIP1($B,$C,$D,$E,$A,$wl[ 9],$sl[ 9],0);
358 &RIP1($A,$B,$C,$D,$E,$wl[10],$sl[10],0);
359 &RIP1($E,$A,$B,$C,$D,$wl[11],$sl[11],0);
360 &RIP1($D,$E,$A,$B,$C,$wl[12],$sl[12],0);
361 &RIP1($C,$D,$E,$A,$B,$wl[13],$sl[13],0);
362 &RIP1($B,$C,$D,$E,$A,$wl[14],$sl[14],0);
363 &RIP1($A,$B,$C,$D,$E,$wl[15],$sl[15],1,$wl[16]);
364
365 &RIP2($E,$A,$B,$C,$D,$wl[16],$wl[17],$sl[16],$KL1,-1);
366 &RIP2($D,$E,$A,$B,$C,$wl[17],$wl[18],$sl[17],$KL1,0);
367 &RIP2($C,$D,$E,$A,$B,$wl[18],$wl[19],$sl[18],$KL1,0);
368 &RIP2($B,$C,$D,$E,$A,$wl[19],$wl[20],$sl[19],$KL1,0);
369 &RIP2($A,$B,$C,$D,$E,$wl[20],$wl[21],$sl[20],$KL1,0);
370 &RIP2($E,$A,$B,$C,$D,$wl[21],$wl[22],$sl[21],$KL1,0);
371 &RIP2($D,$E,$A,$B,$C,$wl[22],$wl[23],$sl[22],$KL1,0);
372 &RIP2($C,$D,$E,$A,$B,$wl[23],$wl[24],$sl[23],$KL1,0);
373 &RIP2($B,$C,$D,$E,$A,$wl[24],$wl[25],$sl[24],$KL1,0);
374 &RIP2($A,$B,$C,$D,$E,$wl[25],$wl[26],$sl[25],$KL1,0);
375 &RIP2($E,$A,$B,$C,$D,$wl[26],$wl[27],$sl[26],$KL1,0);
376 &RIP2($D,$E,$A,$B,$C,$wl[27],$wl[28],$sl[27],$KL1,0);
377 &RIP2($C,$D,$E,$A,$B,$wl[28],$wl[29],$sl[28],$KL1,0);
378 &RIP2($B,$C,$D,$E,$A,$wl[29],$wl[30],$sl[29],$KL1,0);
379 &RIP2($A,$B,$C,$D,$E,$wl[30],$wl[31],$sl[30],$KL1,0);
380 &RIP2($E,$A,$B,$C,$D,$wl[31],$wl[32],$sl[31],$KL1,1);
381
382 &RIP3($D,$E,$A,$B,$C,$wl[32],$sl[32],$KL2,-1);
383 &RIP3($C,$D,$E,$A,$B,$wl[33],$sl[33],$KL2,0);
384 &RIP3($B,$C,$D,$E,$A,$wl[34],$sl[34],$KL2,0);
385 &RIP3($A,$B,$C,$D,$E,$wl[35],$sl[35],$KL2,0);
386 &RIP3($E,$A,$B,$C,$D,$wl[36],$sl[36],$KL2,0);
387 &RIP3($D,$E,$A,$B,$C,$wl[37],$sl[37],$KL2,0);
388 &RIP3($C,$D,$E,$A,$B,$wl[38],$sl[38],$KL2,0);
389 &RIP3($B,$C,$D,$E,$A,$wl[39],$sl[39],$KL2,0);
390 &RIP3($A,$B,$C,$D,$E,$wl[40],$sl[40],$KL2,0);
391 &RIP3($E,$A,$B,$C,$D,$wl[41],$sl[41],$KL2,0);
392 &RIP3($D,$E,$A,$B,$C,$wl[42],$sl[42],$KL2,0);
393 &RIP3($C,$D,$E,$A,$B,$wl[43],$sl[43],$KL2,0);
394 &RIP3($B,$C,$D,$E,$A,$wl[44],$sl[44],$KL2,0);
395 &RIP3($A,$B,$C,$D,$E,$wl[45],$sl[45],$KL2,0);
396 &RIP3($E,$A,$B,$C,$D,$wl[46],$sl[46],$KL2,0);
397 &RIP3($D,$E,$A,$B,$C,$wl[47],$sl[47],$KL2,1);
398
399 &RIP4($C,$D,$E,$A,$B,$wl[48],$sl[48],$KL3,-1);
400 &RIP4($B,$C,$D,$E,$A,$wl[49],$sl[49],$KL3,0);
401 &RIP4($A,$B,$C,$D,$E,$wl[50],$sl[50],$KL3,0);
402 &RIP4($E,$A,$B,$C,$D,$wl[51],$sl[51],$KL3,0);
403 &RIP4($D,$E,$A,$B,$C,$wl[52],$sl[52],$KL3,0);
404 &RIP4($C,$D,$E,$A,$B,$wl[53],$sl[53],$KL3,0);
405 &RIP4($B,$C,$D,$E,$A,$wl[54],$sl[54],$KL3,0);
406 &RIP4($A,$B,$C,$D,$E,$wl[55],$sl[55],$KL3,0);
407 &RIP4($E,$A,$B,$C,$D,$wl[56],$sl[56],$KL3,0);
408 &RIP4($D,$E,$A,$B,$C,$wl[57],$sl[57],$KL3,0);
409 &RIP4($C,$D,$E,$A,$B,$wl[58],$sl[58],$KL3,0);
410 &RIP4($B,$C,$D,$E,$A,$wl[59],$sl[59],$KL3,0);
411 &RIP4($A,$B,$C,$D,$E,$wl[60],$sl[60],$KL3,0);
412 &RIP4($E,$A,$B,$C,$D,$wl[61],$sl[61],$KL3,0);
413 &RIP4($D,$E,$A,$B,$C,$wl[62],$sl[62],$KL3,0);
414 &RIP4($C,$D,$E,$A,$B,$wl[63],$sl[63],$KL3,1);
415
416 &RIP5($B,$C,$D,$E,$A,$wl[64],$sl[64],$KL4,-1);
417 &RIP5($A,$B,$C,$D,$E,$wl[65],$sl[65],$KL4,0);
418 &RIP5($E,$A,$B,$C,$D,$wl[66],$sl[66],$KL4,0);
419 &RIP5($D,$E,$A,$B,$C,$wl[67],$sl[67],$KL4,0);
420 &RIP5($C,$D,$E,$A,$B,$wl[68],$sl[68],$KL4,0);
421 &RIP5($B,$C,$D,$E,$A,$wl[69],$sl[69],$KL4,0);
422 &RIP5($A,$B,$C,$D,$E,$wl[70],$sl[70],$KL4,0);
423 &RIP5($E,$A,$B,$C,$D,$wl[71],$sl[71],$KL4,0);
424 &RIP5($D,$E,$A,$B,$C,$wl[72],$sl[72],$KL4,0);
425 &RIP5($C,$D,$E,$A,$B,$wl[73],$sl[73],$KL4,0);
426 &RIP5($B,$C,$D,$E,$A,$wl[74],$sl[74],$KL4,0);
427 &RIP5($A,$B,$C,$D,$E,$wl[75],$sl[75],$KL4,0);
428 &RIP5($E,$A,$B,$C,$D,$wl[76],$sl[76],$KL4,0);
429 &RIP5($D,$E,$A,$B,$C,$wl[77],$sl[77],$KL4,0);
430 &RIP5($C,$D,$E,$A,$B,$wl[78],$sl[78],$KL4,0);
431 &RIP5($B,$C,$D,$E,$A,$wl[79],$sl[79],$KL4,1);
432
433 # &mov($tmp2, &wparam(0)); # moved into last RIP5
434 # &mov(&swtmp(16), $A);
435 &mov($A, &DWP( 0,$tmp2,"",0));
436 &mov(&swtmp(16+1), $B);
437 &mov(&swtmp(16+2), $C);
438 &mov($B, &DWP( 4,$tmp2,"",0));
439 &mov(&swtmp(16+3), $D);
440 &mov($C, &DWP( 8,$tmp2,"",0));
441 &mov(&swtmp(16+4), $E);
442 &mov($D, &DWP(12,$tmp2,"",0));
443 &mov($E, &DWP(16,$tmp2,"",0));
444
445 &RIP5($A,$B,$C,$D,$E,$wr[ 0],$sr[ 0],$KR0,-2);
446 &RIP5($E,$A,$B,$C,$D,$wr[ 1],$sr[ 1],$KR0,0);
447 &RIP5($D,$E,$A,$B,$C,$wr[ 2],$sr[ 2],$KR0,0);
448 &RIP5($C,$D,$E,$A,$B,$wr[ 3],$sr[ 3],$KR0,0);
449 &RIP5($B,$C,$D,$E,$A,$wr[ 4],$sr[ 4],$KR0,0);
450 &RIP5($A,$B,$C,$D,$E,$wr[ 5],$sr[ 5],$KR0,0);
451 &RIP5($E,$A,$B,$C,$D,$wr[ 6],$sr[ 6],$KR0,0);
452 &RIP5($D,$E,$A,$B,$C,$wr[ 7],$sr[ 7],$KR0,0);
453 &RIP5($C,$D,$E,$A,$B,$wr[ 8],$sr[ 8],$KR0,0);
454 &RIP5($B,$C,$D,$E,$A,$wr[ 9],$sr[ 9],$KR0,0);
455 &RIP5($A,$B,$C,$D,$E,$wr[10],$sr[10],$KR0,0);
456 &RIP5($E,$A,$B,$C,$D,$wr[11],$sr[11],$KR0,0);
457 &RIP5($D,$E,$A,$B,$C,$wr[12],$sr[12],$KR0,0);
458 &RIP5($C,$D,$E,$A,$B,$wr[13],$sr[13],$KR0,0);
459 &RIP5($B,$C,$D,$E,$A,$wr[14],$sr[14],$KR0,0);
460 &RIP5($A,$B,$C,$D,$E,$wr[15],$sr[15],$KR0,2);
461
462 &RIP4($E,$A,$B,$C,$D,$wr[16],$sr[16],$KR1,-2);
463 &RIP4($D,$E,$A,$B,$C,$wr[17],$sr[17],$KR1,0);
464 &RIP4($C,$D,$E,$A,$B,$wr[18],$sr[18],$KR1,0);
465 &RIP4($B,$C,$D,$E,$A,$wr[19],$sr[19],$KR1,0);
466 &RIP4($A,$B,$C,$D,$E,$wr[20],$sr[20],$KR1,0);
467 &RIP4($E,$A,$B,$C,$D,$wr[21],$sr[21],$KR1,0);
468 &RIP4($D,$E,$A,$B,$C,$wr[22],$sr[22],$KR1,0);
469 &RIP4($C,$D,$E,$A,$B,$wr[23],$sr[23],$KR1,0);
470 &RIP4($B,$C,$D,$E,$A,$wr[24],$sr[24],$KR1,0);
471 &RIP4($A,$B,$C,$D,$E,$wr[25],$sr[25],$KR1,0);
472 &RIP4($E,$A,$B,$C,$D,$wr[26],$sr[26],$KR1,0);
473 &RIP4($D,$E,$A,$B,$C,$wr[27],$sr[27],$KR1,0);
474 &RIP4($C,$D,$E,$A,$B,$wr[28],$sr[28],$KR1,0);
475 &RIP4($B,$C,$D,$E,$A,$wr[29],$sr[29],$KR1,0);
476 &RIP4($A,$B,$C,$D,$E,$wr[30],$sr[30],$KR1,0);
477 &RIP4($E,$A,$B,$C,$D,$wr[31],$sr[31],$KR1,2);
478
479 &RIP3($D,$E,$A,$B,$C,$wr[32],$sr[32],$KR2,-2);
480 &RIP3($C,$D,$E,$A,$B,$wr[33],$sr[33],$KR2,0);
481 &RIP3($B,$C,$D,$E,$A,$wr[34],$sr[34],$KR2,0);
482 &RIP3($A,$B,$C,$D,$E,$wr[35],$sr[35],$KR2,0);
483 &RIP3($E,$A,$B,$C,$D,$wr[36],$sr[36],$KR2,0);
484 &RIP3($D,$E,$A,$B,$C,$wr[37],$sr[37],$KR2,0);
485 &RIP3($C,$D,$E,$A,$B,$wr[38],$sr[38],$KR2,0);
486 &RIP3($B,$C,$D,$E,$A,$wr[39],$sr[39],$KR2,0);
487 &RIP3($A,$B,$C,$D,$E,$wr[40],$sr[40],$KR2,0);
488 &RIP3($E,$A,$B,$C,$D,$wr[41],$sr[41],$KR2,0);
489 &RIP3($D,$E,$A,$B,$C,$wr[42],$sr[42],$KR2,0);
490 &RIP3($C,$D,$E,$A,$B,$wr[43],$sr[43],$KR2,0);
491 &RIP3($B,$C,$D,$E,$A,$wr[44],$sr[44],$KR2,0);
492 &RIP3($A,$B,$C,$D,$E,$wr[45],$sr[45],$KR2,0);
493 &RIP3($E,$A,$B,$C,$D,$wr[46],$sr[46],$KR2,0);
494 &RIP3($D,$E,$A,$B,$C,$wr[47],$sr[47],$KR2,2,$wr[48]);
495
496 &RIP2($C,$D,$E,$A,$B,$wr[48],$wr[49],$sr[48],$KR3,-2);
497 &RIP2($B,$C,$D,$E,$A,$wr[49],$wr[50],$sr[49],$KR3,0);
498 &RIP2($A,$B,$C,$D,$E,$wr[50],$wr[51],$sr[50],$KR3,0);
499 &RIP2($E,$A,$B,$C,$D,$wr[51],$wr[52],$sr[51],$KR3,0);
500 &RIP2($D,$E,$A,$B,$C,$wr[52],$wr[53],$sr[52],$KR3,0);
501 &RIP2($C,$D,$E,$A,$B,$wr[53],$wr[54],$sr[53],$KR3,0);
502 &RIP2($B,$C,$D,$E,$A,$wr[54],$wr[55],$sr[54],$KR3,0);
503 &RIP2($A,$B,$C,$D,$E,$wr[55],$wr[56],$sr[55],$KR3,0);
504 &RIP2($E,$A,$B,$C,$D,$wr[56],$wr[57],$sr[56],$KR3,0);
505 &RIP2($D,$E,$A,$B,$C,$wr[57],$wr[58],$sr[57],$KR3,0);
506 &RIP2($C,$D,$E,$A,$B,$wr[58],$wr[59],$sr[58],$KR3,0);
507 &RIP2($B,$C,$D,$E,$A,$wr[59],$wr[60],$sr[59],$KR3,0);
508 &RIP2($A,$B,$C,$D,$E,$wr[60],$wr[61],$sr[60],$KR3,0);
509 &RIP2($E,$A,$B,$C,$D,$wr[61],$wr[62],$sr[61],$KR3,0);
510 &RIP2($D,$E,$A,$B,$C,$wr[62],$wr[63],$sr[62],$KR3,0);
511 &RIP2($C,$D,$E,$A,$B,$wr[63],$wr[64],$sr[63],$KR3,2);
512
513 &RIP1($B,$C,$D,$E,$A,$wr[64],$sr[64],-2);
514 &RIP1($A,$B,$C,$D,$E,$wr[65],$sr[65],0);
515 &RIP1($E,$A,$B,$C,$D,$wr[66],$sr[66],0);
516 &RIP1($D,$E,$A,$B,$C,$wr[67],$sr[67],0);
517 &RIP1($C,$D,$E,$A,$B,$wr[68],$sr[68],0);
518 &RIP1($B,$C,$D,$E,$A,$wr[69],$sr[69],0);
519 &RIP1($A,$B,$C,$D,$E,$wr[70],$sr[70],0);
520 &RIP1($E,$A,$B,$C,$D,$wr[71],$sr[71],0);
521 &RIP1($D,$E,$A,$B,$C,$wr[72],$sr[72],0);
522 &RIP1($C,$D,$E,$A,$B,$wr[73],$sr[73],0);
523 &RIP1($B,$C,$D,$E,$A,$wr[74],$sr[74],0);
524 &RIP1($A,$B,$C,$D,$E,$wr[75],$sr[75],0);
525 &RIP1($E,$A,$B,$C,$D,$wr[76],$sr[76],0);
526 &RIP1($D,$E,$A,$B,$C,$wr[77],$sr[77],0);
527 &RIP1($C,$D,$E,$A,$B,$wr[78],$sr[78],0);
528 &RIP1($B,$C,$D,$E,$A,$wr[79],$sr[79],2);
529
530 # &mov($tmp2, &wparam(0)); # Moved into last round
531
532 &mov($tmp1, &DWP( 4,$tmp2,"",0)); # ctx->B
533 &add($D, $tmp1);
534 &mov($tmp1, &swtmp(16+2)); # $c
535 &add($D, $tmp1);
536
537 &mov($tmp1, &DWP( 8,$tmp2,"",0)); # ctx->C
538 &add($E, $tmp1);
539 &mov($tmp1, &swtmp(16+3)); # $d
540 &add($E, $tmp1);
541
542 &mov($tmp1, &DWP(12,$tmp2,"",0)); # ctx->D
543 &add($A, $tmp1);
544 &mov($tmp1, &swtmp(16+4)); # $e
545 &add($A, $tmp1);
546
547
548 &mov($tmp1, &DWP(16,$tmp2,"",0)); # ctx->E
549 &add($B, $tmp1);
550 &mov($tmp1, &swtmp(16+0)); # $a
551 &add($B, $tmp1);
552
553 &mov($tmp1, &DWP( 0,$tmp2,"",0)); # ctx->A
554 &add($C, $tmp1);
555 &mov($tmp1, &swtmp(16+1)); # $b
556 &add($C, $tmp1);
557
558 &mov($tmp1, &wparam(2));
559
560 &mov(&DWP( 0,$tmp2,"",0), $D);
561 &mov(&DWP( 4,$tmp2,"",0), $E);
562 &mov(&DWP( 8,$tmp2,"",0), $A);
563 &sub($tmp1,1);
564 &mov(&DWP(12,$tmp2,"",0), $B);
565 &mov(&DWP(16,$tmp2,"",0), $C);
566
567 &jle(&label("get_out"));
568
569 &mov(&wparam(2),$tmp1);
570 &mov($C, $A);
571 &mov($tmp1, &wparam(1));
572 &mov($A, $D);
573 &add($tmp1, 64);
574 &mov($B, $E);
575 &mov(&wparam(1),$tmp1);
576
577 &jmp(&label("start"));
578
579 &set_label("get_out");
580
581 &stack_pop(16+5+6);
582
583 &pop("ebx");
584 &pop("ebp");
585 &pop("edi");
586 &pop("esi");
587 &ret();
588 &function_end_B($name);
589 }
590
diff --git a/src/lib/libcrypto/ripemd/ripemd.h b/src/lib/libcrypto/ripemd/ripemd.h
deleted file mode 100644
index 78d5f36560..0000000000
--- a/src/lib/libcrypto/ripemd/ripemd.h
+++ /dev/null
@@ -1,103 +0,0 @@
1/* crypto/ripemd/ripemd.h */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#ifndef HEADER_RIPEMD_H
60#define HEADER_RIPEMD_H
61
62#include <openssl/e_os2.h>
63
64#ifdef __cplusplus
65extern "C" {
66#endif
67
68#ifdef OPENSSL_NO_RIPEMD
69#error RIPEMD is disabled.
70#endif
71
72#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)
73#define RIPEMD160_LONG unsigned long
74#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
75#define RIPEMD160_LONG unsigned long
76#define RIPEMD160_LONG_LOG2 3
77#else
78#define RIPEMD160_LONG unsigned int
79#endif
80
81#define RIPEMD160_CBLOCK 64
82#define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4)
83#define RIPEMD160_DIGEST_LENGTH 20
84
85typedef struct RIPEMD160state_st
86 {
87 RIPEMD160_LONG A,B,C,D,E;
88 RIPEMD160_LONG Nl,Nh;
89 RIPEMD160_LONG data[RIPEMD160_LBLOCK];
90 int num;
91 } RIPEMD160_CTX;
92
93int RIPEMD160_Init(RIPEMD160_CTX *c);
94int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, unsigned long len);
95int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);
96unsigned char *RIPEMD160(const unsigned char *d, unsigned long n,
97 unsigned char *md);
98void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b);
99#ifdef __cplusplus
100}
101#endif
102
103#endif
diff --git a/src/lib/libcrypto/ripemd/rmd_dgst.c b/src/lib/libcrypto/ripemd/rmd_dgst.c
deleted file mode 100644
index 28896512e7..0000000000
--- a/src/lib/libcrypto/ripemd/rmd_dgst.c
+++ /dev/null
@@ -1,494 +0,0 @@
1/* crypto/ripemd/rmd_dgst.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "rmd_locl.h"
61#include <openssl/opensslv.h>
62
63const char *RMD160_version="RIPE-MD160" OPENSSL_VERSION_PTEXT;
64
65# ifdef RMD160_ASM
66 void ripemd160_block_x86(RIPEMD160_CTX *c, unsigned long *p,int num);
67# define ripemd160_block ripemd160_block_x86
68# else
69 void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,int num);
70# endif
71
72int RIPEMD160_Init(RIPEMD160_CTX *c)
73 {
74 c->A=RIPEMD160_A;
75 c->B=RIPEMD160_B;
76 c->C=RIPEMD160_C;
77 c->D=RIPEMD160_D;
78 c->E=RIPEMD160_E;
79 c->Nl=0;
80 c->Nh=0;
81 c->num=0;
82 return 1;
83 }
84
85#ifndef ripemd160_block_host_order
86#ifdef X
87#undef X
88#endif
89#define X(i) XX[i]
90void ripemd160_block_host_order (RIPEMD160_CTX *ctx, const void *p, int num)
91 {
92 const RIPEMD160_LONG *XX=p;
93 register volatile unsigned MD32_REG_T A,B,C,D,E;
94 register unsigned MD32_REG_T a,b,c,d,e;
95
96 for (;num--;XX+=HASH_LBLOCK)
97 {
98
99 A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E;
100
101 RIP1(A,B,C,D,E,WL00,SL00);
102 RIP1(E,A,B,C,D,WL01,SL01);
103 RIP1(D,E,A,B,C,WL02,SL02);
104 RIP1(C,D,E,A,B,WL03,SL03);
105 RIP1(B,C,D,E,A,WL04,SL04);
106 RIP1(A,B,C,D,E,WL05,SL05);
107 RIP1(E,A,B,C,D,WL06,SL06);
108 RIP1(D,E,A,B,C,WL07,SL07);
109 RIP1(C,D,E,A,B,WL08,SL08);
110 RIP1(B,C,D,E,A,WL09,SL09);
111 RIP1(A,B,C,D,E,WL10,SL10);
112 RIP1(E,A,B,C,D,WL11,SL11);
113 RIP1(D,E,A,B,C,WL12,SL12);
114 RIP1(C,D,E,A,B,WL13,SL13);
115 RIP1(B,C,D,E,A,WL14,SL14);
116 RIP1(A,B,C,D,E,WL15,SL15);
117
118 RIP2(E,A,B,C,D,WL16,SL16,KL1);
119 RIP2(D,E,A,B,C,WL17,SL17,KL1);
120 RIP2(C,D,E,A,B,WL18,SL18,KL1);
121 RIP2(B,C,D,E,A,WL19,SL19,KL1);
122 RIP2(A,B,C,D,E,WL20,SL20,KL1);
123 RIP2(E,A,B,C,D,WL21,SL21,KL1);
124 RIP2(D,E,A,B,C,WL22,SL22,KL1);
125 RIP2(C,D,E,A,B,WL23,SL23,KL1);
126 RIP2(B,C,D,E,A,WL24,SL24,KL1);
127 RIP2(A,B,C,D,E,WL25,SL25,KL1);
128 RIP2(E,A,B,C,D,WL26,SL26,KL1);
129 RIP2(D,E,A,B,C,WL27,SL27,KL1);
130 RIP2(C,D,E,A,B,WL28,SL28,KL1);
131 RIP2(B,C,D,E,A,WL29,SL29,KL1);
132 RIP2(A,B,C,D,E,WL30,SL30,KL1);
133 RIP2(E,A,B,C,D,WL31,SL31,KL1);
134
135 RIP3(D,E,A,B,C,WL32,SL32,KL2);
136 RIP3(C,D,E,A,B,WL33,SL33,KL2);
137 RIP3(B,C,D,E,A,WL34,SL34,KL2);
138 RIP3(A,B,C,D,E,WL35,SL35,KL2);
139 RIP3(E,A,B,C,D,WL36,SL36,KL2);
140 RIP3(D,E,A,B,C,WL37,SL37,KL2);
141 RIP3(C,D,E,A,B,WL38,SL38,KL2);
142 RIP3(B,C,D,E,A,WL39,SL39,KL2);
143 RIP3(A,B,C,D,E,WL40,SL40,KL2);
144 RIP3(E,A,B,C,D,WL41,SL41,KL2);
145 RIP3(D,E,A,B,C,WL42,SL42,KL2);
146 RIP3(C,D,E,A,B,WL43,SL43,KL2);
147 RIP3(B,C,D,E,A,WL44,SL44,KL2);
148 RIP3(A,B,C,D,E,WL45,SL45,KL2);
149 RIP3(E,A,B,C,D,WL46,SL46,KL2);
150 RIP3(D,E,A,B,C,WL47,SL47,KL2);
151
152 RIP4(C,D,E,A,B,WL48,SL48,KL3);
153 RIP4(B,C,D,E,A,WL49,SL49,KL3);
154 RIP4(A,B,C,D,E,WL50,SL50,KL3);
155 RIP4(E,A,B,C,D,WL51,SL51,KL3);
156 RIP4(D,E,A,B,C,WL52,SL52,KL3);
157 RIP4(C,D,E,A,B,WL53,SL53,KL3);
158 RIP4(B,C,D,E,A,WL54,SL54,KL3);
159 RIP4(A,B,C,D,E,WL55,SL55,KL3);
160 RIP4(E,A,B,C,D,WL56,SL56,KL3);
161 RIP4(D,E,A,B,C,WL57,SL57,KL3);
162 RIP4(C,D,E,A,B,WL58,SL58,KL3);
163 RIP4(B,C,D,E,A,WL59,SL59,KL3);
164 RIP4(A,B,C,D,E,WL60,SL60,KL3);
165 RIP4(E,A,B,C,D,WL61,SL61,KL3);
166 RIP4(D,E,A,B,C,WL62,SL62,KL3);
167 RIP4(C,D,E,A,B,WL63,SL63,KL3);
168
169 RIP5(B,C,D,E,A,WL64,SL64,KL4);
170 RIP5(A,B,C,D,E,WL65,SL65,KL4);
171 RIP5(E,A,B,C,D,WL66,SL66,KL4);
172 RIP5(D,E,A,B,C,WL67,SL67,KL4);
173 RIP5(C,D,E,A,B,WL68,SL68,KL4);
174 RIP5(B,C,D,E,A,WL69,SL69,KL4);
175 RIP5(A,B,C,D,E,WL70,SL70,KL4);
176 RIP5(E,A,B,C,D,WL71,SL71,KL4);
177 RIP5(D,E,A,B,C,WL72,SL72,KL4);
178 RIP5(C,D,E,A,B,WL73,SL73,KL4);
179 RIP5(B,C,D,E,A,WL74,SL74,KL4);
180 RIP5(A,B,C,D,E,WL75,SL75,KL4);
181 RIP5(E,A,B,C,D,WL76,SL76,KL4);
182 RIP5(D,E,A,B,C,WL77,SL77,KL4);
183 RIP5(C,D,E,A,B,WL78,SL78,KL4);
184 RIP5(B,C,D,E,A,WL79,SL79,KL4);
185
186 a=A; b=B; c=C; d=D; e=E;
187 /* Do other half */
188 A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E;
189
190 RIP5(A,B,C,D,E,WR00,SR00,KR0);
191 RIP5(E,A,B,C,D,WR01,SR01,KR0);
192 RIP5(D,E,A,B,C,WR02,SR02,KR0);
193 RIP5(C,D,E,A,B,WR03,SR03,KR0);
194 RIP5(B,C,D,E,A,WR04,SR04,KR0);
195 RIP5(A,B,C,D,E,WR05,SR05,KR0);
196 RIP5(E,A,B,C,D,WR06,SR06,KR0);
197 RIP5(D,E,A,B,C,WR07,SR07,KR0);
198 RIP5(C,D,E,A,B,WR08,SR08,KR0);
199 RIP5(B,C,D,E,A,WR09,SR09,KR0);
200 RIP5(A,B,C,D,E,WR10,SR10,KR0);
201 RIP5(E,A,B,C,D,WR11,SR11,KR0);
202 RIP5(D,E,A,B,C,WR12,SR12,KR0);
203 RIP5(C,D,E,A,B,WR13,SR13,KR0);
204 RIP5(B,C,D,E,A,WR14,SR14,KR0);
205 RIP5(A,B,C,D,E,WR15,SR15,KR0);
206
207 RIP4(E,A,B,C,D,WR16,SR16,KR1);
208 RIP4(D,E,A,B,C,WR17,SR17,KR1);
209 RIP4(C,D,E,A,B,WR18,SR18,KR1);
210 RIP4(B,C,D,E,A,WR19,SR19,KR1);
211 RIP4(A,B,C,D,E,WR20,SR20,KR1);
212 RIP4(E,A,B,C,D,WR21,SR21,KR1);
213 RIP4(D,E,A,B,C,WR22,SR22,KR1);
214 RIP4(C,D,E,A,B,WR23,SR23,KR1);
215 RIP4(B,C,D,E,A,WR24,SR24,KR1);
216 RIP4(A,B,C,D,E,WR25,SR25,KR1);
217 RIP4(E,A,B,C,D,WR26,SR26,KR1);
218 RIP4(D,E,A,B,C,WR27,SR27,KR1);
219 RIP4(C,D,E,A,B,WR28,SR28,KR1);
220 RIP4(B,C,D,E,A,WR29,SR29,KR1);
221 RIP4(A,B,C,D,E,WR30,SR30,KR1);
222 RIP4(E,A,B,C,D,WR31,SR31,KR1);
223
224 RIP3(D,E,A,B,C,WR32,SR32,KR2);
225 RIP3(C,D,E,A,B,WR33,SR33,KR2);
226 RIP3(B,C,D,E,A,WR34,SR34,KR2);
227 RIP3(A,B,C,D,E,WR35,SR35,KR2);
228 RIP3(E,A,B,C,D,WR36,SR36,KR2);
229 RIP3(D,E,A,B,C,WR37,SR37,KR2);
230 RIP3(C,D,E,A,B,WR38,SR38,KR2);
231 RIP3(B,C,D,E,A,WR39,SR39,KR2);
232 RIP3(A,B,C,D,E,WR40,SR40,KR2);
233 RIP3(E,A,B,C,D,WR41,SR41,KR2);
234 RIP3(D,E,A,B,C,WR42,SR42,KR2);
235 RIP3(C,D,E,A,B,WR43,SR43,KR2);
236 RIP3(B,C,D,E,A,WR44,SR44,KR2);
237 RIP3(A,B,C,D,E,WR45,SR45,KR2);
238 RIP3(E,A,B,C,D,WR46,SR46,KR2);
239 RIP3(D,E,A,B,C,WR47,SR47,KR2);
240
241 RIP2(C,D,E,A,B,WR48,SR48,KR3);
242 RIP2(B,C,D,E,A,WR49,SR49,KR3);
243 RIP2(A,B,C,D,E,WR50,SR50,KR3);
244 RIP2(E,A,B,C,D,WR51,SR51,KR3);
245 RIP2(D,E,A,B,C,WR52,SR52,KR3);
246 RIP2(C,D,E,A,B,WR53,SR53,KR3);
247 RIP2(B,C,D,E,A,WR54,SR54,KR3);
248 RIP2(A,B,C,D,E,WR55,SR55,KR3);
249 RIP2(E,A,B,C,D,WR56,SR56,KR3);
250 RIP2(D,E,A,B,C,WR57,SR57,KR3);
251 RIP2(C,D,E,A,B,WR58,SR58,KR3);
252 RIP2(B,C,D,E,A,WR59,SR59,KR3);
253 RIP2(A,B,C,D,E,WR60,SR60,KR3);
254 RIP2(E,A,B,C,D,WR61,SR61,KR3);
255 RIP2(D,E,A,B,C,WR62,SR62,KR3);
256 RIP2(C,D,E,A,B,WR63,SR63,KR3);
257
258 RIP1(B,C,D,E,A,WR64,SR64);
259 RIP1(A,B,C,D,E,WR65,SR65);
260 RIP1(E,A,B,C,D,WR66,SR66);
261 RIP1(D,E,A,B,C,WR67,SR67);
262 RIP1(C,D,E,A,B,WR68,SR68);
263 RIP1(B,C,D,E,A,WR69,SR69);
264 RIP1(A,B,C,D,E,WR70,SR70);
265 RIP1(E,A,B,C,D,WR71,SR71);
266 RIP1(D,E,A,B,C,WR72,SR72);
267 RIP1(C,D,E,A,B,WR73,SR73);
268 RIP1(B,C,D,E,A,WR74,SR74);
269 RIP1(A,B,C,D,E,WR75,SR75);
270 RIP1(E,A,B,C,D,WR76,SR76);
271 RIP1(D,E,A,B,C,WR77,SR77);
272 RIP1(C,D,E,A,B,WR78,SR78);
273 RIP1(B,C,D,E,A,WR79,SR79);
274
275 D =ctx->B+c+D;
276 ctx->B=ctx->C+d+E;
277 ctx->C=ctx->D+e+A;
278 ctx->D=ctx->E+a+B;
279 ctx->E=ctx->A+b+C;
280 ctx->A=D;
281
282 }
283 }
284#endif
285
286#ifndef ripemd160_block_data_order
287#ifdef X
288#undef X
289#endif
290void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, int num)
291 {
292 const unsigned char *data=p;
293 register volatile unsigned MD32_REG_T A,B,C,D,E;
294 unsigned MD32_REG_T a,b,c,d,e,l;
295#ifndef MD32_XARRAY
296 /* See comment in crypto/sha/sha_locl.h for details. */
297 unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
298 XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15;
299# define X(i) XX##i
300#else
301 RIPEMD160_LONG XX[16];
302# define X(i) XX[i]
303#endif
304
305 for (;num--;)
306 {
307
308 A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E;
309
310 HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l;
311 RIP1(A,B,C,D,E,WL00,SL00); HOST_c2l(data,l); X( 2)=l;
312 RIP1(E,A,B,C,D,WL01,SL01); HOST_c2l(data,l); X( 3)=l;
313 RIP1(D,E,A,B,C,WL02,SL02); HOST_c2l(data,l); X( 4)=l;
314 RIP1(C,D,E,A,B,WL03,SL03); HOST_c2l(data,l); X( 5)=l;
315 RIP1(B,C,D,E,A,WL04,SL04); HOST_c2l(data,l); X( 6)=l;
316 RIP1(A,B,C,D,E,WL05,SL05); HOST_c2l(data,l); X( 7)=l;
317 RIP1(E,A,B,C,D,WL06,SL06); HOST_c2l(data,l); X( 8)=l;
318 RIP1(D,E,A,B,C,WL07,SL07); HOST_c2l(data,l); X( 9)=l;
319 RIP1(C,D,E,A,B,WL08,SL08); HOST_c2l(data,l); X(10)=l;
320 RIP1(B,C,D,E,A,WL09,SL09); HOST_c2l(data,l); X(11)=l;
321 RIP1(A,B,C,D,E,WL10,SL10); HOST_c2l(data,l); X(12)=l;
322 RIP1(E,A,B,C,D,WL11,SL11); HOST_c2l(data,l); X(13)=l;
323 RIP1(D,E,A,B,C,WL12,SL12); HOST_c2l(data,l); X(14)=l;
324 RIP1(C,D,E,A,B,WL13,SL13); HOST_c2l(data,l); X(15)=l;
325 RIP1(B,C,D,E,A,WL14,SL14);
326 RIP1(A,B,C,D,E,WL15,SL15);
327
328 RIP2(E,A,B,C,D,WL16,SL16,KL1);
329 RIP2(D,E,A,B,C,WL17,SL17,KL1);
330 RIP2(C,D,E,A,B,WL18,SL18,KL1);
331 RIP2(B,C,D,E,A,WL19,SL19,KL1);
332 RIP2(A,B,C,D,E,WL20,SL20,KL1);
333 RIP2(E,A,B,C,D,WL21,SL21,KL1);
334 RIP2(D,E,A,B,C,WL22,SL22,KL1);
335 RIP2(C,D,E,A,B,WL23,SL23,KL1);
336 RIP2(B,C,D,E,A,WL24,SL24,KL1);
337 RIP2(A,B,C,D,E,WL25,SL25,KL1);
338 RIP2(E,A,B,C,D,WL26,SL26,KL1);
339 RIP2(D,E,A,B,C,WL27,SL27,KL1);
340 RIP2(C,D,E,A,B,WL28,SL28,KL1);
341 RIP2(B,C,D,E,A,WL29,SL29,KL1);
342 RIP2(A,B,C,D,E,WL30,SL30,KL1);
343 RIP2(E,A,B,C,D,WL31,SL31,KL1);
344
345 RIP3(D,E,A,B,C,WL32,SL32,KL2);
346 RIP3(C,D,E,A,B,WL33,SL33,KL2);
347 RIP3(B,C,D,E,A,WL34,SL34,KL2);
348 RIP3(A,B,C,D,E,WL35,SL35,KL2);
349 RIP3(E,A,B,C,D,WL36,SL36,KL2);
350 RIP3(D,E,A,B,C,WL37,SL37,KL2);
351 RIP3(C,D,E,A,B,WL38,SL38,KL2);
352 RIP3(B,C,D,E,A,WL39,SL39,KL2);
353 RIP3(A,B,C,D,E,WL40,SL40,KL2);
354 RIP3(E,A,B,C,D,WL41,SL41,KL2);
355 RIP3(D,E,A,B,C,WL42,SL42,KL2);
356 RIP3(C,D,E,A,B,WL43,SL43,KL2);
357 RIP3(B,C,D,E,A,WL44,SL44,KL2);
358 RIP3(A,B,C,D,E,WL45,SL45,KL2);
359 RIP3(E,A,B,C,D,WL46,SL46,KL2);
360 RIP3(D,E,A,B,C,WL47,SL47,KL2);
361
362 RIP4(C,D,E,A,B,WL48,SL48,KL3);
363 RIP4(B,C,D,E,A,WL49,SL49,KL3);
364 RIP4(A,B,C,D,E,WL50,SL50,KL3);
365 RIP4(E,A,B,C,D,WL51,SL51,KL3);
366 RIP4(D,E,A,B,C,WL52,SL52,KL3);
367 RIP4(C,D,E,A,B,WL53,SL53,KL3);
368 RIP4(B,C,D,E,A,WL54,SL54,KL3);
369 RIP4(A,B,C,D,E,WL55,SL55,KL3);
370 RIP4(E,A,B,C,D,WL56,SL56,KL3);
371 RIP4(D,E,A,B,C,WL57,SL57,KL3);
372 RIP4(C,D,E,A,B,WL58,SL58,KL3);
373 RIP4(B,C,D,E,A,WL59,SL59,KL3);
374 RIP4(A,B,C,D,E,WL60,SL60,KL3);
375 RIP4(E,A,B,C,D,WL61,SL61,KL3);
376 RIP4(D,E,A,B,C,WL62,SL62,KL3);
377 RIP4(C,D,E,A,B,WL63,SL63,KL3);
378
379 RIP5(B,C,D,E,A,WL64,SL64,KL4);
380 RIP5(A,B,C,D,E,WL65,SL65,KL4);
381 RIP5(E,A,B,C,D,WL66,SL66,KL4);
382 RIP5(D,E,A,B,C,WL67,SL67,KL4);
383 RIP5(C,D,E,A,B,WL68,SL68,KL4);
384 RIP5(B,C,D,E,A,WL69,SL69,KL4);
385 RIP5(A,B,C,D,E,WL70,SL70,KL4);
386 RIP5(E,A,B,C,D,WL71,SL71,KL4);
387 RIP5(D,E,A,B,C,WL72,SL72,KL4);
388 RIP5(C,D,E,A,B,WL73,SL73,KL4);
389 RIP5(B,C,D,E,A,WL74,SL74,KL4);
390 RIP5(A,B,C,D,E,WL75,SL75,KL4);
391 RIP5(E,A,B,C,D,WL76,SL76,KL4);
392 RIP5(D,E,A,B,C,WL77,SL77,KL4);
393 RIP5(C,D,E,A,B,WL78,SL78,KL4);
394 RIP5(B,C,D,E,A,WL79,SL79,KL4);
395
396 a=A; b=B; c=C; d=D; e=E;
397 /* Do other half */
398 A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E;
399
400 RIP5(A,B,C,D,E,WR00,SR00,KR0);
401 RIP5(E,A,B,C,D,WR01,SR01,KR0);
402 RIP5(D,E,A,B,C,WR02,SR02,KR0);
403 RIP5(C,D,E,A,B,WR03,SR03,KR0);
404 RIP5(B,C,D,E,A,WR04,SR04,KR0);
405 RIP5(A,B,C,D,E,WR05,SR05,KR0);
406 RIP5(E,A,B,C,D,WR06,SR06,KR0);
407 RIP5(D,E,A,B,C,WR07,SR07,KR0);
408 RIP5(C,D,E,A,B,WR08,SR08,KR0);
409 RIP5(B,C,D,E,A,WR09,SR09,KR0);
410 RIP5(A,B,C,D,E,WR10,SR10,KR0);
411 RIP5(E,A,B,C,D,WR11,SR11,KR0);
412 RIP5(D,E,A,B,C,WR12,SR12,KR0);
413 RIP5(C,D,E,A,B,WR13,SR13,KR0);
414 RIP5(B,C,D,E,A,WR14,SR14,KR0);
415 RIP5(A,B,C,D,E,WR15,SR15,KR0);
416
417 RIP4(E,A,B,C,D,WR16,SR16,KR1);
418 RIP4(D,E,A,B,C,WR17,SR17,KR1);
419 RIP4(C,D,E,A,B,WR18,SR18,KR1);
420 RIP4(B,C,D,E,A,WR19,SR19,KR1);
421 RIP4(A,B,C,D,E,WR20,SR20,KR1);
422 RIP4(E,A,B,C,D,WR21,SR21,KR1);
423 RIP4(D,E,A,B,C,WR22,SR22,KR1);
424 RIP4(C,D,E,A,B,WR23,SR23,KR1);
425 RIP4(B,C,D,E,A,WR24,SR24,KR1);
426 RIP4(A,B,C,D,E,WR25,SR25,KR1);
427 RIP4(E,A,B,C,D,WR26,SR26,KR1);
428 RIP4(D,E,A,B,C,WR27,SR27,KR1);
429 RIP4(C,D,E,A,B,WR28,SR28,KR1);
430 RIP4(B,C,D,E,A,WR29,SR29,KR1);
431 RIP4(A,B,C,D,E,WR30,SR30,KR1);
432 RIP4(E,A,B,C,D,WR31,SR31,KR1);
433
434 RIP3(D,E,A,B,C,WR32,SR32,KR2);
435 RIP3(C,D,E,A,B,WR33,SR33,KR2);
436 RIP3(B,C,D,E,A,WR34,SR34,KR2);
437 RIP3(A,B,C,D,E,WR35,SR35,KR2);
438 RIP3(E,A,B,C,D,WR36,SR36,KR2);
439 RIP3(D,E,A,B,C,WR37,SR37,KR2);
440 RIP3(C,D,E,A,B,WR38,SR38,KR2);
441 RIP3(B,C,D,E,A,WR39,SR39,KR2);
442 RIP3(A,B,C,D,E,WR40,SR40,KR2);
443 RIP3(E,A,B,C,D,WR41,SR41,KR2);
444 RIP3(D,E,A,B,C,WR42,SR42,KR2);
445 RIP3(C,D,E,A,B,WR43,SR43,KR2);
446 RIP3(B,C,D,E,A,WR44,SR44,KR2);
447 RIP3(A,B,C,D,E,WR45,SR45,KR2);
448 RIP3(E,A,B,C,D,WR46,SR46,KR2);
449 RIP3(D,E,A,B,C,WR47,SR47,KR2);
450
451 RIP2(C,D,E,A,B,WR48,SR48,KR3);
452 RIP2(B,C,D,E,A,WR49,SR49,KR3);
453 RIP2(A,B,C,D,E,WR50,SR50,KR3);
454 RIP2(E,A,B,C,D,WR51,SR51,KR3);
455 RIP2(D,E,A,B,C,WR52,SR52,KR3);
456 RIP2(C,D,E,A,B,WR53,SR53,KR3);
457 RIP2(B,C,D,E,A,WR54,SR54,KR3);
458 RIP2(A,B,C,D,E,WR55,SR55,KR3);
459 RIP2(E,A,B,C,D,WR56,SR56,KR3);
460 RIP2(D,E,A,B,C,WR57,SR57,KR3);
461 RIP2(C,D,E,A,B,WR58,SR58,KR3);
462 RIP2(B,C,D,E,A,WR59,SR59,KR3);
463 RIP2(A,B,C,D,E,WR60,SR60,KR3);
464 RIP2(E,A,B,C,D,WR61,SR61,KR3);
465 RIP2(D,E,A,B,C,WR62,SR62,KR3);
466 RIP2(C,D,E,A,B,WR63,SR63,KR3);
467
468 RIP1(B,C,D,E,A,WR64,SR64);
469 RIP1(A,B,C,D,E,WR65,SR65);
470 RIP1(E,A,B,C,D,WR66,SR66);
471 RIP1(D,E,A,B,C,WR67,SR67);
472 RIP1(C,D,E,A,B,WR68,SR68);
473 RIP1(B,C,D,E,A,WR69,SR69);
474 RIP1(A,B,C,D,E,WR70,SR70);
475 RIP1(E,A,B,C,D,WR71,SR71);
476 RIP1(D,E,A,B,C,WR72,SR72);
477 RIP1(C,D,E,A,B,WR73,SR73);
478 RIP1(B,C,D,E,A,WR74,SR74);
479 RIP1(A,B,C,D,E,WR75,SR75);
480 RIP1(E,A,B,C,D,WR76,SR76);
481 RIP1(D,E,A,B,C,WR77,SR77);
482 RIP1(C,D,E,A,B,WR78,SR78);
483 RIP1(B,C,D,E,A,WR79,SR79);
484
485 D =ctx->B+c+D;
486 ctx->B=ctx->C+d+E;
487 ctx->C=ctx->D+e+A;
488 ctx->D=ctx->E+a+B;
489 ctx->E=ctx->A+b+C;
490 ctx->A=D;
491
492 }
493 }
494#endif
diff --git a/src/lib/libcrypto/ripemd/rmd_locl.h b/src/lib/libcrypto/ripemd/rmd_locl.h
deleted file mode 100644
index 7b835dfbd4..0000000000
--- a/src/lib/libcrypto/ripemd/rmd_locl.h
+++ /dev/null
@@ -1,160 +0,0 @@
1/* crypto/ripemd/rmd_locl.h */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdlib.h>
60#include <string.h>
61#include <openssl/opensslconf.h>
62#include <openssl/ripemd.h>
63
64#ifndef RIPEMD160_LONG_LOG2
65#define RIPEMD160_LONG_LOG2 2 /* default to 32 bits */
66#endif
67
68/*
69 * DO EXAMINE COMMENTS IN crypto/md5/md5_locl.h & crypto/md5/md5_dgst.c
70 * FOR EXPLANATIONS ON FOLLOWING "CODE."
71 * <appro@fy.chalmers.se>
72 */
73#ifdef RMD160_ASM
74# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__)
75# define ripemd160_block_host_order ripemd160_block_asm_host_order
76# endif
77#endif
78
79void ripemd160_block_host_order (RIPEMD160_CTX *c, const void *p,int num);
80void ripemd160_block_data_order (RIPEMD160_CTX *c, const void *p,int num);
81
82#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__)
83#define ripemd160_block_data_order ripemd160_block_host_order
84#endif
85
86#define DATA_ORDER_IS_LITTLE_ENDIAN
87
88#define HASH_LONG RIPEMD160_LONG
89#define HASH_LONG_LOG2 RIPEMD160_LONG_LOG2
90#define HASH_CTX RIPEMD160_CTX
91#define HASH_CBLOCK RIPEMD160_CBLOCK
92#define HASH_LBLOCK RIPEMD160_LBLOCK
93#define HASH_UPDATE RIPEMD160_Update
94#define HASH_TRANSFORM RIPEMD160_Transform
95#define HASH_FINAL RIPEMD160_Final
96#define HASH_BLOCK_HOST_ORDER ripemd160_block_host_order
97#define HASH_MAKE_STRING(c,s) do { \
98 unsigned long ll; \
99 ll=(c)->A; HOST_l2c(ll,(s)); \
100 ll=(c)->B; HOST_l2c(ll,(s)); \
101 ll=(c)->C; HOST_l2c(ll,(s)); \
102 ll=(c)->D; HOST_l2c(ll,(s)); \
103 ll=(c)->E; HOST_l2c(ll,(s)); \
104 } while (0)
105#if !defined(L_ENDIAN) || defined(ripemd160_block_data_order)
106#define HASH_BLOCK_DATA_ORDER ripemd160_block_data_order
107#endif
108
109#include "md32_common.h"
110
111#if 0
112#define F1(x,y,z) ((x)^(y)^(z))
113#define F2(x,y,z) (((x)&(y))|((~x)&z))
114#define F3(x,y,z) (((x)|(~y))^(z))
115#define F4(x,y,z) (((x)&(z))|((y)&(~(z))))
116#define F5(x,y,z) ((x)^((y)|(~(z))))
117#else
118/*
119 * Transformed F2 and F4 are courtesy of Wei Dai <weidai@eskimo.com>
120 */
121#define F1(x,y,z) ((x) ^ (y) ^ (z))
122#define F2(x,y,z) ((((y) ^ (z)) & (x)) ^ (z))
123#define F3(x,y,z) (((~(y)) | (x)) ^ (z))
124#define F4(x,y,z) ((((x) ^ (y)) & (z)) ^ (y))
125#define F5(x,y,z) (((~(z)) | (y)) ^ (x))
126#endif
127
128#define RIPEMD160_A 0x67452301L
129#define RIPEMD160_B 0xEFCDAB89L
130#define RIPEMD160_C 0x98BADCFEL
131#define RIPEMD160_D 0x10325476L
132#define RIPEMD160_E 0xC3D2E1F0L
133
134#include "rmdconst.h"
135
136#define RIP1(a,b,c,d,e,w,s) { \
137 a+=F1(b,c,d)+X(w); \
138 a=ROTATE(a,s)+e; \
139 c=ROTATE(c,10); }
140
141#define RIP2(a,b,c,d,e,w,s,K) { \
142 a+=F2(b,c,d)+X(w)+K; \
143 a=ROTATE(a,s)+e; \
144 c=ROTATE(c,10); }
145
146#define RIP3(a,b,c,d,e,w,s,K) { \
147 a+=F3(b,c,d)+X(w)+K; \
148 a=ROTATE(a,s)+e; \
149 c=ROTATE(c,10); }
150
151#define RIP4(a,b,c,d,e,w,s,K) { \
152 a+=F4(b,c,d)+X(w)+K; \
153 a=ROTATE(a,s)+e; \
154 c=ROTATE(c,10); }
155
156#define RIP5(a,b,c,d,e,w,s,K) { \
157 a+=F5(b,c,d)+X(w)+K; \
158 a=ROTATE(a,s)+e; \
159 c=ROTATE(c,10); }
160
diff --git a/src/lib/libcrypto/ripemd/rmd_one.c b/src/lib/libcrypto/ripemd/rmd_one.c
deleted file mode 100644
index f8b580c33a..0000000000
--- a/src/lib/libcrypto/ripemd/rmd_one.c
+++ /dev/null
@@ -1,77 +0,0 @@
1/* crypto/ripemd/rmd_one.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <string.h>
61#include <openssl/ripemd.h>
62#include <openssl/crypto.h>
63
64unsigned char *RIPEMD160(const unsigned char *d, unsigned long n,
65 unsigned char *md)
66 {
67 RIPEMD160_CTX c;
68 static unsigned char m[RIPEMD160_DIGEST_LENGTH];
69
70 if (md == NULL) md=m;
71 RIPEMD160_Init(&c);
72 RIPEMD160_Update(&c,d,n);
73 RIPEMD160_Final(md,&c);
74 OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
75 return(md);
76 }
77
diff --git a/src/lib/libcrypto/ripemd/rmdconst.h b/src/lib/libcrypto/ripemd/rmdconst.h
deleted file mode 100644
index 59c48dead1..0000000000
--- a/src/lib/libcrypto/ripemd/rmdconst.h
+++ /dev/null
@@ -1,399 +0,0 @@
1/* crypto/ripemd/rmdconst.h */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58#define KL0 0x00000000L
59#define KL1 0x5A827999L
60#define KL2 0x6ED9EBA1L
61#define KL3 0x8F1BBCDCL
62#define KL4 0xA953FD4EL
63
64#define KR0 0x50A28BE6L
65#define KR1 0x5C4DD124L
66#define KR2 0x6D703EF3L
67#define KR3 0x7A6D76E9L
68#define KR4 0x00000000L
69
70#define WL00 0
71#define SL00 11
72#define WL01 1
73#define SL01 14
74#define WL02 2
75#define SL02 15
76#define WL03 3
77#define SL03 12
78#define WL04 4
79#define SL04 5
80#define WL05 5
81#define SL05 8
82#define WL06 6
83#define SL06 7
84#define WL07 7
85#define SL07 9
86#define WL08 8
87#define SL08 11
88#define WL09 9
89#define SL09 13
90#define WL10 10
91#define SL10 14
92#define WL11 11
93#define SL11 15
94#define WL12 12
95#define SL12 6
96#define WL13 13
97#define SL13 7
98#define WL14 14
99#define SL14 9
100#define WL15 15
101#define SL15 8
102
103#define WL16 7
104#define SL16 7
105#define WL17 4
106#define SL17 6
107#define WL18 13
108#define SL18 8
109#define WL19 1
110#define SL19 13
111#define WL20 10
112#define SL20 11
113#define WL21 6
114#define SL21 9
115#define WL22 15
116#define SL22 7
117#define WL23 3
118#define SL23 15
119#define WL24 12
120#define SL24 7
121#define WL25 0
122#define SL25 12
123#define WL26 9
124#define SL26 15
125#define WL27 5
126#define SL27 9
127#define WL28 2
128#define SL28 11
129#define WL29 14
130#define SL29 7
131#define WL30 11
132#define SL30 13
133#define WL31 8
134#define SL31 12
135
136#define WL32 3
137#define SL32 11
138#define WL33 10
139#define SL33 13
140#define WL34 14
141#define SL34 6
142#define WL35 4
143#define SL35 7
144#define WL36 9
145#define SL36 14
146#define WL37 15
147#define SL37 9
148#define WL38 8
149#define SL38 13
150#define WL39 1
151#define SL39 15
152#define WL40 2
153#define SL40 14
154#define WL41 7
155#define SL41 8
156#define WL42 0
157#define SL42 13
158#define WL43 6
159#define SL43 6
160#define WL44 13
161#define SL44 5
162#define WL45 11
163#define SL45 12
164#define WL46 5
165#define SL46 7
166#define WL47 12
167#define SL47 5
168
169#define WL48 1
170#define SL48 11
171#define WL49 9
172#define SL49 12
173#define WL50 11
174#define SL50 14
175#define WL51 10
176#define SL51 15
177#define WL52 0
178#define SL52 14
179#define WL53 8
180#define SL53 15
181#define WL54 12
182#define SL54 9
183#define WL55 4
184#define SL55 8
185#define WL56 13
186#define SL56 9
187#define WL57 3
188#define SL57 14
189#define WL58 7
190#define SL58 5
191#define WL59 15
192#define SL59 6
193#define WL60 14
194#define SL60 8
195#define WL61 5
196#define SL61 6
197#define WL62 6
198#define SL62 5
199#define WL63 2
200#define SL63 12
201
202#define WL64 4
203#define SL64 9
204#define WL65 0
205#define SL65 15
206#define WL66 5
207#define SL66 5
208#define WL67 9
209#define SL67 11
210#define WL68 7
211#define SL68 6
212#define WL69 12
213#define SL69 8
214#define WL70 2
215#define SL70 13
216#define WL71 10
217#define SL71 12
218#define WL72 14
219#define SL72 5
220#define WL73 1
221#define SL73 12
222#define WL74 3
223#define SL74 13
224#define WL75 8
225#define SL75 14
226#define WL76 11
227#define SL76 11
228#define WL77 6
229#define SL77 8
230#define WL78 15
231#define SL78 5
232#define WL79 13
233#define SL79 6
234
235#define WR00 5
236#define SR00 8
237#define WR01 14
238#define SR01 9
239#define WR02 7
240#define SR02 9
241#define WR03 0
242#define SR03 11
243#define WR04 9
244#define SR04 13
245#define WR05 2
246#define SR05 15
247#define WR06 11
248#define SR06 15
249#define WR07 4
250#define SR07 5
251#define WR08 13
252#define SR08 7
253#define WR09 6
254#define SR09 7
255#define WR10 15
256#define SR10 8
257#define WR11 8
258#define SR11 11
259#define WR12 1
260#define SR12 14
261#define WR13 10
262#define SR13 14
263#define WR14 3
264#define SR14 12
265#define WR15 12
266#define SR15 6
267
268#define WR16 6
269#define SR16 9
270#define WR17 11
271#define SR17 13
272#define WR18 3
273#define SR18 15
274#define WR19 7
275#define SR19 7
276#define WR20 0
277#define SR20 12
278#define WR21 13
279#define SR21 8
280#define WR22 5
281#define SR22 9
282#define WR23 10
283#define SR23 11
284#define WR24 14
285#define SR24 7
286#define WR25 15
287#define SR25 7
288#define WR26 8
289#define SR26 12
290#define WR27 12
291#define SR27 7
292#define WR28 4
293#define SR28 6
294#define WR29 9
295#define SR29 15
296#define WR30 1
297#define SR30 13
298#define WR31 2
299#define SR31 11
300
301#define WR32 15
302#define SR32 9
303#define WR33 5
304#define SR33 7
305#define WR34 1
306#define SR34 15
307#define WR35 3
308#define SR35 11
309#define WR36 7
310#define SR36 8
311#define WR37 14
312#define SR37 6
313#define WR38 6
314#define SR38 6
315#define WR39 9
316#define SR39 14
317#define WR40 11
318#define SR40 12
319#define WR41 8
320#define SR41 13
321#define WR42 12
322#define SR42 5
323#define WR43 2
324#define SR43 14
325#define WR44 10
326#define SR44 13
327#define WR45 0
328#define SR45 13
329#define WR46 4
330#define SR46 7
331#define WR47 13
332#define SR47 5
333
334#define WR48 8
335#define SR48 15
336#define WR49 6
337#define SR49 5
338#define WR50 4
339#define SR50 8
340#define WR51 1
341#define SR51 11
342#define WR52 3
343#define SR52 14
344#define WR53 11
345#define SR53 14
346#define WR54 15
347#define SR54 6
348#define WR55 0
349#define SR55 14
350#define WR56 5
351#define SR56 6
352#define WR57 12
353#define SR57 9
354#define WR58 2
355#define SR58 12
356#define WR59 13
357#define SR59 9
358#define WR60 9
359#define SR60 12
360#define WR61 7
361#define SR61 5
362#define WR62 10
363#define SR62 15
364#define WR63 14
365#define SR63 8
366
367#define WR64 12
368#define SR64 8
369#define WR65 15
370#define SR65 5
371#define WR66 10
372#define SR66 12
373#define WR67 4
374#define SR67 9
375#define WR68 1
376#define SR68 12
377#define WR69 5
378#define SR69 5
379#define WR70 8
380#define SR70 14
381#define WR71 7
382#define SR71 6
383#define WR72 6
384#define SR72 8
385#define WR73 2
386#define SR73 13
387#define WR74 13
388#define SR74 6
389#define WR75 14
390#define SR75 5
391#define WR76 0
392#define SR76 15
393#define WR77 3
394#define SR77 13
395#define WR78 9
396#define SR78 11
397#define WR79 11
398#define SR79 11
399