Trust-Machines / p256k1

Wrappers around secp256k1 to expose the underlying math, specifically unwrapped points and scalars with multiexponentiation
Apache License 2.0
12 stars 6 forks source link

`From<Compressed> for Point` does not check return values #8

Closed xoloki closed 1 year ago

xoloki commented 1 year ago

The API for p256k1 is modeled after curve25519_dalek, since that allows easy porting between the two curve libraries. But there is one discrepancy: curve25519_dalek does not implement From<CompressedRistretto> for RistrettoPoint, since CompressedRistretto does not do any validation of the bytes it is constructed with, and not all byte arrays are valid points on the curve.

Remove From<Compressed> for Point and replace it with TryFrom<Compressed> for Point instead, returning errors when they arise.

xoloki commented 1 year ago

Fixed in #9