]> git.codecow.com Git - libnemo.git/commitdiff
Remove unneeded variable-time multiplication.
authorChris Duncan <chris@zoso.dev>
Thu, 4 Dec 2025 18:03:41 +0000 (10:03 -0800)
committerChris Duncan <chris@zoso.dev>
Thu, 4 Dec 2025 18:03:41 +0000 (10:03 -0800)
src/lib/crypto/secp256k1.ts

index a3b54cdc6ac6c4c089e8079663a2c4b2bcb83e85..278278b3e221af395b1a34c8f5c1b7266f348fba 100644 (file)
@@ -20,7 +20,6 @@ type Point = {
        double: () => Point
        add: (other: Point) => Point
        multiply: (n: bigint, safe?: boolean) => Point
-       multiplyUnsafe: (scalar: bigint) => Point
        toAffine: () => AffinePoint
        assertValidity: () => Point
        toBytes: (isCompressed?: boolean) => Bytes
@@ -247,9 +246,6 @@ export class Secp256k1 {
                                }
                                return p
                        },
-                       multiplyUnsafe (scalar: bigint): Point {
-                               return this.multiply(scalar, false)
-                       },
                        /** Convert point to 2d xy affine point. (X, Y, Z) ∋ (x=X/Z, y=Y/Z) */
                        toAffine (): AffinePoint {
                                const { X: x, Y: y, Z: z } = this
@@ -310,11 +306,6 @@ export class Secp256k1 {
        /** Identity / zero point */
        static I: Point = this.Point(0n, 1n, 0n)
 
-       /** `Q = u1⋅G + u2⋅R`. Verifies Q is not ZERO. Unsafe: non-constant-time. */
-       static doubleScalarMultiplyUnsafe (R: Point, u1: bigint, u2: bigint): Point {
-               return this.G.multiplyUnsafe(u1).add(R.multiplyUnsafe(u2)).assertValidity()
-       }
-
        static bytesToBigint (b: Bytes): bigint {
                let int = BigInt(b[0]), len = b.length
                for (let i = 1; i < len; i++) {