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

weierstrass: initial crate #631

Merged
merged 4 commits into from
Aug 3, 2022
Merged

weierstrass: initial crate #631

merged 4 commits into from
Aug 3, 2022

Conversation

tarcieri
Copy link
Member

@tarcieri tarcieri commented Aug 2, 2022

Implements AffinePoint and ProjectivePoint generically and uses it for both the p256 and p384 crates, with the potential to use it for bp256/bp384/p521 as well.

TODO

  • serde support
  • PrimeField constants
  • Compaction support

cc @jedisct1 @brycx

@tarcieri tarcieri force-pushed the weierstrass branch 8 times, most recently from 3373308 to c5fc82f Compare August 3, 2022 00:09
@tarcieri tarcieri changed the title [WIP] weierstrass: initial crate weierstrass: initial crate Aug 3, 2022
@tarcieri tarcieri marked this pull request as ready for review August 3, 2022 00:10
@tarcieri tarcieri requested a review from str4d August 3, 2022 00:10
p256/src/arithmetic/field.rs Outdated Show resolved Hide resolved
p384/src/arithmetic/field.rs Outdated Show resolved Hide resolved
Comment on lines +14 to +29
/// Assert that the provided projective point matches the given test vector.
// TODO(tarcieri): use coordinate APIs. See zkcrypto/group#30
macro_rules! assert_point_eq {
($actual:expr, $expected:expr) => {
let (expected_x, expected_y) = $expected;

let point = $actual.to_affine().to_encoded_point(false);
let (actual_x, actual_y) = match point.coordinates() {
sec1::Coordinates::Uncompressed { x, y } => (x, y),
_ => unreachable!(),
};

assert_eq!(&expected_x, actual_x.as_slice());
assert_eq!(&expected_y, actual_y.as_slice());
};
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@str4d workaround I ended up with for comparing curve points to test vectors.

I suppose I can just change the structure of the test vectors to include SEC1-encoded points.

@tarcieri tarcieri mentioned this pull request Aug 3, 2022
11 tasks
@tarcieri tarcieri force-pushed the weierstrass branch 2 times, most recently from d106c34 to f077312 Compare August 3, 2022 03:13
Implements `AffinePoint` and `ProjectivePoint` generically for both the
`p256` and `p384` crates, with the potential to use it for
`bp256`/`bp384`/`p521`.
@tarcieri tarcieri merged commit 6c28923 into master Aug 3, 2022
@tarcieri tarcieri deleted the weierstrass branch August 3, 2022 20:01
This was referenced Jan 16, 2023
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.

1 participant