Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions src/vendor/ECDSA384.hinted.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ diff --git a/contracts/libs/crypto/ECDSA384.sol b/contracts/libs/crypto/ECDSA384
index 9e43756..053803b 100644
--- a/contracts/libs/crypto/ECDSA384.sol
+++ b/contracts/libs/crypto/ECDSA384.sol
@@ -64,6 +64,40 @@ library ECDSA384 {
@@ -64,6 +64,28 @@ library ECDSA384 {
bytes memory signature_,
bytes memory pubKey_
) internal view returns (bool) {
Expand All @@ -22,16 +22,6 @@ index 9e43756..053803b 100644
+ require(consumed_ == inverseHints_.length, "unused inverse hints");
+ }
+
+ function verifyWithHintsConsumed(
+ Parameters memory curveParams_,
+ bytes memory hashedMessage_,
+ bytes memory signature_,
+ bytes memory pubKey_,
+ bytes memory inverseHints_
+ ) internal view returns (bool ok_, uint256 consumed_) {
+ return _verify(curveParams_, hashedMessage_, signature_, pubKey_, inverseHints_, true);
+ }
+
+ function _verify(
+ Parameters memory curveParams_,
+ bytes memory hashedMessage_,
Expand Down
14 changes: 2 additions & 12 deletions src/vendor/ECDSA384.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
//
// Vendored from Solarity solidity-lib: https://github.com/dl-solarity/solidity-lib
// Base (upstream, unmodified): commit b947757194de6436062c2d68118c0352be84ac4be
// Local modifications: "Add hinted P384 inverse verification" (verifyWithHints /
// verifyWithHintsConsumed and the U384 hint-consumption paths), plus strict public
// Local modifications: "Add hinted P384 inverse verification" (verifyWithHints and the U384
// hint-consumption paths), plus strict public
// key coordinate bounds. The exact upstream diff is committed alongside this file
// as ECDSA384.hinted.patch for review.
// Copyright (c) 2023 Solarity. Originally licensed MIT (see header above).
Expand Down Expand Up @@ -88,16 +88,6 @@ library ECDSA384 {
require(consumed_ == inverseHints_.length, "unused inverse hints");
}

function verifyWithHintsConsumed(
Parameters memory curveParams_,
bytes memory hashedMessage_,
bytes memory signature_,
bytes memory pubKey_,
bytes memory inverseHints_
) internal view returns (bool ok_, uint256 consumed_) {
return _verify(curveParams_, hashedMessage_, signature_, pubKey_, inverseHints_, true);
}

function _verify(
Parameters memory curveParams_,
bytes memory hashedMessage_,
Expand Down
4 changes: 2 additions & 2 deletions src/vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ from `solidity-lib` is used by this repo.

`ECDSA384.sol` carries two functional changes on top of the base commit:

- **"Add hinted P384 inverse verification"** — adding `verifyWithHints` /
`verifyWithHintsConsumed` and the hint-consumption paths in `U384`
- **"Add hinted P384 inverse verification"** — adding `verifyWithHints` and the
hint-consumption paths in `U384`
(`initCallWithHints`, `_nextInverseHint`, the hinted branches of `moddivAssign` /
`modinv`).
- **Strict public key coordinate bounds** — `_isOnCurve` rejects coordinates `>= p`,
Expand Down
10 changes: 0 additions & 10 deletions test/helpers/ECDSA384HintCollector.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,6 @@ library ECDSA384HintCollectorLib {
require(consumed_ == inverseHints_.length, "unused inverse hints");
}

function verifyWithHintsConsumed(
Parameters memory curveParams_,
bytes memory hashedMessage_,
bytes memory signature_,
bytes memory pubKey_,
bytes memory inverseHints_
) internal returns (bool ok_, uint256 consumed_) {
return _verify(curveParams_, hashedMessage_, signature_, pubKey_, inverseHints_, true);
}

function _verify(
Parameters memory curveParams_,
bytes memory hashedMessage_,
Expand Down
Loading