]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - crypto/perlasm/sparcv9_modes.pl
Copyright consolidation: perl files
[thirdparty/openssl.git] / crypto / perlasm / sparcv9_modes.pl
index 19dc1b3058a3c81e658e10b226f1daffe8658436..47c2e53b994e5126ee5bb8e3012fc901d800e432 100644 (file)
@@ -1,4 +1,11 @@
-#!/usr/bin/env perl
+#! /usr/bin/env perl
+# Copyright 2012-2016 The OpenSSL Project Authors. All Rights Reserved.
+#
+# Licensed under the OpenSSL license (the "License").  You may not use
+# this file except in compliance with the License.  You can obtain a copy
+# in the file LICENSE in the source distribution or at
+# https://www.openssl.org/source/license.html
+
 
 # Specific modes implementations for SPARC Architecture 2011. There
 # is T4 dependency though, an ASI value that is not specified in the
 # block sizes [though few percent better for not so long ones]. All
 # this based on suggestions from David Miller.
 
+$::bias="STACK_BIAS";
+$::frame="STACK_FRAME";
+$::size_t_cc="SIZE_T_CC";
+
 sub asm_init {         # to be called with @ARGV as argument
     for (@_)           { $::abibits=64 if (/\-m64/ || /\-xarch\=v9/); }
     if ($::abibits==64)        { $::bias=2047; $::frame=192; $::size_t_cc="%xcc"; }
@@ -35,6 +46,8 @@ $::code.=<<___;
 .align 32
 ${alg}${bits}_t4_cbc_encrypt:
        save            %sp, -$::frame, %sp
+       cmp             $len, 0
+       be,pn           $::size_t_cc, .L${bits}_cbc_enc_abort
        sub             $inp, $out, $blk_init   ! $inp!=$out
 ___
 $::code.=<<___ if (!$::evp);
@@ -123,6 +136,7 @@ $::code.=<<___ if (!$::evp);
        std             %f2, [$ivec + 8]
 ___
 $::code.=<<___;
+.L${bits}_cbc_enc_abort:
        ret
        restore
 
@@ -249,6 +263,8 @@ $::code.=<<___;
 .align 32
 ${alg}${bits}_t4_cbc_decrypt:
        save            %sp, -$::frame, %sp
+       cmp             $len, 0
+       be,pn           $::size_t_cc, .L${bits}_cbc_dec_abort
        sub             $inp, $out, $blk_init   ! $inp!=$out
 ___
 $::code.=<<___ if (!$::evp);
@@ -341,6 +357,7 @@ $::code.=<<___ if (!$::evp);
        std             %f14, [$ivec + 8]
 ___
 $::code.=<<___;
+.L${bits}_cbc_dec_abort:
        ret
        restore
 
@@ -1243,6 +1260,7 @@ $code.=<<___;
        fxor            %f8,  %f4, %f4
        fxor            %f10, %f6, %f6
 
+       subcc           $len, 2, $len
        stda            %f0, [$out]0xe2         ! ASI_BLK_INIT, T4-specific
        add             $out, 8, $out
        stda            %f2, [$out]0xe2         ! ASI_BLK_INIT, T4-specific