Skip to content

Commit

Permalink
Merge pull request #16 from jml/ensure-in-group
Browse files Browse the repository at this point in the history
Remove unproven shortcut from safeScalarMultiply
  • Loading branch information
jml authored Jan 16, 2018
2 parents 63ffe71 + 416e7c2 commit 5d79f72
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Crypto/Spake2/Groups/Ed25519.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module Crypto.Spake2.Groups.Ed25519
, generator
) where

import Protolude hiding (group, zero)
import Protolude hiding (group)

import Crypto.Error (CryptoFailable(..), CryptoError(..))
import Crypto.Number.Generate (generateMax)
Expand Down Expand Up @@ -301,7 +301,6 @@ safeScalarMultiply n = scalarMultiplyExtendedPoint addExtendedPoints n
scalarMultiplyExtendedPoint :: (ExtendedPoint a -> ExtendedPoint a -> ExtendedPoint a) -> Integer -> ExtendedPoint a -> ExtendedPoint a
scalarMultiplyExtendedPoint _ 0 _ = extendedZero
scalarMultiplyExtendedPoint add n x
| n >= l = scalarMultiplyExtendedPoint add (n `mod` l) x
| even n = doubleExtendedPoint (scalarMultiplyExtendedPoint add (n `div` 2) x)
| n == 1 = x
| n <= 0 = panic $ "Unexpected negative multiplier: " <> show n
Expand Down

0 comments on commit 5d79f72

Please sign in to comment.