ECAlgorithms.smali

.class public Lorg/spongycastle/math/ec/ECAlgorithms;
.super Ljava/lang/Object;
.source "ECAlgorithms.java"


# direct methods
.method public constructor <init>()V
    .registers 1

    .prologue
    .line 10
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method static implShamirsTrickJsf(Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;
    .registers 14

    .prologue
    const/4 v9, 0x4

    const/4 v8, 0x3

    const/4 v7, 0x2

    const/4 v6, 0x1

    const/4 v5, 0x0

    .line 223
    invoke-virtual {p0}, Lorg/spongycastle/math/ec/ECPoint;->getCurve()Lorg/spongycastle/math/ec/ECCurve;

    move-result-object v0

    .line 224
    invoke-virtual {v0}, Lorg/spongycastle/math/ec/ECCurve;->getInfinity()Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v1

    .line 227
    invoke-virtual {p0, p2}, Lorg/spongycastle/math/ec/ECPoint;->add(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v2

    .line 228
    invoke-virtual {p0, p2}, Lorg/spongycastle/math/ec/ECPoint;->subtract(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v3

    .line 230
    new-array v4, v9, [Lorg/spongycastle/math/ec/ECPoint;

    aput-object p2, v4, v5

    aput-object v3, v4, v6

    aput-object p0, v4, v7

    aput-object v2, v4, v8

    .line 231
    invoke-virtual {v0, v4}, Lorg/spongycastle/math/ec/ECCurve;->normalizeAll([Lorg/spongycastle/math/ec/ECPoint;)V

    .line 233
    const/16 v0, 0x9

    new-array v2, v0, [Lorg/spongycastle/math/ec/ECPoint;

    aget-object v0, v4, v8

    .line 234
    invoke-virtual {v0}, Lorg/spongycastle/math/ec/ECPoint;->negate()Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    aput-object v0, v2, v5

    aget-object v0, v4, v7

    invoke-virtual {v0}, Lorg/spongycastle/math/ec/ECPoint;->negate()Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    aput-object v0, v2, v6

    aget-object v0, v4, v6

    invoke-virtual {v0}, Lorg/spongycastle/math/ec/ECPoint;->negate()Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    aput-object v0, v2, v7

    aget-object v0, v4, v5

    .line 235
    invoke-virtual {v0}, Lorg/spongycastle/math/ec/ECPoint;->negate()Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    aput-object v0, v2, v8

    aput-object v1, v2, v9

    const/4 v0, 0x5

    aget-object v3, v4, v5

    aput-object v3, v2, v0

    const/4 v0, 0x6

    aget-object v3, v4, v6

    aput-object v3, v2, v0

    const/4 v0, 0x7

    aget-object v3, v4, v7

    aput-object v3, v2, v0

    const/16 v0, 0x8

    aget-object v3, v4, v8

    aput-object v3, v2, v0

    .line 238
    invoke-static {p1, p3}, Lorg/spongycastle/math/ec/WNafUtil;->generateJSF(Ljava/math/BigInteger;Ljava/math/BigInteger;)[B

    move-result-object v3

    .line 242
    array-length v0, v3

    .line 243
    :goto_62
    add-int/lit8 v0, v0, -0x1

    if-ltz v0, :cond_7c

    .line 245
    aget-byte v4, v3, v0

    .line 248
    shl-int/lit8 v5, v4, 0x18

    shr-int/lit8 v5, v5, 0x1c

    shl-int/lit8 v4, v4, 0x1c

    shr-int/lit8 v4, v4, 0x1c

    .line 250
    mul-int/lit8 v5, v5, 0x3

    add-int/lit8 v5, v5, 0x4

    add-int/2addr v4, v5

    .line 251
    aget-object v4, v2, v4

    invoke-virtual {v1, v4}, Lorg/spongycastle/math/ec/ECPoint;->twicePlus(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v1

    goto :goto_62

    .line 254
    :cond_7c
    return-object v1
.end method

.method static implShamirsTrickWNaf(Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;
    .registers 14

    .prologue
    const/16 v8, 0x10

    const/4 v4, 0x2

    const/4 v2, 0x0

    const/4 v0, 0x1

    .line 260
    invoke-virtual {p1}, Ljava/math/BigInteger;->signum()I

    move-result v1

    if-gez v1, :cond_68

    move v1, v0

    :goto_c
    invoke-virtual {p3}, Ljava/math/BigInteger;->signum()I

    move-result v3

    if-gez v3, :cond_13

    move v2, v0

    .line 262
    :cond_13
    invoke-virtual {p1}, Ljava/math/BigInteger;->abs()Ljava/math/BigInteger;

    move-result-object v5

    .line 263
    invoke-virtual {p3}, Ljava/math/BigInteger;->abs()Ljava/math/BigInteger;

    move-result-object v6

    .line 265
    invoke-virtual {v5}, Ljava/math/BigInteger;->bitLength()I

    move-result v3

    invoke-static {v3}, Lorg/spongycastle/math/ec/WNafUtil;->getWindowSize(I)I

    move-result v3

    invoke-static {v8, v3}, Ljava/lang/Math;->min(II)I

    move-result v3

    invoke-static {v4, v3}, Ljava/lang/Math;->max(II)I

    move-result v7

    .line 266
    invoke-virtual {v6}, Ljava/math/BigInteger;->bitLength()I

    move-result v3

    invoke-static {v3}, Lorg/spongycastle/math/ec/WNafUtil;->getWindowSize(I)I

    move-result v3

    invoke-static {v8, v3}, Ljava/lang/Math;->min(II)I

    move-result v3

    invoke-static {v4, v3}, Ljava/lang/Math;->max(II)I

    move-result v8

    .line 268
    invoke-static {p0, v7, v0}, Lorg/spongycastle/math/ec/WNafUtil;->precompute(Lorg/spongycastle/math/ec/ECPoint;IZ)Lorg/spongycastle/math/ec/WNafPreCompInfo;

    move-result-object v4

    .line 269
    invoke-static {p2, v8, v0}, Lorg/spongycastle/math/ec/WNafUtil;->precompute(Lorg/spongycastle/math/ec/ECPoint;IZ)Lorg/spongycastle/math/ec/WNafPreCompInfo;

    move-result-object v9

    .line 271
    if-eqz v1, :cond_6a

    invoke-virtual {v4}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreCompNeg()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    .line 272
    :goto_49
    if-eqz v2, :cond_6f

    invoke-virtual {v9}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreCompNeg()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v3

    .line 273
    :goto_4f
    if-eqz v1, :cond_74

    invoke-virtual {v4}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreComp()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v1

    .line 274
    :goto_55
    if-eqz v2, :cond_79

    invoke-virtual {v9}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreComp()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v4

    .line 276
    :goto_5b
    invoke-static {v7, v5}, Lorg/spongycastle/math/ec/WNafUtil;->generateWindowNaf(ILjava/math/BigInteger;)[B

    move-result-object v2

    .line 277
    invoke-static {v8, v6}, Lorg/spongycastle/math/ec/WNafUtil;->generateWindowNaf(ILjava/math/BigInteger;)[B

    move-result-object v5

    .line 279
    invoke-static/range {v0 .. v5}, Lorg/spongycastle/math/ec/ECAlgorithms;->implShamirsTrickWNaf([Lorg/spongycastle/math/ec/ECPoint;[Lorg/spongycastle/math/ec/ECPoint;[B[Lorg/spongycastle/math/ec/ECPoint;[Lorg/spongycastle/math/ec/ECPoint;[B)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    return-object v0

    :cond_68
    move v1, v2

    .line 260
    goto :goto_c

    .line 271
    :cond_6a
    invoke-virtual {v4}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreComp()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    goto :goto_49

    .line 272
    :cond_6f
    invoke-virtual {v9}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreComp()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v3

    goto :goto_4f

    .line 273
    :cond_74
    invoke-virtual {v4}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreCompNeg()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v1

    goto :goto_55

    .line 274
    :cond_79
    invoke-virtual {v9}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreCompNeg()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v4

    goto :goto_5b
.end method

.method static implShamirsTrickWNaf(Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;Lorg/spongycastle/math/ec/ECPointMap;Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;
    .registers 13

    .prologue
    const/4 v2, 0x0

    const/4 v0, 0x1

    .line 284
    invoke-virtual {p1}, Ljava/math/BigInteger;->signum()I

    move-result v1

    if-gez v1, :cond_64

    move v1, v0

    :goto_9
    invoke-virtual {p3}, Ljava/math/BigInteger;->signum()I

    move-result v3

    if-gez v3, :cond_10

    move v2, v0

    .line 286
    :cond_10
    invoke-virtual {p1}, Ljava/math/BigInteger;->abs()Ljava/math/BigInteger;

    move-result-object v5

    .line 287
    invoke-virtual {p3}, Ljava/math/BigInteger;->abs()Ljava/math/BigInteger;

    move-result-object v6

    .line 289
    const/4 v3, 0x2

    const/16 v4, 0x10

    invoke-virtual {v5}, Ljava/math/BigInteger;->bitLength()I

    move-result v7

    invoke-virtual {v6}, Ljava/math/BigInteger;->bitLength()I

    move-result v8

    invoke-static {v7, v8}, Ljava/lang/Math;->max(II)I

    move-result v7

    invoke-static {v7}, Lorg/spongycastle/math/ec/WNafUtil;->getWindowSize(I)I

    move-result v7

    invoke-static {v4, v7}, Ljava/lang/Math;->min(II)I

    move-result v4

    invoke-static {v3, v4}, Ljava/lang/Math;->max(II)I

    move-result v7

    .line 291
    invoke-static {p0, v7, v0, p2}, Lorg/spongycastle/math/ec/WNafUtil;->mapPointWithPrecomp(Lorg/spongycastle/math/ec/ECPoint;IZLorg/spongycastle/math/ec/ECPointMap;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    .line 292
    invoke-static {p0}, Lorg/spongycastle/math/ec/WNafUtil;->getWNafPreCompInfo(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/WNafPreCompInfo;

    move-result-object v4

    .line 293
    invoke-static {v0}, Lorg/spongycastle/math/ec/WNafUtil;->getWNafPreCompInfo(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/WNafPreCompInfo;

    move-result-object v8

    .line 295
    if-eqz v1, :cond_66

    invoke-virtual {v4}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreCompNeg()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    .line 296
    :goto_45
    if-eqz v2, :cond_6b

    invoke-virtual {v8}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreCompNeg()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v3

    .line 297
    :goto_4b
    if-eqz v1, :cond_70

    invoke-virtual {v4}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreComp()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v1

    .line 298
    :goto_51
    if-eqz v2, :cond_75

    invoke-virtual {v8}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreComp()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v4

    .line 300
    :goto_57
    invoke-static {v7, v5}, Lorg/spongycastle/math/ec/WNafUtil;->generateWindowNaf(ILjava/math/BigInteger;)[B

    move-result-object v2

    .line 301
    invoke-static {v7, v6}, Lorg/spongycastle/math/ec/WNafUtil;->generateWindowNaf(ILjava/math/BigInteger;)[B

    move-result-object v5

    .line 303
    invoke-static/range {v0 .. v5}, Lorg/spongycastle/math/ec/ECAlgorithms;->implShamirsTrickWNaf([Lorg/spongycastle/math/ec/ECPoint;[Lorg/spongycastle/math/ec/ECPoint;[B[Lorg/spongycastle/math/ec/ECPoint;[Lorg/spongycastle/math/ec/ECPoint;[B)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    return-object v0

    :cond_64
    move v1, v2

    .line 284
    goto :goto_9

    .line 295
    :cond_66
    invoke-virtual {v4}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreComp()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    goto :goto_45

    .line 296
    :cond_6b
    invoke-virtual {v8}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreComp()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v3

    goto :goto_4b

    .line 297
    :cond_70
    invoke-virtual {v4}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreCompNeg()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v1

    goto :goto_51

    .line 298
    :cond_75
    invoke-virtual {v8}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreCompNeg()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v4

    goto :goto_57
.end method

.method private static implShamirsTrickWNaf([Lorg/spongycastle/math/ec/ECPoint;[Lorg/spongycastle/math/ec/ECPoint;[B[Lorg/spongycastle/math/ec/ECPoint;[Lorg/spongycastle/math/ec/ECPoint;[B)Lorg/spongycastle/math/ec/ECPoint;
    .registers 15

    .prologue
    const/4 v1, 0x0

    .line 309
    array-length v0, p2

    array-length v2, p5

    invoke-static {v0, v2}, Ljava/lang/Math;->max(II)I

    move-result v0

    .line 311
    aget-object v2, p0, v1

    invoke-virtual {v2}, Lorg/spongycastle/math/ec/ECPoint;->getCurve()Lorg/spongycastle/math/ec/ECCurve;

    move-result-object v2

    .line 312
    invoke-virtual {v2}, Lorg/spongycastle/math/ec/ECCurve;->getInfinity()Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v5

    .line 317
    add-int/lit8 v0, v0, -0x1

    move v2, v1

    move-object v3, v5

    move v7, v0

    :goto_16
    if-ltz v7, :cond_66

    .line 319
    array-length v0, p2

    if-ge v7, v0, :cond_2e

    aget-byte v0, p2, v7

    .line 320
    :goto_1d
    array-length v4, p5

    if-ge v7, v4, :cond_30

    aget-byte v4, p5, v7

    move v6, v4

    .line 322
    :goto_23
    or-int v4, v0, v6

    if-nez v4, :cond_32

    .line 324
    add-int/lit8 v0, v2, 0x1

    .line 317
    :goto_29
    add-int/lit8 v2, v7, -0x1

    move v7, v2

    move v2, v0

    goto :goto_16

    :cond_2e
    move v0, v1

    .line 319
    goto :goto_1d

    :cond_30
    move v6, v1

    .line 320
    goto :goto_23

    .line 329
    :cond_32
    if-eqz v0, :cond_70

    .line 331
    invoke-static {v0}, Ljava/lang/Math;->abs(I)I

    move-result v4

    .line 332
    if-gez v0, :cond_62

    move-object v0, p1

    .line 333
    :goto_3b
    ushr-int/lit8 v4, v4, 0x1

    aget-object v0, v0, v4

    invoke-virtual {v5, v0}, Lorg/spongycastle/math/ec/ECPoint;->add(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v4

    .line 335
    :goto_43
    if-eqz v6, :cond_55

    .line 337
    invoke-static {v6}, Ljava/lang/Math;->abs(I)I

    move-result v8

    .line 338
    if-gez v6, :cond_64

    move-object v0, p4

    .line 339
    :goto_4c
    ushr-int/lit8 v6, v8, 0x1

    aget-object v0, v0, v6

    invoke-virtual {v4, v0}, Lorg/spongycastle/math/ec/ECPoint;->add(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    move-object v4, v0

    .line 342
    :cond_55
    if-lez v2, :cond_6d

    .line 344
    invoke-virtual {v3, v2}, Lorg/spongycastle/math/ec/ECPoint;->timesPow2(I)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    move-object v2, v0

    move v0, v1

    .line 348
    :goto_5d
    invoke-virtual {v2, v4}, Lorg/spongycastle/math/ec/ECPoint;->twicePlus(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v3

    goto :goto_29

    :cond_62
    move-object v0, p0

    .line 332
    goto :goto_3b

    :cond_64
    move-object v0, p3

    .line 338
    goto :goto_4c

    .line 351
    :cond_66
    if-lez v2, :cond_6c

    .line 353
    invoke-virtual {v3, v2}, Lorg/spongycastle/math/ec/ECPoint;->timesPow2(I)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v3

    .line 356
    :cond_6c
    return-object v3

    :cond_6d
    move v0, v2

    move-object v2, v3

    goto :goto_5d

    :cond_70
    move-object v4, v5

    goto :goto_43
.end method

.method static implSumOfMultiplies([Lorg/spongycastle/math/ec/ECPoint;Lorg/spongycastle/math/ec/ECPointMap;[Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;
    .registers 16

    .prologue
    .line 412
    array-length v2, p0

    shl-int/lit8 v0, v2, 0x1

    .line 414
    new-array v3, v0, [Z

    .line 415
    new-array v4, v0, [Lorg/spongycastle/math/ec/WNafPreCompInfo;

    .line 416
    new-array v5, v0, [[B

    .line 418
    const/4 v0, 0x0

    move v1, v0

    :goto_b
    if-ge v1, v2, :cond_71

    .line 420
    shl-int/lit8 v6, v1, 0x1

    add-int/lit8 v7, v6, 0x1

    .line 422
    aget-object v8, p2, v6

    invoke-virtual {v8}, Ljava/math/BigInteger;->signum()I

    move-result v0

    if-gez v0, :cond_6d

    const/4 v0, 0x1

    :goto_1a
    aput-boolean v0, v3, v6

    invoke-virtual {v8}, Ljava/math/BigInteger;->abs()Ljava/math/BigInteger;

    move-result-object v8

    .line 423
    aget-object v9, p2, v7

    invoke-virtual {v9}, Ljava/math/BigInteger;->signum()I

    move-result v0

    if-gez v0, :cond_6f

    const/4 v0, 0x1

    :goto_29
    aput-boolean v0, v3, v7

    invoke-virtual {v9}, Ljava/math/BigInteger;->abs()Ljava/math/BigInteger;

    move-result-object v0

    .line 425
    const/4 v9, 0x2

    const/16 v10, 0x10

    invoke-virtual {v8}, Ljava/math/BigInteger;->bitLength()I

    move-result v11

    invoke-virtual {v0}, Ljava/math/BigInteger;->bitLength()I

    move-result v12

    invoke-static {v11, v12}, Ljava/lang/Math;->max(II)I

    move-result v11

    invoke-static {v11}, Lorg/spongycastle/math/ec/WNafUtil;->getWindowSize(I)I

    move-result v11

    invoke-static {v10, v11}, Ljava/lang/Math;->min(II)I

    move-result v10

    invoke-static {v9, v10}, Ljava/lang/Math;->max(II)I

    move-result v9

    .line 427
    aget-object v10, p0, v1

    const/4 v11, 0x1

    invoke-static {v10, v9, v11, p1}, Lorg/spongycastle/math/ec/WNafUtil;->mapPointWithPrecomp(Lorg/spongycastle/math/ec/ECPoint;IZLorg/spongycastle/math/ec/ECPointMap;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v11

    .line 428
    invoke-static {v10}, Lorg/spongycastle/math/ec/WNafUtil;->getWNafPreCompInfo(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/WNafPreCompInfo;

    move-result-object v10

    aput-object v10, v4, v6

    .line 429
    invoke-static {v11}, Lorg/spongycastle/math/ec/WNafUtil;->getWNafPreCompInfo(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/WNafPreCompInfo;

    move-result-object v10

    aput-object v10, v4, v7

    .line 430
    invoke-static {v9, v8}, Lorg/spongycastle/math/ec/WNafUtil;->generateWindowNaf(ILjava/math/BigInteger;)[B

    move-result-object v8

    aput-object v8, v5, v6

    .line 431
    invoke-static {v9, v0}, Lorg/spongycastle/math/ec/WNafUtil;->generateWindowNaf(ILjava/math/BigInteger;)[B

    move-result-object v0

    aput-object v0, v5, v7

    .line 418
    add-int/lit8 v0, v1, 0x1

    move v1, v0

    goto :goto_b

    .line 422
    :cond_6d
    const/4 v0, 0x0

    goto :goto_1a

    .line 423
    :cond_6f
    const/4 v0, 0x0

    goto :goto_29

    .line 434
    :cond_71
    invoke-static {v3, v4, v5}, Lorg/spongycastle/math/ec/ECAlgorithms;->implSumOfMultiplies([Z[Lorg/spongycastle/math/ec/WNafPreCompInfo;[[B)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    return-object v0
.end method

.method static implSumOfMultiplies([Lorg/spongycastle/math/ec/ECPoint;[Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;
    .registers 13

    .prologue
    const/4 v1, 0x1

    const/4 v2, 0x0

    .line 361
    array-length v4, p0

    .line 362
    new-array v5, v4, [Z

    .line 363
    new-array v6, v4, [Lorg/spongycastle/math/ec/WNafPreCompInfo;

    .line 364
    new-array v7, v4, [[B

    move v3, v2

    .line 366
    :goto_a
    if-ge v3, v4, :cond_42

    .line 368
    aget-object v8, p1, v3

    invoke-virtual {v8}, Ljava/math/BigInteger;->signum()I

    move-result v0

    if-gez v0, :cond_40

    move v0, v1

    :goto_15
    aput-boolean v0, v5, v3

    invoke-virtual {v8}, Ljava/math/BigInteger;->abs()Ljava/math/BigInteger;

    move-result-object v0

    .line 370
    const/4 v8, 0x2

    const/16 v9, 0x10

    invoke-virtual {v0}, Ljava/math/BigInteger;->bitLength()I

    move-result v10

    invoke-static {v10}, Lorg/spongycastle/math/ec/WNafUtil;->getWindowSize(I)I

    move-result v10

    invoke-static {v9, v10}, Ljava/lang/Math;->min(II)I

    move-result v9

    invoke-static {v8, v9}, Ljava/lang/Math;->max(II)I

    move-result v8

    .line 371
    aget-object v9, p0, v3

    invoke-static {v9, v8, v1}, Lorg/spongycastle/math/ec/WNafUtil;->precompute(Lorg/spongycastle/math/ec/ECPoint;IZ)Lorg/spongycastle/math/ec/WNafPreCompInfo;

    move-result-object v9

    aput-object v9, v6, v3

    .line 372
    invoke-static {v8, v0}, Lorg/spongycastle/math/ec/WNafUtil;->generateWindowNaf(ILjava/math/BigInteger;)[B

    move-result-object v0

    aput-object v0, v7, v3

    .line 366
    add-int/lit8 v0, v3, 0x1

    move v3, v0

    goto :goto_a

    :cond_40
    move v0, v2

    .line 368
    goto :goto_15

    .line 375
    :cond_42
    invoke-static {v5, v6, v7}, Lorg/spongycastle/math/ec/ECAlgorithms;->implSumOfMultiplies([Z[Lorg/spongycastle/math/ec/WNafPreCompInfo;[[B)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    return-object v0
.end method

.method private static implSumOfMultiplies([Z[Lorg/spongycastle/math/ec/WNafPreCompInfo;[[B)Lorg/spongycastle/math/ec/ECPoint;
    .registers 15

    .prologue
    const/4 v1, 0x0

    .line 439
    array-length v8, p2

    move v0, v1

    move v2, v1

    .line 440
    :goto_4
    if-ge v0, v8, :cond_10

    .line 442
    aget-object v3, p2, v0

    array-length v3, v3

    invoke-static {v2, v3}, Ljava/lang/Math;->max(II)I

    move-result v2

    .line 440
    add-int/lit8 v0, v0, 0x1

    goto :goto_4

    .line 445
    :cond_10
    aget-object v0, p1, v1

    invoke-virtual {v0}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreComp()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    aget-object v0, v0, v1

    invoke-virtual {v0}, Lorg/spongycastle/math/ec/ECPoint;->getCurve()Lorg/spongycastle/math/ec/ECCurve;

    move-result-object v0

    .line 446
    invoke-virtual {v0}, Lorg/spongycastle/math/ec/ECCurve;->getInfinity()Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v6

    .line 451
    add-int/lit8 v0, v2, -0x1

    move v3, v1

    move-object v4, v6

    move v7, v0

    :goto_25
    if-ltz v7, :cond_71

    move v5, v1

    move-object v2, v6

    .line 455
    :goto_29
    if-ge v5, v8, :cond_5b

    .line 457
    aget-object v0, p2, v5

    .line 458
    array-length v9, v0

    if-ge v7, v9, :cond_52

    aget-byte v0, v0, v7

    .line 459
    :goto_32
    if-eqz v0, :cond_7b

    .line 461
    invoke-static {v0}, Ljava/lang/Math;->abs(I)I

    move-result v9

    .line 462
    aget-object v10, p1, v5

    .line 463
    if-gez v0, :cond_54

    const/4 v0, 0x1

    :goto_3d
    aget-boolean v11, p0, v5

    if-ne v0, v11, :cond_56

    invoke-virtual {v10}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreComp()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    .line 464
    :goto_45
    ushr-int/lit8 v9, v9, 0x1

    aget-object v0, v0, v9

    invoke-virtual {v2, v0}, Lorg/spongycastle/math/ec/ECPoint;->add(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    .line 455
    :goto_4d
    add-int/lit8 v2, v5, 0x1

    move v5, v2

    move-object v2, v0

    goto :goto_29

    :cond_52
    move v0, v1

    .line 458
    goto :goto_32

    :cond_54
    move v0, v1

    .line 463
    goto :goto_3d

    :cond_56
    invoke-virtual {v10}, Lorg/spongycastle/math/ec/WNafPreCompInfo;->getPreCompNeg()[Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    goto :goto_45

    .line 468
    :cond_5b
    if-ne v2, v6, :cond_64

    .line 470
    add-int/lit8 v0, v3, 0x1

    .line 451
    :goto_5f
    add-int/lit8 v2, v7, -0x1

    move v3, v0

    move v7, v2

    goto :goto_25

    .line 474
    :cond_64
    if-lez v3, :cond_78

    .line 476
    invoke-virtual {v4, v3}, Lorg/spongycastle/math/ec/ECPoint;->timesPow2(I)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    move-object v3, v0

    move v0, v1

    .line 480
    :goto_6c
    invoke-virtual {v3, v2}, Lorg/spongycastle/math/ec/ECPoint;->twicePlus(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v4

    goto :goto_5f

    .line 483
    :cond_71
    if-lez v3, :cond_77

    .line 485
    invoke-virtual {v4, v3}, Lorg/spongycastle/math/ec/ECPoint;->timesPow2(I)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v4

    .line 488
    :cond_77
    return-object v4

    :cond_78
    move v0, v3

    move-object v3, v4

    goto :goto_6c

    :cond_7b
    move-object v0, v2

    goto :goto_4d
.end method

.method static implSumOfMultipliesGLV([Lorg/spongycastle/math/ec/ECPoint;[Ljava/math/BigInteger;Lorg/spongycastle/math/ec/endo/GLVEndomorphism;)Lorg/spongycastle/math/ec/ECPoint;
    .registers 12

    .prologue
    const/4 v0, 0x0

    .line 380
    aget-object v1, p0, v0

    invoke-virtual {v1}, Lorg/spongycastle/math/ec/ECPoint;->getCurve()Lorg/spongycastle/math/ec/ECCurve;

    move-result-object v1

    invoke-virtual {v1}, Lorg/spongycastle/math/ec/ECCurve;->getOrder()Ljava/math/BigInteger;

    move-result-object v3

    .line 382
    array-length v4, p0

    .line 384
    shl-int/lit8 v1, v4, 0x1

    new-array v5, v1, [Ljava/math/BigInteger;

    move v1, v0

    move v2, v0

    .line 385
    :goto_12
    if-ge v2, v4, :cond_2e

    .line 387
    aget-object v6, p1, v2

    invoke-virtual {v6, v3}, Ljava/math/BigInteger;->mod(Ljava/math/BigInteger;)Ljava/math/BigInteger;

    move-result-object v6

    invoke-interface {p2, v6}, Lorg/spongycastle/math/ec/endo/GLVEndomorphism;->decomposeScalar(Ljava/math/BigInteger;)[Ljava/math/BigInteger;

    move-result-object v6

    .line 388
    add-int/lit8 v7, v1, 0x1

    aget-object v8, v6, v0

    aput-object v8, v5, v1

    .line 389
    add-int/lit8 v1, v7, 0x1

    const/4 v8, 0x1

    aget-object v6, v6, v8

    aput-object v6, v5, v7

    .line 385
    add-int/lit8 v2, v2, 0x1

    goto :goto_12

    .line 392
    :cond_2e
    invoke-interface {p2}, Lorg/spongycastle/math/ec/endo/GLVEndomorphism;->getPointMap()Lorg/spongycastle/math/ec/ECPointMap;

    move-result-object v2

    .line 393
    invoke-interface {p2}, Lorg/spongycastle/math/ec/endo/GLVEndomorphism;->hasEfficientPointMap()Z

    move-result v1

    if-eqz v1, :cond_3d

    .line 395
    invoke-static {p0, v2, v5}, Lorg/spongycastle/math/ec/ECAlgorithms;->implSumOfMultiplies([Lorg/spongycastle/math/ec/ECPoint;Lorg/spongycastle/math/ec/ECPointMap;[Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    .line 406
    :goto_3c
    return-object v0

    .line 398
    :cond_3d
    shl-int/lit8 v1, v4, 0x1

    new-array v3, v1, [Lorg/spongycastle/math/ec/ECPoint;

    move v1, v0

    .line 399
    :goto_42
    if-ge v0, v4, :cond_55

    .line 401
    aget-object v6, p0, v0

    invoke-interface {v2, v6}, Lorg/spongycastle/math/ec/ECPointMap;->map(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v7

    .line 402
    add-int/lit8 v8, v1, 0x1

    aput-object v6, v3, v1

    .line 403
    add-int/lit8 v1, v8, 0x1

    aput-object v7, v3, v8

    .line 399
    add-int/lit8 v0, v0, 0x1

    goto :goto_42

    .line 406
    :cond_55
    invoke-static {v3, v5}, Lorg/spongycastle/math/ec/ECAlgorithms;->implSumOfMultiplies([Lorg/spongycastle/math/ec/ECPoint;[Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    goto :goto_3c
.end method

.method public static importPoint(Lorg/spongycastle/math/ec/ECCurve;Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;
    .registers 4

    .prologue
    .line 126
    invoke-virtual {p1}, Lorg/spongycastle/math/ec/ECPoint;->getCurve()Lorg/spongycastle/math/ec/ECCurve;

    move-result-object v0

    .line 127
    invoke-virtual {p0, v0}, Lorg/spongycastle/math/ec/ECCurve;->equals(Lorg/spongycastle/math/ec/ECCurve;)Z

    move-result v0

    if-nez v0, :cond_12

    .line 129
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "Point must be on the same curve"

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 131
    :cond_12
    invoke-virtual {p0, p1}, Lorg/spongycastle/math/ec/ECCurve;->importPoint(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    return-object v0
.end method

.method public static isF2mCurve(Lorg/spongycastle/math/ec/ECCurve;)Z
    .registers 2

    .prologue
    .line 14
    invoke-virtual {p0}, Lorg/spongycastle/math/ec/ECCurve;->getField()Lorg/spongycastle/math/field/FiniteField;

    move-result-object v0

    invoke-static {v0}, Lorg/spongycastle/math/ec/ECAlgorithms;->isF2mField(Lorg/spongycastle/math/field/FiniteField;)Z

    move-result v0

    return v0
.end method

.method public static isF2mField(Lorg/spongycastle/math/field/FiniteField;)Z
    .registers 4

    .prologue
    const/4 v0, 0x1

    .line 19
    invoke-interface {p0}, Lorg/spongycastle/math/field/FiniteField;->getDimension()I

    move-result v1

    if-le v1, v0, :cond_18

    invoke-interface {p0}, Lorg/spongycastle/math/field/FiniteField;->getCharacteristic()Ljava/math/BigInteger;

    move-result-object v1

    sget-object v2, Lorg/spongycastle/math/ec/ECConstants;->TWO:Ljava/math/BigInteger;

    invoke-virtual {v1, v2}, Ljava/math/BigInteger;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_18

    instance-of v1, p0, Lorg/spongycastle/math/field/PolynomialExtensionField;

    if-eqz v1, :cond_18

    :goto_17
    return v0

    :cond_18
    const/4 v0, 0x0

    goto :goto_17
.end method

.method public static isFpCurve(Lorg/spongycastle/math/ec/ECCurve;)Z
    .registers 2

    .prologue
    .line 25
    invoke-virtual {p0}, Lorg/spongycastle/math/ec/ECCurve;->getField()Lorg/spongycastle/math/field/FiniteField;

    move-result-object v0

    invoke-static {v0}, Lorg/spongycastle/math/ec/ECAlgorithms;->isFpField(Lorg/spongycastle/math/field/FiniteField;)Z

    move-result v0

    return v0
.end method

.method public static isFpField(Lorg/spongycastle/math/field/FiniteField;)Z
    .registers 3

    .prologue
    const/4 v0, 0x1

    .line 30
    invoke-interface {p0}, Lorg/spongycastle/math/field/FiniteField;->getDimension()I

    move-result v1

    if-ne v1, v0, :cond_8

    :goto_7
    return v0

    :cond_8
    const/4 v0, 0x0

    goto :goto_7
.end method

.method public static montgomeryTrick([Lorg/spongycastle/math/ec/ECFieldElement;II)V
    .registers 4

    .prologue
    .line 136
    const/4 v0, 0x0

    invoke-static {p0, p1, p2, v0}, Lorg/spongycastle/math/ec/ECAlgorithms;->montgomeryTrick([Lorg/spongycastle/math/ec/ECFieldElement;IILorg/spongycastle/math/ec/ECFieldElement;)V

    .line 137
    return-void
.end method

.method public static montgomeryTrick([Lorg/spongycastle/math/ec/ECFieldElement;IILorg/spongycastle/math/ec/ECFieldElement;)V
    .registers 10

    .prologue
    const/4 v0, 0x0

    .line 148
    new-array v3, p2, [Lorg/spongycastle/math/ec/ECFieldElement;

    .line 149
    aget-object v1, p0, p1

    aput-object v1, v3, v0

    .line 152
    :goto_7
    add-int/lit8 v0, v0, 0x1

    if-ge v0, p2, :cond_1a

    .line 154
    add-int/lit8 v1, v0, -0x1

    aget-object v1, v3, v1

    add-int v2, p1, v0

    aget-object v2, p0, v2

    invoke-virtual {v1, v2}, Lorg/spongycastle/math/ec/ECFieldElement;->multiply(Lorg/spongycastle/math/ec/ECFieldElement;)Lorg/spongycastle/math/ec/ECFieldElement;

    move-result-object v1

    aput-object v1, v3, v0

    goto :goto_7

    .line 157
    :cond_1a
    add-int/lit8 v0, v0, -0x1

    .line 159
    if-eqz p3, :cond_26

    .line 161
    aget-object v1, v3, v0

    invoke-virtual {v1, p3}, Lorg/spongycastle/math/ec/ECFieldElement;->multiply(Lorg/spongycastle/math/ec/ECFieldElement;)Lorg/spongycastle/math/ec/ECFieldElement;

    move-result-object v1

    aput-object v1, v3, v0

    .line 164
    :cond_26
    aget-object v1, v3, v0

    invoke-virtual {v1}, Lorg/spongycastle/math/ec/ECFieldElement;->invert()Lorg/spongycastle/math/ec/ECFieldElement;

    move-result-object v1

    move-object v2, v1

    .line 166
    :goto_2d
    if-lez v0, :cond_43

    .line 168
    add-int/lit8 v1, v0, -0x1

    add-int/2addr v0, p1

    .line 169
    aget-object v4, p0, v0

    .line 170
    aget-object v5, v3, v1

    invoke-virtual {v5, v2}, Lorg/spongycastle/math/ec/ECFieldElement;->multiply(Lorg/spongycastle/math/ec/ECFieldElement;)Lorg/spongycastle/math/ec/ECFieldElement;

    move-result-object v5

    aput-object v5, p0, v0

    .line 171
    invoke-virtual {v2, v4}, Lorg/spongycastle/math/ec/ECFieldElement;->multiply(Lorg/spongycastle/math/ec/ECFieldElement;)Lorg/spongycastle/math/ec/ECFieldElement;

    move-result-object v0

    move-object v2, v0

    move v0, v1

    .line 172
    goto :goto_2d

    .line 174
    :cond_43
    aput-object v2, p0, p1

    .line 175
    return-void
.end method

.method public static referenceMultiply(Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;
    .registers 7

    .prologue
    .line 189
    invoke-virtual {p1}, Ljava/math/BigInteger;->abs()Ljava/math/BigInteger;

    move-result-object v2

    .line 190
    invoke-virtual {p0}, Lorg/spongycastle/math/ec/ECPoint;->getCurve()Lorg/spongycastle/math/ec/ECCurve;

    move-result-object v0

    invoke-virtual {v0}, Lorg/spongycastle/math/ec/ECCurve;->getInfinity()Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    .line 191
    invoke-virtual {v2}, Ljava/math/BigInteger;->bitLength()I

    move-result v3

    .line 192
    if-lez v3, :cond_2e

    .line 194
    const/4 v1, 0x0

    invoke-virtual {v2, v1}, Ljava/math/BigInteger;->testBit(I)Z

    move-result v1

    if-eqz v1, :cond_1a

    move-object v0, p0

    .line 198
    :cond_1a
    const/4 v1, 0x1

    :goto_1b
    if-ge v1, v3, :cond_2e

    .line 200
    invoke-virtual {p0}, Lorg/spongycastle/math/ec/ECPoint;->twice()Lorg/spongycastle/math/ec/ECPoint;

    move-result-object p0

    .line 201
    invoke-virtual {v2, v1}, Ljava/math/BigInteger;->testBit(I)Z

    move-result v4

    if-eqz v4, :cond_2b

    .line 203
    invoke-virtual {v0, p0}, Lorg/spongycastle/math/ec/ECPoint;->add(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    .line 198
    :cond_2b
    add-int/lit8 v1, v1, 0x1

    goto :goto_1b

    .line 207
    :cond_2e
    invoke-virtual {p1}, Ljava/math/BigInteger;->signum()I

    move-result v1

    if-gez v1, :cond_38

    invoke-virtual {v0}, Lorg/spongycastle/math/ec/ECPoint;->negate()Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    :cond_38
    return-object v0
.end method

.method public static shamirsTrick(Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;
    .registers 5

    .prologue
    .line 118
    invoke-virtual {p0}, Lorg/spongycastle/math/ec/ECPoint;->getCurve()Lorg/spongycastle/math/ec/ECCurve;

    move-result-object v0

    .line 119
    invoke-static {v0, p2}, Lorg/spongycastle/math/ec/ECAlgorithms;->importPoint(Lorg/spongycastle/math/ec/ECCurve;Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    .line 121
    invoke-static {p0, p1, v0, p3}, Lorg/spongycastle/math/ec/ECAlgorithms;->implShamirsTrickJsf(Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    invoke-static {v0}, Lorg/spongycastle/math/ec/ECAlgorithms;->validatePoint(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    return-object v0
.end method

.method public static sumOfMultiplies([Lorg/spongycastle/math/ec/ECPoint;[Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;
    .registers 8

    .prologue
    const/4 v0, 0x1

    const/4 v5, 0x0

    .line 35
    if-eqz p0, :cond_d

    if-eqz p1, :cond_d

    array-length v1, p0

    array-length v2, p1

    if-ne v1, v2, :cond_d

    array-length v1, p0

    if-gtz v1, :cond_15

    .line 37
    :cond_d
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "point and scalar arrays should be non-null, and of equal, non-zero, length"

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 40
    :cond_15
    array-length v1, p0

    .line 41
    packed-switch v1, :pswitch_data_62

    .line 51
    aget-object v2, p0, v5

    .line 52
    invoke-virtual {v2}, Lorg/spongycastle/math/ec/ECPoint;->getCurve()Lorg/spongycastle/math/ec/ECCurve;

    move-result-object v3

    .line 54
    new-array v4, v1, [Lorg/spongycastle/math/ec/ECPoint;

    .line 55
    aput-object v2, v4, v5

    .line 56
    :goto_23
    if-ge v0, v1, :cond_46

    .line 58
    aget-object v2, p0, v0

    invoke-static {v3, v2}, Lorg/spongycastle/math/ec/ECAlgorithms;->importPoint(Lorg/spongycastle/math/ec/ECCurve;Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v2

    aput-object v2, v4, v0

    .line 56
    add-int/lit8 v0, v0, 0x1

    goto :goto_23

    .line 44
    :pswitch_30
    aget-object v0, p0, v5

    aget-object v1, p1, v5

    invoke-virtual {v0, v1}, Lorg/spongycastle/math/ec/ECPoint;->multiply(Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    .line 67
    :goto_38
    return-object v0

    .line 46
    :pswitch_39
    aget-object v1, p0, v5

    aget-object v2, p1, v5

    aget-object v3, p0, v0

    aget-object v0, p1, v0

    invoke-static {v1, v2, v3, v0}, Lorg/spongycastle/math/ec/ECAlgorithms;->sumOfTwoMultiplies(Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    goto :goto_38

    .line 61
    :cond_46
    invoke-virtual {v3}, Lorg/spongycastle/math/ec/ECCurve;->getEndomorphism()Lorg/spongycastle/math/ec/endo/ECEndomorphism;

    move-result-object v0

    .line 62
    instance-of v1, v0, Lorg/spongycastle/math/ec/endo/GLVEndomorphism;

    if-eqz v1, :cond_59

    .line 64
    check-cast v0, Lorg/spongycastle/math/ec/endo/GLVEndomorphism;

    invoke-static {v4, p1, v0}, Lorg/spongycastle/math/ec/ECAlgorithms;->implSumOfMultipliesGLV([Lorg/spongycastle/math/ec/ECPoint;[Ljava/math/BigInteger;Lorg/spongycastle/math/ec/endo/GLVEndomorphism;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    invoke-static {v0}, Lorg/spongycastle/math/ec/ECAlgorithms;->validatePoint(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    goto :goto_38

    .line 67
    :cond_59
    invoke-static {v4, p1}, Lorg/spongycastle/math/ec/ECAlgorithms;->implSumOfMultiplies([Lorg/spongycastle/math/ec/ECPoint;[Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    invoke-static {v0}, Lorg/spongycastle/math/ec/ECAlgorithms;->validatePoint(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    goto :goto_38

    .line 41
    :pswitch_data_62
    .packed-switch 0x1
        :pswitch_30
        :pswitch_39
    .end packed-switch
.end method

.method public static sumOfTwoMultiplies(Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;
    .registers 10

    .prologue
    const/4 v5, 0x2

    const/4 v4, 0x1

    const/4 v3, 0x0

    .line 73
    invoke-virtual {p0}, Lorg/spongycastle/math/ec/ECPoint;->getCurve()Lorg/spongycastle/math/ec/ECCurve;

    move-result-object v1

    .line 74
    invoke-static {v1, p2}, Lorg/spongycastle/math/ec/ECAlgorithms;->importPoint(Lorg/spongycastle/math/ec/ECCurve;Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v2

    .line 77
    instance-of v0, v1, Lorg/spongycastle/math/ec/ECCurve$AbstractF2m;

    if-eqz v0, :cond_29

    move-object v0, v1

    .line 79
    check-cast v0, Lorg/spongycastle/math/ec/ECCurve$AbstractF2m;

    .line 80
    invoke-virtual {v0}, Lorg/spongycastle/math/ec/ECCurve$AbstractF2m;->isKoblitz()Z

    move-result v0

    if-eqz v0, :cond_29

    .line 82
    invoke-virtual {p0, p1}, Lorg/spongycastle/math/ec/ECPoint;->multiply(Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    invoke-virtual {v2, p3}, Lorg/spongycastle/math/ec/ECPoint;->multiply(Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v1

    invoke-virtual {v0, v1}, Lorg/spongycastle/math/ec/ECPoint;->add(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    invoke-static {v0}, Lorg/spongycastle/math/ec/ECAlgorithms;->validatePoint(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    .line 93
    :goto_28
    return-object v0

    .line 86
    :cond_29
    invoke-virtual {v1}, Lorg/spongycastle/math/ec/ECCurve;->getEndomorphism()Lorg/spongycastle/math/ec/endo/ECEndomorphism;

    move-result-object v0

    .line 87
    instance-of v1, v0, Lorg/spongycastle/math/ec/endo/GLVEndomorphism;

    if-eqz v1, :cond_48

    .line 89
    new-array v1, v5, [Lorg/spongycastle/math/ec/ECPoint;

    aput-object p0, v1, v3

    aput-object v2, v1, v4

    new-array v2, v5, [Ljava/math/BigInteger;

    aput-object p1, v2, v3

    aput-object p3, v2, v4

    check-cast v0, Lorg/spongycastle/math/ec/endo/GLVEndomorphism;

    .line 90
    invoke-static {v1, v2, v0}, Lorg/spongycastle/math/ec/ECAlgorithms;->implSumOfMultipliesGLV([Lorg/spongycastle/math/ec/ECPoint;[Ljava/math/BigInteger;Lorg/spongycastle/math/ec/endo/GLVEndomorphism;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    .line 89
    invoke-static {v0}, Lorg/spongycastle/math/ec/ECAlgorithms;->validatePoint(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    goto :goto_28

    .line 93
    :cond_48
    invoke-static {p0, p1, v2, p3}, Lorg/spongycastle/math/ec/ECAlgorithms;->implShamirsTrickWNaf(Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;Lorg/spongycastle/math/ec/ECPoint;Ljava/math/BigInteger;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    invoke-static {v0}, Lorg/spongycastle/math/ec/ECAlgorithms;->validatePoint(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;

    move-result-object v0

    goto :goto_28
.end method

.method public static validatePoint(Lorg/spongycastle/math/ec/ECPoint;)Lorg/spongycastle/math/ec/ECPoint;
    .registers 3

    .prologue
    .line 212
    invoke-virtual {p0}, Lorg/spongycastle/math/ec/ECPoint;->isValid()Z

    move-result v0

    if-nez v0, :cond_e

    .line 214
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string v1, "Invalid point"

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 217
    :cond_e
    return-object p0
.end method