use binary serializer for P256 instead of going through the simple point layer
This commit is contained in:
parent
052417e5b1
commit
5e52a7ffa2
@ -100,13 +100,8 @@ instance EllipticCurve Curve_P256R1 where
|
|||||||
curveGenerateScalar _ = P256.scalarGenerate
|
curveGenerateScalar _ = P256.scalarGenerate
|
||||||
curveGenerateKeyPair _ = toKeyPair <$> P256.scalarGenerate
|
curveGenerateKeyPair _ = toKeyPair <$> P256.scalarGenerate
|
||||||
where toKeyPair scalar = KeyPair (P256.toPoint scalar) scalar
|
where toKeyPair scalar = KeyPair (P256.toPoint scalar) scalar
|
||||||
encodePoint _ p = encodeECPoint (Simple.Point x y :: Simple.Point Simple.SEC_p256r1)
|
encodePoint _ p = P256.pointToBinary p
|
||||||
where
|
decodePoint _ bs = P256.pointFromBinary bs
|
||||||
(x,y) = P256.pointToIntegers p
|
|
||||||
decodePoint _ bs = fromSimplePoint <$> decodeECPoint bs
|
|
||||||
where fromSimplePoint :: Simple.Point Simple.SEC_p256r1 -> P256.Point
|
|
||||||
fromSimplePoint (Simple.Point x y) = P256.pointFromIntegers (x,y)
|
|
||||||
fromSimplePoint Simple.PointO = error "impossible happened: fromPoint is infinite"
|
|
||||||
|
|
||||||
instance EllipticCurveArith Curve_P256R1 where
|
instance EllipticCurveArith Curve_P256R1 where
|
||||||
pointAdd _ a b = P256.pointAdd a b
|
pointAdd _ a b = P256.pointAdd a b
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user