mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-06-30 01:33:39 +08:00
update
This commit is contained in:
@@ -52,6 +52,9 @@ md5-ia64.s: asm/md5-ia64.S
|
||||
$(CC) $(CFLAGS) -E asm/md5-ia64.S | \
|
||||
$(PERL) -ne 's/;\s+/;\n/g; print;' > $@
|
||||
|
||||
md5-sparcv9.S: asm/md5-sparcv9.pl
|
||||
$(PERL) asm/md5-sparcv9.pl $@ $(CFLAGS)
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
|
||||
|
||||
@@ -76,6 +79,8 @@ tests:
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
update: depend
|
||||
|
||||
depend:
|
||||
@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
|
||||
$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
|
||||
@@ -89,9 +94,11 @@ clean:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
md5_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/md5.h
|
||||
md5_dgst.o: ../../include/openssl/opensslconf.h
|
||||
md5_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md5_dgst.c
|
||||
md5_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
|
||||
md5_dgst.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h
|
||||
md5_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
|
||||
md5_dgst.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
md5_dgst.o: ../../include/openssl/symhacks.h ../md32_common.h md5_dgst.c
|
||||
md5_dgst.o: md5_locl.h
|
||||
md5_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
|
||||
md5_one.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h
|
||||
|
||||
430
crypto/md5/asm/md5-sparcv9.pl
Normal file
430
crypto/md5/asm/md5-sparcv9.pl
Normal file
@@ -0,0 +1,430 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# ====================================================================
|
||||
# Written by Andy Polyakov <appro@openssl.org> for the OpenSSL
|
||||
# project. The module is, however, dual licensed under OpenSSL and
|
||||
# CRYPTOGAMS licenses depending on where you obtain it. For further
|
||||
# details see http://www.openssl.org/~appro/cryptogams/.
|
||||
#
|
||||
# Hardware SPARC T4 support by David S. Miller <davem@davemloft.net>.
|
||||
# ====================================================================
|
||||
|
||||
# MD5 for SPARCv9, 6.9 cycles per byte on UltraSPARC, >40% faster than
|
||||
# code generated by Sun C 5.2.
|
||||
|
||||
# SPARC T4 MD5 hardware achieves 3.20 cycles per byte, which is 2.1x
|
||||
# faster than software. Multi-process benchmark saturates at 12x
|
||||
# single-process result on 8-core processor, or ~11GBps per 2.85GHz
|
||||
# socket.
|
||||
|
||||
$output=shift;
|
||||
open STDOUT,">$output";
|
||||
|
||||
use integer;
|
||||
|
||||
($ctx,$inp,$len)=("%i0","%i1","%i2"); # input arguments
|
||||
|
||||
# 64-bit values
|
||||
@X=("%o0","%o1","%o2","%o3","%o4","%o5","%o7","%g1","%g2");
|
||||
$tx="%g3";
|
||||
($AB,$CD)=("%g4","%g5");
|
||||
|
||||
# 32-bit values
|
||||
@V=($A,$B,$C,$D)=map("%l$_",(0..3));
|
||||
($t1,$t2,$t3,$saved_asi)=map("%l$_",(4..7));
|
||||
($shr,$shl1,$shl2)=("%i3","%i4","%i5");
|
||||
|
||||
my @K=( 0xd76aa478,0xe8c7b756,0x242070db,0xc1bdceee,
|
||||
0xf57c0faf,0x4787c62a,0xa8304613,0xfd469501,
|
||||
0x698098d8,0x8b44f7af,0xffff5bb1,0x895cd7be,
|
||||
0x6b901122,0xfd987193,0xa679438e,0x49b40821,
|
||||
|
||||
0xf61e2562,0xc040b340,0x265e5a51,0xe9b6c7aa,
|
||||
0xd62f105d,0x02441453,0xd8a1e681,0xe7d3fbc8,
|
||||
0x21e1cde6,0xc33707d6,0xf4d50d87,0x455a14ed,
|
||||
0xa9e3e905,0xfcefa3f8,0x676f02d9,0x8d2a4c8a,
|
||||
|
||||
0xfffa3942,0x8771f681,0x6d9d6122,0xfde5380c,
|
||||
0xa4beea44,0x4bdecfa9,0xf6bb4b60,0xbebfbc70,
|
||||
0x289b7ec6,0xeaa127fa,0xd4ef3085,0x04881d05,
|
||||
0xd9d4d039,0xe6db99e5,0x1fa27cf8,0xc4ac5665,
|
||||
|
||||
0xf4292244,0x432aff97,0xab9423a7,0xfc93a039,
|
||||
0x655b59c3,0x8f0ccc92,0xffeff47d,0x85845dd1,
|
||||
0x6fa87e4f,0xfe2ce6e0,0xa3014314,0x4e0811a1,
|
||||
0xf7537e82,0xbd3af235,0x2ad7d2bb,0xeb86d391, 0 );
|
||||
|
||||
sub R0 {
|
||||
my ($i,$a,$b,$c,$d) = @_;
|
||||
my $rot = (7,12,17,22)[$i%4];
|
||||
my $j = ($i+1)/2;
|
||||
|
||||
if ($i&1) {
|
||||
$code.=<<___;
|
||||
srlx @X[$j],$shr,@X[$j] ! align X[`$i+1`]
|
||||
and $b,$t1,$t1 ! round $i
|
||||
sllx @X[$j+1],$shl1,$tx
|
||||
add $t2,$a,$a
|
||||
sllx $tx,$shl2,$tx
|
||||
xor $d,$t1,$t1
|
||||
or $tx,@X[$j],@X[$j]
|
||||
sethi %hi(@K[$i+1]),$t2
|
||||
add $t1,$a,$a
|
||||
or $t2,%lo(@K[$i+1]),$t2
|
||||
sll $a,$rot,$t3
|
||||
add @X[$j],$t2,$t2 ! X[`$i+1`]+K[`$i+1`]
|
||||
srl $a,32-$rot,$a
|
||||
add $b,$t3,$t3
|
||||
xor $b,$c,$t1
|
||||
add $t3,$a,$a
|
||||
___
|
||||
} else {
|
||||
$code.=<<___;
|
||||
srlx @X[$j],32,$tx ! extract X[`2*$j+1`]
|
||||
and $b,$t1,$t1 ! round $i
|
||||
add $t2,$a,$a
|
||||
xor $d,$t1,$t1
|
||||
sethi %hi(@K[$i+1]),$t2
|
||||
add $t1,$a,$a
|
||||
or $t2,%lo(@K[$i+1]),$t2
|
||||
sll $a,$rot,$t3
|
||||
add $tx,$t2,$t2 ! X[`2*$j+1`]+K[`$i+1`]
|
||||
srl $a,32-$rot,$a
|
||||
add $b,$t3,$t3
|
||||
xor $b,$c,$t1
|
||||
add $t3,$a,$a
|
||||
___
|
||||
}
|
||||
}
|
||||
|
||||
sub R0_1 {
|
||||
my ($i,$a,$b,$c,$d) = @_;
|
||||
my $rot = (7,12,17,22)[$i%4];
|
||||
|
||||
$code.=<<___;
|
||||
srlx @X[0],32,$tx ! extract X[1]
|
||||
and $b,$t1,$t1 ! round $i
|
||||
add $t2,$a,$a
|
||||
xor $d,$t1,$t1
|
||||
sethi %hi(@K[$i+1]),$t2
|
||||
add $t1,$a,$a
|
||||
or $t2,%lo(@K[$i+1]),$t2
|
||||
sll $a,$rot,$t3
|
||||
add $tx,$t2,$t2 ! X[1]+K[`$i+1`]
|
||||
srl $a,32-$rot,$a
|
||||
add $b,$t3,$t3
|
||||
andn $b,$c,$t1
|
||||
add $t3,$a,$a
|
||||
___
|
||||
}
|
||||
|
||||
sub R1 {
|
||||
my ($i,$a,$b,$c,$d) = @_;
|
||||
my $rot = (5,9,14,20)[$i%4];
|
||||
my $j = $i<31 ? (1+5*($i+1))%16 : (5+3*($i+1))%16;
|
||||
my $xi = @X[$j/2];
|
||||
|
||||
$code.=<<___ if ($j&1 && ($xi=$tx));
|
||||
srlx @X[$j/2],32,$xi ! extract X[$j]
|
||||
___
|
||||
$code.=<<___;
|
||||
and $b,$d,$t3 ! round $i
|
||||
add $t2,$a,$a
|
||||
or $t3,$t1,$t1
|
||||
sethi %hi(@K[$i+1]),$t2
|
||||
add $t1,$a,$a
|
||||
or $t2,%lo(@K[$i+1]),$t2
|
||||
sll $a,$rot,$t3
|
||||
add $xi,$t2,$t2 ! X[$j]+K[`$i+1`]
|
||||
srl $a,32-$rot,$a
|
||||
add $b,$t3,$t3
|
||||
`$i<31?"andn":"xor"` $b,$c,$t1
|
||||
add $t3,$a,$a
|
||||
___
|
||||
}
|
||||
|
||||
sub R2 {
|
||||
my ($i,$a,$b,$c,$d) = @_;
|
||||
my $rot = (4,11,16,23)[$i%4];
|
||||
my $j = $i<47 ? (5+3*($i+1))%16 : (0+7*($i+1))%16;
|
||||
my $xi = @X[$j/2];
|
||||
|
||||
$code.=<<___ if ($j&1 && ($xi=$tx));
|
||||
srlx @X[$j/2],32,$xi ! extract X[$j]
|
||||
___
|
||||
$code.=<<___;
|
||||
add $t2,$a,$a ! round $i
|
||||
xor $b,$t1,$t1
|
||||
sethi %hi(@K[$i+1]),$t2
|
||||
add $t1,$a,$a
|
||||
or $t2,%lo(@K[$i+1]),$t2
|
||||
sll $a,$rot,$t3
|
||||
add $xi,$t2,$t2 ! X[$j]+K[`$i+1`]
|
||||
srl $a,32-$rot,$a
|
||||
add $b,$t3,$t3
|
||||
xor $b,$c,$t1
|
||||
add $t3,$a,$a
|
||||
___
|
||||
}
|
||||
|
||||
sub R3 {
|
||||
my ($i,$a,$b,$c,$d) = @_;
|
||||
my $rot = (6,10,15,21)[$i%4];
|
||||
my $j = (0+7*($i+1))%16;
|
||||
my $xi = @X[$j/2];
|
||||
|
||||
$code.=<<___;
|
||||
add $t2,$a,$a ! round $i
|
||||
___
|
||||
$code.=<<___ if ($j&1 && ($xi=$tx));
|
||||
srlx @X[$j/2],32,$xi ! extract X[$j]
|
||||
___
|
||||
$code.=<<___;
|
||||
orn $b,$d,$t1
|
||||
sethi %hi(@K[$i+1]),$t2
|
||||
xor $c,$t1,$t1
|
||||
or $t2,%lo(@K[$i+1]),$t2
|
||||
add $t1,$a,$a
|
||||
sll $a,$rot,$t3
|
||||
add $xi,$t2,$t2 ! X[$j]+K[`$i+1`]
|
||||
srl $a,32-$rot,$a
|
||||
add $b,$t3,$t3
|
||||
add $t3,$a,$a
|
||||
___
|
||||
}
|
||||
|
||||
$code.=<<___;
|
||||
#include "sparc_arch.h"
|
||||
|
||||
#ifdef __arch64__
|
||||
.register %g2,#scratch
|
||||
.register %g3,#scratch
|
||||
#endif
|
||||
|
||||
.section ".text",#alloc,#execinstr
|
||||
|
||||
#ifdef __PIC__
|
||||
SPARC_PIC_THUNK(%g1)
|
||||
#endif
|
||||
|
||||
.globl md5_block_asm_data_order
|
||||
.align 32
|
||||
md5_block_asm_data_order:
|
||||
SPARC_LOAD_ADDRESS_LEAF(OPENSSL_sparcv9cap_P,%g1,%g5)
|
||||
ld [%g1+4],%g1 ! OPENSSL_sparcv9cap_P[1]
|
||||
|
||||
andcc %g1, CFR_MD5, %g0
|
||||
be .Lsoftware
|
||||
nop
|
||||
|
||||
mov 4, %g1
|
||||
andcc %o1, 0x7, %g0
|
||||
lda [%o0 + %g0]0x88, %f0 ! load context
|
||||
lda [%o0 + %g1]0x88, %f1
|
||||
add %o0, 8, %o0
|
||||
lda [%o0 + %g0]0x88, %f2
|
||||
lda [%o0 + %g1]0x88, %f3
|
||||
bne,pn %icc, .Lhwunaligned
|
||||
sub %o0, 8, %o0
|
||||
|
||||
.Lhw_loop:
|
||||
ldd [%o1 + 0x00], %f8
|
||||
ldd [%o1 + 0x08], %f10
|
||||
ldd [%o1 + 0x10], %f12
|
||||
ldd [%o1 + 0x18], %f14
|
||||
ldd [%o1 + 0x20], %f16
|
||||
ldd [%o1 + 0x28], %f18
|
||||
ldd [%o1 + 0x30], %f20
|
||||
subcc %o2, 1, %o2 ! done yet?
|
||||
ldd [%o1 + 0x38], %f22
|
||||
add %o1, 0x40, %o1
|
||||
prefetch [%o1 + 63], 20
|
||||
|
||||
.word 0x81b02800 ! MD5
|
||||
|
||||
bne,pt SIZE_T_CC, .Lhw_loop
|
||||
nop
|
||||
|
||||
.Lhwfinish:
|
||||
sta %f0, [%o0 + %g0]0x88 ! store context
|
||||
sta %f1, [%o0 + %g1]0x88
|
||||
add %o0, 8, %o0
|
||||
sta %f2, [%o0 + %g0]0x88
|
||||
sta %f3, [%o0 + %g1]0x88
|
||||
retl
|
||||
nop
|
||||
|
||||
.align 8
|
||||
.Lhwunaligned:
|
||||
alignaddr %o1, %g0, %o1
|
||||
|
||||
ldd [%o1 + 0x00], %f10
|
||||
.Lhwunaligned_loop:
|
||||
ldd [%o1 + 0x08], %f12
|
||||
ldd [%o1 + 0x10], %f14
|
||||
ldd [%o1 + 0x18], %f16
|
||||
ldd [%o1 + 0x20], %f18
|
||||
ldd [%o1 + 0x28], %f20
|
||||
ldd [%o1 + 0x30], %f22
|
||||
ldd [%o1 + 0x38], %f24
|
||||
subcc %o2, 1, %o2 ! done yet?
|
||||
ldd [%o1 + 0x40], %f26
|
||||
add %o1, 0x40, %o1
|
||||
prefetch [%o1 + 63], 20
|
||||
|
||||
faligndata %f10, %f12, %f8
|
||||
faligndata %f12, %f14, %f10
|
||||
faligndata %f14, %f16, %f12
|
||||
faligndata %f16, %f18, %f14
|
||||
faligndata %f18, %f20, %f16
|
||||
faligndata %f20, %f22, %f18
|
||||
faligndata %f22, %f24, %f20
|
||||
faligndata %f24, %f26, %f22
|
||||
|
||||
.word 0x81b02800 ! MD5
|
||||
|
||||
bne,pt SIZE_T_CC, .Lhwunaligned_loop
|
||||
for %f26, %f26, %f10 ! %f10=%f26
|
||||
|
||||
ba .Lhwfinish
|
||||
nop
|
||||
|
||||
.align 16
|
||||
.Lsoftware:
|
||||
save %sp,-STACK_FRAME,%sp
|
||||
|
||||
rd %asi,$saved_asi
|
||||
wr %g0,0x88,%asi ! ASI_PRIMARY_LITTLE
|
||||
and $inp,7,$shr
|
||||
andn $inp,7,$inp
|
||||
|
||||
sll $shr,3,$shr ! *=8
|
||||
mov 56,$shl2
|
||||
ld [$ctx+0],$A
|
||||
sub $shl2,$shr,$shl2
|
||||
ld [$ctx+4],$B
|
||||
and $shl2,32,$shl1
|
||||
add $shl2,8,$shl2
|
||||
ld [$ctx+8],$C
|
||||
sub $shl2,$shl1,$shl2 ! shr+shl1+shl2==64
|
||||
ld [$ctx+12],$D
|
||||
nop
|
||||
|
||||
.Loop:
|
||||
cmp $shr,0 ! was inp aligned?
|
||||
ldxa [$inp+0]%asi,@X[0] ! load little-endian input
|
||||
ldxa [$inp+8]%asi,@X[1]
|
||||
ldxa [$inp+16]%asi,@X[2]
|
||||
ldxa [$inp+24]%asi,@X[3]
|
||||
ldxa [$inp+32]%asi,@X[4]
|
||||
sllx $A,32,$AB ! pack A,B
|
||||
ldxa [$inp+40]%asi,@X[5]
|
||||
sllx $C,32,$CD ! pack C,D
|
||||
ldxa [$inp+48]%asi,@X[6]
|
||||
or $B,$AB,$AB
|
||||
ldxa [$inp+56]%asi,@X[7]
|
||||
or $D,$CD,$CD
|
||||
bnz,a,pn %icc,.+8
|
||||
ldxa [$inp+64]%asi,@X[8]
|
||||
|
||||
srlx @X[0],$shr,@X[0] ! align X[0]
|
||||
sllx @X[1],$shl1,$tx
|
||||
sethi %hi(@K[0]),$t2
|
||||
sllx $tx,$shl2,$tx
|
||||
or $t2,%lo(@K[0]),$t2
|
||||
or $tx,@X[0],@X[0]
|
||||
xor $C,$D,$t1
|
||||
add @X[0],$t2,$t2 ! X[0]+K[0]
|
||||
___
|
||||
for ($i=0;$i<15;$i++) { &R0($i,@V); unshift(@V,pop(@V)); }
|
||||
for (;$i<16;$i++) { &R0_1($i,@V); unshift(@V,pop(@V)); }
|
||||
for (;$i<32;$i++) { &R1($i,@V); unshift(@V,pop(@V)); }
|
||||
for (;$i<48;$i++) { &R2($i,@V); unshift(@V,pop(@V)); }
|
||||
for (;$i<64;$i++) { &R3($i,@V); unshift(@V,pop(@V)); }
|
||||
$code.=<<___;
|
||||
srlx $AB,32,$t1 ! unpack A,B,C,D and accumulate
|
||||
add $inp,64,$inp ! advance inp
|
||||
srlx $CD,32,$t2
|
||||
add $t1,$A,$A
|
||||
subcc $len,1,$len ! done yet?
|
||||
add $AB,$B,$B
|
||||
add $t2,$C,$C
|
||||
add $CD,$D,$D
|
||||
srl $B,0,$B ! clruw $B
|
||||
bne SIZE_T_CC,.Loop
|
||||
srl $D,0,$D ! clruw $D
|
||||
|
||||
st $A,[$ctx+0] ! write out ctx
|
||||
st $B,[$ctx+4]
|
||||
st $C,[$ctx+8]
|
||||
st $D,[$ctx+12]
|
||||
|
||||
wr %g0,$saved_asi,%asi
|
||||
ret
|
||||
restore
|
||||
.type md5_block_asm_data_order,#function
|
||||
.size md5_block_asm_data_order,(.-md5_block_asm_data_order)
|
||||
|
||||
.asciz "MD5 block transform for SPARCv9, CRYPTOGAMS by <appro\@openssl.org>"
|
||||
.align 4
|
||||
___
|
||||
|
||||
# Purpose of these subroutines is to explicitly encode VIS instructions,
|
||||
# so that one can compile the module without having to specify VIS
|
||||
# extentions on compiler command line, e.g. -xarch=v9 vs. -xarch=v9a.
|
||||
# Idea is to reserve for option to produce "universal" binary and let
|
||||
# programmer detect if current CPU is VIS capable at run-time.
|
||||
sub unvis {
|
||||
my ($mnemonic,$rs1,$rs2,$rd)=@_;
|
||||
my $ref,$opf;
|
||||
my %visopf = ( "faligndata" => 0x048,
|
||||
"for" => 0x07c );
|
||||
|
||||
$ref = "$mnemonic\t$rs1,$rs2,$rd";
|
||||
|
||||
if ($opf=$visopf{$mnemonic}) {
|
||||
foreach ($rs1,$rs2,$rd) {
|
||||
return $ref if (!/%f([0-9]{1,2})/);
|
||||
$_=$1;
|
||||
if ($1>=32) {
|
||||
return $ref if ($1&1);
|
||||
# re-encode for upper double register addressing
|
||||
$_=($1|$1>>5)&31;
|
||||
}
|
||||
}
|
||||
|
||||
return sprintf ".word\t0x%08x !%s",
|
||||
0x81b00000|$rd<<25|$rs1<<14|$opf<<5|$rs2,
|
||||
$ref;
|
||||
} else {
|
||||
return $ref;
|
||||
}
|
||||
}
|
||||
sub unalignaddr {
|
||||
my ($mnemonic,$rs1,$rs2,$rd)=@_;
|
||||
my %bias = ( "g" => 0, "o" => 8, "l" => 16, "i" => 24 );
|
||||
my $ref="$mnemonic\t$rs1,$rs2,$rd";
|
||||
|
||||
foreach ($rs1,$rs2,$rd) {
|
||||
if (/%([goli])([0-7])/) { $_=$bias{$1}+$2; }
|
||||
else { return $ref; }
|
||||
}
|
||||
return sprintf ".word\t0x%08x !%s",
|
||||
0x81b00300|$rd<<25|$rs1<<14|$rs2,
|
||||
$ref;
|
||||
}
|
||||
|
||||
foreach (split("\n",$code)) {
|
||||
s/\`([^\`]*)\`/eval $1/ge;
|
||||
|
||||
s/\b(f[^\s]*)\s+(%f[0-9]{1,2}),\s*(%f[0-9]{1,2}),\s*(%f[0-9]{1,2})/
|
||||
&unvis($1,$2,$3,$4)
|
||||
/ge;
|
||||
s/\b(alignaddr)\s+(%[goli][0-7]),\s*(%[goli][0-7]),\s*(%[goli][0-7])/
|
||||
&unalignaddr($1,$2,$3,$4)
|
||||
/ge;
|
||||
|
||||
print $_,"\n";
|
||||
}
|
||||
|
||||
close STDOUT;
|
||||
@@ -108,6 +108,7 @@ sub round4_step
|
||||
EOF
|
||||
}
|
||||
|
||||
no warnings qw(uninitialized);
|
||||
my $flavour = shift;
|
||||
my $output = shift;
|
||||
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; }
|
||||
@@ -119,8 +120,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; my $dir=$1; my $xlate;
|
||||
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
|
||||
die "can't locate x86_64-xlate.pl";
|
||||
|
||||
no warnings qw(uninitialized);
|
||||
open STDOUT,"| $^X $xlate $flavour $output";
|
||||
open OUT,"| \"$^X\" $xlate $flavour $output";
|
||||
*STDOUT=*OUT;
|
||||
|
||||
$code .= <<EOF;
|
||||
.text
|
||||
|
||||
Binary file not shown.
@@ -1,677 +0,0 @@
|
||||
.file "asm/md5-586.s"
|
||||
.text
|
||||
.globl _md5_block_asm_data_order
|
||||
.align 4
|
||||
_md5_block_asm_data_order:
|
||||
L_md5_block_asm_data_order_begin:
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
movl 12(%esp),%edi
|
||||
movl 16(%esp),%esi
|
||||
movl 20(%esp),%ecx
|
||||
pushl %ebp
|
||||
shll $6,%ecx
|
||||
pushl %ebx
|
||||
addl %esi,%ecx
|
||||
subl $64,%ecx
|
||||
movl (%edi),%eax
|
||||
pushl %ecx
|
||||
movl 4(%edi),%ebx
|
||||
movl 8(%edi),%ecx
|
||||
movl 12(%edi),%edx
|
||||
L000start:
|
||||
|
||||
# R0 section
|
||||
movl %ecx,%edi
|
||||
movl (%esi),%ebp
|
||||
# R0 0
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
leal 3614090360(%eax,%ebp,1),%eax
|
||||
xorl %edx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $7,%eax
|
||||
movl 4(%esi),%ebp
|
||||
addl %ebx,%eax
|
||||
# R0 1
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
leal 3905402710(%edx,%ebp,1),%edx
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $12,%edx
|
||||
movl 8(%esi),%ebp
|
||||
addl %eax,%edx
|
||||
# R0 2
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
leal 606105819(%ecx,%ebp,1),%ecx
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $17,%ecx
|
||||
movl 12(%esi),%ebp
|
||||
addl %edx,%ecx
|
||||
# R0 3
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
leal 3250441966(%ebx,%ebp,1),%ebx
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $22,%ebx
|
||||
movl 16(%esi),%ebp
|
||||
addl %ecx,%ebx
|
||||
# R0 4
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
leal 4118548399(%eax,%ebp,1),%eax
|
||||
xorl %edx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $7,%eax
|
||||
movl 20(%esi),%ebp
|
||||
addl %ebx,%eax
|
||||
# R0 5
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
leal 1200080426(%edx,%ebp,1),%edx
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $12,%edx
|
||||
movl 24(%esi),%ebp
|
||||
addl %eax,%edx
|
||||
# R0 6
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
leal 2821735955(%ecx,%ebp,1),%ecx
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $17,%ecx
|
||||
movl 28(%esi),%ebp
|
||||
addl %edx,%ecx
|
||||
# R0 7
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
leal 4249261313(%ebx,%ebp,1),%ebx
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $22,%ebx
|
||||
movl 32(%esi),%ebp
|
||||
addl %ecx,%ebx
|
||||
# R0 8
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
leal 1770035416(%eax,%ebp,1),%eax
|
||||
xorl %edx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $7,%eax
|
||||
movl 36(%esi),%ebp
|
||||
addl %ebx,%eax
|
||||
# R0 9
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
leal 2336552879(%edx,%ebp,1),%edx
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $12,%edx
|
||||
movl 40(%esi),%ebp
|
||||
addl %eax,%edx
|
||||
# R0 10
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
leal 4294925233(%ecx,%ebp,1),%ecx
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $17,%ecx
|
||||
movl 44(%esi),%ebp
|
||||
addl %edx,%ecx
|
||||
# R0 11
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
leal 2304563134(%ebx,%ebp,1),%ebx
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $22,%ebx
|
||||
movl 48(%esi),%ebp
|
||||
addl %ecx,%ebx
|
||||
# R0 12
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
leal 1804603682(%eax,%ebp,1),%eax
|
||||
xorl %edx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $7,%eax
|
||||
movl 52(%esi),%ebp
|
||||
addl %ebx,%eax
|
||||
# R0 13
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
leal 4254626195(%edx,%ebp,1),%edx
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $12,%edx
|
||||
movl 56(%esi),%ebp
|
||||
addl %eax,%edx
|
||||
# R0 14
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
leal 2792965006(%ecx,%ebp,1),%ecx
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $17,%ecx
|
||||
movl 60(%esi),%ebp
|
||||
addl %edx,%ecx
|
||||
# R0 15
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
leal 1236535329(%ebx,%ebp,1),%ebx
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $22,%ebx
|
||||
movl 4(%esi),%ebp
|
||||
addl %ecx,%ebx
|
||||
|
||||
# R1 section
|
||||
# R1 16
|
||||
leal 4129170786(%eax,%ebp,1),%eax
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
movl 24(%esi),%ebp
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $5,%eax
|
||||
addl %ebx,%eax
|
||||
# R1 17
|
||||
leal 3225465664(%edx,%ebp,1),%edx
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
movl 44(%esi),%ebp
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $9,%edx
|
||||
addl %eax,%edx
|
||||
# R1 18
|
||||
leal 643717713(%ecx,%ebp,1),%ecx
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
movl (%esi),%ebp
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $14,%ecx
|
||||
addl %edx,%ecx
|
||||
# R1 19
|
||||
leal 3921069994(%ebx,%ebp,1),%ebx
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
movl 20(%esi),%ebp
|
||||
xorl %edx,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $20,%ebx
|
||||
addl %ecx,%ebx
|
||||
# R1 20
|
||||
leal 3593408605(%eax,%ebp,1),%eax
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
movl 40(%esi),%ebp
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $5,%eax
|
||||
addl %ebx,%eax
|
||||
# R1 21
|
||||
leal 38016083(%edx,%ebp,1),%edx
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
movl 60(%esi),%ebp
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $9,%edx
|
||||
addl %eax,%edx
|
||||
# R1 22
|
||||
leal 3634488961(%ecx,%ebp,1),%ecx
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
movl 16(%esi),%ebp
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $14,%ecx
|
||||
addl %edx,%ecx
|
||||
# R1 23
|
||||
leal 3889429448(%ebx,%ebp,1),%ebx
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
movl 36(%esi),%ebp
|
||||
xorl %edx,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $20,%ebx
|
||||
addl %ecx,%ebx
|
||||
# R1 24
|
||||
leal 568446438(%eax,%ebp,1),%eax
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
movl 56(%esi),%ebp
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $5,%eax
|
||||
addl %ebx,%eax
|
||||
# R1 25
|
||||
leal 3275163606(%edx,%ebp,1),%edx
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
movl 12(%esi),%ebp
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $9,%edx
|
||||
addl %eax,%edx
|
||||
# R1 26
|
||||
leal 4107603335(%ecx,%ebp,1),%ecx
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
movl 32(%esi),%ebp
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $14,%ecx
|
||||
addl %edx,%ecx
|
||||
# R1 27
|
||||
leal 1163531501(%ebx,%ebp,1),%ebx
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
movl 52(%esi),%ebp
|
||||
xorl %edx,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $20,%ebx
|
||||
addl %ecx,%ebx
|
||||
# R1 28
|
||||
leal 2850285829(%eax,%ebp,1),%eax
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
movl 8(%esi),%ebp
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $5,%eax
|
||||
addl %ebx,%eax
|
||||
# R1 29
|
||||
leal 4243563512(%edx,%ebp,1),%edx
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
movl 28(%esi),%ebp
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $9,%edx
|
||||
addl %eax,%edx
|
||||
# R1 30
|
||||
leal 1735328473(%ecx,%ebp,1),%ecx
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
movl 48(%esi),%ebp
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $14,%ecx
|
||||
addl %edx,%ecx
|
||||
# R1 31
|
||||
leal 2368359562(%ebx,%ebp,1),%ebx
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
movl 20(%esi),%ebp
|
||||
xorl %edx,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $20,%ebx
|
||||
addl %ecx,%ebx
|
||||
|
||||
# R2 section
|
||||
# R2 32
|
||||
xorl %edx,%edi
|
||||
xorl %ebx,%edi
|
||||
leal 4294588738(%eax,%ebp,1),%eax
|
||||
addl %edi,%eax
|
||||
roll $4,%eax
|
||||
movl 32(%esi),%ebp
|
||||
movl %ebx,%edi
|
||||
# R2 33
|
||||
leal 2272392833(%edx,%ebp,1),%edx
|
||||
addl %ebx,%eax
|
||||
xorl %ecx,%edi
|
||||
xorl %eax,%edi
|
||||
movl 44(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $11,%edx
|
||||
addl %eax,%edx
|
||||
# R2 34
|
||||
xorl %ebx,%edi
|
||||
xorl %edx,%edi
|
||||
leal 1839030562(%ecx,%ebp,1),%ecx
|
||||
addl %edi,%ecx
|
||||
roll $16,%ecx
|
||||
movl 56(%esi),%ebp
|
||||
movl %edx,%edi
|
||||
# R2 35
|
||||
leal 4259657740(%ebx,%ebp,1),%ebx
|
||||
addl %edx,%ecx
|
||||
xorl %eax,%edi
|
||||
xorl %ecx,%edi
|
||||
movl 4(%esi),%ebp
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $23,%ebx
|
||||
addl %ecx,%ebx
|
||||
# R2 36
|
||||
xorl %edx,%edi
|
||||
xorl %ebx,%edi
|
||||
leal 2763975236(%eax,%ebp,1),%eax
|
||||
addl %edi,%eax
|
||||
roll $4,%eax
|
||||
movl 16(%esi),%ebp
|
||||
movl %ebx,%edi
|
||||
# R2 37
|
||||
leal 1272893353(%edx,%ebp,1),%edx
|
||||
addl %ebx,%eax
|
||||
xorl %ecx,%edi
|
||||
xorl %eax,%edi
|
||||
movl 28(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $11,%edx
|
||||
addl %eax,%edx
|
||||
# R2 38
|
||||
xorl %ebx,%edi
|
||||
xorl %edx,%edi
|
||||
leal 4139469664(%ecx,%ebp,1),%ecx
|
||||
addl %edi,%ecx
|
||||
roll $16,%ecx
|
||||
movl 40(%esi),%ebp
|
||||
movl %edx,%edi
|
||||
# R2 39
|
||||
leal 3200236656(%ebx,%ebp,1),%ebx
|
||||
addl %edx,%ecx
|
||||
xorl %eax,%edi
|
||||
xorl %ecx,%edi
|
||||
movl 52(%esi),%ebp
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $23,%ebx
|
||||
addl %ecx,%ebx
|
||||
# R2 40
|
||||
xorl %edx,%edi
|
||||
xorl %ebx,%edi
|
||||
leal 681279174(%eax,%ebp,1),%eax
|
||||
addl %edi,%eax
|
||||
roll $4,%eax
|
||||
movl (%esi),%ebp
|
||||
movl %ebx,%edi
|
||||
# R2 41
|
||||
leal 3936430074(%edx,%ebp,1),%edx
|
||||
addl %ebx,%eax
|
||||
xorl %ecx,%edi
|
||||
xorl %eax,%edi
|
||||
movl 12(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $11,%edx
|
||||
addl %eax,%edx
|
||||
# R2 42
|
||||
xorl %ebx,%edi
|
||||
xorl %edx,%edi
|
||||
leal 3572445317(%ecx,%ebp,1),%ecx
|
||||
addl %edi,%ecx
|
||||
roll $16,%ecx
|
||||
movl 24(%esi),%ebp
|
||||
movl %edx,%edi
|
||||
# R2 43
|
||||
leal 76029189(%ebx,%ebp,1),%ebx
|
||||
addl %edx,%ecx
|
||||
xorl %eax,%edi
|
||||
xorl %ecx,%edi
|
||||
movl 36(%esi),%ebp
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $23,%ebx
|
||||
addl %ecx,%ebx
|
||||
# R2 44
|
||||
xorl %edx,%edi
|
||||
xorl %ebx,%edi
|
||||
leal 3654602809(%eax,%ebp,1),%eax
|
||||
addl %edi,%eax
|
||||
roll $4,%eax
|
||||
movl 48(%esi),%ebp
|
||||
movl %ebx,%edi
|
||||
# R2 45
|
||||
leal 3873151461(%edx,%ebp,1),%edx
|
||||
addl %ebx,%eax
|
||||
xorl %ecx,%edi
|
||||
xorl %eax,%edi
|
||||
movl 60(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $11,%edx
|
||||
addl %eax,%edx
|
||||
# R2 46
|
||||
xorl %ebx,%edi
|
||||
xorl %edx,%edi
|
||||
leal 530742520(%ecx,%ebp,1),%ecx
|
||||
addl %edi,%ecx
|
||||
roll $16,%ecx
|
||||
movl 8(%esi),%ebp
|
||||
movl %edx,%edi
|
||||
# R2 47
|
||||
leal 3299628645(%ebx,%ebp,1),%ebx
|
||||
addl %edx,%ecx
|
||||
xorl %eax,%edi
|
||||
xorl %ecx,%edi
|
||||
movl (%esi),%ebp
|
||||
addl %edi,%ebx
|
||||
movl $-1,%edi
|
||||
roll $23,%ebx
|
||||
addl %ecx,%ebx
|
||||
|
||||
# R3 section
|
||||
# R3 48
|
||||
xorl %edx,%edi
|
||||
orl %ebx,%edi
|
||||
leal 4096336452(%eax,%ebp,1),%eax
|
||||
xorl %ecx,%edi
|
||||
movl 28(%esi),%ebp
|
||||
addl %edi,%eax
|
||||
movl $-1,%edi
|
||||
roll $6,%eax
|
||||
xorl %ecx,%edi
|
||||
addl %ebx,%eax
|
||||
# R3 49
|
||||
orl %eax,%edi
|
||||
leal 1126891415(%edx,%ebp,1),%edx
|
||||
xorl %ebx,%edi
|
||||
movl 56(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl $-1,%edi
|
||||
roll $10,%edx
|
||||
xorl %ebx,%edi
|
||||
addl %eax,%edx
|
||||
# R3 50
|
||||
orl %edx,%edi
|
||||
leal 2878612391(%ecx,%ebp,1),%ecx
|
||||
xorl %eax,%edi
|
||||
movl 20(%esi),%ebp
|
||||
addl %edi,%ecx
|
||||
movl $-1,%edi
|
||||
roll $15,%ecx
|
||||
xorl %eax,%edi
|
||||
addl %edx,%ecx
|
||||
# R3 51
|
||||
orl %ecx,%edi
|
||||
leal 4237533241(%ebx,%ebp,1),%ebx
|
||||
xorl %edx,%edi
|
||||
movl 48(%esi),%ebp
|
||||
addl %edi,%ebx
|
||||
movl $-1,%edi
|
||||
roll $21,%ebx
|
||||
xorl %edx,%edi
|
||||
addl %ecx,%ebx
|
||||
# R3 52
|
||||
orl %ebx,%edi
|
||||
leal 1700485571(%eax,%ebp,1),%eax
|
||||
xorl %ecx,%edi
|
||||
movl 12(%esi),%ebp
|
||||
addl %edi,%eax
|
||||
movl $-1,%edi
|
||||
roll $6,%eax
|
||||
xorl %ecx,%edi
|
||||
addl %ebx,%eax
|
||||
# R3 53
|
||||
orl %eax,%edi
|
||||
leal 2399980690(%edx,%ebp,1),%edx
|
||||
xorl %ebx,%edi
|
||||
movl 40(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl $-1,%edi
|
||||
roll $10,%edx
|
||||
xorl %ebx,%edi
|
||||
addl %eax,%edx
|
||||
# R3 54
|
||||
orl %edx,%edi
|
||||
leal 4293915773(%ecx,%ebp,1),%ecx
|
||||
xorl %eax,%edi
|
||||
movl 4(%esi),%ebp
|
||||
addl %edi,%ecx
|
||||
movl $-1,%edi
|
||||
roll $15,%ecx
|
||||
xorl %eax,%edi
|
||||
addl %edx,%ecx
|
||||
# R3 55
|
||||
orl %ecx,%edi
|
||||
leal 2240044497(%ebx,%ebp,1),%ebx
|
||||
xorl %edx,%edi
|
||||
movl 32(%esi),%ebp
|
||||
addl %edi,%ebx
|
||||
movl $-1,%edi
|
||||
roll $21,%ebx
|
||||
xorl %edx,%edi
|
||||
addl %ecx,%ebx
|
||||
# R3 56
|
||||
orl %ebx,%edi
|
||||
leal 1873313359(%eax,%ebp,1),%eax
|
||||
xorl %ecx,%edi
|
||||
movl 60(%esi),%ebp
|
||||
addl %edi,%eax
|
||||
movl $-1,%edi
|
||||
roll $6,%eax
|
||||
xorl %ecx,%edi
|
||||
addl %ebx,%eax
|
||||
# R3 57
|
||||
orl %eax,%edi
|
||||
leal 4264355552(%edx,%ebp,1),%edx
|
||||
xorl %ebx,%edi
|
||||
movl 24(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl $-1,%edi
|
||||
roll $10,%edx
|
||||
xorl %ebx,%edi
|
||||
addl %eax,%edx
|
||||
# R3 58
|
||||
orl %edx,%edi
|
||||
leal 2734768916(%ecx,%ebp,1),%ecx
|
||||
xorl %eax,%edi
|
||||
movl 52(%esi),%ebp
|
||||
addl %edi,%ecx
|
||||
movl $-1,%edi
|
||||
roll $15,%ecx
|
||||
xorl %eax,%edi
|
||||
addl %edx,%ecx
|
||||
# R3 59
|
||||
orl %ecx,%edi
|
||||
leal 1309151649(%ebx,%ebp,1),%ebx
|
||||
xorl %edx,%edi
|
||||
movl 16(%esi),%ebp
|
||||
addl %edi,%ebx
|
||||
movl $-1,%edi
|
||||
roll $21,%ebx
|
||||
xorl %edx,%edi
|
||||
addl %ecx,%ebx
|
||||
# R3 60
|
||||
orl %ebx,%edi
|
||||
leal 4149444226(%eax,%ebp,1),%eax
|
||||
xorl %ecx,%edi
|
||||
movl 44(%esi),%ebp
|
||||
addl %edi,%eax
|
||||
movl $-1,%edi
|
||||
roll $6,%eax
|
||||
xorl %ecx,%edi
|
||||
addl %ebx,%eax
|
||||
# R3 61
|
||||
orl %eax,%edi
|
||||
leal 3174756917(%edx,%ebp,1),%edx
|
||||
xorl %ebx,%edi
|
||||
movl 8(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl $-1,%edi
|
||||
roll $10,%edx
|
||||
xorl %ebx,%edi
|
||||
addl %eax,%edx
|
||||
# R3 62
|
||||
orl %edx,%edi
|
||||
leal 718787259(%ecx,%ebp,1),%ecx
|
||||
xorl %eax,%edi
|
||||
movl 36(%esi),%ebp
|
||||
addl %edi,%ecx
|
||||
movl $-1,%edi
|
||||
roll $15,%ecx
|
||||
xorl %eax,%edi
|
||||
addl %edx,%ecx
|
||||
# R3 63
|
||||
orl %ecx,%edi
|
||||
leal 3951481745(%ebx,%ebp,1),%ebx
|
||||
xorl %edx,%edi
|
||||
movl 24(%esp),%ebp
|
||||
addl %edi,%ebx
|
||||
addl $64,%esi
|
||||
roll $21,%ebx
|
||||
movl (%ebp),%edi
|
||||
addl %ecx,%ebx
|
||||
addl %edi,%eax
|
||||
movl 4(%ebp),%edi
|
||||
addl %edi,%ebx
|
||||
movl 8(%ebp),%edi
|
||||
addl %edi,%ecx
|
||||
movl 12(%ebp),%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,(%ebp)
|
||||
movl %ebx,4(%ebp)
|
||||
movl (%esp),%edi
|
||||
movl %ecx,8(%ebp)
|
||||
movl %edx,12(%ebp)
|
||||
cmpl %esi,%edi
|
||||
jae L000start
|
||||
popl %eax
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
popl %edi
|
||||
popl %esi
|
||||
ret
|
||||
106
crypto/md5/md5.c
106
crypto/md5/md5.c
@@ -5,21 +5,21 @@
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@@ -34,10 +34,10 @@
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -49,7 +49,7 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
@@ -60,7 +60,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <openssl/md5.h>
|
||||
|
||||
#define BUFSIZE 1024*16
|
||||
#define BUFSIZE 1024*16
|
||||
|
||||
void do_fp(FILE *f);
|
||||
void pt(unsigned char *md);
|
||||
@@ -69,59 +69,53 @@ int read(int, void *, unsigned int);
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i,err=0;
|
||||
FILE *IN;
|
||||
{
|
||||
int i, err = 0;
|
||||
FILE *IN;
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
do_fp(stdin);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i=1; i<argc; i++)
|
||||
{
|
||||
IN=fopen(argv[i],"r");
|
||||
if (IN == NULL)
|
||||
{
|
||||
perror(argv[i]);
|
||||
err++;
|
||||
continue;
|
||||
}
|
||||
printf("MD5(%s)= ",argv[i]);
|
||||
do_fp(IN);
|
||||
fclose(IN);
|
||||
}
|
||||
}
|
||||
exit(err);
|
||||
}
|
||||
if (argc == 1) {
|
||||
do_fp(stdin);
|
||||
} else {
|
||||
for (i = 1; i < argc; i++) {
|
||||
IN = fopen(argv[i], "r");
|
||||
if (IN == NULL) {
|
||||
perror(argv[i]);
|
||||
err++;
|
||||
continue;
|
||||
}
|
||||
printf("MD5(%s)= ", argv[i]);
|
||||
do_fp(IN);
|
||||
fclose(IN);
|
||||
}
|
||||
}
|
||||
exit(err);
|
||||
}
|
||||
|
||||
void do_fp(FILE *f)
|
||||
{
|
||||
MD5_CTX c;
|
||||
unsigned char md[MD5_DIGEST_LENGTH];
|
||||
int fd;
|
||||
int i;
|
||||
static unsigned char buf[BUFSIZE];
|
||||
{
|
||||
MD5_CTX c;
|
||||
unsigned char md[MD5_DIGEST_LENGTH];
|
||||
int fd;
|
||||
int i;
|
||||
static unsigned char buf[BUFSIZE];
|
||||
|
||||
fd=fileno(f);
|
||||
MD5_Init(&c);
|
||||
for (;;)
|
||||
{
|
||||
i=read(fd,buf,BUFSIZE);
|
||||
if (i <= 0) break;
|
||||
MD5_Update(&c,buf,(unsigned long)i);
|
||||
}
|
||||
MD5_Final(&(md[0]),&c);
|
||||
pt(md);
|
||||
}
|
||||
fd = fileno(f);
|
||||
MD5_Init(&c);
|
||||
for (;;) {
|
||||
i = read(fd, buf, BUFSIZE);
|
||||
if (i <= 0)
|
||||
break;
|
||||
MD5_Update(&c, buf, (unsigned long)i);
|
||||
}
|
||||
MD5_Final(&(md[0]), &c);
|
||||
pt(md);
|
||||
}
|
||||
|
||||
void pt(unsigned char *md)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<MD5_DIGEST_LENGTH; i++)
|
||||
printf("%02x",md[i]);
|
||||
printf("\n");
|
||||
}
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MD5_DIGEST_LENGTH; i++)
|
||||
printf("%02x", md[i]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@@ -5,21 +5,21 @@
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@@ -34,10 +34,10 @@
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -49,7 +49,7 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
@@ -57,54 +57,56 @@
|
||||
*/
|
||||
|
||||
#ifndef HEADER_MD5_H
|
||||
#define HEADER_MD5_H
|
||||
# define HEADER_MD5_H
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
#include <stddef.h>
|
||||
# include <openssl/e_os2.h>
|
||||
# include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef OPENSSL_NO_MD5
|
||||
#error MD5 is disabled.
|
||||
#endif
|
||||
# ifdef OPENSSL_NO_MD5
|
||||
# error MD5 is disabled.
|
||||
# endif
|
||||
|
||||
/*
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* ! MD5_LONG has to be at least 32 bits wide. If it's wider, then !
|
||||
* ! MD5_LONG_LOG2 has to be defined along. !
|
||||
* ! MD5_LONG_LOG2 has to be defined along. !
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*/
|
||||
|
||||
#if defined(__LP32__)
|
||||
#define MD5_LONG unsigned long
|
||||
#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
|
||||
#define MD5_LONG unsigned long
|
||||
#define MD5_LONG_LOG2 3
|
||||
# if defined(__LP32__)
|
||||
# define MD5_LONG unsigned long
|
||||
# elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
|
||||
# define MD5_LONG unsigned long
|
||||
# define MD5_LONG_LOG2 3
|
||||
/*
|
||||
* _CRAY note. I could declare short, but I have no idea what impact
|
||||
* does it have on performance on none-T3E machines. I could declare
|
||||
* int, but at least on C90 sizeof(int) can be chosen at compile time.
|
||||
* So I've chosen long...
|
||||
* <appro@fy.chalmers.se>
|
||||
* <appro@fy.chalmers.se>
|
||||
*/
|
||||
#else
|
||||
#define MD5_LONG unsigned int
|
||||
#endif
|
||||
# else
|
||||
# define MD5_LONG unsigned int
|
||||
# endif
|
||||
|
||||
#define MD5_CBLOCK 64
|
||||
#define MD5_LBLOCK (MD5_CBLOCK/4)
|
||||
#define MD5_DIGEST_LENGTH 16
|
||||
# define MD5_CBLOCK 64
|
||||
# define MD5_LBLOCK (MD5_CBLOCK/4)
|
||||
# define MD5_DIGEST_LENGTH 16
|
||||
|
||||
typedef struct MD5state_st
|
||||
{
|
||||
MD5_LONG A,B,C,D;
|
||||
MD5_LONG Nl,Nh;
|
||||
MD5_LONG data[MD5_LBLOCK];
|
||||
unsigned int num;
|
||||
} MD5_CTX;
|
||||
typedef struct MD5state_st {
|
||||
MD5_LONG A, B, C, D;
|
||||
MD5_LONG Nl, Nh;
|
||||
MD5_LONG data[MD5_LBLOCK];
|
||||
unsigned int num;
|
||||
} MD5_CTX;
|
||||
|
||||
# ifdef OPENSSL_FIPS
|
||||
int private_MD5_Init(MD5_CTX *c);
|
||||
# endif
|
||||
int MD5_Init(MD5_CTX *c);
|
||||
int MD5_Update(MD5_CTX *c, const void *data, size_t len);
|
||||
int MD5_Final(unsigned char *md, MD5_CTX *c);
|
||||
|
||||
@@ -5,21 +5,21 @@
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@@ -34,10 +34,10 @@
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -49,7 +49,7 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
@@ -59,10 +59,12 @@
|
||||
#include <stdio.h>
|
||||
#include "md5_locl.h"
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
const char MD5_version[]="MD5" OPENSSL_VERSION_PTEXT;
|
||||
const char MD5_version[] = "MD5" OPENSSL_VERSION_PTEXT;
|
||||
|
||||
/* Implemented from RFC1321 The MD5 Message-Digest Algorithm
|
||||
/*
|
||||
* Implemented from RFC1321 The MD5 Message-Digest Algorithm
|
||||
*/
|
||||
|
||||
#define INIT_DATA_A (unsigned long)0x67452301L
|
||||
@@ -70,115 +72,145 @@ const char MD5_version[]="MD5" OPENSSL_VERSION_PTEXT;
|
||||
#define INIT_DATA_C (unsigned long)0x98badcfeL
|
||||
#define INIT_DATA_D (unsigned long)0x10325476L
|
||||
|
||||
int MD5_Init(MD5_CTX *c)
|
||||
{
|
||||
memset (c,0,sizeof(*c));
|
||||
c->A=INIT_DATA_A;
|
||||
c->B=INIT_DATA_B;
|
||||
c->C=INIT_DATA_C;
|
||||
c->D=INIT_DATA_D;
|
||||
return 1;
|
||||
}
|
||||
fips_md_init(MD5)
|
||||
{
|
||||
memset(c, 0, sizeof(*c));
|
||||
c->A = INIT_DATA_A;
|
||||
c->B = INIT_DATA_B;
|
||||
c->C = INIT_DATA_C;
|
||||
c->D = INIT_DATA_D;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef md5_block_data_order
|
||||
#ifdef X
|
||||
#undef X
|
||||
#endif
|
||||
void md5_block_data_order (MD5_CTX *c, const void *data_, size_t num)
|
||||
{
|
||||
const unsigned char *data=data_;
|
||||
register unsigned MD32_REG_T A,B,C,D,l;
|
||||
#ifndef MD32_XARRAY
|
||||
/* See comment in crypto/sha/sha_locl.h for details. */
|
||||
unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
|
||||
XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15;
|
||||
# define X(i) XX##i
|
||||
#else
|
||||
MD5_LONG XX[MD5_LBLOCK];
|
||||
# define X(i) XX[i]
|
||||
#endif
|
||||
# ifdef X
|
||||
# undef X
|
||||
# endif
|
||||
void md5_block_data_order(MD5_CTX *c, const void *data_, size_t num)
|
||||
{
|
||||
const unsigned char *data = data_;
|
||||
register unsigned MD32_REG_T A, B, C, D, l;
|
||||
# ifndef MD32_XARRAY
|
||||
/* See comment in crypto/sha/sha_locl.h for details. */
|
||||
unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
|
||||
XX8, XX9, XX10, XX11, XX12, XX13, XX14, XX15;
|
||||
# define X(i) XX##i
|
||||
# else
|
||||
MD5_LONG XX[MD5_LBLOCK];
|
||||
# define X(i) XX[i]
|
||||
# endif
|
||||
|
||||
A=c->A;
|
||||
B=c->B;
|
||||
C=c->C;
|
||||
D=c->D;
|
||||
A = c->A;
|
||||
B = c->B;
|
||||
C = c->C;
|
||||
D = c->D;
|
||||
|
||||
for (;num--;)
|
||||
{
|
||||
HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l;
|
||||
/* Round 0 */
|
||||
R0(A,B,C,D,X( 0), 7,0xd76aa478L); HOST_c2l(data,l); X( 2)=l;
|
||||
R0(D,A,B,C,X( 1),12,0xe8c7b756L); HOST_c2l(data,l); X( 3)=l;
|
||||
R0(C,D,A,B,X( 2),17,0x242070dbL); HOST_c2l(data,l); X( 4)=l;
|
||||
R0(B,C,D,A,X( 3),22,0xc1bdceeeL); HOST_c2l(data,l); X( 5)=l;
|
||||
R0(A,B,C,D,X( 4), 7,0xf57c0fafL); HOST_c2l(data,l); X( 6)=l;
|
||||
R0(D,A,B,C,X( 5),12,0x4787c62aL); HOST_c2l(data,l); X( 7)=l;
|
||||
R0(C,D,A,B,X( 6),17,0xa8304613L); HOST_c2l(data,l); X( 8)=l;
|
||||
R0(B,C,D,A,X( 7),22,0xfd469501L); HOST_c2l(data,l); X( 9)=l;
|
||||
R0(A,B,C,D,X( 8), 7,0x698098d8L); HOST_c2l(data,l); X(10)=l;
|
||||
R0(D,A,B,C,X( 9),12,0x8b44f7afL); HOST_c2l(data,l); X(11)=l;
|
||||
R0(C,D,A,B,X(10),17,0xffff5bb1L); HOST_c2l(data,l); X(12)=l;
|
||||
R0(B,C,D,A,X(11),22,0x895cd7beL); HOST_c2l(data,l); X(13)=l;
|
||||
R0(A,B,C,D,X(12), 7,0x6b901122L); HOST_c2l(data,l); X(14)=l;
|
||||
R0(D,A,B,C,X(13),12,0xfd987193L); HOST_c2l(data,l); X(15)=l;
|
||||
R0(C,D,A,B,X(14),17,0xa679438eL);
|
||||
R0(B,C,D,A,X(15),22,0x49b40821L);
|
||||
/* Round 1 */
|
||||
R1(A,B,C,D,X( 1), 5,0xf61e2562L);
|
||||
R1(D,A,B,C,X( 6), 9,0xc040b340L);
|
||||
R1(C,D,A,B,X(11),14,0x265e5a51L);
|
||||
R1(B,C,D,A,X( 0),20,0xe9b6c7aaL);
|
||||
R1(A,B,C,D,X( 5), 5,0xd62f105dL);
|
||||
R1(D,A,B,C,X(10), 9,0x02441453L);
|
||||
R1(C,D,A,B,X(15),14,0xd8a1e681L);
|
||||
R1(B,C,D,A,X( 4),20,0xe7d3fbc8L);
|
||||
R1(A,B,C,D,X( 9), 5,0x21e1cde6L);
|
||||
R1(D,A,B,C,X(14), 9,0xc33707d6L);
|
||||
R1(C,D,A,B,X( 3),14,0xf4d50d87L);
|
||||
R1(B,C,D,A,X( 8),20,0x455a14edL);
|
||||
R1(A,B,C,D,X(13), 5,0xa9e3e905L);
|
||||
R1(D,A,B,C,X( 2), 9,0xfcefa3f8L);
|
||||
R1(C,D,A,B,X( 7),14,0x676f02d9L);
|
||||
R1(B,C,D,A,X(12),20,0x8d2a4c8aL);
|
||||
/* Round 2 */
|
||||
R2(A,B,C,D,X( 5), 4,0xfffa3942L);
|
||||
R2(D,A,B,C,X( 8),11,0x8771f681L);
|
||||
R2(C,D,A,B,X(11),16,0x6d9d6122L);
|
||||
R2(B,C,D,A,X(14),23,0xfde5380cL);
|
||||
R2(A,B,C,D,X( 1), 4,0xa4beea44L);
|
||||
R2(D,A,B,C,X( 4),11,0x4bdecfa9L);
|
||||
R2(C,D,A,B,X( 7),16,0xf6bb4b60L);
|
||||
R2(B,C,D,A,X(10),23,0xbebfbc70L);
|
||||
R2(A,B,C,D,X(13), 4,0x289b7ec6L);
|
||||
R2(D,A,B,C,X( 0),11,0xeaa127faL);
|
||||
R2(C,D,A,B,X( 3),16,0xd4ef3085L);
|
||||
R2(B,C,D,A,X( 6),23,0x04881d05L);
|
||||
R2(A,B,C,D,X( 9), 4,0xd9d4d039L);
|
||||
R2(D,A,B,C,X(12),11,0xe6db99e5L);
|
||||
R2(C,D,A,B,X(15),16,0x1fa27cf8L);
|
||||
R2(B,C,D,A,X( 2),23,0xc4ac5665L);
|
||||
/* Round 3 */
|
||||
R3(A,B,C,D,X( 0), 6,0xf4292244L);
|
||||
R3(D,A,B,C,X( 7),10,0x432aff97L);
|
||||
R3(C,D,A,B,X(14),15,0xab9423a7L);
|
||||
R3(B,C,D,A,X( 5),21,0xfc93a039L);
|
||||
R3(A,B,C,D,X(12), 6,0x655b59c3L);
|
||||
R3(D,A,B,C,X( 3),10,0x8f0ccc92L);
|
||||
R3(C,D,A,B,X(10),15,0xffeff47dL);
|
||||
R3(B,C,D,A,X( 1),21,0x85845dd1L);
|
||||
R3(A,B,C,D,X( 8), 6,0x6fa87e4fL);
|
||||
R3(D,A,B,C,X(15),10,0xfe2ce6e0L);
|
||||
R3(C,D,A,B,X( 6),15,0xa3014314L);
|
||||
R3(B,C,D,A,X(13),21,0x4e0811a1L);
|
||||
R3(A,B,C,D,X( 4), 6,0xf7537e82L);
|
||||
R3(D,A,B,C,X(11),10,0xbd3af235L);
|
||||
R3(C,D,A,B,X( 2),15,0x2ad7d2bbL);
|
||||
R3(B,C,D,A,X( 9),21,0xeb86d391L);
|
||||
for (; num--;) {
|
||||
HOST_c2l(data, l);
|
||||
X(0) = l;
|
||||
HOST_c2l(data, l);
|
||||
X(1) = l;
|
||||
/* Round 0 */
|
||||
R0(A, B, C, D, X(0), 7, 0xd76aa478L);
|
||||
HOST_c2l(data, l);
|
||||
X(2) = l;
|
||||
R0(D, A, B, C, X(1), 12, 0xe8c7b756L);
|
||||
HOST_c2l(data, l);
|
||||
X(3) = l;
|
||||
R0(C, D, A, B, X(2), 17, 0x242070dbL);
|
||||
HOST_c2l(data, l);
|
||||
X(4) = l;
|
||||
R0(B, C, D, A, X(3), 22, 0xc1bdceeeL);
|
||||
HOST_c2l(data, l);
|
||||
X(5) = l;
|
||||
R0(A, B, C, D, X(4), 7, 0xf57c0fafL);
|
||||
HOST_c2l(data, l);
|
||||
X(6) = l;
|
||||
R0(D, A, B, C, X(5), 12, 0x4787c62aL);
|
||||
HOST_c2l(data, l);
|
||||
X(7) = l;
|
||||
R0(C, D, A, B, X(6), 17, 0xa8304613L);
|
||||
HOST_c2l(data, l);
|
||||
X(8) = l;
|
||||
R0(B, C, D, A, X(7), 22, 0xfd469501L);
|
||||
HOST_c2l(data, l);
|
||||
X(9) = l;
|
||||
R0(A, B, C, D, X(8), 7, 0x698098d8L);
|
||||
HOST_c2l(data, l);
|
||||
X(10) = l;
|
||||
R0(D, A, B, C, X(9), 12, 0x8b44f7afL);
|
||||
HOST_c2l(data, l);
|
||||
X(11) = l;
|
||||
R0(C, D, A, B, X(10), 17, 0xffff5bb1L);
|
||||
HOST_c2l(data, l);
|
||||
X(12) = l;
|
||||
R0(B, C, D, A, X(11), 22, 0x895cd7beL);
|
||||
HOST_c2l(data, l);
|
||||
X(13) = l;
|
||||
R0(A, B, C, D, X(12), 7, 0x6b901122L);
|
||||
HOST_c2l(data, l);
|
||||
X(14) = l;
|
||||
R0(D, A, B, C, X(13), 12, 0xfd987193L);
|
||||
HOST_c2l(data, l);
|
||||
X(15) = l;
|
||||
R0(C, D, A, B, X(14), 17, 0xa679438eL);
|
||||
R0(B, C, D, A, X(15), 22, 0x49b40821L);
|
||||
/* Round 1 */
|
||||
R1(A, B, C, D, X(1), 5, 0xf61e2562L);
|
||||
R1(D, A, B, C, X(6), 9, 0xc040b340L);
|
||||
R1(C, D, A, B, X(11), 14, 0x265e5a51L);
|
||||
R1(B, C, D, A, X(0), 20, 0xe9b6c7aaL);
|
||||
R1(A, B, C, D, X(5), 5, 0xd62f105dL);
|
||||
R1(D, A, B, C, X(10), 9, 0x02441453L);
|
||||
R1(C, D, A, B, X(15), 14, 0xd8a1e681L);
|
||||
R1(B, C, D, A, X(4), 20, 0xe7d3fbc8L);
|
||||
R1(A, B, C, D, X(9), 5, 0x21e1cde6L);
|
||||
R1(D, A, B, C, X(14), 9, 0xc33707d6L);
|
||||
R1(C, D, A, B, X(3), 14, 0xf4d50d87L);
|
||||
R1(B, C, D, A, X(8), 20, 0x455a14edL);
|
||||
R1(A, B, C, D, X(13), 5, 0xa9e3e905L);
|
||||
R1(D, A, B, C, X(2), 9, 0xfcefa3f8L);
|
||||
R1(C, D, A, B, X(7), 14, 0x676f02d9L);
|
||||
R1(B, C, D, A, X(12), 20, 0x8d2a4c8aL);
|
||||
/* Round 2 */
|
||||
R2(A, B, C, D, X(5), 4, 0xfffa3942L);
|
||||
R2(D, A, B, C, X(8), 11, 0x8771f681L);
|
||||
R2(C, D, A, B, X(11), 16, 0x6d9d6122L);
|
||||
R2(B, C, D, A, X(14), 23, 0xfde5380cL);
|
||||
R2(A, B, C, D, X(1), 4, 0xa4beea44L);
|
||||
R2(D, A, B, C, X(4), 11, 0x4bdecfa9L);
|
||||
R2(C, D, A, B, X(7), 16, 0xf6bb4b60L);
|
||||
R2(B, C, D, A, X(10), 23, 0xbebfbc70L);
|
||||
R2(A, B, C, D, X(13), 4, 0x289b7ec6L);
|
||||
R2(D, A, B, C, X(0), 11, 0xeaa127faL);
|
||||
R2(C, D, A, B, X(3), 16, 0xd4ef3085L);
|
||||
R2(B, C, D, A, X(6), 23, 0x04881d05L);
|
||||
R2(A, B, C, D, X(9), 4, 0xd9d4d039L);
|
||||
R2(D, A, B, C, X(12), 11, 0xe6db99e5L);
|
||||
R2(C, D, A, B, X(15), 16, 0x1fa27cf8L);
|
||||
R2(B, C, D, A, X(2), 23, 0xc4ac5665L);
|
||||
/* Round 3 */
|
||||
R3(A, B, C, D, X(0), 6, 0xf4292244L);
|
||||
R3(D, A, B, C, X(7), 10, 0x432aff97L);
|
||||
R3(C, D, A, B, X(14), 15, 0xab9423a7L);
|
||||
R3(B, C, D, A, X(5), 21, 0xfc93a039L);
|
||||
R3(A, B, C, D, X(12), 6, 0x655b59c3L);
|
||||
R3(D, A, B, C, X(3), 10, 0x8f0ccc92L);
|
||||
R3(C, D, A, B, X(10), 15, 0xffeff47dL);
|
||||
R3(B, C, D, A, X(1), 21, 0x85845dd1L);
|
||||
R3(A, B, C, D, X(8), 6, 0x6fa87e4fL);
|
||||
R3(D, A, B, C, X(15), 10, 0xfe2ce6e0L);
|
||||
R3(C, D, A, B, X(6), 15, 0xa3014314L);
|
||||
R3(B, C, D, A, X(13), 21, 0x4e0811a1L);
|
||||
R3(A, B, C, D, X(4), 6, 0xf7537e82L);
|
||||
R3(D, A, B, C, X(11), 10, 0xbd3af235L);
|
||||
R3(C, D, A, B, X(2), 15, 0x2ad7d2bbL);
|
||||
R3(B, C, D, A, X(9), 21, 0xeb86d391L);
|
||||
|
||||
A = c->A += A;
|
||||
B = c->B += B;
|
||||
C = c->C += C;
|
||||
D = c->D += D;
|
||||
}
|
||||
}
|
||||
A = c->A += A;
|
||||
B = c->B += B;
|
||||
C = c->C += C;
|
||||
D = c->D += D;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Binary file not shown.
@@ -5,21 +5,21 @@
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@@ -34,10 +34,10 @@
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -49,7 +49,7 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
@@ -62,7 +62,7 @@
|
||||
#include <openssl/md5.h>
|
||||
|
||||
#ifndef MD5_LONG_LOG2
|
||||
#define MD5_LONG_LOG2 2 /* default to 32 bits */
|
||||
# define MD5_LONG_LOG2 2 /* default to 32 bits */
|
||||
#endif
|
||||
|
||||
#ifdef MD5_ASM
|
||||
@@ -71,60 +71,63 @@
|
||||
# define md5_block_data_order md5_block_asm_data_order
|
||||
# elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
|
||||
# define md5_block_data_order md5_block_asm_data_order
|
||||
# elif defined(__sparc) || defined(__sparc__)
|
||||
# define md5_block_data_order md5_block_asm_data_order
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void md5_block_data_order (MD5_CTX *c, const void *p,size_t num);
|
||||
void md5_block_data_order(MD5_CTX *c, const void *p, size_t num);
|
||||
|
||||
#define DATA_ORDER_IS_LITTLE_ENDIAN
|
||||
|
||||
#define HASH_LONG MD5_LONG
|
||||
#define HASH_CTX MD5_CTX
|
||||
#define HASH_CBLOCK MD5_CBLOCK
|
||||
#define HASH_UPDATE MD5_Update
|
||||
#define HASH_TRANSFORM MD5_Transform
|
||||
#define HASH_FINAL MD5_Final
|
||||
#define HASH_MAKE_STRING(c,s) do { \
|
||||
unsigned long ll; \
|
||||
ll=(c)->A; HOST_l2c(ll,(s)); \
|
||||
ll=(c)->B; HOST_l2c(ll,(s)); \
|
||||
ll=(c)->C; HOST_l2c(ll,(s)); \
|
||||
ll=(c)->D; HOST_l2c(ll,(s)); \
|
||||
} while (0)
|
||||
#define HASH_BLOCK_DATA_ORDER md5_block_data_order
|
||||
#define HASH_LONG MD5_LONG
|
||||
#define HASH_CTX MD5_CTX
|
||||
#define HASH_CBLOCK MD5_CBLOCK
|
||||
#define HASH_UPDATE MD5_Update
|
||||
#define HASH_TRANSFORM MD5_Transform
|
||||
#define HASH_FINAL MD5_Final
|
||||
#define HASH_MAKE_STRING(c,s) do { \
|
||||
unsigned long ll; \
|
||||
ll=(c)->A; (void)HOST_l2c(ll,(s)); \
|
||||
ll=(c)->B; (void)HOST_l2c(ll,(s)); \
|
||||
ll=(c)->C; (void)HOST_l2c(ll,(s)); \
|
||||
ll=(c)->D; (void)HOST_l2c(ll,(s)); \
|
||||
} while (0)
|
||||
#define HASH_BLOCK_DATA_ORDER md5_block_data_order
|
||||
|
||||
#include "md32_common.h"
|
||||
|
||||
/*
|
||||
#define F(x,y,z) (((x) & (y)) | ((~(x)) & (z)))
|
||||
#define G(x,y,z) (((x) & (z)) | ((y) & (~(z))))
|
||||
/*-
|
||||
#define F(x,y,z) (((x) & (y)) | ((~(x)) & (z)))
|
||||
#define G(x,y,z) (((x) & (z)) | ((y) & (~(z))))
|
||||
*/
|
||||
|
||||
/* As pointed out by Wei Dai <weidai@eskimo.com>, the above can be
|
||||
* simplified to the code below. Wei attributes these optimizations
|
||||
* to Peter Gutmann's SHS code, and he attributes it to Rich Schroeppel.
|
||||
/*
|
||||
* As pointed out by Wei Dai <weidai@eskimo.com>, the above can be simplified
|
||||
* to the code below. Wei attributes these optimizations to Peter Gutmann's
|
||||
* SHS code, and he attributes it to Rich Schroeppel.
|
||||
*/
|
||||
#define F(b,c,d) ((((c) ^ (d)) & (b)) ^ (d))
|
||||
#define G(b,c,d) ((((b) ^ (c)) & (d)) ^ (c))
|
||||
#define H(b,c,d) ((b) ^ (c) ^ (d))
|
||||
#define I(b,c,d) (((~(d)) | (b)) ^ (c))
|
||||
#define F(b,c,d) ((((c) ^ (d)) & (b)) ^ (d))
|
||||
#define G(b,c,d) ((((b) ^ (c)) & (d)) ^ (c))
|
||||
#define H(b,c,d) ((b) ^ (c) ^ (d))
|
||||
#define I(b,c,d) (((~(d)) | (b)) ^ (c))
|
||||
|
||||
#define R0(a,b,c,d,k,s,t) { \
|
||||
a+=((k)+(t)+F((b),(c),(d))); \
|
||||
a=ROTATE(a,s); \
|
||||
a+=b; };\
|
||||
a+=((k)+(t)+F((b),(c),(d))); \
|
||||
a=ROTATE(a,s); \
|
||||
a+=b; };\
|
||||
|
||||
#define R1(a,b,c,d,k,s,t) { \
|
||||
a+=((k)+(t)+G((b),(c),(d))); \
|
||||
a=ROTATE(a,s); \
|
||||
a+=b; };
|
||||
a+=((k)+(t)+G((b),(c),(d))); \
|
||||
a=ROTATE(a,s); \
|
||||
a+=b; };
|
||||
|
||||
#define R2(a,b,c,d,k,s,t) { \
|
||||
a+=((k)+(t)+H((b),(c),(d))); \
|
||||
a=ROTATE(a,s); \
|
||||
a+=b; };
|
||||
a+=((k)+(t)+H((b),(c),(d))); \
|
||||
a=ROTATE(a,s); \
|
||||
a+=b; };
|
||||
|
||||
#define R3(a,b,c,d,k,s,t) { \
|
||||
a+=((k)+(t)+I((b),(c),(d))); \
|
||||
a=ROTATE(a,s); \
|
||||
a+=b; };
|
||||
a+=((k)+(t)+I((b),(c),(d))); \
|
||||
a=ROTATE(a,s); \
|
||||
a+=b; };
|
||||
|
||||
@@ -5,21 +5,21 @@
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@@ -34,10 +34,10 @@
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -49,7 +49,7 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
@@ -62,36 +62,35 @@
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
#ifdef CHARSET_EBCDIC
|
||||
#include <openssl/ebcdic.h>
|
||||
# include <openssl/ebcdic.h>
|
||||
#endif
|
||||
|
||||
unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md)
|
||||
{
|
||||
MD5_CTX c;
|
||||
static unsigned char m[MD5_DIGEST_LENGTH];
|
||||
{
|
||||
MD5_CTX c;
|
||||
static unsigned char m[MD5_DIGEST_LENGTH];
|
||||
|
||||
if (md == NULL) md=m;
|
||||
if (!MD5_Init(&c))
|
||||
return NULL;
|
||||
if (md == NULL)
|
||||
md = m;
|
||||
if (!MD5_Init(&c))
|
||||
return NULL;
|
||||
#ifndef CHARSET_EBCDIC
|
||||
MD5_Update(&c,d,n);
|
||||
MD5_Update(&c, d, n);
|
||||
#else
|
||||
{
|
||||
char temp[1024];
|
||||
unsigned long chunk;
|
||||
{
|
||||
char temp[1024];
|
||||
unsigned long chunk;
|
||||
|
||||
while (n > 0)
|
||||
{
|
||||
chunk = (n > sizeof(temp)) ? sizeof(temp) : n;
|
||||
ebcdic2ascii(temp, d, chunk);
|
||||
MD5_Update(&c,temp,chunk);
|
||||
n -= chunk;
|
||||
d += chunk;
|
||||
}
|
||||
}
|
||||
while (n > 0) {
|
||||
chunk = (n > sizeof(temp)) ? sizeof(temp) : n;
|
||||
ebcdic2ascii(temp, d, chunk);
|
||||
MD5_Update(&c, temp, chunk);
|
||||
n -= chunk;
|
||||
d += chunk;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
MD5_Final(md,&c);
|
||||
OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
|
||||
return(md);
|
||||
}
|
||||
|
||||
MD5_Final(md, &c);
|
||||
OPENSSL_cleanse(&c, sizeof(c)); /* security consideration */
|
||||
return (md);
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -5,21 +5,21 @@
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@@ -34,10 +34,10 @@
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -49,7 +49,7 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
@@ -66,75 +66,73 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("No MD5 support\n");
|
||||
return(0);
|
||||
return (0);
|
||||
}
|
||||
#else
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/md5.h>
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/md5.h>
|
||||
|
||||
static char *test[]={
|
||||
"",
|
||||
"a",
|
||||
"abc",
|
||||
"message digest",
|
||||
"abcdefghijklmnopqrstuvwxyz",
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
|
||||
"12345678901234567890123456789012345678901234567890123456789012345678901234567890",
|
||||
NULL,
|
||||
};
|
||||
static char *test[] = {
|
||||
"",
|
||||
"a",
|
||||
"abc",
|
||||
"message digest",
|
||||
"abcdefghijklmnopqrstuvwxyz",
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
|
||||
"12345678901234567890123456789012345678901234567890123456789012345678901234567890",
|
||||
NULL,
|
||||
};
|
||||
|
||||
static char *ret[]={
|
||||
"d41d8cd98f00b204e9800998ecf8427e",
|
||||
"0cc175b9c0f1b6a831c399e269772661",
|
||||
"900150983cd24fb0d6963f7d28e17f72",
|
||||
"f96b697d7cb7938d525a2f31aaf161d0",
|
||||
"c3fcd3d76192e4007dfb496cca67e13b",
|
||||
"d174ab98d277d9f5a5611c2c9f419d9f",
|
||||
"57edf4a22be3c955ac49da2e2107b67a",
|
||||
};
|
||||
static char *ret[] = {
|
||||
"d41d8cd98f00b204e9800998ecf8427e",
|
||||
"0cc175b9c0f1b6a831c399e269772661",
|
||||
"900150983cd24fb0d6963f7d28e17f72",
|
||||
"f96b697d7cb7938d525a2f31aaf161d0",
|
||||
"c3fcd3d76192e4007dfb496cca67e13b",
|
||||
"d174ab98d277d9f5a5611c2c9f419d9f",
|
||||
"57edf4a22be3c955ac49da2e2107b67a",
|
||||
};
|
||||
|
||||
static char *pt(unsigned char *md);
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i,err=0;
|
||||
char **P,**R;
|
||||
char *p;
|
||||
unsigned char md[MD5_DIGEST_LENGTH];
|
||||
{
|
||||
int i, err = 0;
|
||||
char **P, **R;
|
||||
char *p;
|
||||
unsigned char md[MD5_DIGEST_LENGTH];
|
||||
|
||||
P=test;
|
||||
R=ret;
|
||||
i=1;
|
||||
while (*P != NULL)
|
||||
{
|
||||
EVP_Digest(&(P[0][0]),strlen((char *)*P),md,NULL,EVP_md5(), NULL);
|
||||
p=pt(md);
|
||||
if (strcmp(p,(char *)*R) != 0)
|
||||
{
|
||||
printf("error calculating MD5 on '%s'\n",*P);
|
||||
printf("got %s instead of %s\n",p,*R);
|
||||
err++;
|
||||
}
|
||||
else
|
||||
printf("test %d ok\n",i);
|
||||
i++;
|
||||
R++;
|
||||
P++;
|
||||
}
|
||||
P = test;
|
||||
R = ret;
|
||||
i = 1;
|
||||
while (*P != NULL) {
|
||||
EVP_Digest(&(P[0][0]), strlen((char *)*P), md, NULL, EVP_md5(), NULL);
|
||||
p = pt(md);
|
||||
if (strcmp(p, (char *)*R) != 0) {
|
||||
printf("error calculating MD5 on '%s'\n", *P);
|
||||
printf("got %s instead of %s\n", p, *R);
|
||||
err++;
|
||||
} else
|
||||
printf("test %d ok\n", i);
|
||||
i++;
|
||||
R++;
|
||||
P++;
|
||||
}
|
||||
|
||||
#ifdef OPENSSL_SYS_NETWARE
|
||||
if (err) printf("ERROR: %d\n", err);
|
||||
#endif
|
||||
EXIT(err);
|
||||
return(0);
|
||||
}
|
||||
# ifdef OPENSSL_SYS_NETWARE
|
||||
if (err)
|
||||
printf("ERROR: %d\n", err);
|
||||
# endif
|
||||
EXIT(err);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static char *pt(unsigned char *md)
|
||||
{
|
||||
int i;
|
||||
static char buf[80];
|
||||
{
|
||||
int i;
|
||||
static char buf[80];
|
||||
|
||||
for (i=0; i<MD5_DIGEST_LENGTH; i++)
|
||||
sprintf(&(buf[i*2]),"%02x",md[i]);
|
||||
return(buf);
|
||||
}
|
||||
for (i = 0; i < MD5_DIGEST_LENGTH; i++)
|
||||
sprintf(&(buf[i * 2]), "%02x", md[i]);
|
||||
return (buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user