Skip to content

Commit

Permalink
Protect against malleable signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Apr 23, 2024
1 parent 562e8dd commit 9bcbe58
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/EasyECC.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use ParagonIE\EasyECC\ECDSA\SecretKey;
use ParagonIE\EasyECC\ECDSA\Signature;
use ParagonIE\EasyECC\Exception\ConfigException;
use ParagonIE\EasyECC\Exception\EasyEccException;
use ParagonIE\EasyECC\Exception\NotImplementedException;

/**
Expand Down Expand Up @@ -218,7 +219,7 @@ public function sign(
$k = $kGen->generate($this->generator->getOrder());

// We care about leaking the one-time secret:
$signer = new Signer(new ConstantTimeMath());
$signer = new Signer(new ConstantTimeMath(), true);
$signature = $signer->sign($privateKey, $hash, $k);

if ($ieeeFormat) {
Expand Down Expand Up @@ -268,7 +269,7 @@ public function verify(
$hash = $this->hasher->makeHash($message, $this->generator);

// This can safely be variable-time:
$signer = new Signer($this->adapter);
$signer = new Signer($this->adapter, true);

return $signer->verify($publicKey, $sig, $hash);
}
Expand Down

0 comments on commit 9bcbe58

Please sign in to comment.