Export and test ECC.pointNegate

This commit is contained in:
Olivier Chéron 2017-11-10 13:10:20 +01:00
parent c55dd4d27f
commit 4f7d742461
2 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,7 @@
module Crypto.PubKey.ECC.Prim
( scalarGenerate
, pointAdd
, pointNegate
, pointDouble
, pointBaseMul
, pointMul

View File

@ -155,6 +155,13 @@ eccTests = testGroup "ECC"
p2 = ECC.pointMul aCurve r2 curveGen
pR = ECC.pointMul aCurve ((r1 + r2) `mod` curveN) curveGen
in pR `propertyEq` ECC.pointAdd aCurve p1 p2
, testProperty "point-negate-add" $ \aCurve -> do
p <- arbitraryPoint aCurve
let o = ECC.pointAdd aCurve p (ECC.pointNegate aCurve p)
return $ ECC.PointO `propertyEq` o
, testProperty "point-negate-negate" $ \aCurve -> do
p <- arbitraryPoint aCurve
return $ p `propertyEq` ECC.pointNegate aCurve (ECC.pointNegate aCurve p)
, localOption (QuickCheckTests 20) $
testProperty "point-mul-mul" $ \aCurve (QAInteger n1) (QAInteger n2) -> do
p <- arbitraryPoint aCurve