# ====================================================================
# Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
-# project. Rights for redistribution and usage in source and binary
-# forms are granted according to the OpenSSL license.
+# 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/.
# ====================================================================
# I let hardware handle unaligned input(*), except on page boundaries
# -m64 -m32
# ----------------------------------
# PPC970,gcc-4.0.0 +76% +59%
+# Power6,xlc-7 +68% +33%
-$output = shift;
+$flavour = shift;
-if ($output =~ /64\.s/) {
+if ($flavour =~ /64/) {
$SIZE_T =8;
$UCMP ="cmpld";
$STU ="stdu";
$POP ="ld";
$PUSH ="std";
-} elsif ($output =~ /32\.s/) {
+} elsif ($flavour =~ /32/) {
$SIZE_T =4;
$UCMP ="cmplw";
$STU ="stwu";
$POP ="lwz";
$PUSH ="stw";
-} else { die "nonsense $output"; }
+} else { die "nonsense $flavour"; }
-( defined shift || open STDOUT,"| $^X ../perlasm/ppc-xlate.pl $output" ) ||
- die "can't call ../perlasm/ppc-xlate.pl: $!";
+$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
+( $xlate="${dir}ppc-xlate.pl" and -f $xlate ) or
+( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
+die "can't locate ppc-xlate.pl";
+
+open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!";
$FRAME=24*$SIZE_T;
$code=<<___;
.text
-.globl .sha1_block_asm_data_order
+.globl .sha1_block_data_order
.align 4
-.sha1_block_asm_data_order:
+.sha1_block_data_order:
mflr r0
$STU $sp,`-($FRAME+64)`($sp)
$PUSH r0,`$FRAME-$SIZE_T*18`($sp)
bdnz- Lsha1_block_private
blr
___
+$code.=<<___;
+.asciz "SHA1 block transform for PPC, CRYPTOGAMS by <appro\@fy.chalmers.se>"
+___
$code =~ s/\`([^\`]*)\`/eval $1/gem;
print $code;