From: Chris Duncan Date: Tue, 3 Nov 2026 07:43:01 +0000 (-0800) Subject: Move temporary buffers into module-scoped variables. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=f4d4be36ce6ec63540f4adab5d61ac38a96768aa;p=nano25519.git Move temporary buffers into module-scoped variables. --- diff --git a/src/assembly/crypto_derive.ts b/src/assembly/crypto_derive.ts index 4742d98..2fa58aa 100644 --- a/src/assembly/crypto_derive.ts +++ b/src/assembly/crypto_derive.ts @@ -3,7 +3,6 @@ import { Blake2b } from './ed25519/blake2b' import { ge_scalarmult_base_tobytes } from './ed25519/ge' -import { clear_t, t_p3 } from './ed25519/t' import { clamp } from './ed25519/utils' const PRIVATEKEY_BYTES: i32 = 32 @@ -40,7 +39,6 @@ export function crypto_derive (A: StaticArray, key: StaticArray): void { clamp(s) // Perform fixed-base scalar multiplication `[s]B`, output to public key `A` - ge_scalarmult_base_tobytes(A, s, t_p3) + ge_scalarmult_base_tobytes(A, s) s.fill(0) - clear_t() } diff --git a/src/assembly/crypto_sign.ts b/src/assembly/crypto_sign.ts index c8ad634..3f8b711 100644 --- a/src/assembly/crypto_sign.ts +++ b/src/assembly/crypto_sign.ts @@ -6,7 +6,6 @@ import { crypto_derive } from './crypto_derive' import { Blake2b } from './ed25519/blake2b' import { ge_scalarmult_base_tobytes } from './ed25519/ge' import { sc_muladd, sc_reduce } from './ed25519/sc' -import { clear_t, t_p3 } from './ed25519/t' import { clamp } from './ed25519/utils' // crypto_hash function @@ -72,8 +71,7 @@ export function crypto_sign (RS: StaticArray, M: StaticArray, mlen: i32, sc_reduce(r) // Perform fixed-base scalar multiplication `[r]B`, output to point `R` - ge_scalarmult_base_tobytes(R, r, t_p3) - clear_t() + ge_scalarmult_base_tobytes(R, r) // Compute challenge hash `blake2b(R || A || M)`, output to `k` blake2b.init().update(R, 32).update(A, 32).update(M, mlen).digest(k) diff --git a/src/assembly/crypto_verify.ts b/src/assembly/crypto_verify.ts index 714c099..e4ae787 100644 --- a/src/assembly/crypto_verify.ts +++ b/src/assembly/crypto_verify.ts @@ -6,7 +6,6 @@ import { Blake2b } from './ed25519/blake2b' import { ge_accept_small_order, ge_cache_odd_multiples, ge_double_scalarmult_vartime_to_p3, ge_frombytes, ge_frombytes_negate, ge_is_canonical, ge_reject_small_order } from './ed25519/ge' import { p3, p3_0, p3_sub_p3, p3_tobytes, p_cached } from './ed25519/p' import { sc_is_canonical, sc_reduce } from './ed25519/sc' -import { clear_t, t_fe } from './ed25519/t' import { equalbytes } from './ed25519/utils' // crypto_hash function @@ -31,8 +30,6 @@ const h = new StaticArray(64) const sb_ah = new p3() const check = new p3() const check_r = new StaticArray(32) -const t_p3 = new p3() -const t_u8x32 = new StaticArray(32) /** * Verify public key `pub` can be decoded to point `A`. If so, builds a cache @@ -40,13 +37,12 @@ const t_u8x32 = new StaticArray(32) * @returns null if public key fails to decode, else return pointer to Ai */ export function crypto_verify_decodepubkey (pub: StaticArray): StaticArray | null { - const b = ge_frombytes_negate(A, pub, t_fe, t_u8x32) - clear_t() + const b = ge_frombytes_negate(A, pub) if (b != 0) { p3_0(A) return null } - ge_cache_odd_multiples(Ai, A, t_p3, t_fe) + ge_cache_odd_multiples(Ai, A) return Ai } @@ -78,8 +74,7 @@ export function crypto_verify_donna (sig: StaticArray, M: StaticArray, A sc_reduce(h) ge_double_scalarmult_vartime_to_p3(sb_ah, h, Ai, S) - p3_tobytes(check_r, sb_ah, t_p3) - clear_t() + p3_tobytes(check_r, sb_ah) return equalbytes(sig, check_r, KEY_BYTELENGTH) } @@ -105,14 +100,13 @@ export function crypto_verify_sodium (sig: StaticArray, M: StaticArray, blake2b.init().update(sig, 32).update(pub, 32).update(M, mlen).digest(h) sc_reduce(h) - ge_cache_odd_multiples(Ai, A, t_p3, t_fe) + ge_cache_odd_multiples(Ai, A) ge_double_scalarmult_vartime_to_p3(sb_ah, h, Ai, S) - p3_sub_p3(check, expected_r, sb_ah, t_fe) + p3_sub_p3(check, expected_r, sb_ah) // after cofactoring, `check` should be small order and not malformed in order // to pass, unlike `verify_pubkey()` and `verify_signature()` below - const b = ge_accept_small_order(check, t_fe, t_u8x32) - clear_t() + const b = ge_accept_small_order(check) if (b != 0) return 0 return 1 @@ -140,10 +134,9 @@ export function crypto_verify_strict (sig: StaticArray, M: StaticArray, blake2b.init().update(sig, 32).update(pub, 32).update(M, mlen).digest(h) sc_reduce(h) - ge_cache_odd_multiples(Ai, A, t_p3, t_fe) + ge_cache_odd_multiples(Ai, A) ge_double_scalarmult_vartime_to_p3(sb_ah, h, Ai, S) - p3_tobytes(check_r, sb_ah, t_p3) - clear_t() + p3_tobytes(check_r, sb_ah) return equalbytes(sig, check_r, KEY_BYTELENGTH) } @@ -162,20 +155,17 @@ export function verify_pubkey (pub: StaticArray): boolean { } // fail if public key cannot be decoded - if (ge_frombytes_negate(A, pub, t_fe, t_u8x32) != 0) { + if (ge_frombytes_negate(A, pub) != 0) { p3_0(A) - clear_t() return false } // fail if public key `k` is small order - if (ge_reject_small_order(A, t_fe, t_u8x32) != 0) { + if (ge_reject_small_order(A) != 0) { p3_0(A) - clear_t() return false } - clear_t() return true } @@ -200,17 +190,14 @@ export function verify_signature (sig: StaticArray): boolean { } // fail if nonce `R` does not decode to a valid curve point - if (ge_frombytes(expected_r, sig, t_fe, t_u8x32) != 0) { - clear_t() + if (ge_frombytes(expected_r, sig) != 0) { return false } // fail if nonce `R` is small order - if (ge_reject_small_order(expected_r, t_fe, t_u8x32) != 0) { - clear_t() + if (ge_reject_small_order(expected_r) != 0) { return false } - clear_t() return true } diff --git a/src/assembly/ed25519/fe.ts b/src/assembly/ed25519/fe.ts index 0a608ab..0a84e6d 100644 --- a/src/assembly/ed25519/fe.ts +++ b/src/assembly/ed25519/fe.ts @@ -17,6 +17,9 @@ */ import { load_3, load_4 } from './utils' +const t_fe = fe() +const t_u8x32 = new StaticArray(32) + /** * Ed25519 curve constant √-1 * = 2⁽ᵖ⁻¹⁾⸍⁴ mod `p` @@ -392,9 +395,11 @@ export function fe_invert (out: FieldElement, z: FieldElement, t_fe_0: FieldElem * Preconditions: * |f| bounded by 1.1x2²⁶,1.1x2²⁵,1.1x2²⁶,1.1x2²⁵,etc. */ -export function fe_isnegative (f: FieldElement, t: FieldElement): u8 { - fe_reduce(t, f) - return u8(load(changetype(t), 0) & 1) +export function fe_isnegative (f: FieldElement): u8 { + fe_reduce(t_fe, f) + const isNeg = u8(load(changetype(t_fe), 0) & 1) + fe_0(t_fe) + return isNeg } /** @@ -404,12 +409,14 @@ export function fe_isnegative (f: FieldElement, t: FieldElement): u8 { * Preconditions: * |f| bounded by 1.1x2²⁶,1.1x2²⁵,1.1x2²⁶,1.1x2²⁵,etc. */ -export function fe_iszero (f: FieldElement, t_fe: FieldElement, t_u8x32: StaticArray): u8 { - fe_tobytes(t_u8x32, f, t_fe) +export function fe_iszero (f: FieldElement): u8 { + fe_tobytes(t_u8x32, f) const t_ptr: usize = changetype(t_u8x32) const t0 = v128.load(t_ptr, 0 << 4) const t1 = v128.load(t_ptr, 1 << 4) const d = v128.or(t0, t1) + v128.store(t_ptr, i64x2.splat(0), 0 << 4) + v128.store(t_ptr, i64x2.splat(0), 1 << 4) return u8(v128.any_true(d)) ^ 1 } @@ -1885,7 +1892,7 @@ export function fe_sub (h: FieldElement, f: FieldElement, g: FieldElement): void * * Goal: Output h0+...+2²³⁰ h9. */ -export function fe_tobytes (s: StaticArray, h: FieldElement, t_fe: FieldElement): void { +export function fe_tobytes (s: StaticArray, h: FieldElement): void { fe_reduce(t_fe, h) const t_ptr: usize = changetype(t_fe) @@ -1900,6 +1907,8 @@ export function fe_tobytes (s: StaticArray, h: FieldElement, t_fe: FieldElem const t8 = load(t_ptr, 8 << 2) const t9 = load(t_ptr, 9 << 2) + fe_0(t_fe) + const s_ptr: usize = changetype(s) store(s_ptr, t0 >> 0, 0) store(s_ptr, t0 >> 8, 1) diff --git a/src/assembly/ed25519/ge.ts b/src/assembly/ed25519/ge.ts index a4c05c2..8321464 100644 --- a/src/assembly/ed25519/ge.ts +++ b/src/assembly/ed25519/ge.ts @@ -23,6 +23,8 @@ import { FieldElement, fe, fe_1, fe_add, fe_addsub, fe_cmov, fe_frombytes, fe_is import { p1p1, p1p1_0, p1p1_to_p2, p1p1_to_p3, p2, p2_0, p2_dbl, p3, p3_0, p3_add_cached, p3_add_cached_output_cached, p3_add_precomp, p3_dbl, p3_dbl_to_p3, p3_sub_cached, p3_sub_precomp, p3_to_cached, p3_tobytes, p_cached, p_precomp, precomp_0 } from './p' import { fe_pow22523 } from './pow22523' +const t_p3 = new p3() + function ge_cmov8_base (t: p_precomp, bp: usize, b: i8): void { const isbneg: i8 = (b >> 7) & 1 /* 0: positive; 1: negative */ const babs: i8 = b - (((-isbneg) & b) * (i8(1) << 1)) @@ -84,7 +86,7 @@ const ge_frombytes_x_sqrtm1: FieldElement = fe() * * @returns {i32} 0 if `s` decodes to a valid point, else -1 */ -export function ge_frombytes (h: p3, s: StaticArray, t_fe_0: FieldElement, t_u8x32: StaticArray): i32 { +export function ge_frombytes (h: p3, s: StaticArray): i32 { const u = ge_frombytes_u const v = ge_frombytes_v const vx2 = ge_frombytes_vx2 @@ -123,8 +125,8 @@ export function ge_frombytes (h: p3, s: StaticArray, t_fe_0: FieldElement, t // p = vx²+u // m = vx²-u fe_addsub(p_root_check, m_root_check, vx2, u) - has_p_root = fe_iszero(p_root_check, t_fe_0, t_u8x32) - has_m_root = fe_iszero(m_root_check, t_fe_0, t_u8x32) + has_p_root = fe_iszero(p_root_check) + has_m_root = fe_iszero(m_root_check) // x = x√-1 if vx² = -u, else x fe_cmov(h.X, x_sqrtm1, 1 - has_m_root) @@ -132,7 +134,7 @@ export function ge_frombytes (h: p3, s: StaticArray, t_fe_0: FieldElement, t // negx = -x fe_neg(negx, h.X) // x = |x| - fe_cmov(h.X, negx, fe_isnegative(h.X, t_fe_0) ^ (s[31] >> 7)) + fe_cmov(h.X, negx, fe_isnegative(h.X) ^ (s[31] >> 7)) // Create point projection fe_mul(h.T, h.X, h.Y) @@ -145,8 +147,8 @@ export function ge_frombytes (h: p3, s: StaticArray, t_fe_0: FieldElement, t * * @returns {i32} 0 if `s` decodes to a valid point, else -1 */ -export function ge_frombytes_negate (h: p3, s: StaticArray, t_fe_0: FieldElement, t_u8x32: StaticArray): i32 { - const check = ge_frombytes(h, s, t_fe_0, t_u8x32) +export function ge_frombytes_negate (h: p3, s: StaticArray): i32 { + const check = ge_frombytes(h, s) fe_neg(h.X, h.X) fe_neg(h.T, h.T) return check @@ -156,10 +158,10 @@ export function ge_frombytes_negate (h: p3, s: StaticArray, t_fe_0: FieldEle * @param {p3} p * @returns 1 if `p` is malformed (`Z = 0`, or `X = Y = 0`), else 0 */ -function ge_is_malformed (p: p3, t_fe: FieldElement, t_u8x32: StaticArray): i32 { - const x_iszero = fe_iszero(p.X, t_fe, t_u8x32) - const y_iszero = fe_iszero(p.Y, t_fe, t_u8x32) - const z_iszero = fe_iszero(p.Z, t_fe, t_u8x32) +function ge_is_malformed (p: p3): i32 { + const x_iszero = fe_iszero(p.X) + const y_iszero = fe_iszero(p.Y) + const z_iszero = fe_iszero(p.Z) return ((x_iszero & y_iszero) | z_iszero) } @@ -169,18 +171,18 @@ const ge_has_small_order_c: FieldElement = fe() * @param {p3} p * @returns 1 if `p` has small order, else 0 */ -function ge_has_small_order (p: p3, t_fe: FieldElement, t_u8x32: StaticArray): i32 { +function ge_has_small_order (p: p3): i32 { const y_sqrtm1 = ge_has_small_order_y_sqrtm1 const c = ge_has_small_order_c - const x_iszero = fe_iszero(p.X, t_fe, t_u8x32) - const y_iszero = fe_iszero(p.Y, t_fe, t_u8x32) + const x_iszero = fe_iszero(p.X) + const y_iszero = fe_iszero(p.Y) fe_mul_sqrtm1(y_sqrtm1, p.Y) fe_sub(c, y_sqrtm1, p.X) - const y_sqrtm1_minusx = fe_iszero(c, t_fe, t_u8x32) + const y_sqrtm1_minusx = fe_iszero(c) fe_add(c, y_sqrtm1, p.X) - const y_sqrtm1_plusx = fe_iszero(c, t_fe, t_u8x32) + const y_sqrtm1_plusx = fe_iszero(c) return x_iszero | y_iszero | y_sqrtm1_minusx | y_sqrtm1_plusx } @@ -191,9 +193,9 @@ function ge_has_small_order (p: p3, t_fe: FieldElement, t_u8x32: StaticArray * @param {p3} p * @returns 0 if `p` is not malformed and has small order, else -1 */ -export function ge_accept_small_order (p: p3, t_fe: FieldElement, t_u8x32: StaticArray): i32 { - const malformed = ge_is_malformed(p, t_fe, t_u8x32) - const small_order = ge_has_small_order(p, t_fe, t_u8x32) +export function ge_accept_small_order (p: p3): i32 { + const malformed = ge_is_malformed(p) + const small_order = ge_has_small_order(p) return 0 - (malformed | (small_order ^ 1)) } @@ -203,9 +205,9 @@ export function ge_accept_small_order (p: p3, t_fe: FieldElement, t_u8x32: Stati * @param {p3} p * @returns 0 if `p` is not malformed and not small order, else -1 */ -export function ge_reject_small_order (p: p3, t_fe: FieldElement, t_u8x32: StaticArray): i32 { - const malformed = ge_is_malformed(p, t_fe, t_u8x32) - const small_order = ge_has_small_order(p, t_fe, t_u8x32) +export function ge_reject_small_order (p: p3): i32 { + const malformed = ge_is_malformed(p) + const small_order = ge_has_small_order(p) return 0 - (malformed | small_order) } @@ -249,7 +251,7 @@ const ge_scalarmult_base_tobytes_t: p_precomp = new p_precomp() * @param S 32-byte output buffer for scalar * base point * @param a 32-byte input buffer for scalar */ -export function ge_scalarmult_base_tobytes (S: StaticArray, a: StaticArray, t_p3: p3): void { +export function ge_scalarmult_base_tobytes (S: StaticArray, a: StaticArray): void { const h = ge_scalarmult_base_tobytes_h const e = ge_scalarmult_base_tobytes_e const r = ge_scalarmult_base_tobytes_r @@ -298,7 +300,7 @@ export function ge_scalarmult_base_tobytes (S: StaticArray, a: StaticArray, a: StaticArray, A: p3, t_p3: p3, t_fe: FieldElement): void { +export function ge_cache_odd_multiples (Ai: StaticArray, A: p3): void { p3_to_cached(Ai[0], A) - p3_dbl_to_p3(t_p3, A, t_fe) + p3_dbl_to_p3(t_p3, A) for (let i = 0; i < 7; i++) { - p3_add_cached_output_cached(Ai[i + 1], t_p3, Ai[i], t_fe) + p3_add_cached_output_cached(Ai[i + 1], t_p3, Ai[i]) } + p3_0(t_p3) } const ge_double_scalarmult_vartime_aslide: StaticArray = new StaticArray(256) diff --git a/src/assembly/ed25519/p.ts b/src/assembly/ed25519/p.ts index afb4b7f..d58ac26 100644 --- a/src/assembly/ed25519/p.ts +++ b/src/assembly/ed25519/p.ts @@ -56,6 +56,9 @@ export class p_precomp { xy2d: FieldElement = fe() } +const t_fe = fe() +const t_p3 = new p3() + export function p2_0 (h: p2): void { fe_0(h.X) fe_1(h.Y) @@ -194,7 +197,7 @@ export function p3_add_p3 (r: p3, p: p3, q: p3, t_fe: FieldElement): void { * T = 2Z₁² - (Y₁²-X₁²) * ``` */ -export function p3_dbl_to_p3 (r: p3, p: p3, t_fe: FieldElement): void { +export function p3_dbl_to_p3 (r: p3, p: p3): void { fe_add(r.X, p.X, p.Y) fe_sq_pair_dbl(r.X, r.X, r.T, p.Z) fe_sq_pair(r.Z, p.X, r.Y, p.Y) @@ -204,6 +207,8 @@ export function p3_dbl_to_p3 (r: p3, p: p3, t_fe: FieldElement): void { fe_mul_pair(r.X, r.X, t_fe, r.T, r.X, r.Y) fe_mul_pair(r.Y, r.Y, r.Z, r.Z, r.Z, t_fe) + + fe_0(t_fe) } /** @@ -262,7 +267,7 @@ export function p3_add_cached (r: p1p1, p: p3, q: p_cached): void { * T2d = 2X₁Y₁d * ``` */ -export function p3_add_cached_output_cached (r: p_cached, p: p3, q: p_cached, t_fe: FieldElement): void { +export function p3_add_cached_output_cached (r: p_cached, p: p3, q: p_cached): void { // p3 + cached fe_addsub(r.YplusX, r.YminusX, p.Y, p.X) fe_mul_pair(r.YplusX, r.YplusX, q.YplusX, r.YminusX, r.YminusX, q.YminusX) @@ -274,6 +279,8 @@ export function p3_add_cached_output_cached (r: p_cached, p: p3, q: p_cached, t_ fe_mul_pair_2d(r.YminusX, r.YminusX, t_fe, r.T2d, r.YminusX, r.YplusX) fe_mul_pair(r.YplusX, r.YplusX, r.Z, r.Z, r.Z, t_fe) fe_addsub(r.YplusX, r.YminusX, r.YplusX, r.YminusX) + + fe_0(t_fe) } /** @@ -305,7 +312,7 @@ export function p3_add_precomp (r: p1p1, p: p3, q: p_precomp): void { * T = X₃Y₃ = ((Y₁+X₁)(Y₂-X₂) - (Y₁-X₁)(Y₂+X₂))((Y₁+X₁)(Y₂-X₂) + (Y₁-X₁)(Y₂+X₂)) * ``` */ -export function p3_sub_p3 (r: p3, p: p3, q: p3, t_fe: FieldElement): void { +export function p3_sub_p3 (r: p3, p: p3, q: p3): void { fe_addsub(r.X, r.Y, p.Y, p.X) // X = Y₁+X₁, Y = Y₁-X₁ fe_addsub(r.Z, r.T, q.Y, q.X) // Z = Y₂+X₂, T = Y₂-X₂ fe_mul_pair(r.X, r.X, r.T, r.Y, r.Y, r.Z) // X = (Y₁+X₁)(Y₂-X₂), Y = (Y₁-X₁)(Y₂+X₂) @@ -315,6 +322,8 @@ export function p3_sub_p3 (r: p3, p: p3, q: p3, t_fe: FieldElement): void { fe_mul_pair(r.Y, r.Y, r.Z, r.T, r.X, r.Y) fe_mul_pair(r.X, r.X, t_fe, r.Z, r.Z, t_fe) + + fe_0(t_fe) } /** @@ -354,9 +363,10 @@ export function p3_sub_precomp (r: p1p1, p: p3, q: p_precomp): void { fe_addsub(r.T, r.Z, r.Z, r.T) } -export function p3_tobytes (s: StaticArray, h: p3, t_p3: p3): void { +export function p3_tobytes (s: StaticArray, h: p3): void { fe_invert(t_p3.T, h.Z, t_p3.X, t_p3.Y, t_p3.Z) fe_mul_pair(t_p3.X, h.X, t_p3.T, t_p3.Y, h.Y, t_p3.T) - fe_tobytes(s, t_p3.Y, t_p3.T) - s[31] ^= fe_isnegative(t_p3.X, t_p3.T) << 7 + fe_tobytes(s, t_p3.Y) + s[31] ^= fe_isnegative(t_p3.X) << 7 + p3_0(t_p3) } diff --git a/src/assembly/ed25519/t.ts b/src/assembly/ed25519/t.ts deleted file mode 100644 index a14821c..0000000 --- a/src/assembly/ed25519/t.ts +++ /dev/null @@ -1,23 +0,0 @@ -//! SPDX-FileCopyrightText: 2026 Chris Duncan -//! SPDX-License-Identifier: GPL-3.0-or-later - -/** - * Shared buffers for holding temporary values. Only import in `crypto_derive`, - * `crypto_sign`, and `crypto_verify`; they pass scratch buffers to lower - * functions as `t_` parameters, and they clear all buffers when done with them. - * - * Beware nested calls. `crypto_sign` calls `crypto_derive` which overwrites all - * temporary buffers; this specific call is OK because they never use the - * buffers at the same time. However, never pass a buffer to a called function - * if it presently holds a value in the current function. - */ -import { fe, fe_0 } from './fe' -import { p3, p3_0 } from './p' - -export const t_fe = fe() -export const t_p3 = new p3() - -export function clear_t (): void { - fe_0(t_fe) - p3_0(t_p3) -} diff --git a/src/assembly/ed25519/utils.ts b/src/assembly/ed25519/utils.ts index 423479f..89ffb8a 100644 --- a/src/assembly/ed25519/utils.ts +++ b/src/assembly/ed25519/utils.ts @@ -1,6 +1,11 @@ //! SPDX-FileCopyrightText: 2013-2026 Frank Denis //! SPDX-FileCopyrightText: 2026 Chris Duncan //! SPDX-License-Identifier: ISC +/** + * Functions intended for use by any other arbitrary module in this Ed25519 + * implementation. As such, it should never contain any imports to avoid any + * circular dependencies. + */ /** * Clears the 3 least significant bits to guarantee multiple of 8 and prevent diff --git a/src/assembly/tests.ts b/src/assembly/tests.ts index e968c81..260c9a3 100644 --- a/src/assembly/tests.ts +++ b/src/assembly/tests.ts @@ -192,8 +192,6 @@ const FE_ONE: i32 = 2 // byte i set to m const FE_PAIR: i32 = 3 // bytes i and j both set to m const check_fe_iszero_f = fe() -const check_fe_iszero_t_fe = fe() -const check_fe_iszero_t_u8x32 = new StaticArray(KEY_BYTELENGTH) function fe_case (shape: i32, m: i32, i: i32 = 0, j: i32 = 0): i32 { return m | (i << 8) | (j << 13) | (shape << 18) @@ -218,7 +216,7 @@ function check_fe_iszero (c: i32, zero: bool): void { fe_frombytes(check_fe_iszero_f, actual) } - const result = fe_iszero(check_fe_iszero_f, check_fe_iszero_t_fe, check_fe_iszero_t_u8x32) + const result = fe_iszero(check_fe_iszero_f) if (zero && result != 1) { raise(ERROR_FE_ISZERO_SELFTEST_XPASS, c, result) }