blake2b.init().update(sig, 32).update(pub, KEY_BYTELENGTH).update(M, BLOCKHASH_BYTELENGTH).digest(h)
sc_reduce(h)
- ge_double_scalarmult_vartime_to_p3(sb_ah, h, A, S, t_fe_0, t_fe_1, t_fe_2)
+ ge_double_scalarmult_vartime_to_p3(sb_ah, h, A, S)
ge_p3_tobytes(check_r, sb_ah, t_fe_0, t_fe_1, t_fe_2, t_fe_3, t_fe_4, t_fe_5, t_fe_6)
clear_t()
blake2b.init().update(sig, 32).update(pub, 32).update(M, mlen).digest(h)
sc_reduce(h)
- ge_double_scalarmult_vartime_to_p3(sb_ah, h, A, S, t_fe_0, t_fe_1, t_fe_2)
+ ge_double_scalarmult_vartime_to_p3(sb_ah, h, A, S)
ge_sub_p3(check, expected_r, sb_ah, t_fe_0, t_ge_cached, t_ge_p1p1)
// after cofactoring, `check` should be small order and not malformed in order
blake2b.init().update(sig, 32).update(pub, 32).update(M, mlen).digest(h)
sc_reduce(h)
- ge_double_scalarmult_vartime_to_p3(sb_ah, h, A, S, t_fe_0, t_fe_1, t_fe_2)
+ ge_double_scalarmult_vartime_to_p3(sb_ah, h, A, S)
ge_p3_tobytes(check_r, sb_ah, t_fe_0, t_fe_1, t_fe_2, t_fe_3, t_fe_4, t_fe_5, t_fe_6)
clear_t()
return equalbytes(sig, check_r, KEY_BYTELENGTH)
import { base } from './base'
import { base2 } from './base2'
import { FieldElement, fe, fe_0, fe_1, fe_add, fe_cmov, fe_frombytes, fe_isnegative, fe_iszero, fe_mul, fe_neg, fe_pow22523, fe_sq, fe_sub } from './fe'
-import { FieldElementPair, fep, fep_unpack } from './fep'
+import { FieldElementPair, fep, fep_pack, fep_unpack } from './fep'
import { ge_add_cached, ge_add_precomp, ge_p3_dbl, ge_cached, ge_p1p1, ge_p1p1_0, ge_p1p1_to_p2, ge_p1p1_to_p3, ge_p2, ge_p2_0, ge_p2_dbl, ge_p3, ge_p3_0, ge_p3_to_cached, ge_p3_tobytes, ge_precomp, ge_precomp_0 } from './p'
-import { gepair_add_cached, gepair_add_precomp, gepair_p1p1_to_p2, gepair_p1p1_to_p3, gepair_p2_dbl, gepair_p2_to_fep, gepair_sub_cached, gepair_sub_precomp } from './p2'
+import { gepair_add_cached, gepair_add_precomp, gepair_p1p1_to_p2, gepair_p1p1_to_p3, gepair_p2_dbl, gepair_sub_cached, gepair_sub_precomp } from './p2'
/**
* √-1
*
* Variable-time; only used for signature verification.
*/
-export function ge_double_scalarmult_vartime_to_p3 (r: ge_p3, a: StaticArray<u8>, A: ge_p3, b: StaticArray<u8>, t_fe_0: FieldElement, t_fe_1: FieldElement, t_fe_2: FieldElement): void {
+export function ge_double_scalarmult_vartime_to_p3 (r: ge_p3, a: StaticArray<u8>, A: ge_p3, b: StaticArray<u8>): void {
const Bi = base2
const aslide = ge_double_scalarmult_vartime_aslide
const bslide = ge_double_scalarmult_vartime_bslide
ge_p1p1_to_p3(u, t)
ge_p3_to_cached(Ai[7], u)
- ge_p2_0(p)
-
let i: i32 = 255
while (i >= 0 && !aslide[i] && !bslide[i]) {
i--
}
- gepair_p2_to_fep(pA, pB, p, t_fe_0)
+ ge_p2_0(p)
+ fep_pack(pA, p.X, p.Y)
+ fep_pack(pB, p.Z, p.X) // T = p.X = 0
while (i >= 0) {
gepair_p2_dbl(tA, tB, pA, pB)
if (i > 0) {
gepair_p1p1_to_p2(pA, pB, tA, tB)
} else {
- gepair_p1p1_to_p3(rA, rB, tA, tB)
- fep_unpack(r.X, r.Y, rA)
- fep_unpack(r.Z, r.T, rB)
+ gepair_p1p1_to_p3(pA, pB, tA, tB)
}
i--
}
- fe_0(t_fe_0)
- fe_0(t_fe_1)
- fe_0(t_fe_2)
+ fep_unpack(r.X, r.Y, pA)
+ fep_unpack(r.Z, r.T, pB)
}
function slide_vartime (r: StaticArray<i8>, a: StaticArray<u8>): void {