SecP128R1Field.smali

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


# static fields
.field private static final M:J = 0xffffffffL

.field static final P:[I

.field private static final P3:I = -0x3

.field static final PExt:[I

.field private static final PExt7:I = -0x4

.field private static final PExtInv:[I


# direct methods
.method static constructor <clinit>()V
    .registers 2

    .prologue
    const/16 v1, 0x8

    .line 14
    const/4 v0, 0x4

    new-array v0, v0, [I

    fill-array-data v0, :array_1a

    sput-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->P:[I

    .line 15
    new-array v0, v1, [I

    fill-array-data v0, :array_26

    sput-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->PExt:[I

    .line 17
    new-array v0, v1, [I

    fill-array-data v0, :array_3a

    sput-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->PExtInv:[I

    return-void

    .line 14
    nop

    :array_1a
    .array-data 4
        -0x1
        -0x1
        -0x1
        -0x3
    .end array-data

    .line 15
    :array_26
    .array-data 4
        0x1
        0x0
        0x0
        0x4
        -0x2
        -0x1
        0x3
        -0x4
    .end array-data

    .line 17
    :array_3a
    .array-data 4
        -0x1
        -0x1
        -0x1
        -0x5
        0x1
        0x0
        -0x4
        0x3
    .end array-data
.end method

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

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

    return-void
.end method

.method public static add([I[I[I)V
    .registers 5

    .prologue
    .line 24
    invoke-static {p0, p1, p2}, Lorg/spongycastle/math/raw/Nat128;->add([I[I[I)I

    move-result v0

    .line 25
    if-nez v0, :cond_14

    const/4 v0, 0x3

    aget v0, p2, v0

    const/4 v1, -0x3

    if-ne v0, v1, :cond_17

    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->P:[I

    invoke-static {p2, v0}, Lorg/spongycastle/math/raw/Nat128;->gte([I[I)Z

    move-result v0

    if-eqz v0, :cond_17

    .line 27
    :cond_14
    invoke-static {p2}, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->addPInvTo([I)V

    .line 29
    :cond_17
    return-void
.end method

.method public static addExt([I[I[I)V
    .registers 5

    .prologue
    .line 33
    invoke-static {p0, p1, p2}, Lorg/spongycastle/math/raw/Nat256;->add([I[I[I)I

    move-result v0

    .line 34
    if-nez v0, :cond_14

    const/4 v0, 0x7

    aget v0, p2, v0

    const/4 v1, -0x4

    if-ne v0, v1, :cond_1c

    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->PExt:[I

    invoke-static {p2, v0}, Lorg/spongycastle/math/raw/Nat256;->gte([I[I)Z

    move-result v0

    if-eqz v0, :cond_1c

    .line 36
    :cond_14
    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->PExtInv:[I

    array-length v0, v0

    sget-object v1, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->PExtInv:[I

    invoke-static {v0, v1, p2}, Lorg/spongycastle/math/raw/Nat;->addTo(I[I[I)I

    .line 38
    :cond_1c
    return-void
.end method

.method public static addOne([I[I)V
    .registers 4

    .prologue
    .line 42
    const/4 v0, 0x4

    invoke-static {v0, p0, p1}, Lorg/spongycastle/math/raw/Nat;->inc(I[I[I)I

    move-result v0

    .line 43
    if-nez v0, :cond_15

    const/4 v0, 0x3

    aget v0, p1, v0

    const/4 v1, -0x3

    if-ne v0, v1, :cond_18

    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->P:[I

    invoke-static {p1, v0}, Lorg/spongycastle/math/raw/Nat128;->gte([I[I)Z

    move-result v0

    if-eqz v0, :cond_18

    .line 45
    :cond_15
    invoke-static {p1}, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->addPInvTo([I)V

    .line 47
    :cond_18
    return-void
.end method

.method private static addPInvTo([I)V
    .registers 11

    .prologue
    const/4 v9, 0x2

    const/4 v8, 0x1

    const/4 v7, 0x0

    const/16 v6, 0x20

    const-wide v4, 0xffffffffL

    .line 193
    aget v0, p0, v7

    int-to-long v0, v0

    and-long/2addr v0, v4

    const-wide/16 v2, 0x1

    add-long/2addr v0, v2

    .line 194
    long-to-int v2, v0

    aput v2, p0, v7

    shr-long/2addr v0, v6

    .line 195
    const-wide/16 v2, 0x0

    cmp-long v2, v0, v2

    if-eqz v2, :cond_2d

    .line 197
    aget v2, p0, v8

    int-to-long v2, v2

    and-long/2addr v2, v4

    add-long/2addr v0, v2

    .line 198
    long-to-int v2, v0

    aput v2, p0, v8

    shr-long/2addr v0, v6

    .line 199
    aget v2, p0, v9

    int-to-long v2, v2

    and-long/2addr v2, v4

    add-long/2addr v0, v2

    .line 200
    long-to-int v2, v0

    aput v2, p0, v9

    shr-long/2addr v0, v6

    .line 202
    :cond_2d
    const/4 v2, 0x3

    aget v2, p0, v2

    int-to-long v2, v2

    and-long/2addr v2, v4

    const-wide/16 v4, 0x2

    add-long/2addr v2, v4

    add-long/2addr v0, v2

    .line 203
    const/4 v2, 0x3

    long-to-int v0, v0

    aput v0, p0, v2

    .line 204
    return-void
.end method

.method public static fromBigInteger(Ljava/math/BigInteger;)[I
    .registers 4

    .prologue
    .line 51
    invoke-static {p0}, Lorg/spongycastle/math/raw/Nat128;->fromBigInteger(Ljava/math/BigInteger;)[I

    move-result-object v0

    .line 52
    const/4 v1, 0x3

    aget v1, v0, v1

    const/4 v2, -0x3

    if-ne v1, v2, :cond_17

    sget-object v1, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->P:[I

    invoke-static {v0, v1}, Lorg/spongycastle/math/raw/Nat128;->gte([I[I)Z

    move-result v1

    if-eqz v1, :cond_17

    .line 54
    sget-object v1, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->P:[I

    invoke-static {v1, v0}, Lorg/spongycastle/math/raw/Nat128;->subFrom([I[I)I

    .line 56
    :cond_17
    return-object v0
.end method

.method public static half([I[I)V
    .registers 5

    .prologue
    const/4 v2, 0x4

    const/4 v1, 0x0

    .line 61
    aget v0, p0, v1

    and-int/lit8 v0, v0, 0x1

    if-nez v0, :cond_c

    .line 63
    invoke-static {v2, p0, v1, p1}, Lorg/spongycastle/math/raw/Nat;->shiftDownBit(I[II[I)I

    .line 70
    :goto_b
    return-void

    .line 67
    :cond_c
    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->P:[I

    invoke-static {p0, v0, p1}, Lorg/spongycastle/math/raw/Nat128;->add([I[I[I)I

    move-result v0

    .line 68
    invoke-static {v2, p1, v0}, Lorg/spongycastle/math/raw/Nat;->shiftDownBit(I[II)I

    goto :goto_b
.end method

.method public static multiply([I[I[I)V
    .registers 4

    .prologue
    .line 74
    invoke-static {}, Lorg/spongycastle/math/raw/Nat128;->createExt()[I

    move-result-object v0

    .line 75
    invoke-static {p0, p1, v0}, Lorg/spongycastle/math/raw/Nat128;->mul([I[I[I)V

    .line 76
    invoke-static {v0, p2}, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->reduce([I[I)V

    .line 77
    return-void
.end method

.method public static multiplyAddToExt([I[I[I)V
    .registers 5

    .prologue
    .line 81
    invoke-static {p0, p1, p2}, Lorg/spongycastle/math/raw/Nat128;->mulAddTo([I[I[I)I

    move-result v0

    .line 82
    if-nez v0, :cond_14

    const/4 v0, 0x7

    aget v0, p2, v0

    const/4 v1, -0x4

    if-ne v0, v1, :cond_1c

    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->PExt:[I

    invoke-static {p2, v0}, Lorg/spongycastle/math/raw/Nat256;->gte([I[I)Z

    move-result v0

    if-eqz v0, :cond_1c

    .line 84
    :cond_14
    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->PExtInv:[I

    array-length v0, v0

    sget-object v1, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->PExtInv:[I

    invoke-static {v0, v1, p2}, Lorg/spongycastle/math/raw/Nat;->addTo(I[I[I)I

    .line 86
    :cond_1c
    return-void
.end method

.method public static negate([I[I)V
    .registers 3

    .prologue
    .line 90
    invoke-static {p0}, Lorg/spongycastle/math/raw/Nat128;->isZero([I)Z

    move-result v0

    if-eqz v0, :cond_a

    .line 92
    invoke-static {p1}, Lorg/spongycastle/math/raw/Nat128;->zero([I)V

    .line 98
    :goto_9
    return-void

    .line 96
    :cond_a
    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->P:[I

    invoke-static {v0, p0, p1}, Lorg/spongycastle/math/raw/Nat128;->sub([I[I[I)I

    goto :goto_9
.end method

.method public static reduce([I[I)V
    .registers 22

    .prologue
    .line 102
    const/4 v2, 0x0

    aget v2, p0, v2

    int-to-long v2, v2

    const-wide v4, 0xffffffffL

    and-long/2addr v2, v4

    const/4 v4, 0x1

    aget v4, p0, v4

    int-to-long v4, v4

    const-wide v6, 0xffffffffL

    and-long/2addr v4, v6

    const/4 v6, 0x2

    aget v6, p0, v6

    int-to-long v6, v6

    const-wide v8, 0xffffffffL

    and-long/2addr v6, v8

    const/4 v8, 0x3

    aget v8, p0, v8

    int-to-long v8, v8

    const-wide v10, 0xffffffffL

    and-long/2addr v8, v10

    .line 103
    const/4 v10, 0x4

    aget v10, p0, v10

    int-to-long v10, v10

    const-wide v12, 0xffffffffL

    and-long/2addr v10, v12

    const/4 v12, 0x5

    aget v12, p0, v12

    int-to-long v12, v12

    const-wide v14, 0xffffffffL

    and-long/2addr v12, v14

    const/4 v14, 0x6

    aget v14, p0, v14

    int-to-long v14, v14

    const-wide v16, 0xffffffffL

    and-long v14, v14, v16

    const/16 v16, 0x7

    aget v16, p0, v16

    move/from16 v0, v16

    int-to-long v0, v0

    move-wide/from16 v16, v0

    const-wide v18, 0xffffffffL

    and-long v16, v16, v18

    .line 105
    add-long v8, v8, v16

    const/16 v18, 0x1

    shl-long v16, v16, v18

    add-long v14, v14, v16

    .line 106
    add-long/2addr v6, v14

    const/16 v16, 0x1

    shl-long v14, v14, v16

    add-long/2addr v12, v14

    .line 107
    add-long/2addr v4, v12

    const/4 v14, 0x1

    shl-long/2addr v12, v14

    add-long/2addr v10, v12

    .line 108
    add-long/2addr v2, v10

    const/4 v12, 0x1

    shl-long/2addr v10, v12

    add-long/2addr v8, v10

    .line 110
    const/4 v10, 0x0

    long-to-int v11, v2

    aput v11, p1, v10

    const/16 v10, 0x20

    ushr-long/2addr v2, v10

    add-long/2addr v2, v4

    .line 111
    const/4 v4, 0x1

    long-to-int v5, v2

    aput v5, p1, v4

    const/16 v4, 0x20

    ushr-long/2addr v2, v4

    add-long/2addr v2, v6

    .line 112
    const/4 v4, 0x2

    long-to-int v5, v2

    aput v5, p1, v4

    const/16 v4, 0x20

    ushr-long/2addr v2, v4

    add-long/2addr v2, v8

    .line 113
    const/4 v4, 0x3

    long-to-int v5, v2

    aput v5, p1, v4

    .line 115
    const/16 v4, 0x20

    ushr-long/2addr v2, v4

    long-to-int v2, v2

    move-object/from16 v0, p1

    invoke-static {v2, v0}, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->reduce32(I[I)V

    .line 116
    return-void
.end method

.method public static reduce32(I[I)V
    .registers 14

    .prologue
    const/4 v11, 0x2

    const/4 v10, 0x0

    const/4 v9, 0x1

    const/16 v8, 0x20

    const-wide v6, 0xffffffffL

    .line 120
    :goto_a
    if-eqz p0, :cond_3f

    .line 122
    int-to-long v0, p0

    and-long v2, v0, v6

    .line 124
    aget v0, p1, v10

    int-to-long v0, v0

    and-long/2addr v0, v6

    add-long/2addr v0, v2

    .line 125
    long-to-int v4, v0

    aput v4, p1, v10

    shr-long/2addr v0, v8

    .line 126
    const-wide/16 v4, 0x0

    cmp-long v4, v0, v4

    if-eqz v4, :cond_30

    .line 128
    aget v4, p1, v9

    int-to-long v4, v4

    and-long/2addr v4, v6

    add-long/2addr v0, v4

    .line 129
    long-to-int v4, v0

    aput v4, p1, v9

    shr-long/2addr v0, v8

    .line 130
    aget v4, p1, v11

    int-to-long v4, v4

    and-long/2addr v4, v6

    add-long/2addr v0, v4

    .line 131
    long-to-int v4, v0

    aput v4, p1, v11

    shr-long/2addr v0, v8

    .line 133
    :cond_30
    const/4 v4, 0x3

    aget v4, p1, v4

    int-to-long v4, v4

    and-long/2addr v4, v6

    shl-long/2addr v2, v9

    add-long/2addr v2, v4

    add-long/2addr v0, v2

    .line 134
    const/4 v2, 0x3

    long-to-int v3, v0

    aput v3, p1, v2

    shr-long/2addr v0, v8

    .line 138
    long-to-int p0, v0

    .line 139
    goto :goto_a

    .line 140
    :cond_3f
    return-void
.end method

.method public static square([I[I)V
    .registers 3

    .prologue
    .line 144
    invoke-static {}, Lorg/spongycastle/math/raw/Nat128;->createExt()[I

    move-result-object v0

    .line 145
    invoke-static {p0, v0}, Lorg/spongycastle/math/raw/Nat128;->square([I[I)V

    .line 146
    invoke-static {v0, p1}, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->reduce([I[I)V

    .line 147
    return-void
.end method

.method public static squareN([II[I)V
    .registers 4

    .prologue
    .line 153
    invoke-static {}, Lorg/spongycastle/math/raw/Nat128;->createExt()[I

    move-result-object v0

    .line 154
    invoke-static {p0, v0}, Lorg/spongycastle/math/raw/Nat128;->square([I[I)V

    .line 155
    invoke-static {v0, p2}, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->reduce([I[I)V

    .line 157
    :goto_a
    add-int/lit8 p1, p1, -0x1

    if-lez p1, :cond_15

    .line 159
    invoke-static {p2, v0}, Lorg/spongycastle/math/raw/Nat128;->square([I[I)V

    .line 160
    invoke-static {v0, p2}, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->reduce([I[I)V

    goto :goto_a

    .line 162
    :cond_15
    return-void
.end method

.method private static subPInvFrom([I)V
    .registers 11

    .prologue
    const/4 v9, 0x2

    const/4 v8, 0x1

    const/4 v7, 0x0

    const/16 v6, 0x20

    const-wide v4, 0xffffffffL

    .line 208
    aget v0, p0, v7

    int-to-long v0, v0

    and-long/2addr v0, v4

    const-wide/16 v2, 0x1

    sub-long/2addr v0, v2

    .line 209
    long-to-int v2, v0

    aput v2, p0, v7

    shr-long/2addr v0, v6

    .line 210
    const-wide/16 v2, 0x0

    cmp-long v2, v0, v2

    if-eqz v2, :cond_2d

    .line 212
    aget v2, p0, v8

    int-to-long v2, v2

    and-long/2addr v2, v4

    add-long/2addr v0, v2

    .line 213
    long-to-int v2, v0

    aput v2, p0, v8

    shr-long/2addr v0, v6

    .line 214
    aget v2, p0, v9

    int-to-long v2, v2

    and-long/2addr v2, v4

    add-long/2addr v0, v2

    .line 215
    long-to-int v2, v0

    aput v2, p0, v9

    shr-long/2addr v0, v6

    .line 217
    :cond_2d
    const/4 v2, 0x3

    aget v2, p0, v2

    int-to-long v2, v2

    and-long/2addr v2, v4

    const-wide/16 v4, 0x2

    sub-long/2addr v2, v4

    add-long/2addr v0, v2

    .line 218
    const/4 v2, 0x3

    long-to-int v0, v0

    aput v0, p0, v2

    .line 219
    return-void
.end method

.method public static subtract([I[I[I)V
    .registers 4

    .prologue
    .line 166
    invoke-static {p0, p1, p2}, Lorg/spongycastle/math/raw/Nat128;->sub([I[I[I)I

    move-result v0

    .line 167
    if-eqz v0, :cond_9

    .line 169
    invoke-static {p2}, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->subPInvFrom([I)V

    .line 171
    :cond_9
    return-void
.end method

.method public static subtractExt([I[I[I)V
    .registers 5

    .prologue
    .line 175
    const/16 v0, 0xa

    invoke-static {v0, p0, p1, p2}, Lorg/spongycastle/math/raw/Nat;->sub(I[I[I[I)I

    move-result v0

    .line 176
    if-eqz v0, :cond_10

    .line 178
    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->PExtInv:[I

    array-length v0, v0

    sget-object v1, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->PExtInv:[I

    invoke-static {v0, v1, p2}, Lorg/spongycastle/math/raw/Nat;->subFrom(I[I[I)I

    .line 180
    :cond_10
    return-void
.end method

.method public static twice([I[I)V
    .registers 4

    .prologue
    .line 184
    const/4 v0, 0x4

    const/4 v1, 0x0

    invoke-static {v0, p0, v1, p1}, Lorg/spongycastle/math/raw/Nat;->shiftUpBit(I[II[I)I

    move-result v0

    .line 185
    if-nez v0, :cond_16

    const/4 v0, 0x3

    aget v0, p1, v0

    const/4 v1, -0x3

    if-ne v0, v1, :cond_19

    sget-object v0, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->P:[I

    invoke-static {p1, v0}, Lorg/spongycastle/math/raw/Nat128;->gte([I[I)Z

    move-result v0

    if-eqz v0, :cond_19

    .line 187
    :cond_16
    invoke-static {p1}, Lorg/spongycastle/math/ec/custom/sec/SecP128R1Field;->addPInvTo([I)V

    .line 189
    :cond_19
    return-void
.end method