summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ripemd
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2014-02-27 21:04:58 +0000
committercvs2svn <admin@example.com>2014-02-27 21:04:58 +0000
commit726818f36b5221c023cd04c4b90bdbc08e94cd96 (patch)
treecf8221f3aa5bf5a578ddf1ecf5677ad08c04d342 /src/lib/libcrypto/ripemd
parent3b6d92e82b1421b811bcdec7f7fdfb31eeef18de (diff)
downloadopenbsd-OPENBSD_5_5_BASE.tar.gz
openbsd-OPENBSD_5_5_BASE.tar.bz2
openbsd-OPENBSD_5_5_BASE.zip
This commit was manufactured by cvs2git to create tag 'OPENBSD_5_5_BASE'.OPENBSD_5_5_BASE
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.pl591
-rw-r--r--src/lib/libcrypto/ripemd/ripemd.h107
-rw-r--r--src/lib/libcrypto/ripemd/rmd_dgst.c292
-rw-r--r--src/lib/libcrypto/ripemd/rmd_locl.h150
-rw-r--r--src/lib/libcrypto/ripemd/rmd_one.c78
-rw-r--r--src/lib/libcrypto/ripemd/rmdconst.h399
7 files changed, 0 insertions, 1632 deletions
diff --git a/src/lib/libcrypto/ripemd/README b/src/lib/libcrypto/ripemd/README
deleted file mode 100644
index f1ffc8b134..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 believe 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 e8b2bc2db2..0000000000
--- a/src/lib/libcrypto/ripemd/asm/rmd-586.pl
+++ /dev/null
@@ -1,591 +0,0 @@
1#!/usr/local/bin/perl
2
3# Normal is the
4# ripemd160_block_asm_data_order(RIPEMD160_CTX *c, ULONG *X,int blocks);
5
6$normal=0;
7
8$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
9push(@INC,"${dir}","${dir}../../perlasm");
10require "x86asm.pl";
11
12&asm_init($ARGV[0],$0);
13
14$A="ecx";
15$B="esi";
16$C="edi";
17$D="ebx";
18$E="ebp";
19$tmp1="eax";
20$tmp2="edx";
21
22$KL1=0x5A827999;
23$KL2=0x6ED9EBA1;
24$KL3=0x8F1BBCDC;
25$KL4=0xA953FD4E;
26$KR0=0x50A28BE6;
27$KR1=0x5C4DD124;
28$KR2=0x6D703EF3;
29$KR3=0x7A6D76E9;
30
31
32@wl=( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,
33 7, 4,13, 1,10, 6,15, 3,12, 0, 9, 5, 2,14,11, 8,
34 3,10,14, 4, 9,15, 8, 1, 2, 7, 0, 6,13,11, 5,12,
35 1, 9,11,10, 0, 8,12, 4,13, 3, 7,15,14, 5, 6, 2,
36 4, 0, 5, 9, 7,12, 2,10,14, 1, 3, 8,11, 6,15,13,
37 );
38
39@wr=( 5,14, 7, 0, 9, 2,11, 4,13, 6,15, 8, 1,10, 3,12,
40 6,11, 3, 7, 0,13, 5,10,14,15, 8,12, 4, 9, 1, 2,
41 15, 5, 1, 3, 7,14, 6, 9,11, 8,12, 2,10, 0, 4,13,
42 8, 6, 4, 1, 3,11,15, 0, 5,12, 2,13, 9, 7,10,14,
43 12,15,10, 4, 1, 5, 8, 7, 6, 2,13,14, 0, 3, 9,11,
44 );
45
46@sl=( 11,14,15,12, 5, 8, 7, 9,11,13,14,15, 6, 7, 9, 8,
47 7, 6, 8,13,11, 9, 7,15, 7,12,15, 9,11, 7,13,12,
48 11,13, 6, 7,14, 9,13,15,14, 8,13, 6, 5,12, 7, 5,
49 11,12,14,15,14,15, 9, 8, 9,14, 5, 6, 8, 6, 5,12,
50 9,15, 5,11, 6, 8,13,12, 5,12,13,14,11, 8, 5, 6,
51 );
52
53@sr=( 8, 9, 9,11,13,15,15, 5, 7, 7, 8,11,14,14,12, 6,
54 9,13,15, 7,12, 8, 9,11, 7, 7,12, 7, 6,15,13,11,
55 9, 7,15,11, 8, 6, 6,14,12,13, 5,14,13,13, 7, 5,
56 15, 5, 8,11,14,14, 6,14, 6, 9,12, 9,12, 5,15, 8,
57 8, 5,12, 9,12, 5,14, 6, 8,13, 6, 5,15,13,11,11,
58 );
59
60&ripemd160_block("ripemd160_block_asm_data_order");
61&asm_finish();
62
63sub Xv
64 {
65 local($n)=@_;
66 return(&swtmp($n));
67 # tmp on stack
68 }
69
70sub Np
71 {
72 local($p)=@_;
73 local(%n)=($A,$E,$B,$A,$C,$B,$D,$C,$E,$D);
74 return($n{$p});
75 }
76
77sub RIP1
78 {
79 local($a,$b,$c,$d,$e,$pos,$s,$o,$pos2)=@_;
80
81 &comment($p++);
82 if ($p & 1)
83 {
84 #&mov($tmp1, $c) if $o == -1;
85 &xor($tmp1, $d) if $o == -1;
86 &mov($tmp2, &Xv($pos));
87 &xor($tmp1, $b);
88 &add($a, $tmp2);
89 &rotl($c, 10);
90 &add($a, $tmp1);
91 &mov($tmp1, &Np($c)); # NEXT
92 # XXX
93 &rotl($a, $s);
94 &add($a, $e);
95 }
96 else
97 {
98 &xor($tmp1, $d);
99 &mov($tmp2, &Xv($pos));
100 &xor($tmp1, $b);
101 &add($a, $tmp1);
102 &mov($tmp1, &Np($c)) if $o <= 0;
103 &mov($tmp1, -1) if $o == 1;
104 # XXX if $o == 2;
105 &rotl($c, 10);
106 &add($a, $tmp2);
107 &xor($tmp1, &Np($d)) if $o <= 0;
108 &mov($tmp2, &Xv($pos2)) if $o == 1;
109 &mov($tmp2, &wparam(0)) if $o == 2;
110 &rotl($a, $s);
111 &add($a, $e);
112 }
113 }
114
115sub RIP2
116 {
117 local($a,$b,$c,$d,$e,$pos,$pos2,$s,$K,$o)=@_;
118
119# XXXXXX
120 &comment($p++);
121 if ($p & 1)
122 {
123# &mov($tmp2, &Xv($pos)) if $o < -1;
124# &mov($tmp1, -1) if $o < -1;
125
126 &add($a, $tmp2);
127 &mov($tmp2, $c);
128 &sub($tmp1, $b);
129 &and($tmp2, $b);
130 &and($tmp1, $d);
131 &or($tmp2, $tmp1);
132 &mov($tmp1, &Xv($pos2)) if $o <= 0; # XXXXXXXXXXXXXX
133 # XXX
134 &rotl($c, 10);
135 &lea($a, &DWP($K,$a,$tmp2,1));
136 &mov($tmp2, -1) if $o <= 0;
137 # XXX
138 &rotl($a, $s);
139 &add($a, $e);
140 }
141 else
142 {
143 # XXX
144 &add($a, $tmp1);
145 &mov($tmp1, $c);
146 &sub($tmp2, $b);
147 &and($tmp1, $b);
148 &and($tmp2, $d);
149 if ($o != 2)
150 {
151 &or($tmp1, $tmp2);
152 &mov($tmp2, &Xv($pos2)) if $o <= 0;
153 &mov($tmp2, -1) if $o == 1;
154 &rotl($c, 10);
155 &lea($a, &DWP($K,$a,$tmp1,1));
156 &mov($tmp1, -1) if $o <= 0;
157 &sub($tmp2, &Np($c)) if $o == 1;
158 } else {
159 &or($tmp2, $tmp1);
160 &mov($tmp1, &Np($c));
161 &rotl($c, 10);
162 &lea($a, &DWP($K,$a,$tmp2,1));
163 &xor($tmp1, &Np($d));
164 }
165 &rotl($a, $s);
166 &add($a, $e);
167 }
168 }
169
170sub RIP3
171 {
172 local($a,$b,$c,$d,$e,$pos,$s,$K,$o,$pos2)=@_;
173
174 &comment($p++);
175 if ($p & 1)
176 {
177# &mov($tmp2, -1) if $o < -1;
178# &sub($tmp2, $c) if $o < -1;
179 &mov($tmp1, &Xv($pos));
180 &or($tmp2, $b);
181 &add($a, $tmp1);
182 &xor($tmp2, $d);
183 &mov($tmp1, -1) if $o <= 0; # NEXT
184 # XXX
185 &rotl($c, 10);
186 &lea($a, &DWP($K,$a,$tmp2,1));
187 &sub($tmp1, &Np($c)) if $o <= 0; # NEXT
188 # XXX
189 &rotl($a, $s);
190 &add($a, $e);
191 }
192 else
193 {
194 &mov($tmp2, &Xv($pos));
195 &or($tmp1, $b);
196 &add($a, $tmp2);
197 &xor($tmp1, $d);
198 &mov($tmp2, -1) if $o <= 0; # NEXT
199 &mov($tmp2, -1) if $o == 1;
200 &mov($tmp2, &Xv($pos2)) if $o == 2;
201 &rotl($c, 10);
202 &lea($a, &DWP($K,$a,$tmp1,1));
203 &sub($tmp2, &Np($c)) if $o <= 0; # NEXT
204 &mov($tmp1, &Np($d)) if $o == 1;
205 &mov($tmp1, -1) if $o == 2;
206 &rotl($a, $s);
207 &add($a, $e);
208 }
209 }
210
211sub RIP4
212 {
213 local($a,$b,$c,$d,$e,$pos,$s,$K,$o)=@_;
214
215 &comment($p++);
216 if ($p & 1)
217 {
218# &mov($tmp2, -1) if $o == -2;
219# &mov($tmp1, $d) if $o == -2;
220 &sub($tmp2, $d);
221 &and($tmp1, $b);
222 &and($tmp2, $c);
223 &or($tmp2, $tmp1);
224 &mov($tmp1, &Xv($pos));
225 &rotl($c, 10);
226 &lea($a, &DWP($K,$a,$tmp2));
227 &mov($tmp2, -1) unless $o > 0; # NEXT
228 # XXX
229 &add($a, $tmp1);
230 &mov($tmp1, &Np($d)) unless $o > 0; # NEXT
231 # XXX
232 &rotl($a, $s);
233 &add($a, $e);
234 }
235 else
236 {
237 &sub($tmp2, $d);
238 &and($tmp1, $b);
239 &and($tmp2, $c);
240 &or($tmp2, $tmp1);
241 &mov($tmp1, &Xv($pos));
242 &rotl($c, 10);
243 &lea($a, &DWP($K,$a,$tmp2));
244 &mov($tmp2, -1) if $o == 0; # NEXT
245 &mov($tmp2, -1) if $o == 1;
246 &mov($tmp2, -1) if $o == 2;
247 # XXX
248 &add($a, $tmp1);
249 &mov($tmp1, &Np($d)) if $o == 0; # NEXT
250 &sub($tmp2, &Np($d)) if $o == 1;
251 &sub($tmp2, &Np($c)) if $o == 2;
252 # XXX
253 &rotl($a, $s);
254 &add($a, $e);
255 }
256 }
257
258sub RIP5
259 {
260 local($a,$b,$c,$d,$e,$pos,$s,$K,$o)=@_;
261
262 &comment($p++);
263 if ($p & 1)
264 {
265 &mov($tmp2, -1) if $o == -2;
266 &sub($tmp2, $d) if $o == -2;
267 &mov($tmp1, &Xv($pos));
268 &or($tmp2, $c);
269 &add($a, $tmp1);
270 &xor($tmp2, $b);
271 &mov($tmp1, -1) if $o <= 0;
272 # XXX
273 &rotl($c, 10);
274 &lea($a, &DWP($K,$a,$tmp2,1));
275 &sub($tmp1, &Np($d)) if $o <= 0;
276 # XXX
277 &rotl($a, $s);
278 &add($a, $e);
279 }
280 else
281 {
282 &mov($tmp2, &Xv($pos));
283 &or($tmp1, $c);
284 &add($a, $tmp2);
285 &xor($tmp1, $b);
286 &mov($tmp2, -1) if $o <= 0;
287 &mov($tmp2, &wparam(0)) if $o == 1; # Middle code
288 &mov($tmp2, -1) if $o == 2;
289 &rotl($c, 10);
290 &lea($a, &DWP($K,$a,$tmp1,1));
291 &sub($tmp2, &Np($d)) if $o <= 0;
292 &mov(&swtmp(16), $A) if $o == 1;
293 &mov($tmp1, &Np($d)) if $o == 2;
294 &rotl($a, $s);
295 &add($a, $e);
296 }
297 }
298
299sub ripemd160_block
300 {
301 local($name)=@_;
302
303 &function_begin_B($name,"",3);
304
305 # parameter 1 is the RIPEMD160_CTX structure.
306 # A 0
307 # B 4
308 # C 8
309 # D 12
310 # E 16
311
312 &mov($tmp2, &wparam(0));
313 &mov($tmp1, &wparam(1));
314 &push("esi");
315 &mov($A, &DWP( 0,$tmp2,"",0));
316 &push("edi");
317 &mov($B, &DWP( 4,$tmp2,"",0));
318 &push("ebp");
319 &mov($C, &DWP( 8,$tmp2,"",0));
320 &push("ebx");
321 &stack_push(16+5+6);
322 # Special comment about the figure of 6.
323 # Idea is to pad the current frame so
324 # that the top of the stack gets fairly
325 # aligned. Well, as you realize it would
326 # always depend on how the frame below is
327 # aligned. The good news are that gcc-2.95
328 # and later does keep first argument at
329 # least double-wise aligned.
330 # <appro@fy.chalmers.se>
331
332 &set_label("start") unless $normal;
333 &comment("");
334
335 # &mov($tmp1, &wparam(1)); # Done at end of loop
336 # &mov($tmp2, &wparam(0)); # Done at end of loop
337
338 for ($z=0; $z<16; $z+=2)
339 {
340 &mov($D, &DWP( $z*4,$tmp1,"",0));
341 &mov($E, &DWP( ($z+1)*4,$tmp1,"",0));
342 &mov(&swtmp($z), $D);
343 &mov(&swtmp($z+1), $E);
344 }
345 &mov($tmp1, $C);
346 &mov($D, &DWP(12,$tmp2,"",0));
347 &mov($E, &DWP(16,$tmp2,"",0));
348
349 &RIP1($A,$B,$C,$D,$E,$wl[ 0],$sl[ 0],-1);
350 &RIP1($E,$A,$B,$C,$D,$wl[ 1],$sl[ 1],0);
351 &RIP1($D,$E,$A,$B,$C,$wl[ 2],$sl[ 2],0);
352 &RIP1($C,$D,$E,$A,$B,$wl[ 3],$sl[ 3],0);
353 &RIP1($B,$C,$D,$E,$A,$wl[ 4],$sl[ 4],0);
354 &RIP1($A,$B,$C,$D,$E,$wl[ 5],$sl[ 5],0);
355 &RIP1($E,$A,$B,$C,$D,$wl[ 6],$sl[ 6],0);
356 &RIP1($D,$E,$A,$B,$C,$wl[ 7],$sl[ 7],0);
357 &RIP1($C,$D,$E,$A,$B,$wl[ 8],$sl[ 8],0);
358 &RIP1($B,$C,$D,$E,$A,$wl[ 9],$sl[ 9],0);
359 &RIP1($A,$B,$C,$D,$E,$wl[10],$sl[10],0);
360 &RIP1($E,$A,$B,$C,$D,$wl[11],$sl[11],0);
361 &RIP1($D,$E,$A,$B,$C,$wl[12],$sl[12],0);
362 &RIP1($C,$D,$E,$A,$B,$wl[13],$sl[13],0);
363 &RIP1($B,$C,$D,$E,$A,$wl[14],$sl[14],0);
364 &RIP1($A,$B,$C,$D,$E,$wl[15],$sl[15],1,$wl[16]);
365
366 &RIP2($E,$A,$B,$C,$D,$wl[16],$wl[17],$sl[16],$KL1,-1);
367 &RIP2($D,$E,$A,$B,$C,$wl[17],$wl[18],$sl[17],$KL1,0);
368 &RIP2($C,$D,$E,$A,$B,$wl[18],$wl[19],$sl[18],$KL1,0);
369 &RIP2($B,$C,$D,$E,$A,$wl[19],$wl[20],$sl[19],$KL1,0);
370 &RIP2($A,$B,$C,$D,$E,$wl[20],$wl[21],$sl[20],$KL1,0);
371 &RIP2($E,$A,$B,$C,$D,$wl[21],$wl[22],$sl[21],$KL1,0);
372 &RIP2($D,$E,$A,$B,$C,$wl[22],$wl[23],$sl[22],$KL1,0);
373 &RIP2($C,$D,$E,$A,$B,$wl[23],$wl[24],$sl[23],$KL1,0);
374 &RIP2($B,$C,$D,$E,$A,$wl[24],$wl[25],$sl[24],$KL1,0);
375 &RIP2($A,$B,$C,$D,$E,$wl[25],$wl[26],$sl[25],$KL1,0);
376 &RIP2($E,$A,$B,$C,$D,$wl[26],$wl[27],$sl[26],$KL1,0);
377 &RIP2($D,$E,$A,$B,$C,$wl[27],$wl[28],$sl[27],$KL1,0);
378 &RIP2($C,$D,$E,$A,$B,$wl[28],$wl[29],$sl[28],$KL1,0);
379 &RIP2($B,$C,$D,$E,$A,$wl[29],$wl[30],$sl[29],$KL1,0);
380 &RIP2($A,$B,$C,$D,$E,$wl[30],$wl[31],$sl[30],$KL1,0);
381 &RIP2($E,$A,$B,$C,$D,$wl[31],$wl[32],$sl[31],$KL1,1);
382
383 &RIP3($D,$E,$A,$B,$C,$wl[32],$sl[32],$KL2,-1);
384 &RIP3($C,$D,$E,$A,$B,$wl[33],$sl[33],$KL2,0);
385 &RIP3($B,$C,$D,$E,$A,$wl[34],$sl[34],$KL2,0);
386 &RIP3($A,$B,$C,$D,$E,$wl[35],$sl[35],$KL2,0);
387 &RIP3($E,$A,$B,$C,$D,$wl[36],$sl[36],$KL2,0);
388 &RIP3($D,$E,$A,$B,$C,$wl[37],$sl[37],$KL2,0);
389 &RIP3($C,$D,$E,$A,$B,$wl[38],$sl[38],$KL2,0);
390 &RIP3($B,$C,$D,$E,$A,$wl[39],$sl[39],$KL2,0);
391 &RIP3($A,$B,$C,$D,$E,$wl[40],$sl[40],$KL2,0);
392 &RIP3($E,$A,$B,$C,$D,$wl[41],$sl[41],$KL2,0);
393 &RIP3($D,$E,$A,$B,$C,$wl[42],$sl[42],$KL2,0);
394 &RIP3($C,$D,$E,$A,$B,$wl[43],$sl[43],$KL2,0);
395 &RIP3($B,$C,$D,$E,$A,$wl[44],$sl[44],$KL2,0);
396 &RIP3($A,$B,$C,$D,$E,$wl[45],$sl[45],$KL2,0);
397 &RIP3($E,$A,$B,$C,$D,$wl[46],$sl[46],$KL2,0);
398 &RIP3($D,$E,$A,$B,$C,$wl[47],$sl[47],$KL2,1);
399
400 &RIP4($C,$D,$E,$A,$B,$wl[48],$sl[48],$KL3,-1);
401 &RIP4($B,$C,$D,$E,$A,$wl[49],$sl[49],$KL3,0);
402 &RIP4($A,$B,$C,$D,$E,$wl[50],$sl[50],$KL3,0);
403 &RIP4($E,$A,$B,$C,$D,$wl[51],$sl[51],$KL3,0);
404 &RIP4($D,$E,$A,$B,$C,$wl[52],$sl[52],$KL3,0);
405 &RIP4($C,$D,$E,$A,$B,$wl[53],$sl[53],$KL3,0);
406 &RIP4($B,$C,$D,$E,$A,$wl[54],$sl[54],$KL3,0);
407 &RIP4($A,$B,$C,$D,$E,$wl[55],$sl[55],$KL3,0);
408 &RIP4($E,$A,$B,$C,$D,$wl[56],$sl[56],$KL3,0);
409 &RIP4($D,$E,$A,$B,$C,$wl[57],$sl[57],$KL3,0);
410 &RIP4($C,$D,$E,$A,$B,$wl[58],$sl[58],$KL3,0);
411 &RIP4($B,$C,$D,$E,$A,$wl[59],$sl[59],$KL3,0);
412 &RIP4($A,$B,$C,$D,$E,$wl[60],$sl[60],$KL3,0);
413 &RIP4($E,$A,$B,$C,$D,$wl[61],$sl[61],$KL3,0);
414 &RIP4($D,$E,$A,$B,$C,$wl[62],$sl[62],$KL3,0);
415 &RIP4($C,$D,$E,$A,$B,$wl[63],$sl[63],$KL3,1);
416
417 &RIP5($B,$C,$D,$E,$A,$wl[64],$sl[64],$KL4,-1);
418 &RIP5($A,$B,$C,$D,$E,$wl[65],$sl[65],$KL4,0);
419 &RIP5($E,$A,$B,$C,$D,$wl[66],$sl[66],$KL4,0);
420 &RIP5($D,$E,$A,$B,$C,$wl[67],$sl[67],$KL4,0);
421 &RIP5($C,$D,$E,$A,$B,$wl[68],$sl[68],$KL4,0);
422 &RIP5($B,$C,$D,$E,$A,$wl[69],$sl[69],$KL4,0);
423 &RIP5($A,$B,$C,$D,$E,$wl[70],$sl[70],$KL4,0);
424 &RIP5($E,$A,$B,$C,$D,$wl[71],$sl[71],$KL4,0);
425 &RIP5($D,$E,$A,$B,$C,$wl[72],$sl[72],$KL4,0);
426 &RIP5($C,$D,$E,$A,$B,$wl[73],$sl[73],$KL4,0);
427 &RIP5($B,$C,$D,$E,$A,$wl[74],$sl[74],$KL4,0);
428 &RIP5($A,$B,$C,$D,$E,$wl[75],$sl[75],$KL4,0);
429 &RIP5($E,$A,$B,$C,$D,$wl[76],$sl[76],$KL4,0);
430 &RIP5($D,$E,$A,$B,$C,$wl[77],$sl[77],$KL4,0);
431 &RIP5($C,$D,$E,$A,$B,$wl[78],$sl[78],$KL4,0);
432 &RIP5($B,$C,$D,$E,$A,$wl[79],$sl[79],$KL4,1);
433
434 # &mov($tmp2, &wparam(0)); # moved into last RIP5
435 # &mov(&swtmp(16), $A);
436 &mov($A, &DWP( 0,$tmp2,"",0));
437 &mov(&swtmp(16+1), $B);
438 &mov(&swtmp(16+2), $C);
439 &mov($B, &DWP( 4,$tmp2,"",0));
440 &mov(&swtmp(16+3), $D);
441 &mov($C, &DWP( 8,$tmp2,"",0));
442 &mov(&swtmp(16+4), $E);
443 &mov($D, &DWP(12,$tmp2,"",0));
444 &mov($E, &DWP(16,$tmp2,"",0));
445
446 &RIP5($A,$B,$C,$D,$E,$wr[ 0],$sr[ 0],$KR0,-2);
447 &RIP5($E,$A,$B,$C,$D,$wr[ 1],$sr[ 1],$KR0,0);
448 &RIP5($D,$E,$A,$B,$C,$wr[ 2],$sr[ 2],$KR0,0);
449 &RIP5($C,$D,$E,$A,$B,$wr[ 3],$sr[ 3],$KR0,0);
450 &RIP5($B,$C,$D,$E,$A,$wr[ 4],$sr[ 4],$KR0,0);
451 &RIP5($A,$B,$C,$D,$E,$wr[ 5],$sr[ 5],$KR0,0);
452 &RIP5($E,$A,$B,$C,$D,$wr[ 6],$sr[ 6],$KR0,0);
453 &RIP5($D,$E,$A,$B,$C,$wr[ 7],$sr[ 7],$KR0,0);
454 &RIP5($C,$D,$E,$A,$B,$wr[ 8],$sr[ 8],$KR0,0);
455 &RIP5($B,$C,$D,$E,$A,$wr[ 9],$sr[ 9],$KR0,0);
456 &RIP5($A,$B,$C,$D,$E,$wr[10],$sr[10],$KR0,0);
457 &RIP5($E,$A,$B,$C,$D,$wr[11],$sr[11],$KR0,0);
458 &RIP5($D,$E,$A,$B,$C,$wr[12],$sr[12],$KR0,0);
459 &RIP5($C,$D,$E,$A,$B,$wr[13],$sr[13],$KR0,0);
460 &RIP5($B,$C,$D,$E,$A,$wr[14],$sr[14],$KR0,0);
461 &RIP5($A,$B,$C,$D,$E,$wr[15],$sr[15],$KR0,2);
462
463 &RIP4($E,$A,$B,$C,$D,$wr[16],$sr[16],$KR1,-2);
464 &RIP4($D,$E,$A,$B,$C,$wr[17],$sr[17],$KR1,0);
465 &RIP4($C,$D,$E,$A,$B,$wr[18],$sr[18],$KR1,0);
466 &RIP4($B,$C,$D,$E,$A,$wr[19],$sr[19],$KR1,0);
467 &RIP4($A,$B,$C,$D,$E,$wr[20],$sr[20],$KR1,0);
468 &RIP4($E,$A,$B,$C,$D,$wr[21],$sr[21],$KR1,0);
469 &RIP4($D,$E,$A,$B,$C,$wr[22],$sr[22],$KR1,0);
470 &RIP4($C,$D,$E,$A,$B,$wr[23],$sr[23],$KR1,0);
471 &RIP4($B,$C,$D,$E,$A,$wr[24],$sr[24],$KR1,0);
472 &RIP4($A,$B,$C,$D,$E,$wr[25],$sr[25],$KR1,0);
473 &RIP4($E,$A,$B,$C,$D,$wr[26],$sr[26],$KR1,0);
474 &RIP4($D,$E,$A,$B,$C,$wr[27],$sr[27],$KR1,0);
475 &RIP4($C,$D,$E,$A,$B,$wr[28],$sr[28],$KR1,0);
476 &RIP4($B,$C,$D,$E,$A,$wr[29],$sr[29],$KR1,0);
477 &RIP4($A,$B,$C,$D,$E,$wr[30],$sr[30],$KR1,0);
478 &RIP4($E,$A,$B,$C,$D,$wr[31],$sr[31],$KR1,2);
479
480 &RIP3($D,$E,$A,$B,$C,$wr[32],$sr[32],$KR2,-2);
481 &RIP3($C,$D,$E,$A,$B,$wr[33],$sr[33],$KR2,0);
482 &RIP3($B,$C,$D,$E,$A,$wr[34],$sr[34],$KR2,0);
483 &RIP3($A,$B,$C,$D,$E,$wr[35],$sr[35],$KR2,0);
484 &RIP3($E,$A,$B,$C,$D,$wr[36],$sr[36],$KR2,0);
485 &RIP3($D,$E,$A,$B,$C,$wr[37],$sr[37],$KR2,0);
486 &RIP3($C,$D,$E,$A,$B,$wr[38],$sr[38],$KR2,0);
487 &RIP3($B,$C,$D,$E,$A,$wr[39],$sr[39],$KR2,0);
488 &RIP3($A,$B,$C,$D,$E,$wr[40],$sr[40],$KR2,0);
489 &RIP3($E,$A,$B,$C,$D,$wr[41],$sr[41],$KR2,0);
490 &RIP3($D,$E,$A,$B,$C,$wr[42],$sr[42],$KR2,0);
491 &RIP3($C,$D,$E,$A,$B,$wr[43],$sr[43],$KR2,0);
492 &RIP3($B,$C,$D,$E,$A,$wr[44],$sr[44],$KR2,0);
493 &RIP3($A,$B,$C,$D,$E,$wr[45],$sr[45],$KR2,0);
494 &RIP3($E,$A,$B,$C,$D,$wr[46],$sr[46],$KR2,0);
495 &RIP3($D,$E,$A,$B,$C,$wr[47],$sr[47],$KR2,2,$wr[48]);
496
497 &RIP2($C,$D,$E,$A,$B,$wr[48],$wr[49],$sr[48],$KR3,-2);
498 &RIP2($B,$C,$D,$E,$A,$wr[49],$wr[50],$sr[49],$KR3,0);
499 &RIP2($A,$B,$C,$D,$E,$wr[50],$wr[51],$sr[50],$KR3,0);
500 &RIP2($E,$A,$B,$C,$D,$wr[51],$wr[52],$sr[51],$KR3,0);
501 &RIP2($D,$E,$A,$B,$C,$wr[52],$wr[53],$sr[52],$KR3,0);
502 &RIP2($C,$D,$E,$A,$B,$wr[53],$wr[54],$sr[53],$KR3,0);
503 &RIP2($B,$C,$D,$E,$A,$wr[54],$wr[55],$sr[54],$KR3,0);
504 &RIP2($A,$B,$C,$D,$E,$wr[55],$wr[56],$sr[55],$KR3,0);
505 &RIP2($E,$A,$B,$C,$D,$wr[56],$wr[57],$sr[56],$KR3,0);
506 &RIP2($D,$E,$A,$B,$C,$wr[57],$wr[58],$sr[57],$KR3,0);
507 &RIP2($C,$D,$E,$A,$B,$wr[58],$wr[59],$sr[58],$KR3,0);
508 &RIP2($B,$C,$D,$E,$A,$wr[59],$wr[60],$sr[59],$KR3,0);
509 &RIP2($A,$B,$C,$D,$E,$wr[60],$wr[61],$sr[60],$KR3,0);
510 &RIP2($E,$A,$B,$C,$D,$wr[61],$wr[62],$sr[61],$KR3,0);
511 &RIP2($D,$E,$A,$B,$C,$wr[62],$wr[63],$sr[62],$KR3,0);
512 &RIP2($C,$D,$E,$A,$B,$wr[63],$wr[64],$sr[63],$KR3,2);
513
514 &RIP1($B,$C,$D,$E,$A,$wr[64],$sr[64],-2);
515 &RIP1($A,$B,$C,$D,$E,$wr[65],$sr[65],0);
516 &RIP1($E,$A,$B,$C,$D,$wr[66],$sr[66],0);
517 &RIP1($D,$E,$A,$B,$C,$wr[67],$sr[67],0);
518 &RIP1($C,$D,$E,$A,$B,$wr[68],$sr[68],0);
519 &RIP1($B,$C,$D,$E,$A,$wr[69],$sr[69],0);
520 &RIP1($A,$B,$C,$D,$E,$wr[70],$sr[70],0);
521 &RIP1($E,$A,$B,$C,$D,$wr[71],$sr[71],0);
522 &RIP1($D,$E,$A,$B,$C,$wr[72],$sr[72],0);
523 &RIP1($C,$D,$E,$A,$B,$wr[73],$sr[73],0);
524 &RIP1($B,$C,$D,$E,$A,$wr[74],$sr[74],0);
525 &RIP1($A,$B,$C,$D,$E,$wr[75],$sr[75],0);
526 &RIP1($E,$A,$B,$C,$D,$wr[76],$sr[76],0);
527 &RIP1($D,$E,$A,$B,$C,$wr[77],$sr[77],0);
528 &RIP1($C,$D,$E,$A,$B,$wr[78],$sr[78],0);
529 &RIP1($B,$C,$D,$E,$A,$wr[79],$sr[79],2);
530
531 # &mov($tmp2, &wparam(0)); # Moved into last round
532
533 &mov($tmp1, &DWP( 4,$tmp2,"",0)); # ctx->B
534 &add($D, $tmp1);
535 &mov($tmp1, &swtmp(16+2)); # $c
536 &add($D, $tmp1);
537
538 &mov($tmp1, &DWP( 8,$tmp2,"",0)); # ctx->C
539 &add($E, $tmp1);
540 &mov($tmp1, &swtmp(16+3)); # $d
541 &add($E, $tmp1);
542
543 &mov($tmp1, &DWP(12,$tmp2,"",0)); # ctx->D
544 &add($A, $tmp1);
545 &mov($tmp1, &swtmp(16+4)); # $e
546 &add($A, $tmp1);
547
548
549 &mov($tmp1, &DWP(16,$tmp2,"",0)); # ctx->E
550 &add($B, $tmp1);
551 &mov($tmp1, &swtmp(16+0)); # $a
552 &add($B, $tmp1);
553
554 &mov($tmp1, &DWP( 0,$tmp2,"",0)); # ctx->A
555 &add($C, $tmp1);
556 &mov($tmp1, &swtmp(16+1)); # $b
557 &add($C, $tmp1);
558
559 &mov($tmp1, &wparam(2));
560
561 &mov(&DWP( 0,$tmp2,"",0), $D);
562 &mov(&DWP( 4,$tmp2,"",0), $E);
563 &mov(&DWP( 8,$tmp2,"",0), $A);
564 &sub($tmp1,1);
565 &mov(&DWP(12,$tmp2,"",0), $B);
566 &mov(&DWP(16,$tmp2,"",0), $C);
567
568 &jle(&label("get_out"));
569
570 &mov(&wparam(2),$tmp1);
571 &mov($C, $A);
572 &mov($tmp1, &wparam(1));
573 &mov($A, $D);
574 &add($tmp1, 64);
575 &mov($B, $E);
576 &mov(&wparam(1),$tmp1);
577
578 &jmp(&label("start"));
579
580 &set_label("get_out");
581
582 &stack_pop(16+5+6);
583
584 &pop("ebx");
585 &pop("ebp");
586 &pop("edi");
587 &pop("esi");
588 &ret();
589 &function_end_B($name);
590 }
591
diff --git a/src/lib/libcrypto/ripemd/ripemd.h b/src/lib/libcrypto/ripemd/ripemd.h
deleted file mode 100644
index 189bd8c90e..0000000000
--- a/src/lib/libcrypto/ripemd/ripemd.h
+++ /dev/null
@@ -1,107 +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#include <stddef.h>
64
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69#ifdef OPENSSL_NO_RIPEMD
70#error RIPEMD is disabled.
71#endif
72
73#if defined(__LP32__)
74#define RIPEMD160_LONG unsigned long
75#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
76#define RIPEMD160_LONG unsigned long
77#define RIPEMD160_LONG_LOG2 3
78#else
79#define RIPEMD160_LONG unsigned int
80#endif
81
82#define RIPEMD160_CBLOCK 64
83#define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4)
84#define RIPEMD160_DIGEST_LENGTH 20
85
86typedef struct RIPEMD160state_st
87 {
88 RIPEMD160_LONG A,B,C,D,E;
89 RIPEMD160_LONG Nl,Nh;
90 RIPEMD160_LONG data[RIPEMD160_LBLOCK];
91 unsigned int num;
92 } RIPEMD160_CTX;
93
94#ifdef OPENSSL_FIPS
95int private_RIPEMD160_Init(RIPEMD160_CTX *c);
96#endif
97int RIPEMD160_Init(RIPEMD160_CTX *c);
98int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len);
99int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);
100unsigned char *RIPEMD160(const unsigned char *d, size_t n,
101 unsigned char *md);
102void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b);
103#ifdef __cplusplus
104}
105#endif
106
107#endif
diff --git a/src/lib/libcrypto/ripemd/rmd_dgst.c b/src/lib/libcrypto/ripemd/rmd_dgst.c
deleted file mode 100644
index 9ff1a0705e..0000000000
--- a/src/lib/libcrypto/ripemd/rmd_dgst.c
+++ /dev/null
@@ -1,292 +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#include <openssl/crypto.h>
63
64const char RMD160_version[]="RIPE-MD160" OPENSSL_VERSION_PTEXT;
65
66# ifdef RMD160_ASM
67 void ripemd160_block_x86(RIPEMD160_CTX *c, unsigned long *p,size_t num);
68# define ripemd160_block ripemd160_block_x86
69# else
70 void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,size_t num);
71# endif
72
73fips_md_init(RIPEMD160)
74 {
75 memset (c,0,sizeof(*c));
76 c->A=RIPEMD160_A;
77 c->B=RIPEMD160_B;
78 c->C=RIPEMD160_C;
79 c->D=RIPEMD160_D;
80 c->E=RIPEMD160_E;
81 return 1;
82 }
83
84#ifndef ripemd160_block_data_order
85#ifdef X
86#undef X
87#endif
88void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, size_t num)
89 {
90 const unsigned char *data=p;
91 register volatile unsigned MD32_REG_T A,B,C,D,E;
92 unsigned MD32_REG_T a,b,c,d,e,l;
93#ifndef MD32_XARRAY
94 /* See comment in crypto/sha/sha_locl.h for details. */
95 unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
96 XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15;
97# define X(i) XX##i
98#else
99 RIPEMD160_LONG XX[16];
100# define X(i) XX[i]
101#endif
102
103 for (;num--;)
104 {
105
106 A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E;
107
108 HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l;
109 RIP1(A,B,C,D,E,WL00,SL00); HOST_c2l(data,l); X( 2)=l;
110 RIP1(E,A,B,C,D,WL01,SL01); HOST_c2l(data,l); X( 3)=l;
111 RIP1(D,E,A,B,C,WL02,SL02); HOST_c2l(data,l); X( 4)=l;
112 RIP1(C,D,E,A,B,WL03,SL03); HOST_c2l(data,l); X( 5)=l;
113 RIP1(B,C,D,E,A,WL04,SL04); HOST_c2l(data,l); X( 6)=l;
114 RIP1(A,B,C,D,E,WL05,SL05); HOST_c2l(data,l); X( 7)=l;
115 RIP1(E,A,B,C,D,WL06,SL06); HOST_c2l(data,l); X( 8)=l;
116 RIP1(D,E,A,B,C,WL07,SL07); HOST_c2l(data,l); X( 9)=l;
117 RIP1(C,D,E,A,B,WL08,SL08); HOST_c2l(data,l); X(10)=l;
118 RIP1(B,C,D,E,A,WL09,SL09); HOST_c2l(data,l); X(11)=l;
119 RIP1(A,B,C,D,E,WL10,SL10); HOST_c2l(data,l); X(12)=l;
120 RIP1(E,A,B,C,D,WL11,SL11); HOST_c2l(data,l); X(13)=l;
121 RIP1(D,E,A,B,C,WL12,SL12); HOST_c2l(data,l); X(14)=l;
122 RIP1(C,D,E,A,B,WL13,SL13); HOST_c2l(data,l); X(15)=l;
123 RIP1(B,C,D,E,A,WL14,SL14);
124 RIP1(A,B,C,D,E,WL15,SL15);
125
126 RIP2(E,A,B,C,D,WL16,SL16,KL1);
127 RIP2(D,E,A,B,C,WL17,SL17,KL1);
128 RIP2(C,D,E,A,B,WL18,SL18,KL1);
129 RIP2(B,C,D,E,A,WL19,SL19,KL1);
130 RIP2(A,B,C,D,E,WL20,SL20,KL1);
131 RIP2(E,A,B,C,D,WL21,SL21,KL1);
132 RIP2(D,E,A,B,C,WL22,SL22,KL1);
133 RIP2(C,D,E,A,B,WL23,SL23,KL1);
134 RIP2(B,C,D,E,A,WL24,SL24,KL1);
135 RIP2(A,B,C,D,E,WL25,SL25,KL1);
136 RIP2(E,A,B,C,D,WL26,SL26,KL1);
137 RIP2(D,E,A,B,C,WL27,SL27,KL1);
138 RIP2(C,D,E,A,B,WL28,SL28,KL1);
139 RIP2(B,C,D,E,A,WL29,SL29,KL1);
140 RIP2(A,B,C,D,E,WL30,SL30,KL1);
141 RIP2(E,A,B,C,D,WL31,SL31,KL1);
142
143 RIP3(D,E,A,B,C,WL32,SL32,KL2);
144 RIP3(C,D,E,A,B,WL33,SL33,KL2);
145 RIP3(B,C,D,E,A,WL34,SL34,KL2);
146 RIP3(A,B,C,D,E,WL35,SL35,KL2);
147 RIP3(E,A,B,C,D,WL36,SL36,KL2);
148 RIP3(D,E,A,B,C,WL37,SL37,KL2);
149 RIP3(C,D,E,A,B,WL38,SL38,KL2);
150 RIP3(B,C,D,E,A,WL39,SL39,KL2);
151 RIP3(A,B,C,D,E,WL40,SL40,KL2);
152 RIP3(E,A,B,C,D,WL41,SL41,KL2);
153 RIP3(D,E,A,B,C,WL42,SL42,KL2);
154 RIP3(C,D,E,A,B,WL43,SL43,KL2);
155 RIP3(B,C,D,E,A,WL44,SL44,KL2);
156 RIP3(A,B,C,D,E,WL45,SL45,KL2);
157 RIP3(E,A,B,C,D,WL46,SL46,KL2);
158 RIP3(D,E,A,B,C,WL47,SL47,KL2);
159
160 RIP4(C,D,E,A,B,WL48,SL48,KL3);
161 RIP4(B,C,D,E,A,WL49,SL49,KL3);
162 RIP4(A,B,C,D,E,WL50,SL50,KL3);
163 RIP4(E,A,B,C,D,WL51,SL51,KL3);
164 RIP4(D,E,A,B,C,WL52,SL52,KL3);
165 RIP4(C,D,E,A,B,WL53,SL53,KL3);
166 RIP4(B,C,D,E,A,WL54,SL54,KL3);
167 RIP4(A,B,C,D,E,WL55,SL55,KL3);
168 RIP4(E,A,B,C,D,WL56,SL56,KL3);
169 RIP4(D,E,A,B,C,WL57,SL57,KL3);
170 RIP4(C,D,E,A,B,WL58,SL58,KL3);
171 RIP4(B,C,D,E,A,WL59,SL59,KL3);
172 RIP4(A,B,C,D,E,WL60,SL60,KL3);
173 RIP4(E,A,B,C,D,WL61,SL61,KL3);
174 RIP4(D,E,A,B,C,WL62,SL62,KL3);
175 RIP4(C,D,E,A,B,WL63,SL63,KL3);
176
177 RIP5(B,C,D,E,A,WL64,SL64,KL4);
178 RIP5(A,B,C,D,E,WL65,SL65,KL4);
179 RIP5(E,A,B,C,D,WL66,SL66,KL4);
180 RIP5(D,E,A,B,C,WL67,SL67,KL4);
181 RIP5(C,D,E,A,B,WL68,SL68,KL4);
182 RIP5(B,C,D,E,A,WL69,SL69,KL4);
183 RIP5(A,B,C,D,E,WL70,SL70,KL4);
184 RIP5(E,A,B,C,D,WL71,SL71,KL4);
185 RIP5(D,E,A,B,C,WL72,SL72,KL4);
186 RIP5(C,D,E,A,B,WL73,SL73,KL4);
187 RIP5(B,C,D,E,A,WL74,SL74,KL4);
188 RIP5(A,B,C,D,E,WL75,SL75,KL4);
189 RIP5(E,A,B,C,D,WL76,SL76,KL4);
190 RIP5(D,E,A,B,C,WL77,SL77,KL4);
191 RIP5(C,D,E,A,B,WL78,SL78,KL4);
192 RIP5(B,C,D,E,A,WL79,SL79,KL4);
193
194 a=A; b=B; c=C; d=D; e=E;
195 /* Do other half */
196 A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E;
197
198 RIP5(A,B,C,D,E,WR00,SR00,KR0);
199 RIP5(E,A,B,C,D,WR01,SR01,KR0);
200 RIP5(D,E,A,B,C,WR02,SR02,KR0);
201 RIP5(C,D,E,A,B,WR03,SR03,KR0);
202 RIP5(B,C,D,E,A,WR04,SR04,KR0);
203 RIP5(A,B,C,D,E,WR05,SR05,KR0);
204 RIP5(E,A,B,C,D,WR06,SR06,KR0);
205 RIP5(D,E,A,B,C,WR07,SR07,KR0);
206 RIP5(C,D,E,A,B,WR08,SR08,KR0);
207 RIP5(B,C,D,E,A,WR09,SR09,KR0);
208 RIP5(A,B,C,D,E,WR10,SR10,KR0);
209 RIP5(E,A,B,C,D,WR11,SR11,KR0);
210 RIP5(D,E,A,B,C,WR12,SR12,KR0);
211 RIP5(C,D,E,A,B,WR13,SR13,KR0);
212 RIP5(B,C,D,E,A,WR14,SR14,KR0);
213 RIP5(A,B,C,D,E,WR15,SR15,KR0);
214
215 RIP4(E,A,B,C,D,WR16,SR16,KR1);
216 RIP4(D,E,A,B,C,WR17,SR17,KR1);
217 RIP4(C,D,E,A,B,WR18,SR18,KR1);
218 RIP4(B,C,D,E,A,WR19,SR19,KR1);
219 RIP4(A,B,C,D,E,WR20,SR20,KR1);
220 RIP4(E,A,B,C,D,WR21,SR21,KR1);
221 RIP4(D,E,A,B,C,WR22,SR22,KR1);
222 RIP4(C,D,E,A,B,WR23,SR23,KR1);
223 RIP4(B,C,D,E,A,WR24,SR24,KR1);
224 RIP4(A,B,C,D,E,WR25,SR25,KR1);
225 RIP4(E,A,B,C,D,WR26,SR26,KR1);
226 RIP4(D,E,A,B,C,WR27,SR27,KR1);
227 RIP4(C,D,E,A,B,WR28,SR28,KR1);
228 RIP4(B,C,D,E,A,WR29,SR29,KR1);
229 RIP4(A,B,C,D,E,WR30,SR30,KR1);
230 RIP4(E,A,B,C,D,WR31,SR31,KR1);
231
232 RIP3(D,E,A,B,C,WR32,SR32,KR2);
233 RIP3(C,D,E,A,B,WR33,SR33,KR2);
234 RIP3(B,C,D,E,A,WR34,SR34,KR2);
235 RIP3(A,B,C,D,E,WR35,SR35,KR2);
236 RIP3(E,A,B,C,D,WR36,SR36,KR2);
237 RIP3(D,E,A,B,C,WR37,SR37,KR2);
238 RIP3(C,D,E,A,B,WR38,SR38,KR2);
239 RIP3(B,C,D,E,A,WR39,SR39,KR2);
240 RIP3(A,B,C,D,E,WR40,SR40,KR2);
241 RIP3(E,A,B,C,D,WR41,SR41,KR2);
242 RIP3(D,E,A,B,C,WR42,SR42,KR2);
243 RIP3(C,D,E,A,B,WR43,SR43,KR2);
244 RIP3(B,C,D,E,A,WR44,SR44,KR2);
245 RIP3(A,B,C,D,E,WR45,SR45,KR2);
246 RIP3(E,A,B,C,D,WR46,SR46,KR2);
247 RIP3(D,E,A,B,C,WR47,SR47,KR2);
248
249 RIP2(C,D,E,A,B,WR48,SR48,KR3);
250 RIP2(B,C,D,E,A,WR49,SR49,KR3);
251 RIP2(A,B,C,D,E,WR50,SR50,KR3);
252 RIP2(E,A,B,C,D,WR51,SR51,KR3);
253 RIP2(D,E,A,B,C,WR52,SR52,KR3);
254 RIP2(C,D,E,A,B,WR53,SR53,KR3);
255 RIP2(B,C,D,E,A,WR54,SR54,KR3);
256 RIP2(A,B,C,D,E,WR55,SR55,KR3);
257 RIP2(E,A,B,C,D,WR56,SR56,KR3);
258 RIP2(D,E,A,B,C,WR57,SR57,KR3);
259 RIP2(C,D,E,A,B,WR58,SR58,KR3);
260 RIP2(B,C,D,E,A,WR59,SR59,KR3);
261 RIP2(A,B,C,D,E,WR60,SR60,KR3);
262 RIP2(E,A,B,C,D,WR61,SR61,KR3);
263 RIP2(D,E,A,B,C,WR62,SR62,KR3);
264 RIP2(C,D,E,A,B,WR63,SR63,KR3);
265
266 RIP1(B,C,D,E,A,WR64,SR64);
267 RIP1(A,B,C,D,E,WR65,SR65);
268 RIP1(E,A,B,C,D,WR66,SR66);
269 RIP1(D,E,A,B,C,WR67,SR67);
270 RIP1(C,D,E,A,B,WR68,SR68);
271 RIP1(B,C,D,E,A,WR69,SR69);
272 RIP1(A,B,C,D,E,WR70,SR70);
273 RIP1(E,A,B,C,D,WR71,SR71);
274 RIP1(D,E,A,B,C,WR72,SR72);
275 RIP1(C,D,E,A,B,WR73,SR73);
276 RIP1(B,C,D,E,A,WR74,SR74);
277 RIP1(A,B,C,D,E,WR75,SR75);
278 RIP1(E,A,B,C,D,WR76,SR76);
279 RIP1(D,E,A,B,C,WR77,SR77);
280 RIP1(C,D,E,A,B,WR78,SR78);
281 RIP1(B,C,D,E,A,WR79,SR79);
282
283 D =ctx->B+c+D;
284 ctx->B=ctx->C+d+E;
285 ctx->C=ctx->D+e+A;
286 ctx->D=ctx->E+a+B;
287 ctx->E=ctx->A+b+C;
288 ctx->A=D;
289
290 }
291 }
292#endif
diff --git a/src/lib/libcrypto/ripemd/rmd_locl.h b/src/lib/libcrypto/ripemd/rmd_locl.h
deleted file mode 100644
index f14b346e66..0000000000
--- a/src/lib/libcrypto/ripemd/rmd_locl.h
+++ /dev/null
@@ -1,150 +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_data_order ripemd160_block_asm_data_order
76# endif
77#endif
78
79void ripemd160_block_data_order (RIPEMD160_CTX *c, const void *p,size_t num);
80
81#define DATA_ORDER_IS_LITTLE_ENDIAN
82
83#define HASH_LONG RIPEMD160_LONG
84#define HASH_CTX RIPEMD160_CTX
85#define HASH_CBLOCK RIPEMD160_CBLOCK
86#define HASH_UPDATE RIPEMD160_Update
87#define HASH_TRANSFORM RIPEMD160_Transform
88#define HASH_FINAL RIPEMD160_Final
89#define HASH_MAKE_STRING(c,s) do { \
90 unsigned long ll; \
91 ll=(c)->A; HOST_l2c(ll,(s)); \
92 ll=(c)->B; HOST_l2c(ll,(s)); \
93 ll=(c)->C; HOST_l2c(ll,(s)); \
94 ll=(c)->D; HOST_l2c(ll,(s)); \
95 ll=(c)->E; HOST_l2c(ll,(s)); \
96 } while (0)
97#define HASH_BLOCK_DATA_ORDER ripemd160_block_data_order
98
99#include "md32_common.h"
100
101#if 0
102#define F1(x,y,z) ((x)^(y)^(z))
103#define F2(x,y,z) (((x)&(y))|((~x)&z))
104#define F3(x,y,z) (((x)|(~y))^(z))
105#define F4(x,y,z) (((x)&(z))|((y)&(~(z))))
106#define F5(x,y,z) ((x)^((y)|(~(z))))
107#else
108/*
109 * Transformed F2 and F4 are courtesy of Wei Dai <weidai@eskimo.com>
110 */
111#define F1(x,y,z) ((x) ^ (y) ^ (z))
112#define F2(x,y,z) ((((y) ^ (z)) & (x)) ^ (z))
113#define F3(x,y,z) (((~(y)) | (x)) ^ (z))
114#define F4(x,y,z) ((((x) ^ (y)) & (z)) ^ (y))
115#define F5(x,y,z) (((~(z)) | (y)) ^ (x))
116#endif
117
118#define RIPEMD160_A 0x67452301L
119#define RIPEMD160_B 0xEFCDAB89L
120#define RIPEMD160_C 0x98BADCFEL
121#define RIPEMD160_D 0x10325476L
122#define RIPEMD160_E 0xC3D2E1F0L
123
124#include "rmdconst.h"
125
126#define RIP1(a,b,c,d,e,w,s) { \
127 a+=F1(b,c,d)+X(w); \
128 a=ROTATE(a,s)+e; \
129 c=ROTATE(c,10); }
130
131#define RIP2(a,b,c,d,e,w,s,K) { \
132 a+=F2(b,c,d)+X(w)+K; \
133 a=ROTATE(a,s)+e; \
134 c=ROTATE(c,10); }
135
136#define RIP3(a,b,c,d,e,w,s,K) { \
137 a+=F3(b,c,d)+X(w)+K; \
138 a=ROTATE(a,s)+e; \
139 c=ROTATE(c,10); }
140
141#define RIP4(a,b,c,d,e,w,s,K) { \
142 a+=F4(b,c,d)+X(w)+K; \
143 a=ROTATE(a,s)+e; \
144 c=ROTATE(c,10); }
145
146#define RIP5(a,b,c,d,e,w,s,K) { \
147 a+=F5(b,c,d)+X(w)+K; \
148 a=ROTATE(a,s)+e; \
149 c=ROTATE(c,10); }
150
diff --git a/src/lib/libcrypto/ripemd/rmd_one.c b/src/lib/libcrypto/ripemd/rmd_one.c
deleted file mode 100644
index 3efb13758f..0000000000
--- a/src/lib/libcrypto/ripemd/rmd_one.c
+++ /dev/null
@@ -1,78 +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, size_t 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 if (!RIPEMD160_Init(&c))
72 return NULL;
73 RIPEMD160_Update(&c,d,n);
74 RIPEMD160_Final(md,&c);
75 OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
76 return(md);
77 }
78
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