From: Chris Duncan Date: Thu, 4 Dec 2025 18:03:41 +0000 (-0800) Subject: Remove unneeded variable-time multiplication. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=7661a9ed60a61d9e2cc48a9dc245db8c47d9220f;p=libnemo.git Remove unneeded variable-time multiplication. --- diff --git a/src/lib/crypto/secp256k1.ts b/src/lib/crypto/secp256k1.ts index a3b54cd..278278b 100644 --- a/src/lib/crypto/secp256k1.ts +++ b/src/lib/crypto/secp256k1.ts @@ -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++) {