Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto: add ecdsa malleability checks #21

Merged
merged 2 commits into from
Feb 16, 2024
Merged

crypto: add ecdsa malleability checks #21

merged 2 commits into from
Feb 16, 2024

Conversation

jsign
Copy link
Owner

@jsign jsign commented Jan 31, 2024

This PR should be reviewed/merged after #20

This PR adds the check to solve the ECDSA malleability problem.

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Comment on lines -10 to +11
.url = "https://github.com/jsign/zig-eth-secp256k1/archive/refs/tags/v0.1.0-beta-3.tar.gz",
.hash = "1220fcf062f8ee89b343e1588ac3cc002f37ee3f72841dd7f9493d9c09acad7915a3",
.url = "https://github.com/jsign/zig-eth-secp256k1/archive/refs/tags/v0.1.0-beta-4.tar.gz",
.hash = "1220c2dbdc5ddd85906c8858f2046b52870f4fe793e0c9af50b8591d10a3f267e250",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to do some update in my dep, so updating here.

Comment on lines +28 to +36
pub fn validateSignatureFields(r: u256, s: u256) !void {
if (r > secp256k1.Secp256k1.order) {
return error.InvalidR;
}
// Malleability check.
if (s > secp256k1.Secp256k1.order / 2) {
return error.InvalidS;
}
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the important checks.

@jsign jsign mentioned this pull request Feb 1, 2024
Base automatically changed from jsign-fix-file-names to main February 8, 2024 16:19
Copy link
Collaborator

@gballet gballet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

* types: add receipt structs

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* types/receipt: add logs bloom calculation

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* blockchain: add receipt generation

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

---------

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
@gballet gballet merged commit 22e9429 into main Feb 16, 2024
4 checks passed
@gballet gballet deleted the jsign-malleability branch February 16, 2024 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants