< Summary

Information
Class: Renci.SshNet.Security.Org.BouncyCastle.Math.EC.Multiplier.GlvMultiplier
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\GlvMultiplier.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 19
Coverable lines: 19
Total lines: 40
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 8
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor(...)0%40%
MultiplyPositive(...)0%40%

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\GlvMultiplier.cs

#LineLine coverage
 1using System;
 2
 3using Renci.SshNet.Security.Org.BouncyCastle.Math.EC.Endo;
 4
 5namespace Renci.SshNet.Security.Org.BouncyCastle.Math.EC.Multiplier
 6{
 7    internal class GlvMultiplier
 8        :   AbstractECMultiplier
 9    {
 10        protected readonly ECCurve curve;
 11        protected readonly GlvEndomorphism glvEndomorphism;
 12
 013        public GlvMultiplier(ECCurve curve, GlvEndomorphism glvEndomorphism)
 014        {
 015            if (curve == null || curve.Order == null)
 016                throw new ArgumentException("Need curve with known group order", "curve");
 17
 018            this.curve = curve;
 019            this.glvEndomorphism = glvEndomorphism;
 020        }
 21
 22        protected override ECPoint MultiplyPositive(ECPoint p, BigInteger k)
 023        {
 024            if (!curve.Equals(p.Curve))
 025                throw new InvalidOperationException();
 26
 027            BigInteger n = p.Curve.Order;
 028            BigInteger[] ab = glvEndomorphism.DecomposeScalar(k.Mod(n));
 029            BigInteger a = ab[0], b = ab[1];
 30
 031            ECPointMap pointMap = glvEndomorphism.PointMap;
 032            if (glvEndomorphism.HasEfficientPointMap)
 033            {
 034                return ECAlgorithms.ImplShamirsTrickWNaf(p, a, pointMap, b);
 35            }
 36
 037            return ECAlgorithms.ImplShamirsTrickWNaf(p, a, pointMap.Map(p), b);
 038        }
 39    }
 40}