Skip to content

Commit

Permalink
This does the same thing either way.
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Apr 28, 2024
1 parent d519761 commit 87d860f
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/Crypto/Signature/Signer.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,7 @@ public function sign(PrivateKeyInterface $key, GMP $truncatedHash, GMP $randomK)
if ($math->equals($r, $zero)) {
throw new \RuntimeException("Error: random number R = 0");
}
if ($curve instanceof OptimizedCurveInterface) {
// This will be faster than ConstantTimeMath's
$kInv = $optimized->modInverse($k);
} else {
$kInv = $math->inverseMod($k, $generator->getOrder());
}
$kInv = $math->inverseMod($k, $generator->getOrder());

// S = (d*R + h) / k (mod P) = (d*R + h) * k^-1 (mod P)
$s = $modMath->mul(
Expand Down

0 comments on commit 87d860f

Please # to comment.