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.pl582
-rw-r--r--src/lib/libcrypto/ripemd/ripemd.h94
-rw-r--r--src/lib/libcrypto/ripemd/rmd_dgst.c515
-rw-r--r--src/lib/libcrypto/ripemd/rmd_locl.h222
-rw-r--r--src/lib/libcrypto/ripemd/rmd_one.c75
-rw-r--r--src/lib/libcrypto/ripemd/rmdconst.h399
7 files changed, 0 insertions, 1902 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 e53c5fadba..0000000000
--- a/src/lib/libcrypto/ripemd/asm/rmd-586.pl
+++ /dev/null
@@ -1,582 +0,0 @@
1#!/usr/local/bin/perl
2
3# Normal is the
4# ripemd160_block_x86(MD5_CTX *c, ULONG *X);
5# version, non-normal is the
6# ripemd160_block_x86(MD5_CTX *c, ULONG *X,int blocks);
7
8$normal=0;
9
10push(@INC,"perlasm","../../perlasm");
11require "x86asm.pl";
12
13&asm_init($ARGV[0],$0);
14
15$A="eax";
16$B="ebx";
17$C="ecx";
18$D="edx";
19$E="ebp";
20$tmp1="esi";
21$tmp2="edi";
22
23$KL1=0x5A827999;
24$KL2=0x6ED9EBA1;
25$KL3=0x8F1BBCDC;
26$KL4=0xA953FD4E;
27$KR0=0x50A28BE6;
28$KR1=0x5C4DD124;
29$KR2=0x6D703EF3;
30$KR3=0x7A6D76E9;
31
32
33@wl=( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,
34 7, 4,13, 1,10, 6,15, 3,12, 0, 9, 5, 2,14,11, 8,
35 3,10,14, 4, 9,15, 8, 1, 2, 7, 0, 6,13,11, 5,12,
36 1, 9,11,10, 0, 8,12, 4,13, 3, 7,15,14, 5, 6, 2,
37 4, 0, 5, 9, 7,12, 2,10,14, 1, 3, 8,11, 6,15,13,
38 );
39
40@wr=( 5,14, 7, 0, 9, 2,11, 4,13, 6,15, 8, 1,10, 3,12,
41 6,11, 3, 7, 0,13, 5,10,14,15, 8,12, 4, 9, 1, 2,
42 15, 5, 1, 3, 7,14, 6, 9,11, 8,12, 2,10, 0, 4,13,
43 8, 6, 4, 1, 3,11,15, 0, 5,12, 2,13, 9, 7,10,14,
44 12,15,10, 4, 1, 5, 8, 7, 6, 2,13,14, 0, 3, 9,11,
45 );
46
47@sl=( 11,14,15,12, 5, 8, 7, 9,11,13,14,15, 6, 7, 9, 8,
48 7, 6, 8,13,11, 9, 7,15, 7,12,15, 9,11, 7,13,12,
49 11,13, 6, 7,14, 9,13,15,14, 8,13, 6, 5,12, 7, 5,
50 11,12,14,15,14,15, 9, 8, 9,14, 5, 6, 8, 6, 5,12,
51 9,15, 5,11, 6, 8,13,12, 5,12,13,14,11, 8, 5, 6,
52 );
53
54@sr=( 8, 9, 9,11,13,15,15, 5, 7, 7, 8,11,14,14,12, 6,
55 9,13,15, 7,12, 8, 9,11, 7, 7,12, 7, 6,15,13,11,
56 9, 7,15,11, 8, 6, 6,14,12,13, 5,14,13,13, 7, 5,
57 15, 5, 8,11,14,14, 6,14, 6, 9,12, 9,12, 5,15, 8,
58 8, 5,12, 9,12, 5,14, 6, 8,13, 6, 5,15,13,11,11,
59 );
60
61&ripemd160_block("ripemd160_block_x86");
62&asm_finish();
63
64sub Xv
65 {
66 local($n)=@_;
67 return(&swtmp($n+1));
68 # tmp on stack
69 }
70
71sub Np
72 {
73 local($p)=@_;
74 local(%n)=($A,$E,$B,$A,$C,$B,$D,$C,$E,$D);
75 return($n{$p});
76 }
77
78sub RIP1
79 {
80 local($a,$b,$c,$d,$e,$pos,$s,$o,$pos2)=@_;
81
82 &comment($p++);
83 if ($p & 1)
84 {
85 &mov($tmp1, $c) if $o == -1;
86 &xor($tmp1, $d) if $o == -1;
87 &mov($tmp2, &Xv($pos));
88 &xor($tmp1, $b);
89 &add($a, $tmp2);
90 &rotl($c, 10);
91 &add($a, $tmp1);
92 &mov($tmp1, &Np($c)); # NEXT
93 # XXX
94 &rotl($a, $s);
95 &add($a, $e);
96 }
97 else
98 {
99 &xor($tmp1, $d);
100 &mov($tmp2, &Xv($pos));
101 &xor($tmp1, $b);
102 &add($a, $tmp1);
103 &mov($tmp1, &Np($c)) if $o <= 0;
104 &mov($tmp1, -1) if $o == 1;
105 # XXX if $o == 2;
106 &rotl($c, 10);
107 &add($a, $tmp2);
108 &xor($tmp1, &Np($d)) if $o <= 0;
109 &mov($tmp2, &Xv($pos2)) if $o == 1;
110 &mov($tmp2, &wparam(0)) if $o == 2;
111 &rotl($a, $s);
112 &add($a, $e);
113 }
114 }
115
116sub RIP2
117 {
118 local($a,$b,$c,$d,$e,$pos,$pos2,$s,$K,$o)=@_;
119
120# XXXXXX
121 &comment($p++);
122 if ($p & 1)
123 {
124# &mov($tmp2, &Xv($pos)) if $o < -1;
125# &mov($tmp1, -1) if $o < -1;
126
127 &add($a, $tmp2);
128 &mov($tmp2, $c);
129 &sub($tmp1, $b);
130 &and($tmp2, $b);
131 &and($tmp1, $d);
132 &or($tmp2, $tmp1);
133 &mov($tmp1, &Xv($pos2)) if $o <= 0; # XXXXXXXXXXXXXX
134 # XXX
135 &rotl($c, 10);
136 &lea($a, &DWP($K,$a,$tmp2,1));
137 &mov($tmp2, -1) if $o <= 0;
138 # XXX
139 &rotl($a, $s);
140 &add($a, $e);
141 }
142 else
143 {
144 # XXX
145 &add($a, $tmp1);
146 &mov($tmp1, $c);
147 &sub($tmp2, $b);
148 &and($tmp1, $b);
149 &and($tmp2, $d);
150 if ($o != 2)
151 {
152 &or($tmp1, $tmp2);
153 &mov($tmp2, &Xv($pos2)) if $o <= 0;
154 &mov($tmp2, -1) if $o == 1;
155 &rotl($c, 10);
156 &lea($a, &DWP($K,$a,$tmp1,1));
157 &mov($tmp1, -1) if $o <= 0;
158 &sub($tmp2, &Np($c)) if $o == 1;
159 } else {
160 &or($tmp2, $tmp1);
161 &mov($tmp1, &Np($c));
162 &rotl($c, 10);
163 &lea($a, &DWP($K,$a,$tmp2,1));
164 &xor($tmp1, &Np($d));
165 }
166 &rotl($a, $s);
167 &add($a, $e);
168 }
169 }
170
171sub RIP3
172 {
173 local($a,$b,$c,$d,$e,$pos,$s,$K,$o,$pos2)=@_;
174
175 &comment($p++);
176 if ($p & 1)
177 {
178# &mov($tmp2, -1) if $o < -1;
179# &sub($tmp2, $c) if $o < -1;
180 &mov($tmp1, &Xv($pos));
181 &or($tmp2, $b);
182 &add($a, $tmp1);
183 &xor($tmp2, $d);
184 &mov($tmp1, -1) if $o <= 0; # NEXT
185 # XXX
186 &rotl($c, 10);
187 &lea($a, &DWP($K,$a,$tmp2,1));
188 &sub($tmp1, &Np($c)) if $o <= 0; # NEXT
189 # XXX
190 &rotl($a, $s);
191 &add($a, $e);
192 }
193 else
194 {
195 &mov($tmp2, &Xv($pos));
196 &or($tmp1, $b);
197 &add($a, $tmp2);
198 &xor($tmp1, $d);
199 &mov($tmp2, -1) if $o <= 0; # NEXT
200 &mov($tmp2, -1) if $o == 1;
201 &mov($tmp2, &Xv($pos2)) if $o == 2;
202 &rotl($c, 10);
203 &lea($a, &DWP($K,$a,$tmp1,1));
204 &sub($tmp2, &Np($c)) if $o <= 0; # NEXT
205 &mov($tmp1, &Np($d)) if $o == 1;
206 &mov($tmp1, -1) if $o == 2;
207 &rotl($a, $s);
208 &add($a, $e);
209 }
210 }
211
212sub RIP4
213 {
214 local($a,$b,$c,$d,$e,$pos,$s,$K,$o)=@_;
215
216 &comment($p++);
217 if ($p & 1)
218 {
219# &mov($tmp2, -1) if $o == -2;
220# &mov($tmp1, $d) if $o == -2;
221 &sub($tmp2, $d);
222 &and($tmp1, $b);
223 &and($tmp2, $c);
224 &or($tmp2, $tmp1);
225 &mov($tmp1, &Xv($pos));
226 &rotl($c, 10);
227 &lea($a, &DWP($K,$a,$tmp2));
228 &mov($tmp2, -1) unless $o > 0; # NEXT
229 # XXX
230 &add($a, $tmp1);
231 &mov($tmp1, &Np($d)) unless $o > 0; # NEXT
232 # XXX
233 &rotl($a, $s);
234 &add($a, $e);
235 }
236 else
237 {
238 &sub($tmp2, $d);
239 &and($tmp1, $b);
240 &and($tmp2, $c);
241 &or($tmp2, $tmp1);
242 &mov($tmp1, &Xv($pos));
243 &rotl($c, 10);
244 &lea($a, &DWP($K,$a,$tmp2));
245 &mov($tmp2, -1) if $o == 0; # NEXT
246 &mov($tmp2, -1) if $o == 1;
247 &mov($tmp2, -1) if $o == 2;
248 # XXX
249 &add($a, $tmp1);
250 &mov($tmp1, &Np($d)) if $o == 0; # NEXT
251 &sub($tmp2, &Np($d)) if $o == 1;
252 &sub($tmp2, &Np($c)) if $o == 2;
253 # XXX
254 &rotl($a, $s);
255 &add($a, $e);
256 }
257 }
258
259sub RIP5
260 {
261 local($a,$b,$c,$d,$e,$pos,$s,$K,$o)=@_;
262
263 &comment($p++);
264 if ($p & 1)
265 {
266 &mov($tmp2, -1) if $o == -2;
267 &sub($tmp2, $d) if $o == -2;
268 &mov($tmp1, &Xv($pos));
269 &or($tmp2, $c);
270 &add($a, $tmp1);
271 &xor($tmp2, $b);
272 &mov($tmp1, -1) if $o <= 0;
273 # XXX
274 &rotl($c, 10);
275 &lea($a, &DWP($K,$a,$tmp2,1));
276 &sub($tmp1, &Np($d)) if $o <= 0;
277 # XXX
278 &rotl($a, $s);
279 &add($a, $e);
280 }
281 else
282 {
283 &mov($tmp2, &Xv($pos));
284 &or($tmp1, $c);
285 &add($a, $tmp2);
286 &xor($tmp1, $b);
287 &mov($tmp2, -1) if $o <= 0;
288 &mov($tmp2, &wparam(0)) if $o == 1; # Middle code
289 &mov($tmp2, -1) if $o == 2;
290 &rotl($c, 10);
291 &lea($a, &DWP($K,$a,$tmp1,1));
292 &sub($tmp2, &Np($d)) if $o <= 0;
293 &mov(&swtmp(1+16), $A) if $o == 1;
294 &mov($tmp1, &Np($d)) if $o == 2;
295 &rotl($a, $s);
296 &add($a, $e);
297 }
298 }
299
300sub ripemd160_block
301 {
302 local($name)=@_;
303
304 &function_begin_B($name,"",3);
305
306 # parameter 1 is the RIPEMD160_CTX structure.
307 # A 0
308 # B 4
309 # C 8
310 # D 12
311 # E 16
312
313 &push("esi");
314 &mov($C, &wparam(2));
315 &push("edi");
316 &mov($tmp1, &wparam(1)); # edi
317 &push("ebp");
318 &add($C, $tmp1); # offset we end at
319 &push("ebx");
320 &sub($C, 64);
321 &stack_push(16+5+1);
322 # XXX
323
324 &mov(&swtmp(0), $C);
325 &mov($tmp2, &wparam(0)); # Done at end of loop
326
327 &set_label("start") unless $normal;
328 &comment("");
329
330 # &mov($tmp1, &wparam(1)); # Done at end of loop
331 # &mov($tmp2, &wparam(0)); # Done at end of loop
332
333 for ($z=0; $z<16; $z+=2)
334 {
335 &mov($A, &DWP( $z*4,$tmp1,"",0));
336 &mov($B, &DWP( ($z+1)*4,$tmp1,"",0));
337 &mov(&swtmp(1+$z), $A);
338 &mov(&swtmp(1+$z+1), $B);
339 }
340 &add($tmp1, 64);
341 &mov($A, &DWP( 0,$tmp2,"",0));
342 &mov(&wparam(1),$tmp1);
343 &mov($B, &DWP( 4,$tmp2,"",0));
344 &mov($C, &DWP( 8,$tmp2,"",0));
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(1+16), $A);
435 &mov($A, &DWP( 0,$tmp2,"",0));
436 &mov(&swtmp(1+17), $B);
437 &mov(&swtmp(1+18), $C);
438 &mov($B, &DWP( 4,$tmp2,"",0));
439 &mov(&swtmp(1+19), $D);
440 &mov($C, &DWP( 8,$tmp2,"",0));
441 &mov(&swtmp(1+20), $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(1+18)); # $c
535 &add($D, $tmp1);
536
537 &mov($tmp1, &DWP( 8,$tmp2,"",0)); # ctx->C
538 &add($E, $tmp1);
539 &mov($tmp1, &swtmp(1+19)); # $d
540 &add($E, $tmp1);
541
542 &mov($tmp1, &DWP(12,$tmp2,"",0)); # ctx->D
543 &add($A, $tmp1);
544 &mov($tmp1, &swtmp(1+20)); # $e
545 &add($A, $tmp1);
546
547
548 &mov($tmp1, &DWP(16,$tmp2,"",0)); # ctx->E
549 &add($B, $tmp1);
550 &mov($tmp1, &swtmp(1+16)); # $a
551 &add($B, $tmp1);
552
553 &mov($tmp1, &DWP( 0,$tmp2,"",0)); # ctx->A
554 &add($C, $tmp1);
555 &mov($tmp1, &swtmp(1+17)); # $b
556 &add($C, $tmp1);
557
558 &mov(&DWP( 0,$tmp2,"",0), $D);
559 &mov(&DWP( 4,$tmp2,"",0), $E);
560 &mov(&DWP( 8,$tmp2,"",0), $A);
561 &mov(&DWP(12,$tmp2,"",0), $B);
562 &mov(&DWP(16,$tmp2,"",0), $C);
563
564 &mov($tmp2, &swtmp(0));
565 &mov($tmp1, &wparam(1));
566
567 &cmp($tmp2,$tmp1);
568 &mov($tmp2, &wparam(0));
569
570 # XXX
571 &jge(&label("start"));
572
573 &stack_pop(16+5+1);
574
575 &pop("ebx");
576 &pop("ebp");
577 &pop("edi");
578 &pop("esi");
579 &ret();
580 &function_end_B($name);
581 }
582
diff --git a/src/lib/libcrypto/ripemd/ripemd.h b/src/lib/libcrypto/ripemd/ripemd.h
deleted file mode 100644
index ab76be4c33..0000000000
--- a/src/lib/libcrypto/ripemd/ripemd.h
+++ /dev/null
@@ -1,94 +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#ifdef __cplusplus
63extern "C" {
64#endif
65
66#ifdef NO_RIPEMD
67#error RIPEMD is disabled.
68#endif
69
70#define RIPEMD160_CBLOCK 64
71#define RIPEMD160_LBLOCK 16
72#define RIPEMD160_BLOCK 16
73#define RIPEMD160_LAST_BLOCK 56
74#define RIPEMD160_LENGTH_BLOCK 8
75#define RIPEMD160_DIGEST_LENGTH 20
76
77typedef struct RIPEMD160state_st
78 {
79 unsigned long A,B,C,D,E;
80 unsigned long Nl,Nh;
81 unsigned long data[RIPEMD160_LBLOCK];
82 int num;
83 } RIPEMD160_CTX;
84
85void RIPEMD160_Init(RIPEMD160_CTX *c);
86void RIPEMD160_Update(RIPEMD160_CTX *c, unsigned char *data, unsigned long len);
87void RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);
88unsigned char *RIPEMD160(unsigned char *d, unsigned long n, unsigned char *md);
89void RIPEMD160_Transform(RIPEMD160_CTX *c, unsigned char *b);
90#ifdef __cplusplus
91}
92#endif
93
94#endif
diff --git a/src/lib/libcrypto/ripemd/rmd_dgst.c b/src/lib/libcrypto/ripemd/rmd_dgst.c
deleted file mode 100644
index b590856229..0000000000
--- a/src/lib/libcrypto/ripemd/rmd_dgst.c
+++ /dev/null
@@ -1,515 +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
63char *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
71void RIPEMD160_Init(RIPEMD160_CTX *c)
72 {
73 c->A=RIPEMD160_A;
74 c->B=RIPEMD160_B;
75 c->C=RIPEMD160_C;
76 c->D=RIPEMD160_D;
77 c->E=RIPEMD160_E;
78 c->Nl=0;
79 c->Nh=0;
80 c->num=0;
81 }
82
83void RIPEMD160_Update(RIPEMD160_CTX *c, register unsigned char *data,
84 unsigned long len)
85 {
86 register ULONG *p;
87 int sw,sc;
88 ULONG l;
89
90 if (len == 0) return;
91
92 l=(c->Nl+(len<<3))&0xffffffffL;
93 if (l < c->Nl) /* overflow */
94 c->Nh++;
95 c->Nh+=(len>>29);
96 c->Nl=l;
97
98 if (c->num != 0)
99 {
100 p=c->data;
101 sw=c->num>>2;
102 sc=c->num&0x03;
103
104 if ((c->num+len) >= RIPEMD160_CBLOCK)
105 {
106 l= p[sw];
107 p_c2l(data,l,sc);
108 p[sw++]=l;
109 for (; sw<RIPEMD160_LBLOCK; sw++)
110 {
111 c2l(data,l);
112 p[sw]=l;
113 }
114 len-=(RIPEMD160_CBLOCK-c->num);
115
116 ripemd160_block(c,p,64);
117 c->num=0;
118 /* drop through and do the rest */
119 }
120 else
121 {
122 int ew,ec;
123
124 c->num+=(int)len;
125 if ((sc+len) < 4) /* ugly, add char's to a word */
126 {
127 l= p[sw];
128 p_c2l_p(data,l,sc,len);
129 p[sw]=l;
130 }
131 else
132 {
133 ew=(c->num>>2);
134 ec=(c->num&0x03);
135 l= p[sw];
136 p_c2l(data,l,sc);
137 p[sw++]=l;
138 for (; sw < ew; sw++)
139 { c2l(data,l); p[sw]=l; }
140 if (ec)
141 {
142 c2l_p(data,l,ec);
143 p[sw]=l;
144 }
145 }
146 return;
147 }
148 }
149 /* we now can process the input data in blocks of RIPEMD160_CBLOCK
150 * chars and save the leftovers to c->data. */
151#ifdef L_ENDIAN
152 if ((((unsigned long)data)%sizeof(ULONG)) == 0)
153 {
154 sw=(int)len/RIPEMD160_CBLOCK;
155 if (sw > 0)
156 {
157 sw*=RIPEMD160_CBLOCK;
158 ripemd160_block(c,(ULONG *)data,sw);
159 data+=sw;
160 len-=sw;
161 }
162 }
163#endif
164 p=c->data;
165 while (len >= RIPEMD160_CBLOCK)
166 {
167#if defined(L_ENDIAN) || defined(B_ENDIAN)
168 if (p != (unsigned long *)data)
169 memcpy(p,data,RIPEMD160_CBLOCK);
170 data+=RIPEMD160_CBLOCK;
171#ifdef B_ENDIAN
172 for (sw=(RIPEMD160_LBLOCK/4); sw; sw--)
173 {
174 Endian_Reverse32(p[0]);
175 Endian_Reverse32(p[1]);
176 Endian_Reverse32(p[2]);
177 Endian_Reverse32(p[3]);
178 p+=4;
179 }
180#endif
181#else
182 for (sw=(RIPEMD160_LBLOCK/4); sw; sw--)
183 {
184 c2l(data,l); *(p++)=l;
185 c2l(data,l); *(p++)=l;
186 c2l(data,l); *(p++)=l;
187 c2l(data,l); *(p++)=l;
188 }
189#endif
190 p=c->data;
191 ripemd160_block(c,p,64);
192 len-=RIPEMD160_CBLOCK;
193 }
194 sc=(int)len;
195 c->num=sc;
196 if (sc)
197 {
198 sw=sc>>2; /* words to copy */
199#ifdef L_ENDIAN
200 p[sw]=0;
201 memcpy(p,data,sc);
202#else
203 sc&=0x03;
204 for ( ; sw; sw--)
205 { c2l(data,l); *(p++)=l; }
206 c2l_p(data,l,sc);
207 *p=l;
208#endif
209 }
210 }
211
212void RIPEMD160_Transform(RIPEMD160_CTX *c, unsigned char *b)
213 {
214 ULONG p[16];
215#if !defined(L_ENDIAN)
216 ULONG *q;
217 int i;
218#endif
219
220#if defined(B_ENDIAN) || defined(L_ENDIAN)
221 memcpy(p,b,64);
222#ifdef B_ENDIAN
223 q=p;
224 for (i=(RIPEMD160_LBLOCK/4); i; i--)
225 {
226 Endian_Reverse32(q[0]);
227 Endian_Reverse32(q[1]);
228 Endian_Reverse32(q[2]);
229 Endian_Reverse32(q[3]);
230 q+=4;
231 }
232#endif
233#else
234 q=p;
235 for (i=(RIPEMD160_LBLOCK/4); i; i--)
236 {
237 ULONG l;
238 c2l(b,l); *(q++)=l;
239 c2l(b,l); *(q++)=l;
240 c2l(b,l); *(q++)=l;
241 c2l(b,l); *(q++)=l;
242 }
243#endif
244 ripemd160_block(c,p,64);
245 }
246
247#ifndef RMD160_ASM
248
249void ripemd160_block(RIPEMD160_CTX *ctx, register ULONG *X, int num)
250 {
251 register ULONG A,B,C,D,E;
252 ULONG a,b,c,d,e;
253
254 for (;;)
255 {
256 A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E;
257
258 RIP1(A,B,C,D,E,WL00,SL00);
259 RIP1(E,A,B,C,D,WL01,SL01);
260 RIP1(D,E,A,B,C,WL02,SL02);
261 RIP1(C,D,E,A,B,WL03,SL03);
262 RIP1(B,C,D,E,A,WL04,SL04);
263 RIP1(A,B,C,D,E,WL05,SL05);
264 RIP1(E,A,B,C,D,WL06,SL06);
265 RIP1(D,E,A,B,C,WL07,SL07);
266 RIP1(C,D,E,A,B,WL08,SL08);
267 RIP1(B,C,D,E,A,WL09,SL09);
268 RIP1(A,B,C,D,E,WL10,SL10);
269 RIP1(E,A,B,C,D,WL11,SL11);
270 RIP1(D,E,A,B,C,WL12,SL12);
271 RIP1(C,D,E,A,B,WL13,SL13);
272 RIP1(B,C,D,E,A,WL14,SL14);
273 RIP1(A,B,C,D,E,WL15,SL15);
274
275 RIP2(E,A,B,C,D,WL16,SL16,KL1);
276 RIP2(D,E,A,B,C,WL17,SL17,KL1);
277 RIP2(C,D,E,A,B,WL18,SL18,KL1);
278 RIP2(B,C,D,E,A,WL19,SL19,KL1);
279 RIP2(A,B,C,D,E,WL20,SL20,KL1);
280 RIP2(E,A,B,C,D,WL21,SL21,KL1);
281 RIP2(D,E,A,B,C,WL22,SL22,KL1);
282 RIP2(C,D,E,A,B,WL23,SL23,KL1);
283 RIP2(B,C,D,E,A,WL24,SL24,KL1);
284 RIP2(A,B,C,D,E,WL25,SL25,KL1);
285 RIP2(E,A,B,C,D,WL26,SL26,KL1);
286 RIP2(D,E,A,B,C,WL27,SL27,KL1);
287 RIP2(C,D,E,A,B,WL28,SL28,KL1);
288 RIP2(B,C,D,E,A,WL29,SL29,KL1);
289 RIP2(A,B,C,D,E,WL30,SL30,KL1);
290 RIP2(E,A,B,C,D,WL31,SL31,KL1);
291
292 RIP3(D,E,A,B,C,WL32,SL32,KL2);
293 RIP3(C,D,E,A,B,WL33,SL33,KL2);
294 RIP3(B,C,D,E,A,WL34,SL34,KL2);
295 RIP3(A,B,C,D,E,WL35,SL35,KL2);
296 RIP3(E,A,B,C,D,WL36,SL36,KL2);
297 RIP3(D,E,A,B,C,WL37,SL37,KL2);
298 RIP3(C,D,E,A,B,WL38,SL38,KL2);
299 RIP3(B,C,D,E,A,WL39,SL39,KL2);
300 RIP3(A,B,C,D,E,WL40,SL40,KL2);
301 RIP3(E,A,B,C,D,WL41,SL41,KL2);
302 RIP3(D,E,A,B,C,WL42,SL42,KL2);
303 RIP3(C,D,E,A,B,WL43,SL43,KL2);
304 RIP3(B,C,D,E,A,WL44,SL44,KL2);
305 RIP3(A,B,C,D,E,WL45,SL45,KL2);
306 RIP3(E,A,B,C,D,WL46,SL46,KL2);
307 RIP3(D,E,A,B,C,WL47,SL47,KL2);
308
309 RIP4(C,D,E,A,B,WL48,SL48,KL3);
310 RIP4(B,C,D,E,A,WL49,SL49,KL3);
311 RIP4(A,B,C,D,E,WL50,SL50,KL3);
312 RIP4(E,A,B,C,D,WL51,SL51,KL3);
313 RIP4(D,E,A,B,C,WL52,SL52,KL3);
314 RIP4(C,D,E,A,B,WL53,SL53,KL3);
315 RIP4(B,C,D,E,A,WL54,SL54,KL3);
316 RIP4(A,B,C,D,E,WL55,SL55,KL3);
317 RIP4(E,A,B,C,D,WL56,SL56,KL3);
318 RIP4(D,E,A,B,C,WL57,SL57,KL3);
319 RIP4(C,D,E,A,B,WL58,SL58,KL3);
320 RIP4(B,C,D,E,A,WL59,SL59,KL3);
321 RIP4(A,B,C,D,E,WL60,SL60,KL3);
322 RIP4(E,A,B,C,D,WL61,SL61,KL3);
323 RIP4(D,E,A,B,C,WL62,SL62,KL3);
324 RIP4(C,D,E,A,B,WL63,SL63,KL3);
325
326 RIP5(B,C,D,E,A,WL64,SL64,KL4);
327 RIP5(A,B,C,D,E,WL65,SL65,KL4);
328 RIP5(E,A,B,C,D,WL66,SL66,KL4);
329 RIP5(D,E,A,B,C,WL67,SL67,KL4);
330 RIP5(C,D,E,A,B,WL68,SL68,KL4);
331 RIP5(B,C,D,E,A,WL69,SL69,KL4);
332 RIP5(A,B,C,D,E,WL70,SL70,KL4);
333 RIP5(E,A,B,C,D,WL71,SL71,KL4);
334 RIP5(D,E,A,B,C,WL72,SL72,KL4);
335 RIP5(C,D,E,A,B,WL73,SL73,KL4);
336 RIP5(B,C,D,E,A,WL74,SL74,KL4);
337 RIP5(A,B,C,D,E,WL75,SL75,KL4);
338 RIP5(E,A,B,C,D,WL76,SL76,KL4);
339 RIP5(D,E,A,B,C,WL77,SL77,KL4);
340 RIP5(C,D,E,A,B,WL78,SL78,KL4);
341 RIP5(B,C,D,E,A,WL79,SL79,KL4);
342
343 a=A; b=B; c=C; d=D; e=E;
344 /* Do other half */
345 A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E;
346
347 RIP5(A,B,C,D,E,WR00,SR00,KR0);
348 RIP5(E,A,B,C,D,WR01,SR01,KR0);
349 RIP5(D,E,A,B,C,WR02,SR02,KR0);
350 RIP5(C,D,E,A,B,WR03,SR03,KR0);
351 RIP5(B,C,D,E,A,WR04,SR04,KR0);
352 RIP5(A,B,C,D,E,WR05,SR05,KR0);
353 RIP5(E,A,B,C,D,WR06,SR06,KR0);
354 RIP5(D,E,A,B,C,WR07,SR07,KR0);
355 RIP5(C,D,E,A,B,WR08,SR08,KR0);
356 RIP5(B,C,D,E,A,WR09,SR09,KR0);
357 RIP5(A,B,C,D,E,WR10,SR10,KR0);
358 RIP5(E,A,B,C,D,WR11,SR11,KR0);
359 RIP5(D,E,A,B,C,WR12,SR12,KR0);
360 RIP5(C,D,E,A,B,WR13,SR13,KR0);
361 RIP5(B,C,D,E,A,WR14,SR14,KR0);
362 RIP5(A,B,C,D,E,WR15,SR15,KR0);
363
364 RIP4(E,A,B,C,D,WR16,SR16,KR1);
365 RIP4(D,E,A,B,C,WR17,SR17,KR1);
366 RIP4(C,D,E,A,B,WR18,SR18,KR1);
367 RIP4(B,C,D,E,A,WR19,SR19,KR1);
368 RIP4(A,B,C,D,E,WR20,SR20,KR1);
369 RIP4(E,A,B,C,D,WR21,SR21,KR1);
370 RIP4(D,E,A,B,C,WR22,SR22,KR1);
371 RIP4(C,D,E,A,B,WR23,SR23,KR1);
372 RIP4(B,C,D,E,A,WR24,SR24,KR1);
373 RIP4(A,B,C,D,E,WR25,SR25,KR1);
374 RIP4(E,A,B,C,D,WR26,SR26,KR1);
375 RIP4(D,E,A,B,C,WR27,SR27,KR1);
376 RIP4(C,D,E,A,B,WR28,SR28,KR1);
377 RIP4(B,C,D,E,A,WR29,SR29,KR1);
378 RIP4(A,B,C,D,E,WR30,SR30,KR1);
379 RIP4(E,A,B,C,D,WR31,SR31,KR1);
380
381 RIP3(D,E,A,B,C,WR32,SR32,KR2);
382 RIP3(C,D,E,A,B,WR33,SR33,KR2);
383 RIP3(B,C,D,E,A,WR34,SR34,KR2);
384 RIP3(A,B,C,D,E,WR35,SR35,KR2);
385 RIP3(E,A,B,C,D,WR36,SR36,KR2);
386 RIP3(D,E,A,B,C,WR37,SR37,KR2);
387 RIP3(C,D,E,A,B,WR38,SR38,KR2);
388 RIP3(B,C,D,E,A,WR39,SR39,KR2);
389 RIP3(A,B,C,D,E,WR40,SR40,KR2);
390 RIP3(E,A,B,C,D,WR41,SR41,KR2);
391 RIP3(D,E,A,B,C,WR42,SR42,KR2);
392 RIP3(C,D,E,A,B,WR43,SR43,KR2);
393 RIP3(B,C,D,E,A,WR44,SR44,KR2);
394 RIP3(A,B,C,D,E,WR45,SR45,KR2);
395 RIP3(E,A,B,C,D,WR46,SR46,KR2);
396 RIP3(D,E,A,B,C,WR47,SR47,KR2);
397
398 RIP2(C,D,E,A,B,WR48,SR48,KR3);
399 RIP2(B,C,D,E,A,WR49,SR49,KR3);
400 RIP2(A,B,C,D,E,WR50,SR50,KR3);
401 RIP2(E,A,B,C,D,WR51,SR51,KR3);
402 RIP2(D,E,A,B,C,WR52,SR52,KR3);
403 RIP2(C,D,E,A,B,WR53,SR53,KR3);
404 RIP2(B,C,D,E,A,WR54,SR54,KR3);
405 RIP2(A,B,C,D,E,WR55,SR55,KR3);
406 RIP2(E,A,B,C,D,WR56,SR56,KR3);
407 RIP2(D,E,A,B,C,WR57,SR57,KR3);
408 RIP2(C,D,E,A,B,WR58,SR58,KR3);
409 RIP2(B,C,D,E,A,WR59,SR59,KR3);
410 RIP2(A,B,C,D,E,WR60,SR60,KR3);
411 RIP2(E,A,B,C,D,WR61,SR61,KR3);
412 RIP2(D,E,A,B,C,WR62,SR62,KR3);
413 RIP2(C,D,E,A,B,WR63,SR63,KR3);
414
415 RIP1(B,C,D,E,A,WR64,SR64);
416 RIP1(A,B,C,D,E,WR65,SR65);
417 RIP1(E,A,B,C,D,WR66,SR66);
418 RIP1(D,E,A,B,C,WR67,SR67);
419 RIP1(C,D,E,A,B,WR68,SR68);
420 RIP1(B,C,D,E,A,WR69,SR69);
421 RIP1(A,B,C,D,E,WR70,SR70);
422 RIP1(E,A,B,C,D,WR71,SR71);
423 RIP1(D,E,A,B,C,WR72,SR72);
424 RIP1(C,D,E,A,B,WR73,SR73);
425 RIP1(B,C,D,E,A,WR74,SR74);
426 RIP1(A,B,C,D,E,WR75,SR75);
427 RIP1(E,A,B,C,D,WR76,SR76);
428 RIP1(D,E,A,B,C,WR77,SR77);
429 RIP1(C,D,E,A,B,WR78,SR78);
430 RIP1(B,C,D,E,A,WR79,SR79);
431
432 D =ctx->B+c+D;
433 ctx->B=ctx->C+d+E;
434 ctx->C=ctx->D+e+A;
435 ctx->D=ctx->E+a+B;
436 ctx->E=ctx->A+b+C;
437 ctx->A=D;
438
439 X+=16;
440 num-=64;
441 if (num <= 0) break;
442 }
443 }
444#endif
445
446void RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c)
447 {
448 register int i,j;
449 register ULONG l;
450 register ULONG *p;
451 static unsigned char end[4]={0x80,0x00,0x00,0x00};
452 unsigned char *cp=end;
453
454 /* c->num should definitly have room for at least one more byte. */
455 p=c->data;
456 j=c->num;
457 i=j>>2;
458
459 /* purify often complains about the following line as an
460 * Uninitialized Memory Read. While this can be true, the
461 * following p_c2l macro will reset l when that case is true.
462 * This is because j&0x03 contains the number of 'valid' bytes
463 * already in p[i]. If and only if j&0x03 == 0, the UMR will
464 * occur but this is also the only time p_c2l will do
465 * l= *(cp++) instead of l|= *(cp++)
466 * Many thanks to Alex Tang <altitude@cic.net> for pickup this
467 * 'potential bug' */
468#ifdef PURIFY
469 if ((j&0x03) == 0) p[i]=0;
470#endif
471 l=p[i];
472 p_c2l(cp,l,j&0x03);
473 p[i]=l;
474 i++;
475 /* i is the next 'undefined word' */
476 if (c->num >= RIPEMD160_LAST_BLOCK)
477 {
478 for (; i<RIPEMD160_LBLOCK; i++)
479 p[i]=0;
480 ripemd160_block(c,p,64);
481 i=0;
482 }
483 for (; i<(RIPEMD160_LBLOCK-2); i++)
484 p[i]=0;
485 p[RIPEMD160_LBLOCK-2]=c->Nl;
486 p[RIPEMD160_LBLOCK-1]=c->Nh;
487 ripemd160_block(c,p,64);
488 cp=md;
489 l=c->A; l2c(l,cp);
490 l=c->B; l2c(l,cp);
491 l=c->C; l2c(l,cp);
492 l=c->D; l2c(l,cp);
493 l=c->E; l2c(l,cp);
494
495 /* clear stuff, ripemd160_block may be leaving some stuff on the stack
496 * but I'm not worried :-) */
497 c->num=0;
498/* memset((char *)&c,0,sizeof(c));*/
499 }
500
501#ifdef undef
502int printit(unsigned long *l)
503 {
504 int i,ii;
505
506 for (i=0; i<2; i++)
507 {
508 for (ii=0; ii<8; ii++)
509 {
510 fprintf(stderr,"%08lx ",l[i*8+ii]);
511 }
512 fprintf(stderr,"\n");
513 }
514 }
515#endif
diff --git a/src/lib/libcrypto/ripemd/rmd_locl.h b/src/lib/libcrypto/ripemd/rmd_locl.h
deleted file mode 100644
index d6ba02001a..0000000000
--- a/src/lib/libcrypto/ripemd/rmd_locl.h
+++ /dev/null
@@ -1,222 +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/ripemd.h>
62
63#define ULONG unsigned long
64#define UCHAR unsigned char
65#define UINT unsigned int
66
67#undef c2nl
68#define c2nl(c,l) (l =(((unsigned long)(*((c)++)))<<24), \
69 l|=(((unsigned long)(*((c)++)))<<16), \
70 l|=(((unsigned long)(*((c)++)))<< 8), \
71 l|=(((unsigned long)(*((c)++))) ))
72
73#undef p_c2nl
74#define p_c2nl(c,l,n) { \
75 switch (n) { \
76 case 0: l =((unsigned long)(*((c)++)))<<24; \
77 case 1: l|=((unsigned long)(*((c)++)))<<16; \
78 case 2: l|=((unsigned long)(*((c)++)))<< 8; \
79 case 3: l|=((unsigned long)(*((c)++))); \
80 } \
81 }
82
83#undef c2nl_p
84/* NOTE the pointer is not incremented at the end of this */
85#define c2nl_p(c,l,n) { \
86 l=0; \
87 (c)+=n; \
88 switch (n) { \
89 case 3: l =((unsigned long)(*(--(c))))<< 8; \
90 case 2: l|=((unsigned long)(*(--(c))))<<16; \
91 case 1: l|=((unsigned long)(*(--(c))))<<24; \
92 } \
93 }
94
95#undef p_c2nl_p
96#define p_c2nl_p(c,l,sc,len) { \
97 switch (sc) \
98 { \
99 case 0: l =((unsigned long)(*((c)++)))<<24; \
100 if (--len == 0) break; \
101 case 1: l|=((unsigned long)(*((c)++)))<<16; \
102 if (--len == 0) break; \
103 case 2: l|=((unsigned long)(*((c)++)))<< 8; \
104 } \
105 }
106
107#undef nl2c
108#define nl2c(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \
109 *((c)++)=(unsigned char)(((l)>>16)&0xff), \
110 *((c)++)=(unsigned char)(((l)>> 8)&0xff), \
111 *((c)++)=(unsigned char)(((l) )&0xff))
112
113#undef c2l
114#define c2l(c,l) (l =(((unsigned long)(*((c)++))) ), \
115 l|=(((unsigned long)(*((c)++)))<< 8), \
116 l|=(((unsigned long)(*((c)++)))<<16), \
117 l|=(((unsigned long)(*((c)++)))<<24))
118
119#undef p_c2l
120#define p_c2l(c,l,n) { \
121 switch (n) { \
122 case 0: l =((unsigned long)(*((c)++))); \
123 case 1: l|=((unsigned long)(*((c)++)))<< 8; \
124 case 2: l|=((unsigned long)(*((c)++)))<<16; \
125 case 3: l|=((unsigned long)(*((c)++)))<<24; \
126 } \
127 }
128
129#undef c2l_p
130/* NOTE the pointer is not incremented at the end of this */
131#define c2l_p(c,l,n) { \
132 l=0; \
133 (c)+=n; \
134 switch (n) { \
135 case 3: l =((unsigned long)(*(--(c))))<<16; \
136 case 2: l|=((unsigned long)(*(--(c))))<< 8; \
137 case 1: l|=((unsigned long)(*(--(c)))); \
138 } \
139 }
140
141#undef p_c2l_p
142#define p_c2l_p(c,l,sc,len) { \
143 switch (sc) \
144 { \
145 case 0: l =((unsigned long)(*((c)++))); \
146 if (--len == 0) break; \
147 case 1: l|=((unsigned long)(*((c)++)))<< 8; \
148 if (--len == 0) break; \
149 case 2: l|=((unsigned long)(*((c)++)))<<16; \
150 } \
151 }
152
153#undef l2c
154#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
155 *((c)++)=(unsigned char)(((l)>> 8)&0xff), \
156 *((c)++)=(unsigned char)(((l)>>16)&0xff), \
157 *((c)++)=(unsigned char)(((l)>>24)&0xff))
158
159#undef ROTATE
160#if defined(WIN32)
161#define ROTATE(a,n) _lrotl(a,n)
162#else
163#define ROTATE(a,n) (((a)<<(n))|(((a)&0xffffffff)>>(32-(n))))
164#endif
165
166/* A nice byte order reversal from Wei Dai <weidai@eskimo.com> */
167#if defined(WIN32)
168/* 5 instructions with rotate instruction, else 9 */
169#define Endian_Reverse32(a) \
170 { \
171 unsigned long l=(a); \
172 (a)=((ROTATE(l,8)&0x00FF00FF)|(ROTATE(l,24)&0xFF00FF00)); \
173 }
174#else
175/* 6 instructions with rotate instruction, else 8 */
176#define Endian_Reverse32(a) \
177 { \
178 unsigned long l=(a); \
179 l=(((l&0xFF00FF00)>>8L)|((l&0x00FF00FF)<<8L)); \
180 (a)=ROTATE(l,16L); \
181 }
182#endif
183
184#define F1(x,y,z) ((x)^(y)^(z))
185#define F2(x,y,z) (((x)&(y))|((~x)&z))
186#define F3(x,y,z) (((x)|(~y))^(z))
187#define F4(x,y,z) (((x)&(z))|((y)&(~(z))))
188#define F5(x,y,z) ((x)^((y)|(~(z))))
189
190#define RIPEMD160_A 0x67452301L
191#define RIPEMD160_B 0xEFCDAB89L
192#define RIPEMD160_C 0x98BADCFEL
193#define RIPEMD160_D 0x10325476L
194#define RIPEMD160_E 0xC3D2E1F0L
195
196#include "rmdconst.h"
197
198#define RIP1(a,b,c,d,e,w,s) { \
199 a+=F1(b,c,d)+X[w]; \
200 a=ROTATE(a,s)+e; \
201 c=ROTATE(c,10); }
202
203#define RIP2(a,b,c,d,e,w,s,K) { \
204 a+=F2(b,c,d)+X[w]+K; \
205 a=ROTATE(a,s)+e; \
206 c=ROTATE(c,10); }
207
208#define RIP3(a,b,c,d,e,w,s,K) { \
209 a+=F3(b,c,d)+X[w]+K; \
210 a=ROTATE(a,s)+e; \
211 c=ROTATE(c,10); }
212
213#define RIP4(a,b,c,d,e,w,s,K) { \
214 a+=F4(b,c,d)+X[w]+K; \
215 a=ROTATE(a,s)+e; \
216 c=ROTATE(c,10); }
217
218#define RIP5(a,b,c,d,e,w,s,K) { \
219 a+=F5(b,c,d)+X[w]+K; \
220 a=ROTATE(a,s)+e; \
221 c=ROTATE(c,10); }
222
diff --git a/src/lib/libcrypto/ripemd/rmd_one.c b/src/lib/libcrypto/ripemd/rmd_one.c
deleted file mode 100644
index 5b6ff14714..0000000000
--- a/src/lib/libcrypto/ripemd/rmd_one.c
+++ /dev/null
@@ -1,75 +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 "rmd_locl.h"
61
62unsigned char *RIPEMD160(unsigned char *d, unsigned long n,
63 unsigned char *md)
64 {
65 RIPEMD160_CTX c;
66 static unsigned char m[RIPEMD160_DIGEST_LENGTH];
67
68 if (md == NULL) md=m;
69 RIPEMD160_Init(&c);
70 RIPEMD160_Update(&c,d,n);
71 RIPEMD160_Final(md,&c);
72 memset(&c,0,sizeof(c)); /* security consideration */
73 return(md);
74 }
75
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