Blame SOURCES/0067-fix-ppc64-montgomery.patch

727bdf
diff --git a/crypto/bn/asm/ppc64-mont-fixed.pl b/crypto/bn/asm/ppc64-mont-fixed.pl
727bdf
index 56df89dc27da..e69de29bb2d1 100755
727bdf
--- a/crypto/bn/asm/ppc64-mont-fixed.pl
727bdf
+++ b/crypto/bn/asm/ppc64-mont-fixed.pl
727bdf
@@ -1,581 +0,0 @@
727bdf
-#! /usr/bin/env perl
727bdf
-# Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
727bdf
-#
727bdf
-# Licensed under the Apache License 2.0 (the "License").  You may not use
727bdf
-# this file except in compliance with the License.  You can obtain a copy
727bdf
-# in the file LICENSE in the source distribution or at
727bdf
-# https://www.openssl.org/source/license.html
727bdf
-
727bdf
-# ====================================================================
727bdf
-# Written by Amitay Isaacs <amitay@ozlabs.org>, Martin Schwenke
727bdf
-# <martin@meltin.net> & Alastair D'Silva <alastair@d-silva.org> for
727bdf
-# the OpenSSL project.
727bdf
-# ====================================================================
727bdf
-
727bdf
-#
727bdf
-# Fixed length (n=6), unrolled PPC Montgomery Multiplication
727bdf
-#
727bdf
-
727bdf
-# 2021
727bdf
-#
727bdf
-# Although this is a generic implementation for unrolling Montgomery
727bdf
-# Multiplication for arbitrary values of n, this is currently only
727bdf
-# used for n = 6 to improve the performance of ECC p384.
727bdf
-#
727bdf
-# Unrolling allows intermediate results to be stored in registers,
727bdf
-# rather than on the stack, improving performance by ~7% compared to
727bdf
-# the existing PPC assembly code.
727bdf
-#
727bdf
-# The ISA 3.0 implementation uses combination multiply/add
727bdf
-# instructions (maddld, maddhdu) to improve performance by an
727bdf
-# additional ~10% on Power 9.
727bdf
-#
727bdf
-# Finally, saving non-volatile registers into volatile vector
727bdf
-# registers instead of onto the stack saves a little more.
727bdf
-#
727bdf
-# On a Power 9 machine we see an overall improvement of ~18%.
727bdf
-#
727bdf
-
727bdf
-use strict;
727bdf
-use warnings;
727bdf
-
727bdf
-my ($flavour, $output, $dir, $xlate);
727bdf
-
727bdf
-# $output is the last argument if it looks like a file (it has an extension)
727bdf
-# $flavour is the first argument if it doesn't look like a file
727bdf
-$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
727bdf
-$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
727bdf
-
727bdf
-$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
727bdf
-( $xlate="${dir}ppc-xlate.pl" and -f $xlate ) or
727bdf
-( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
727bdf
-die "can't locate ppc-xlate.pl";
727bdf
-
727bdf
-open STDOUT,"| $^X $xlate $flavour \"$output\""
727bdf
-    or die "can't call $xlate: $!";
727bdf
-
727bdf
-if ($flavour !~ /64/) {
727bdf
-	die "bad flavour ($flavour) - only ppc64 permitted";
727bdf
-}
727bdf
-
727bdf
-my $SIZE_T= 8;
727bdf
-
727bdf
-# Registers are global so the code is remotely readable
727bdf
-
727bdf
-# Parameters for Montgomery multiplication
727bdf
-my $sp	= "r1";
727bdf
-my $toc	= "r2";
727bdf
-my $rp	= "r3";
727bdf
-my $ap	= "r4";
727bdf
-my $bp	= "r5";
727bdf
-my $np	= "r6";
727bdf
-my $n0	= "r7";
727bdf
-my $num	= "r8";
727bdf
-
727bdf
-my $i	= "r9";
727bdf
-my $c0	= "r10";
727bdf
-my $bp0	= "r11";
727bdf
-my $bpi	= "r11";
727bdf
-my $bpj	= "r11";
727bdf
-my $tj	= "r12";
727bdf
-my $apj	= "r12";
727bdf
-my $npj	= "r12";
727bdf
-my $lo	= "r14";
727bdf
-my $c1	= "r14";
727bdf
-
727bdf
-# Non-volatile registers used for tp[i]
727bdf
-#
727bdf
-# 12 registers are available but the limit on unrolling is 10,
727bdf
-# since registers from $tp[0] to $tp[$n+1] are used.
727bdf
-my @tp = ("r20" .. "r31");
727bdf
-
727bdf
-# volatile VSRs for saving non-volatile GPRs - faster than stack
727bdf
-my @vsrs = ("v32" .. "v46");
727bdf
-
727bdf
-package Mont;
727bdf
-
727bdf
-sub new($$)
727bdf
-{
727bdf
-	my ($class, $n) = @_;
727bdf
-
727bdf
-	if ($n > 10) {
727bdf
-		die "Can't unroll for BN length ${n} (maximum 10)"
727bdf
-	}
727bdf
-
727bdf
-	my $self = {
727bdf
-		code => "",
727bdf
-		n => $n,
727bdf
-	};
727bdf
-	bless $self, $class;
727bdf
-
727bdf
-	return $self;
727bdf
-}
727bdf
-
727bdf
-sub add_code($$)
727bdf
-{
727bdf
-	my ($self, $c) = @_;
727bdf
-
727bdf
-	$self->{code} .= $c;
727bdf
-}
727bdf
-
727bdf
-sub get_code($)
727bdf
-{
727bdf
-	my ($self) = @_;
727bdf
-
727bdf
-	return $self->{code};
727bdf
-}
727bdf
-
727bdf
-sub get_function_name($)
727bdf
-{
727bdf
-	my ($self) = @_;
727bdf
-
727bdf
-	return "bn_mul_mont_fixed_n" . $self->{n};
727bdf
-}
727bdf
-
727bdf
-sub get_label($$)
727bdf
-{
727bdf
-	my ($self, $l) = @_;
727bdf
-
727bdf
-	return "L" . $l . "_" . $self->{n};
727bdf
-}
727bdf
-
727bdf
-sub get_labels($@)
727bdf
-{
727bdf
-	my ($self, @labels) = @_;
727bdf
-
727bdf
-	my %out = ();
727bdf
-
727bdf
-	foreach my $l (@labels) {
727bdf
-		$out{"$l"} = $self->get_label("$l");
727bdf
-	}
727bdf
-
727bdf
-	return \%out;
727bdf
-}
727bdf
-
727bdf
-sub nl($)
727bdf
-{
727bdf
-	my ($self) = @_;
727bdf
-
727bdf
-	$self->add_code("\n");
727bdf
-}
727bdf
-
727bdf
-sub copy_result($)
727bdf
-{
727bdf
-	my ($self) = @_;
727bdf
-
727bdf
-	my ($n) = $self->{n};
727bdf
-
727bdf
-	for (my $j = 0; $j < $n; $j++) {
727bdf
-		$self->add_code(<<___);
727bdf
-	std		$tp[$j],`$j*$SIZE_T`($rp)
727bdf
-___
727bdf
-	}
727bdf
-
727bdf
-}
727bdf
-
727bdf
-sub mul_mont_fixed($)
727bdf
-{
727bdf
-	my ($self) = @_;
727bdf
-
727bdf
-	my ($n) = $self->{n};
727bdf
-	my $fname = $self->get_function_name();
727bdf
-	my $label = $self->get_labels("outer", "enter", "sub", "copy", "end");
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-
727bdf
-.globl	.${fname}
727bdf
-.align	5
727bdf
-.${fname}:
727bdf
-
727bdf
-___
727bdf
-
727bdf
-	$self->save_registers();
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	ld		$n0,0($n0)
727bdf
-
727bdf
-	ld		$bp0,0($bp)
727bdf
-
727bdf
-	ld		$apj,0($ap)
727bdf
-___
727bdf
-
727bdf
-	$self->mul_c_0($tp[0], $apj, $bp0, $c0);
727bdf
-
727bdf
-	for (my $j = 1; $j < $n - 1; $j++) {
727bdf
-		$self->add_code(<<___);
727bdf
-	ld		$apj,`$j*$SIZE_T`($ap)
727bdf
-___
727bdf
-		$self->mul($tp[$j], $apj, $bp0, $c0);
727bdf
-	}
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	ld		$apj,`($n-1)*$SIZE_T`($ap)
727bdf
-___
727bdf
-
727bdf
-	$self->mul_last($tp[$n-1], $tp[$n], $apj, $bp0, $c0);
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	li		$tp[$n+1],0
727bdf
-
727bdf
-___
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	li		$i,0
727bdf
-	mtctr		$num
727bdf
-	b		$label->{"enter"}
727bdf
-
727bdf
-.align	4
727bdf
-$label->{"outer"}:
727bdf
-	ldx		$bpi,$bp,$i
727bdf
-
727bdf
-	ld		$apj,0($ap)
727bdf
-___
727bdf
-
727bdf
-	$self->mul_add_c_0($tp[0], $tp[0], $apj, $bpi, $c0);
727bdf
-
727bdf
-	for (my $j = 1; $j < $n; $j++) {
727bdf
-		$self->add_code(<<___);
727bdf
-	ld		$apj,`$j*$SIZE_T`($ap)
727bdf
-___
727bdf
-		$self->mul_add($tp[$j], $tp[$j], $apj, $bpi, $c0);
727bdf
-	}
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	addc		$tp[$n],$tp[$n],$c0
727bdf
-	addze		$tp[$n+1],$tp[$n+1]
727bdf
-___
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-.align	4
727bdf
-$label->{"enter"}:
727bdf
-	mulld		$bpi,$tp[0],$n0
727bdf
-
727bdf
-	ld		$npj,0($np)
727bdf
-___
727bdf
-
727bdf
-	$self->mul_add_c_0($lo, $tp[0], $bpi, $npj, $c0);
727bdf
-
727bdf
-	for (my $j = 1; $j < $n; $j++) {
727bdf
-		$self->add_code(<<___);
727bdf
-	ld		$npj,`$j*$SIZE_T`($np)
727bdf
-___
727bdf
-		$self->mul_add($tp[$j-1], $tp[$j], $npj, $bpi, $c0);
727bdf
-	}
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	addc		$tp[$n-1],$tp[$n],$c0
727bdf
-	addze		$tp[$n],$tp[$n+1]
727bdf
-
727bdf
-	addi		$i,$i,$SIZE_T
727bdf
-	bdnz		$label->{"outer"}
727bdf
-
727bdf
-	and.		$tp[$n],$tp[$n],$tp[$n]
727bdf
-	bne		$label->{"sub"}
727bdf
-
727bdf
-	cmpld	$tp[$n-1],$npj
727bdf
-	blt		$label->{"copy"}
727bdf
-
727bdf
-$label->{"sub"}:
727bdf
-___
727bdf
-
727bdf
-	#
727bdf
-	# Reduction
727bdf
-	#
727bdf
-
727bdf
-		$self->add_code(<<___);
727bdf
-	ld		$bpj,`0*$SIZE_T`($np)
727bdf
-	subfc		$c1,$bpj,$tp[0]
727bdf
-	std		$c1,`0*$SIZE_T`($rp)
727bdf
-
727bdf
-___
727bdf
-	for (my $j = 1; $j < $n - 1; $j++) {
727bdf
-		$self->add_code(<<___);
727bdf
-	ld		$bpj,`$j*$SIZE_T`($np)
727bdf
-	subfe		$c1,$bpj,$tp[$j]
727bdf
-	std		$c1,`$j*$SIZE_T`($rp)
727bdf
-
727bdf
-___
727bdf
-	}
727bdf
-
727bdf
-		$self->add_code(<<___);
727bdf
-	subfe		$c1,$npj,$tp[$n-1]
727bdf
-	std		$c1,`($n-1)*$SIZE_T`($rp)
727bdf
-
727bdf
-___
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	addme.		$tp[$n],$tp[$n]
727bdf
-	beq		$label->{"end"}
727bdf
-
727bdf
-$label->{"copy"}:
727bdf
-___
727bdf
-
727bdf
-	$self->copy_result();
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-
727bdf
-$label->{"end"}:
727bdf
-___
727bdf
-
727bdf
-	$self->restore_registers();
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	li		r3,1
727bdf
-	blr
727bdf
-.size .${fname},.-.${fname}
727bdf
-___
727bdf
-
727bdf
-}
727bdf
-
727bdf
-package Mont::GPR;
727bdf
-
727bdf
-our @ISA = ('Mont');
727bdf
-
727bdf
-sub new($$)
727bdf
-{
727bdf
-    my ($class, $n) = @_;
727bdf
-
727bdf
-    return $class->SUPER::new($n);
727bdf
-}
727bdf
-
727bdf
-sub save_registers($)
727bdf
-{
727bdf
-	my ($self) = @_;
727bdf
-
727bdf
-	my $n = $self->{n};
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	std	$lo,-8($sp)
727bdf
-___
727bdf
-
727bdf
-	for (my $j = 0; $j <= $n+1; $j++) {
727bdf
-		$self->{code}.=<<___;
727bdf
-	std	$tp[$j],-`($j+2)*8`($sp)
727bdf
-___
727bdf
-	}
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-
727bdf
-___
727bdf
-}
727bdf
-
727bdf
-sub restore_registers($)
727bdf
-{
727bdf
-	my ($self) = @_;
727bdf
-
727bdf
-	my $n = $self->{n};
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	ld	$lo,-8($sp)
727bdf
-___
727bdf
-
727bdf
-	for (my $j = 0; $j <= $n+1; $j++) {
727bdf
-		$self->{code}.=<<___;
727bdf
-	ld	$tp[$j],-`($j+2)*8`($sp)
727bdf
-___
727bdf
-	}
727bdf
-
727bdf
-	$self->{code} .=<<___;
727bdf
-
727bdf
-___
727bdf
-}
727bdf
-
727bdf
-# Direct translation of C mul()
727bdf
-sub mul($$$$$)
727bdf
-{
727bdf
-	my ($self, $r, $a, $w, $c) = @_;
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	mulld		$lo,$a,$w
727bdf
-	addc		$r,$lo,$c
727bdf
-	mulhdu		$c,$a,$w
727bdf
-	addze		$c,$c
727bdf
-
727bdf
-___
727bdf
-}
727bdf
-
727bdf
-# Like mul() but $c is ignored as an input - an optimisation to save a
727bdf
-# preliminary instruction that would set input $c to 0
727bdf
-sub mul_c_0($$$$$)
727bdf
-{
727bdf
-	my ($self, $r, $a, $w, $c) = @_;
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	mulld		$r,$a,$w
727bdf
-	mulhdu		$c,$a,$w
727bdf
-
727bdf
-___
727bdf
-}
727bdf
-
727bdf
-# Like mul() but does not to the final addition of CA into $c - an
727bdf
-# optimisation to save an instruction
727bdf
-sub mul_last($$$$$$)
727bdf
-{
727bdf
-	my ($self, $r1, $r2, $a, $w, $c) = @_;
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	mulld		$lo,$a,$w
727bdf
-	addc		$r1,$lo,$c
727bdf
-	mulhdu		$c,$a,$w
727bdf
-
727bdf
-	addze		$r2,$c
727bdf
-___
727bdf
-}
727bdf
-
727bdf
-# Like C mul_add() but allow $r_out and $r_in to be different
727bdf
-sub mul_add($$$$$$)
727bdf
-{
727bdf
-	my ($self, $r_out, $r_in, $a, $w, $c) = @_;
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	mulld		$lo,$a,$w
727bdf
-	addc		$lo,$lo,$c
727bdf
-	mulhdu		$c,$a,$w
727bdf
-	addze		$c,$c
727bdf
-	addc		$r_out,$r_in,$lo
727bdf
-	addze		$c,$c
727bdf
-
727bdf
-___
727bdf
-}
727bdf
-
727bdf
-# Like mul_add() but $c is ignored as an input - an optimisation to save a
727bdf
-# preliminary instruction that would set input $c to 0
727bdf
-sub mul_add_c_0($$$$$$)
727bdf
-{
727bdf
-	my ($self, $r_out, $r_in, $a, $w, $c) = @_;
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	mulld		$lo,$a,$w
727bdf
-	addc		$r_out,$r_in,$lo
727bdf
-	mulhdu		$c,$a,$w
727bdf
-	addze		$c,$c
727bdf
-
727bdf
-___
727bdf
-}
727bdf
-
727bdf
-package Mont::GPR_300;
727bdf
-
727bdf
-our @ISA = ('Mont::GPR');
727bdf
-
727bdf
-sub new($$)
727bdf
-{
727bdf
-	my ($class, $n) = @_;
727bdf
-
727bdf
-	my $mont = $class->SUPER::new($n);
727bdf
-
727bdf
-	return $mont;
727bdf
-}
727bdf
-
727bdf
-sub get_function_name($)
727bdf
-{
727bdf
-	my ($self) = @_;
727bdf
-
727bdf
-	return "bn_mul_mont_300_fixed_n" . $self->{n};
727bdf
-}
727bdf
-
727bdf
-sub get_label($$)
727bdf
-{
727bdf
-	my ($self, $l) = @_;
727bdf
-
727bdf
-	return "L" . $l . "_300_" . $self->{n};
727bdf
-}
727bdf
-
727bdf
-# Direct translation of C mul()
727bdf
-sub mul($$$$$)
727bdf
-{
727bdf
-	my ($self, $r, $a, $w, $c, $last) = @_;
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	maddld		$r,$a,$w,$c
727bdf
-	maddhdu		$c,$a,$w,$c
727bdf
-
727bdf
-___
727bdf
-}
727bdf
-
727bdf
-# Save the last carry as the final entry
727bdf
-sub mul_last($$$$$)
727bdf
-{
727bdf
-	my ($self, $r1, $r2, $a, $w, $c) = @_;
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	maddld		$r1,$a,$w,$c
727bdf
-	maddhdu		$r2,$a,$w,$c
727bdf
-
727bdf
-___
727bdf
-}
727bdf
-
727bdf
-# Like mul() but $c is ignored as an input - an optimisation to save a
727bdf
-# preliminary instruction that would set input $c to 0
727bdf
-sub mul_c_0($$$$$)
727bdf
-{
727bdf
-	my ($self, $r, $a, $w, $c) = @_;
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	mulld          $r,$a,$w
727bdf
-	mulhdu          $c,$a,$w
727bdf
-
727bdf
-___
727bdf
-}
727bdf
-
727bdf
-# Like C mul_add() but allow $r_out and $r_in to be different
727bdf
-sub mul_add($$$$$$)
727bdf
-{
727bdf
-	my ($self, $r_out, $r_in, $a, $w, $c) = @_;
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	maddld		$lo,$a,$w,$c
727bdf
-	maddhdu		$c,$a,$w,$c
727bdf
-	addc		$r_out,$r_in,$lo
727bdf
-	addze		$c,$c
727bdf
-
727bdf
-___
727bdf
-}
727bdf
-
727bdf
-# Like mul_add() but $c is ignored as an input - an optimisation to save a
727bdf
-# preliminary instruction that would set input $c to 0
727bdf
-sub mul_add_c_0($$$$$$)
727bdf
-{
727bdf
-	my ($self, $r_out, $r_in, $a, $w, $c) = @_;
727bdf
-
727bdf
-	$self->add_code(<<___);
727bdf
-	maddld		$lo,$a,$w,$r_in
727bdf
-	maddhdu		$c,$a,$w,$r_in
727bdf
-___
727bdf
-
727bdf
-	if ($r_out ne $lo) {
727bdf
-		$self->add_code(<<___);
727bdf
-	mr			$r_out,$lo
727bdf
-___
727bdf
-	}
727bdf
-
727bdf
-	$self->nl();
727bdf
-}
727bdf
-
727bdf
-
727bdf
-package main;
727bdf
-
727bdf
-my $code;
727bdf
-
727bdf
-$code.=<<___;
727bdf
-.machine "any"
727bdf
-.text
727bdf
-___
727bdf
-
727bdf
-my $mont;
727bdf
-
727bdf
-$mont = new Mont::GPR(6);
727bdf
-$mont->mul_mont_fixed();
727bdf
-$code .= $mont->get_code();
727bdf
-
727bdf
-$mont = new Mont::GPR_300(6);
727bdf
-$mont->mul_mont_fixed();
727bdf
-$code .= $mont->get_code();
727bdf
-
727bdf
-$code =~ s/\`([^\`]*)\`/eval $1/gem;
727bdf
-
727bdf
-$code.=<<___;
727bdf
-.asciz  "Montgomery Multiplication for PPC by <amitay\@ozlabs.org>, <alastair\@d-silva.org>"
727bdf
-___
727bdf
-
727bdf
-print $code;
727bdf
-close STDOUT or die "error closing STDOUT: $!";
727bdf
diff --git a/crypto/bn/bn_ppc.c b/crypto/bn/bn_ppc.c
727bdf
index 1e9421bee213..3ee76ea96574 100644
727bdf
--- a/crypto/bn/bn_ppc.c
727bdf
+++ b/crypto/bn/bn_ppc.c
727bdf
@@ -19,12 +19,6 @@ int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
727bdf
                         const BN_ULONG *np, const BN_ULONG *n0, int num);
727bdf
     int bn_mul4x_mont_int(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
727bdf
                           const BN_ULONG *np, const BN_ULONG *n0, int num);
727bdf
-    int bn_mul_mont_fixed_n6(BN_ULONG *rp, const BN_ULONG *ap,
727bdf
-                             const BN_ULONG *bp, const BN_ULONG *np,
727bdf
-                             const BN_ULONG *n0, int num);
727bdf
-    int bn_mul_mont_300_fixed_n6(BN_ULONG *rp, const BN_ULONG *ap,
727bdf
-                                 const BN_ULONG *bp, const BN_ULONG *np,
727bdf
-                                 const BN_ULONG *n0, int num);
727bdf
 
727bdf
     if (num < 4)
727bdf
         return 0;
727bdf
@@ -40,14 +34,5 @@ int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
727bdf
      * no opportunity to figure it out...
727bdf
      */
727bdf
 
727bdf
-#if defined(_ARCH_PPC64)
727bdf
-    if (num == 6) {
727bdf
-        if (OPENSSL_ppccap_P & PPC_MADD300)
727bdf
-            return bn_mul_mont_300_fixed_n6(rp, ap, bp, np, n0, num);
727bdf
-        else
727bdf
-            return bn_mul_mont_fixed_n6(rp, ap, bp, np, n0, num);
727bdf
-    }
727bdf
-#endif
727bdf
-
727bdf
     return bn_mul_mont_int(rp, ap, bp, np, n0, num);
727bdf
 }
727bdf
diff --git a/crypto/bn/build.info b/crypto/bn/build.info
727bdf
index 987a70ae263b..4f8d0689b5ea 100644
727bdf
--- a/crypto/bn/build.info
727bdf
+++ b/crypto/bn/build.info
727bdf
@@ -79,7 +79,7 @@ IF[{- !$disabled{asm} -}]
727bdf
 
727bdf
   $BNASM_ppc32=bn_ppc.c bn-ppc.s ppc-mont.s
727bdf
   $BNDEF_ppc32=OPENSSL_BN_ASM_MONT
727bdf
-  $BNASM_ppc64=$BNASM_ppc32 ppc64-mont-fixed.s
727bdf
+  $BNASM_ppc64=$BNASM_ppc32
727bdf
   $BNDEF_ppc64=$BNDEF_ppc32
727bdf
 
727bdf
   $BNASM_c64xplus=asm/bn-c64xplus.asm
727bdf
@@ -173,7 +173,6 @@ GENERATE[parisc-mont.s]=asm/parisc-mont.pl
727bdf
 GENERATE[bn-ppc.s]=asm/ppc.pl
727bdf
 GENERATE[ppc-mont.s]=asm/ppc-mont.pl
727bdf
 GENERATE[ppc64-mont.s]=asm/ppc64-mont.pl
727bdf
-GENERATE[ppc64-mont-fixed.s]=asm/ppc64-mont-fixed.pl
727bdf
 
727bdf
 GENERATE[alpha-mont.S]=asm/alpha-mont.pl
727bdf
 
727bdf
diff --git a/test/recipes/30-test_evp_data/evppkey_ecdsa.txt b/test/recipes/30-test_evp_data/evppkey_ecdsa.txt
727bdf
index f36982845db4..1543ed9f7534 100644
727bdf
--- a/test/recipes/30-test_evp_data/evppkey_ecdsa.txt
727bdf
+++ b/test/recipes/30-test_evp_data/evppkey_ecdsa.txt
727bdf
@@ -97,6 +97,18 @@ Key = P-256-PUBLIC
727bdf
 Input = "Hello World"
727bdf
 Output = 3046022100e7515177ec3817b77a4a94066ab3070817b7aa9d44a8a09f040da250116e8972022100ba59b0f631258e59a9026be5d84f60685f4cf22b9165a0c2736d5c21c8ec1862
727bdf
 
727bdf
+PublicKey=P-384-PUBLIC
727bdf
+-----BEGIN PUBLIC KEY-----
727bdf
+MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAES/TlL5WEJ+u1kV+4yVlVUbTTo/2rZ7rd
727bdf
+nWwwk/QlukNjDfcfQvDrfOqpTZ9kSKhd0wMxWIJJ/S/cCzCex+2EgbwW8ngAwT19
727bdf
+twD8guGxyFRaoMDTtW47/nifwYqRaIfC
727bdf
+-----END PUBLIC KEY-----
727bdf
+
727bdf
+DigestVerify = SHA384
727bdf
+Key = P-384-PUBLIC
727bdf
+Input = "123400"
727bdf
+Output = 304d0218389cb27e0bc8d21fa7e5f24cb74f58851313e696333ad68b023100ffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52970
727bdf
+
727bdf
 # Oneshot tests
727bdf
 OneShotDigestVerify = SHA256
727bdf
 Key = P-256-PUBLIC