]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
powerpc: ecc: Fix stack allocation secp384r1 asm
authorRohan McLure <rohanmclure@linux.ibm.com>
Wed, 16 Aug 2023 06:52:47 +0000 (16:52 +1000)
committerHugo Landau <hlandau@openssl.org>
Fri, 1 Sep 2023 09:06:54 +0000 (10:06 +0100)
Assembly acceleration secp384r1 opts to not use any callee-save VSRs, as
VSX enabled systems make extensive use of renaming, and so writebacks in
felem_{mul,square}() can be reordered for best cache effects.

Remove stack allocations. This in turn fixes unmatched push/pops in
felem_{mul,square}().

Signed-off-by: Rohan McLure <rohan.mclure@linux.ibm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21749)

crypto/ec/asm/ecp_nistp384-ppc64.pl

index 3f86b391af699e666cd0c58b318d9b9b2b2be501..28f4168e52181e6877fd2ab08cb45fa7df367fe8 100755 (executable)
@@ -62,51 +62,6 @@ sub endproc($)
 ___
 }
 
-
-sub push_vrs($$)
-{
-    my ($min, $max) = @_;
-
-    my $count = $max - $min + 1;
-
-    $code.=<<___;
-    mr      $savesp,$sp
-    stdu        $sp,-16*`$count+1`($sp)
-
-___
-        for (my $i = $min; $i <= $max; $i++) {
-            my $mult = $max - $i + 1;
-            $code.=<<___;
-    stxv        $i,-16*$mult($savesp)
-___
-
-    }
-
-    $code.=<<___;
-
-___
-}
-
-sub pop_vrs($$)
-{
-    my ($min, $max) = @_;
-
-    $code.=<<___;
-    ld      $savesp,0($sp)
-___
-    for (my $i = $min; $i <= $max; $i++) {
-        my $mult = $max - $i + 1;
-        $code.=<<___;
-    lxv     $i,-16*$mult($savesp)
-___
-    }
-
-    $code.=<<___;
-    mr      $sp,$savesp
-
-___
-}
-
 sub load_vrs($$)
 {
     my ($pointer, $reg_list) = @_;
@@ -162,8 +117,6 @@ ___
 
         startproc("p384_felem_mul");
 
-        push_vrs(52, 63);
-
         $code.=<<___;
     vspltisw    $vzero,0
 
@@ -268,8 +221,6 @@ ___
 
         startproc("p384_felem_square");
 
-        push_vrs(52, 63);
-
         $code.=<<___;
     vspltisw    $vzero,0