vcipher instructions are generated by ppc-xlate.pl in order to keep
compatibility with older compilers.
---
 crypto/perlasm/ppc-xlate.pl | 49 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/crypto/perlasm/ppc-xlate.pl b/crypto/perlasm/ppc-xlate.pl
index fc84766..60c4a4e 100755
--- a/crypto/perlasm/ppc-xlate.pl
+++ b/crypto/perlasm/ppc-xlate.pl
@@ -10,6 +10,32 @@ my %GLOBALS;
 my $dotinlocallabels=($flavour=~/linux/)?1:0;
 
 ################################################################
+# auxiliary function to produce a sequence of bytes based on a
+# sequence of pairs with value and number of bits.
+#
+# for example:
+#   bin(0x1, 4, 0x8, 4, 0xf, 8)
+#
+# produces:
+#   .byte 0x18,0x0f
+#
+################################################################
+sub bin
+{
+    my $ret = "";
+    my $bits = "";
+    for (my $i = 0; $i < $#_; $i += 2) {
+        my ($value, $len) = @_[$i, $i + 1];
+        my $mask = (1 << $len) - 1;
+        $bits .= sprintf "%0*b", $len, ($mask & $value);
+    }
+    my @bytes = (map {
+        sprintf "0x%02x", eval("0b" . $_ . ("0" x (8 - length($_))));
+    } ($bits =~ m/.{1,8}/g));
+    "\t.byte " . join(",", @bytes);
+}
+
+################################################################
 # directives which need special treatment on different platforms
 ################################################################
 my $globl = sub {
@@ -144,6 +170,29 @@ my $extrdi = sub {
     "  rldicl  $ra,$rs,$b,$n";
 };
 
+################################################################
+# vcipher instructions
+################################################################
+
+#
+# value:  4     VTR  VTA  VTB  op
+#         |-----|----|----|----|----------|
+# bit:    0     6    11   16   21         31
+#
+# vcipher:      op=1288
+# vcipherlast:  op=1289
+# vncipher:     op=1352
+# vncipherlast: op=1353
+#
+sub vcipher_op {
+    my ($unused, $vtr, $vra, $vrb, $op) = @_;
+    bin(4, 6, $vtr, 5, $vra, 5, $vrb, 5, $op, 11);
+}
+my $vcipher = sub { vcipher_op @_, 1288 };
+my $vcipherlast = sub { vcipher_op @_, 1289 };
+my $vncipher = sub { vcipher_op @_, 1352 };
+my $vncipherlast = sub { vcipher_op @_, 1353 };
+
 while($line=<>) {
 
     $line =~ s|[#!;].*$||;     # get rid of asm-style comments...
-- 
1.7.12

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to