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

ecc/bls12381: Ensures pairing operations don't overwrite their input #494

Merged
merged 2 commits into from Apr 6, 2024

Conversation

armfazh
Copy link
Contributor

@armfazh armfazh commented Apr 4, 2024

Issue: Pairing functions internally convert input points to affine, overwriting the input. This causes troubles in a multiple goroutine scenario.

Fix: Ensures pairing operations don't overwrite the input.
Added a test for checking input's integrity.

Fixes #493

@armfazh armfazh added the fix-A-bug code that fix a bug label Apr 4, 2024
@armfazh armfazh requested review from bwesterb and thibmeu April 4, 2024 22:29
@armfazh armfazh self-assigned this Apr 4, 2024
Copy link
Contributor

@thibmeu thibmeu left a comment

Choose a reason for hiding this comment

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

Looks good. One minor nit on variable declaration.

Tests are passing locally as well.

ecc/bls12381/g1.go Show resolved Hide resolved
ecc/bls12381/g1.go Show resolved Hide resolved

Choose a reason for hiding this comment

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

Is G2 really not affected at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For points in G2, the Miller's loop only uses the points in read-only mode.

@armfazh armfazh merged commit a4b7601 into cloudflare:main Apr 6, 2024
10 checks passed
@armfazh armfazh deleted the fixPairInputsOverwrite branch April 6, 2024 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix-A-bug code that fix a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In ecc/bls12381, Pairing operations seems racy
4 participants