From: Chris Duncan Date: Fri, 30 Oct 2026 01:25:30 +0000 (-0700) Subject: Fix some tests. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=ebbfb2a6dbfc265d2c2d4076d31e441454b66dfb;p=nano25519.git Fix some tests. --- diff --git a/test/arithmetic.mjs b/test/arithmetic.mjs index 7c63b70..a971fce 100644 --- a/test/arithmetic.mjs +++ b/test/arithmetic.mjs @@ -59,9 +59,9 @@ const asc = new URL('node_modules/assemblyscript/bin/asc.js', root).pathname /** Wrappers over dedicated buffers, compiled as the probe's entry file. */ const HARNESS = ` import './env' -import { fe, fe_add, fe_cmov, fe_dbl, fe_frombytes, fe_invert, fe_isnegative, fe_iszero, fe_mul, fe_neg, fe_pow22523, fe_reduce, fe_sq, fe_sq2, fe_sub, fe_tobytes } from './ed25519/fe' +import { fe, fe_add, fe_cmov, fe_dbl, fe_frombytes, fe_invert, fe_isnegative, fe_iszero, fe_mul_ab, fe_neg, fe_pow22523, fe_reduce, fe_sq, fe_sub, fe_tobytes } from './ed25519/fe' import { ge_double_scalarmult_vartime_to_p3, ge_frombytes, ge_frombytes_negate_vartime, ge_accept_small_order, ge_reject_small_order, ge_is_canonical, ge_scalarmult_base_tobytes } from './ed25519/ge' -import { ge_cached, ge_p1p1, ge_p3, ge_p3_tobytes, ge_sub_p3 } from './ed25519/p' +import { ge_cached, ge_p1p1, ge_p3, ge_p3_tobytes, ge_p3_sub_p3 } from './ed25519/p' import { sc_is_canonical, sc_muladd, sc_reduce } from './ed25519/sc' import { verify_pubkey, verify_signature } from './crypto_verify' @@ -102,13 +102,12 @@ export function fe_tobytes_ (): void { fe_tobytes(U8A, FA, T0) } export function fe_reduce_ (): void { fe_reduce(FH, FA) } export function fe_iszero_ (): i32 { return fe_iszero(FA, T0, U8T) } export function fe_isnegative_ (): i32 { return fe_isnegative(FA, T0) } -export function fe_mul_ (): void { fe_mul(FH, FA, FB) } -export function fe_mul_hf (): void { fe_mul(FA, FA, FB) } -export function fe_mul_hg (): void { fe_mul(FB, FA, FB) } -export function fe_mul_hfg (): void { fe_mul(FA, FA, FA) } +export function fe_mul_ (): void { fe_mul_ab(FH, FA, FB) } +export function fe_mul_hf (): void { fe_mul_ab(FA, FA, FB) } +export function fe_mul_hg (): void { fe_mul_ab(FB, FA, FB) } +export function fe_mul_hfg (): void { fe_mul_ab(FA, FA, FA) } export function fe_sq_ (): void { fe_sq(FH, FA) } export function fe_sq_hf (): void { fe_sq(FA, FA) } -export function fe_sq2_ (): void { fe_sq2(FH, FA) } export function fe_add_ (): void { fe_add(FH, FA, FB) } export function fe_sub_ (): void { fe_sub(FH, FA, FB) } export function fe_neg_ (): void { fe_neg(FH, FA) } @@ -128,7 +127,7 @@ export function ge_reject_small_order_ (): i32 { return ge_reject_small_order(PA export function ge_p3_tobytes_ (): void { ge_p3_tobytes(U8B, PA, T0, T1, T2, T3, T4, T5, T6) } export function ge_scalarmult_base_tobytes_ (): void { ge_scalarmult_base_tobytes(U8B, U8A, T0, T1, T2, T3, T4, T5, T6) } export function ge_double_scalarmult_ (): void { ge_double_scalarmult_vartime_to_p3(PB, U8A, PA, U8B, T0) } -export function ge_sub_p3_ (): void { ge_sub_p3(PC, PA, PB, T0, CACHED, P1P1) } +export function ge_p3_sub_p3_ (): void { ge_p3_sub_p3(PC, PA, PB, T0, CACHED, P1P1) } export function verify_pubkey_ (): i32 { return verify_pubkey(U8A) ? 1 : 0 } export function verify_signature_ (): i32 { return verify_signature(U8W) ? 1 : 0 } ` @@ -238,8 +237,8 @@ function doubleScalarmult (h, note, count) { // R - ([a]A + [b]B), as verify() computes it, with R decoded so Z = 1 const R = mul(B, randomInt(L)) setPoint(PA, R) - x.ge_sub_p3_() - note('ge_sub_p3 of the double scalar multiplication', equal(getPoint(PC), add(R, negate(want))), k) + x.ge_p3_sub_p3_() + note('ge_p3_sub_p3 of the double scalar multiplication', equal(getPoint(PC), add(R, negate(want))), k) } // both scalars zero right after a call that left a point in r setPoint(PA, mul(B, 12345n))