Fix serialization of ECDH and DH
This commit is contained in:
parent
e76d43470d
commit
0c3f68929b
@ -1,3 +1,7 @@
|
|||||||
|
## 0.15
|
||||||
|
|
||||||
|
* Fix serialization of DH and ECDH
|
||||||
|
|
||||||
## 0.14
|
## 0.14
|
||||||
|
|
||||||
* Reduce size of SHA3 context instead of allocating all-size fit memory. save
|
* Reduce size of SHA3 context instead of allocating all-size fit memory. save
|
||||||
|
|||||||
@ -76,4 +76,4 @@ generatePublic = calculatePublic
|
|||||||
|
|
||||||
-- | generate a shared key using our private number and the other party public number
|
-- | generate a shared key using our private number and the other party public number
|
||||||
getShared :: Params -> PrivateNumber -> PublicNumber -> SharedKey
|
getShared :: Params -> PrivateNumber -> PublicNumber -> SharedKey
|
||||||
getShared (Params p _ bits) (PrivateNumber x) (PublicNumber y) = SharedKey $ i2ospOf_ (bits + 7 `div` 8) $ expSafe y x p
|
getShared (Params p _ bits) (PrivateNumber x) (PublicNumber y) = SharedKey $ i2ospOf_ ((bits + 7) `div` 8) $ expSafe y x p
|
||||||
|
|||||||
@ -42,7 +42,7 @@ calculatePublic curve d = q
|
|||||||
-- | Generating a shared key using our private number and
|
-- | Generating a shared key using our private number and
|
||||||
-- the other party public point.
|
-- the other party public point.
|
||||||
getShared :: Curve -> PrivateNumber -> PublicPoint -> SharedKey
|
getShared :: Curve -> PrivateNumber -> PublicPoint -> SharedKey
|
||||||
getShared curve db qa = SharedKey $ i2ospOf_ (nbBits + 7 `div` 8) x
|
getShared curve db qa = SharedKey $ i2ospOf_ ((nbBits + 7) `div` 8) x
|
||||||
where
|
where
|
||||||
Point x _ = pointMul curve db qa
|
Point x _ = pointMul curve db qa
|
||||||
nbBits = curveSizeBits curve
|
nbBits = curveSizeBits curve
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user