package org.bouncycastle.math.ec; import java.math.BigInteger; import org.bouncycastle.math.ec.endo.GLVEndomorphism; /* loaded from: classes6.dex */ public class GLVMultiplier extends AbstractECMultiplier { protected final ECCurve curve; protected final GLVEndomorphism glvEndomorphism; @Override // org.bouncycastle.math.ec.AbstractECMultiplier protected ECPoint multiplyPositive(ECPoint eCPoint, BigInteger bigInteger) { if (!this.curve.equals(eCPoint.getCurve())) { throw new IllegalStateException(); } BigInteger[] decomposeScalar = this.glvEndomorphism.decomposeScalar(bigInteger.mod(eCPoint.getCurve().getOrder())); BigInteger bigInteger2 = decomposeScalar[0]; BigInteger bigInteger3 = decomposeScalar[1]; ECPointMap pointMap = this.glvEndomorphism.getPointMap(); return this.glvEndomorphism.hasEfficientPointMap() ? ECAlgorithms.implShamirsTrickWNaf(eCPoint, bigInteger2, pointMap, bigInteger3) : ECAlgorithms.implShamirsTrickWNaf(eCPoint, bigInteger2, pointMap.map(eCPoint), bigInteger3); } public GLVMultiplier(ECCurve eCCurve, GLVEndomorphism gLVEndomorphism) { if (eCCurve == null || eCCurve.getOrder() == null) { throw new IllegalArgumentException("Need curve with known group order"); } this.curve = eCCurve; this.glvEndomorphism = gLVEndomorphism; } }