scalarmult_curve25519 implemented in wasm

This commit is contained in:
Christophe Diederichs 2020-10-17 22:42:56 +02:00
parent bafe8f8fac
commit 88862d3669
11 changed files with 695 additions and 295 deletions

View File

@ -256,15 +256,16 @@ function crypto_scalarmult_curve25519 (q, n, p) {
ec.fe25519_copy(x3, x1) ec.fe25519_copy(x3, x1)
ec.fe25519_1(z3) ec.fe25519_1(z3)
swap = 0
for (pos = 254; pos >= 0; --pos) { for (pos = 254; pos >= 0; --pos) {
b = t[pos / 8] >> (pos & 7) b = t[Math.floor(pos / 8)] >> (pos & 7)
b &= 1 b &= 1
swap ^= b swap ^= b
ec.fe25519_cswap(x2, x3, swap) ec.fe25519_cswap(x2, x3, swap)
ec.fe25519_cswap(z2, z3, swap) ec.fe25519_cswap(z2, z3, swap)
swap = b swap = b
ec.fe25519_sub(tmp0, x3, z3) ec.fe25519_sub(tmp0, x3, z3)
ec.fe25519_sub(tmp1, x2, z2) ec.fe25519_sub(tmp1, x2, z2)
ec.fe25519_add(x2, x2, z2) ec.fe25519_add(x2, x2, z2)
ec.fe25519_add(z2, x3, z3) ec.fe25519_add(z2, x3, z3)
@ -285,6 +286,7 @@ function crypto_scalarmult_curve25519 (q, n, p) {
ec.fe25519_mul(z3, x1, z2) ec.fe25519_mul(z3, x1, z2)
ec.fe25519_mul(z2, tmp1, tmp0) ec.fe25519_mul(z2, tmp1, tmp0)
} }
ec.fe25519_cswap(x2, x3, swap) ec.fe25519_cswap(x2, x3, swap)
ec.fe25519_cswap(z2, z3, swap) ec.fe25519_cswap(z2, z3, swap)
@ -306,28 +308,19 @@ function crypto_scalarmult_curve25519_1 (q, n, p) {
var pos var pos
var swap var swap
var b var b
var _q = Buffer.alloc(32)
if (has_small_order(p)) { if (has_small_order(p)) {
return -1; return -1;
} }
for (i = 0; i < 32; i++) { t.set(n)
t[i] = n[i]
}
t[0] &= 248 t[0] &= 248
t[31] &= 127 t[31] &= 127
t[31] |= 64 t[31] |= 64
ec.fe25519_frombytes(x1, p) ec.fe25519_frombytes(x1, p)
ec.fe25519_1(x2) swap = ec.scalarmult_curve25519_inner_loop(x1, x2, t)
ec.fe25519_0(z2)
ec.fe25519_copy(x3, x1)
ec.fe25519_1(z3)
swap = ec.scalarmult_curve25519_inner_loop(x1, x2, x3, z2, z3, t)
ec.fe25519_cswap(x2, x3, swap)
ec.fe25519_cswap(z2, z3, swap)
ec.fe25519_invert(z2, z2)
ec.fe25519_mul(x2, x2, z2)
ec.fe25519_tobytes(q, x2) ec.fe25519_tobytes(q, x2)
return 0 return 0
@ -362,3 +355,12 @@ function crypto_scalarmult_curve25519_base (q, n) {
return 0 return 0
} }
function print32 (num) {
if (num < 0) return print32(0x100000000 + num)
console.log(num.toString(16).padStart(16, '0'))
}
function printfe (fe) {
for (let i of fe) print32(i)
}

View File

@ -1,6 +1,9 @@
const sodium = require('./') const sodium = require('./')
const native = require('sodium-native')
const { crypto_scalarmult_ed25519, crypto_scalarmult_ed25519_base, crypto_scalarmult_curve25519, crypto_scalarmult_curve25519_1, crypto_scalarmult_curve25519_base } = require('./crypto_scalarmult_ed25519') const { crypto_scalarmult_ed25519, crypto_scalarmult_ed25519_base, crypto_scalarmult_curve25519, crypto_scalarmult_curve25519_1, crypto_scalarmult_curve25519_base } = require('./crypto_scalarmult_ed25519')
const { crypto_sign, crypto_sign_open } = require('./crypto_sign_ed25519') const { crypto_sign, crypto_sign_open } = require('./crypto_sign_ed25519')
const sign = require('./crypto_sign')
const ed = require('./ed25519')
console.log(crypto_scalarmult_ed25519) console.log(crypto_scalarmult_ed25519)
let sig = Buffer.alloc(sodium.crypto_sign_BYTES) let sig = Buffer.alloc(sodium.crypto_sign_BYTES)
@ -17,19 +20,19 @@ let test
sig.fill(0) sig.fill(0)
var an = Buffer.from([ var an = Buffer.from([
171, 69, 129, 47, 90, 82, 223, 134, 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16, 0xc1,
6, 147, 54, 76, 55, 148, 252, 37, 0x72, 0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 0xc0,
234, 216, 113, 62, 223, 49, 33, 36, 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9, 0x2c, 0x2a
172, 246, 18, 226, 50, 249, 198, 231
]) ])
var bn = Buffer.from([ var bn = Buffer.from([
226, 38, 16, 80, 186, 183, 134, 239, 0x5d, 0xab, 0x08, 0x7e, 0x62, 0x4a, 0x8a, 0x4b, 0x79, 0xe1, 0x7f,
190, 24, 150, 125, 14, 254, 19, 44, 0x8b, 0x83, 0x80, 0x0e, 0xe6, 0x6f, 0x3b, 0xb1, 0x29, 0x26, 0x18,
55, 112, 156, 5, 141, 230, 91, 84, 0xb6, 0xfd, 0x1c, 0x2f, 0x8b, 0x27, 0xff, 0x88, 0xe0, 0xeb
110, 130, 213, 39, 249, 107, 145, 140
]) ])
var bobpk = Buffer.from('de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f', 'hex')
var cn = Buffer.from([ var cn = Buffer.from([
190, 24, 150, 125, 14, 254, 19, 44, 190, 24, 150, 125, 14, 254, 19, 44,
55, 112, 156, 5, 141, 230, 91, 84, 55, 112, 156, 5, 141, 230, 91, 84,
@ -79,16 +82,44 @@ var pass = true
// if (Buffer.compare(sm, sm1) !== 0 || !pass) console.log('test fails at fixture #' + i) // if (Buffer.compare(sm, sm1) !== 0 || !pass) console.log('test fails at fixture #' + i)
// } // }
sodium.crypto_scalarmult(res, an, bn) // //////////////////////////////
// sodium.crypto_scalarmult(res, an, bn)
// console.log(res.toString('hex'))
res.fill(0)
crypto_scalarmult_curve25519(res, an, bobpk)
console.log(res.toString('hex')) console.log(res.toString('hex'))
crypto_scalarmult_ed25519(res, an, bn) // console.time('whole')
crypto_scalarmult_curve25519_1(res, an, bobpk)
// console.timeEnd('whole')
console.log(res.toString('hex'))
native.crypto_scalarmult(res, an, bobpk)
console.log(res.toString('hex')) console.log(res.toString('hex'))
sodium.crypto_scalarmult_base(res, an) sodium.crypto_scalarmult_base(res, an)
console.log(res.toString('hex')) console.log(res.toString('hex'))
sodium.crypto_scalarmult_base(res, an) native.crypto_scalarmult_base(res, an)
console.log(res.toString('hex'))
crypto_scalarmult_curve25519_base(res, an)
console.log(res.toString('hex'))
native.crypto_scalarmult(res, fixtures[1].sk, fixtures[1].pk)
console.log(res.toString('hex'))
crypto_scalarmult_curve25519(res, fixtures[1].sk, fixtures[1].pk)
console.log('wasm naive', res.toString('hex'))
crypto_scalarmult_curve25519_1(res, fixtures[1].sk, fixtures[1].pk)
console.log('wasm inner loop', res.toString('hex'))
native.crypto_scalarmult(res, fixtures[1].sk, fixtures[1].pk)
console.log('native', res.toString('hex'))
crypto_scalarmult_ed25519(res, fixtures[1].sk, fixtures[1].pk)
console.log(res.toString('hex')) console.log(res.toString('hex'))
const a = Buffer.alloc(32) const a = Buffer.alloc(32)
@ -117,6 +148,11 @@ for (let test of fixtures) {
} }
console.timeEnd('wasm') console.timeEnd('wasm')
console.time('native')
for (let test of fixtures) {
native.crypto_scalarmult(res1, test.sk, test.pk)
}
console.timeEnd('native')
console.log(res.toString('hex')) console.log(res.toString('hex'))
console.log(res1.toString('hex')) console.log(res1.toString('hex'))

View File

@ -1,6 +1,10 @@
const assert = require('nanoassert') const assert = require('nanoassert')
const sodium = require('./') const sodium = require('./')
const memory = new WebAssembly.Memory({ initial: 1 })
const mem = Buffer.from(memory.buffer)
const table = new WebAssembly.Table({ initial: 4, element: "anyfunc" })
const debug = { const debug = {
log (...args) { log (...args) {
console.log(...args.map(int => (int >>> 0).toString(16).padStart(8, '0'))) console.log(...args.map(int => (int >>> 0).toString(16).padStart(8, '0')))
@ -14,34 +18,39 @@ const debug = {
const importObject = { const importObject = {
imports: { imports: {
js: { js: {
table: new WebAssembly.Table({ initial: 3, element: "anyfunc" }) table
}, },
debug debug
} }
} }
const wasm_mul = require('./fe25519_25/fe25519_mul')(importObject) const importWithMemory = {
const wasm_sq = require('./fe25519_25/fe25519_sq')(importObject) imports: {
const wasm_invert = require('./fe25519_25/fe25519_invert')() js: {
table,
mem: memory
},
debug
}
}
const wasm_mul = require('./fe25519_25/fe25519_mul')(importWithMemory)
const wasm_sq = require('./fe25519_25/fe25519_sq')(importWithMemory)
const wasm_invert = require('./fe25519_25/fe25519_invert')(importWithMemory)
const wasm_pow = require('./fe25519_25/fe25519_pow22523')() const wasm_pow = require('./fe25519_25/fe25519_pow22523')()
const wasm_sc_red = require('./fe25519_25/sc_reduce')(importObject) const wasm_sc_red = require('./fe25519_25/sc_reduce')(importObject)
const wasm_sc_mul = require('./fe25519_25/sc25519_mul')(importObject) const wasm_sc_mul = require('./fe25519_25/sc25519_mul')(importObject)
const wasm_sc_muladd = require('./fe25519_25/sc25519_muladd')(importObject) const wasm_sc_muladd = require('./fe25519_25/sc25519_muladd')(importObject)
const wasm_scalaramult_internal = require('./fe25519_25/scalarmult_curve25519')(importObject) const wasm_scalaramult_internal = require('./fe25519_25/scalarmult_curve25519')(importWithMemory)
function fe25519_invert (h, f) { function fe25519_invert (h, f) {
var buf = new Uint8Array(f.buffer) var buf = new Uint8Array(f.buffer)
wasm_invert.memory.set(buf) // shared memory - invert takes 280 - 360
wasm_invert.exports.fe25519_invert(40, 0) mem.set(buf, 280)
wasm_invert.exports.fe25519_invert(320, 280)
buf = Buffer.from(wasm_invert.memory.slice(40, 80)) parse_fe(h, mem, 320)
for (let i = 0; i < 10; i++) {
h[i] = buf.readUInt32LE(4 * i)
}
for (let i = 0; i < 10; i++) {
h[i] = buf.readUInt32LE(4 * i)
}
} }
function fe25519_pow22523 (h, f) { function fe25519_pow22523 (h, f) {
@ -765,14 +774,12 @@ function fe25519_mul (h, f, g) {
var fbuf = new Uint8Array(f.buffer) var fbuf = new Uint8Array(f.buffer)
var gbuf = new Uint8Array(g.buffer) var gbuf = new Uint8Array(g.buffer)
wasm_mul.memory.set(fbuf) // shared memory, mul takes 0 - 120
wasm_mul.memory.set(gbuf, 40) mem.set(fbuf)
mem.set(gbuf, 40)
wasm_mul.exports.fe25519_mul(80, 0, 40) wasm_mul.exports.fe25519_mul(80, 0, 40)
buf = Buffer.from(wasm_mul.memory.slice(80, 120)) parse_fe(h, mem, 80)
for (let i = 0; i < 10; i++) {
h[i] = buf.readUInt32LE(4 * i)
}
} }
/* /*
@ -792,13 +799,11 @@ function fe25519_sq (h, f, log) {
var buf = new Uint8Array(f.buffer) var buf = new Uint8Array(f.buffer)
wasm_sq.memory.set(buf) // shared memory, mul takes 120 - 200
wasm_sq.exports.sq(40, 0, 0) mem.set(buf, 120)
wasm_sq.exports.sq(160, 120, 0)
buf = Buffer.from(wasm_sq.memory.slice(40, 80)) parse_fe(h, mem, 160)
for (let i = 0; i < 10; i++) {
h[i] = buf.readUInt32LE(4 * i)
}
} }
/* /*
@ -818,13 +823,10 @@ function fe25519_sq2 (h, f) {
var buf = new Uint8Array(f.buffer) var buf = new Uint8Array(f.buffer)
wasm_sq.memory.set(buf) mem.set(buf)
wasm_sq.exports.sq(40, 0, 1) wasm_sq.exports.sq(160, 120, 1)
buf = Buffer.from(wasm_sq.memory.slice(40, 80)) parse_fe(h, mem, 160)
for (let i = 0; i < 10; i++) {
h[i] = buf.readUInt32LE(4 * i)
}
} }
function fe25519_sqmul (s, n, a) { function fe25519_sqmul (s, n, a) {
@ -971,8 +973,6 @@ function fe25519_unchecked_sqrt (x, x2) {
fe25519_sq(m_root2, m_root) fe25519_sq(m_root2, m_root)
fe25519_sub(e, x2, m_root2) fe25519_sub(e, x2, m_root2)
fe25519_copy(x, p_root) fe25519_copy(x, p_root)
console.log(e)
console.log(fe25519_iszero(e))
fe25519_cmov(x, m_root, fe25519_iszero(e)) fe25519_cmov(x, m_root, fe25519_iszero(e))
} }
@ -2818,46 +2818,20 @@ function ristretto255_from_hash (s, h) {
ristretto255_p3_tobytes(s, p) ristretto255_p3_tobytes(s, p)
} }
function scalarmult_curve25519_inner_loop (x1, x2, x3, z2, z3, t) { function scalarmult_curve25519_inner_loop (x1, x2, t) {
check_fe(x1) check_fe(x1)
check_fe(x2) check_fe(x2)
check_fe(x3)
check_fe(z2)
check_fe(z3)
assert(t instanceof Uint8Array && t.byteLength === 32) assert(t instanceof Uint8Array && t.byteLength === 32)
// printFe(f, 'f')
// printFe(g, 'g')
const x1buf = new Uint8Array(x1.buffer) const x1buf = new Uint8Array(x1.buffer)
const x2buf = new Uint8Array(x2.buffer)
const x3buf = new Uint8Array(x3.buffer)
const z2buf = new Uint8Array(z2.buffer)
const z3buf = new Uint8Array(z3.buffer)
const tbuf = new Uint8Array(t.buffer) const tbuf = new Uint8Array(t.buffer)
wasm_scalaramult_internal.memory.set(x1buf, 0) // shared memory, mul takes 200 - 280
wasm_scalaramult_internal.memory.set(x2buf, 40) mem.set(x1buf, 200)
wasm_scalaramult_internal.memory.set(x3buf, 80) mem.set(tbuf, 240)
wasm_scalaramult_internal.memory.set(z2buf, 120) wasm_scalaramult_internal.exports.scalarmult(280, 200, 240)
wasm_scalaramult_internal.memory.set(z3buf, 160)
wasm_scalaramult_internal.memory.set(tbuf, 200)
const swap = wasm_scalaramult_internal.exports.scalarmult(0, 40, 80, 120, 160, 200, 240, 280, 320, 360)
buf = Buffer.from(wasm_scalaramult_internal.memory.slice(240, 400)) parse_fe(x2, mem, 280)
for (let i = 0; i < 10; i++) {
x2[i] = buf.readInt32LE(4 * i)
}
for (let i = 10; i < 20; i++) {
x3[i % 10] = buf.readInt32LE(4 * i)
}
for (let i = 20; i < 30; i++) {
z2[i % 10] = buf.readInt32LE(4 * i)
}
for (let i = 30; i < 40; i++) {
z3[i % 10] = buf.readInt32LE(4 * i)
}
return swap
} }
function check_fe (h) { function check_fe (h) {
@ -2882,3 +2856,9 @@ function intDivide (a, b) {
function signedInt (i) { function signedInt (i) {
return i < 0 ? 2 ** 32 + i : i return i < 0 ? 2 ** 32 + i : i
} }
function parse_fe (res, buf, offset = 0) {
for (let i = 0; i < 10; i++) {
res[i] = buf.readInt32LE(4 * i + offset)
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,8 @@
(module (module
(memory $0 1) (import "js" "table" (table 3 anyfunc))
(export "memory" (memory $0)) (import "js" "mem" (memory 1))
(elem (i32.const 3) $invert)
(global $tmp0 (mut i64) (i64.const 0)) (global $tmp0 (mut i64) (i64.const 0))
(global $tmp1 (mut i64) (i64.const 0)) (global $tmp1 (mut i64) (i64.const 0))
@ -372,17 +374,18 @@
(set_global $tmp1 (i64.add (get_global $tmp1) (get_local $carry0))) (set_global $tmp1 (i64.add (get_global $tmp1) (get_local $carry0)))
(set_global $tmp0 (i64.sub (get_global $tmp0) (i64.mul (get_local $carry0) (i64.shl (i64.const 1) (i64.const 26)))))) (set_global $tmp0 (i64.sub (get_global $tmp0) (i64.mul (get_local $carry0) (i64.shl (i64.const 1) (i64.const 26))))))
(func $fe25519_invert (export "fe25519_invert") (param $out i32) (param $f i32) (func $invert
(local $f0 i64) (param $f0 i64)
(local $f1 i64) (param $f1 i64)
(local $f2 i64) (param $f2 i64)
(local $f3 i64) (param $f3 i64)
(local $f4 i64) (param $f4 i64)
(local $f5 i64) (param $f5 i64)
(local $f6 i64) (param $f6 i64)
(local $f7 i64) (param $f7 i64)
(local $f8 i64) (param $f8 i64)
(local $f9 i64) (param $f9 i64)
(param $out i32)
(local $i i32) (local $i i32)
@ -397,17 +400,6 @@
(local $t0_8 i64) (local $t1_8 i64) (local $t2_8 i64) (local $t0_8 i64) (local $t1_8 i64) (local $t2_8 i64)
(local $t0_9 i64) (local $t1_9 i64) (local $t2_9 i64) (local $t0_9 i64) (local $t1_9 i64) (local $t2_9 i64)
(set_local $f0 (i64.load32_u offset=0 (get_local $f)))
(set_local $f1 (i64.load32_u offset=4 (get_local $f)))
(set_local $f2 (i64.load32_u offset=8 (get_local $f)))
(set_local $f3 (i64.load32_u offset=12 (get_local $f)))
(set_local $f4 (i64.load32_u offset=16 (get_local $f)))
(set_local $f5 (i64.load32_u offset=20 (get_local $f)))
(set_local $f6 (i64.load32_u offset=24 (get_local $f)))
(set_local $f7 (i64.load32_u offset=28 (get_local $f)))
(set_local $f8 (i64.load32_u offset=32 (get_local $f)))
(set_local $f9 (i64.load32_u offset=36 (get_local $f)))
(set_local $f0 (i64.extend_s/i32 (i32.wrap/i64 (get_local $f0)))) (set_local $f0 (i64.extend_s/i32 (i32.wrap/i64 (get_local $f0))))
(set_local $f1 (i64.extend_s/i32 (i32.wrap/i64 (get_local $f1)))) (set_local $f1 (i64.extend_s/i32 (i32.wrap/i64 (get_local $f1))))
(set_local $f2 (i64.extend_s/i32 (i32.wrap/i64 (get_local $f2)))) (set_local $f2 (i64.extend_s/i32 (i32.wrap/i64 (get_local $f2))))
@ -1115,4 +1107,19 @@
(i64.store32 offset=24 (get_local $out) (get_global $tmp6)) (i64.store32 offset=24 (get_local $out) (get_global $tmp6))
(i64.store32 offset=28 (get_local $out) (get_global $tmp7)) (i64.store32 offset=28 (get_local $out) (get_global $tmp7))
(i64.store32 offset=32 (get_local $out) (get_global $tmp8)) (i64.store32 offset=32 (get_local $out) (get_global $tmp8))
(i64.store32 offset=36 (get_local $out) (get_global $tmp9)))) (i64.store32 offset=36 (get_local $out) (get_global $tmp9)))
(func $fe25519_invert (export "fe25519_invert") (param $out i32) (param $f i32)
(i64.load32_u offset=0 (get_local $f))
(i64.load32_u offset=4 (get_local $f))
(i64.load32_u offset=8 (get_local $f))
(i64.load32_u offset=12 (get_local $f))
(i64.load32_u offset=16 (get_local $f))
(i64.load32_u offset=20 (get_local $f))
(i64.load32_u offset=24 (get_local $f))
(i64.load32_u offset=28 (get_local $f))
(i64.load32_u offset=32 (get_local $f))
(i64.load32_u offset=36 (get_local $f))
(get_local $out)
(call $invert)))

View File

@ -6,8 +6,8 @@ loadWebAssembly.supported = typeof WebAssembly !== 'undefined'
function loadWebAssembly (opts) { function loadWebAssembly (opts) {
if (!loadWebAssembly.supported) return null if (!loadWebAssembly.supported) return null
var imp = opts && opts.imports || { imports: {} } var imp = opts && opts.imports
var wasm = toUint8Array('AGFzbQEAAAABHwJgFX5+fn5+fn5+fn5+fn5+fn5+fn5+fwBgA39/fwACDgECanMFdGFibGUBcAABAwMCAAEFAwEAAQcYAgZtZW1vcnkCAAtmZTI1NTE5X211bAABCQcBAEEBCwEACv4QApAQAYYBfiAAp6whACABp6whASACp6whAiADp6whAyAEp6whBCAFp6whBSAGp6whBiAHp6whByAIp6whCCAJp6whCSAKp6whCiALp6whCyAMp6whDCANp6whDSAOp6whDiAPp6whDyAQp6whECARp6whESASp6whEiATp6whE0ITIAt+IAtCgICAgAiDQgGGQhN+fSEpQhMgDH4gDEKAgICACINCAYZCE359ISpCEyANfiANQoCAgIAIg0IBhkITfn0hK0ITIA5+IA5CgICAgAiDQgGGQhN+fSEsQhMgD34gD0KAgICACINCAYZCE359IS1CEyAQfiAQQoCAgIAIg0IBhkITfn0hLkITIBF+IBFCgICAgAiDQgGGQhN+fSEvQhMgEn4gEkKAgICACINCAYZCE359ITBCEyATfiATQoCAgIAIg0IBhkITfn0hMUICIAF+IAFCgICAgAiDQgGGQgJ+fSEyQgIgA34gA0KAgICACINCAYZCAn59ITNCAiAFfiAFQoCAgIAIg0IBhkICfn0hNEICIAd+IAdCgICAgAiDQgGGQgJ+fSE1QgIgCX4gCUKAgICACINCAYZCAn59ITYgKaesISkgKqesISogK6esISsgLKesISwgLaesIS0gLqesIS4gL6esIS8gMKesITAgMaesITEgMqesITIgM6esITMgNKesITQgNaesITUgNqesITYgACAKfiE3IAAgC34hOCAAIAx+ITkgACANfiE6IAAgDn4hOyAAIA9+ITwgACAQfiE9IAAgEX4hPiAAIBJ+IT8gACATfiFAIAEgCn4hQSAyIAt+IUIgASAMfiFDIDIgDX4hRCABIA5+IUUgMiAPfiFGIAEgEH4hRyAyIBF+IUggASASfiFJIDIgMX4hSiACIAp+IUsgAiALfiFMIAIgDH4hTSACIA1+IU4gAiAOfiFPIAIgD34hUCACIBB+IVEgAiARfiFSIAIgMH4hUyACIDF+IVQgAyAKfiFVIDMg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kQgFCGYZ+fSEaIBdCAUIZhnxCGochISAYICF8IRggFyAhQgFCGoZ+fSEXIBtCAUIZhnxCGochJSAcICV8IRwgGyAlQgFCGoZ+fSEbIBhCAUIYhnxCGYchIiAZICJ8IRkgGCAiQgFCGYZ+fSEYIBxCAUIYhnxCGYchJiAdICZ8IR0gHCAmQgFCGYZ+fSEcIBlCAUIZhnxCGochIyAaICN8IRogGSAjQgFCGoZ+fSEZIB1CAUIZhnxCGochJyAeICd8IR4gHSAnQgFCGoZ+fSEdIB5CAUIYhnxCGYchKCAVIChCE358IRUgHiAoQgFCGYZ+fSEeIBVCAUIZhnxCGochHyAWIB98IRYgFSAfQgFCGoZ+fSEVIBQgFT4CACAUIBY+AgQgFCAXPgIIIBQgGD4CDCAUIBk+AhAgFCAaPgIUIBQgGz4CGCAUIBw+AhwgFCAdPgIgIBQgHj4CJAtqACABNQIAIAE1AgQgATUCCCABNQIMIAE1AhAgATUCFCABNQIYIAE1AhwgATUCICABNQIkIAI1AgAgAjUCBCACNQIIIAI1AgwgAjUCECACNQIUIAI1AhggAjUCHCACNQIgIAI1AiQgABAACw==')
var ready = null var ready = null
var mod = { var mod = {
@ -39,7 +39,6 @@ function loadWebAssembly (opts) {
if (opts && opts.async) throw new Error('async') if (opts && opts.async) throw new Error('async')
setup({instance: new WebAssembly.Instance(new WebAssembly.Module(wasm), imp)}) setup({instance: new WebAssembly.Instance(new WebAssembly.Module(wasm), imp)})
} catch (err) { } catch (err) {
console.log(err)
ready = WebAssembly.instantiate(wasm, imp).then(setup) ready = WebAssembly.instantiate(wasm, imp).then(setup)
} }

View File

@ -1,5 +1,7 @@
(module (module
(import "js" "table" (table 1 anyfunc)) (import "js" "table" (table 1 anyfunc))
(import "js" "mem" (memory 1))
(elem (i32.const 1) $fe_mul) (elem (i32.const 1) $fe_mul)
;; (func $i32.log (import "debug" "log") (param i32)) ;; (func $i32.log (import "debug" "log") (param i32))
@ -13,9 +15,6 @@
;; (func $f64.log (import "debug" "log") (param f64)) ;; (func $f64.log (import "debug" "log") (param f64))
;; (func $f64.log_tee (import "debug" "log_tee") (param f64) (result f64)) ;; (func $f64.log_tee (import "debug" "log_tee") (param f64) (result f64))
(memory $0 1)
(export "memory" (memory $0))
;; ;; i64 logging by splitting into two i32 limbs ;; ;; i64 logging by splitting into two i32 limbs
;; (func $i64.log ;; (func $i64.log
;; (param $0 i64) ;; (param $0 i64)

View File

@ -7,7 +7,7 @@ function loadWebAssembly (opts) {
if (!loadWebAssembly.supported) return null if (!loadWebAssembly.supported) return null
var imp = opts && opts.imports var imp = opts && opts.imports
var wasm = toUint8Array('AGFzbQEAAAABGAJgDX5+fn5+fn5+fn5/f38AYAR/f39/AAIOAQJqcwV0YWJsZQFwAAEDAwIAAQUDAQABBw8CBm1lbW9yeQIAAnNxAAEJBwEAQQILAQAKxgoChgoCAX9ZfgJAA0AgAKesIQAgAaesIQEgAqesIQIgA6esIQMgBKesIQQgBaesIQUgBqesIQYgB6esIQcgCKesIQggCaesIQkgAEICfiEjIAFCAn4hJCACQgJ+ISUgA0ICfiEmIARCAn4hJyAFQgJ+ISggBkICfiEpIAdCAn4hKiAFQiZ+ISsgBkITfiEsIAdCJn4hLSAIQhN+IS4gCUImfiEvIAAgAH4hMCAjIAF+ITEgIyACfiEyICMgA34hMyAjIAR+ITQgIyAFfiE1ICMgBn4hNiAjIAd+ITcgIyAIfiE4ICMgCX4hOSAkIAF+ITogJCACfiE7ICQgJn4hPCAkIAR+IT0gJCAofiE+ICQgBn4hPyAkICp+IUAgJCAIfiFBICQgL34hQiACIAJ+IUMgJSADfiFEICUgBH4hRSAlIAV+IUYgJSAGfiFHICUgB34hSCAlIC5+IUkgAiAvfiFKICYgA34hSyAmIAR+IUwgJiAofiFNICYgBn4hTiAmIC1+IU8gJiAufiFQICYgL34hUSAEIAR+IVIgJyAFfiFTICcgLH4hVCAEIC1+IVUgJyAufiFWIAQgL34hVyAFICt+IVggKCAsfiFZICggLX4hWiAoIC5+IVsgKCAvfiFcI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IUIAE1AhggATUCHCABNQIgIAE1AiQgAiADIAAQCQs=')
var ready = null var ready = null
var mod = { var mod = {

View File

@ -1,9 +1,36 @@
(module (module
(import "js" "table" (table 1 anyfunc)) (import "js" "table" (table 1 anyfunc))
(import "js" "mem" (memory 1))
(elem (i32.const 2) $fe_sq) (elem (i32.const 2) $fe_sq)
(memory $0 1) (func $i32.log (import "debug" "log") (param i32))
(export "memory" (memory $0)) (func $i32.log_tee (import "debug" "log_tee") (param i32) (result i32))
;; No i64 interop with JS yet - but maybe coming with WebAssembly BigInt
;; So we can instead fake this by splitting the i64 into two i32 limbs,
;; however these are WASM functions using i32x2.log:
(func $i32x2.log (import "debug" "log") (param i32) (param i32))
(func $f32.log (import "debug" "log") (param f32))
(func $f32.log_tee (import "debug" "log_tee") (param f32) (result f32))
(func $f64.log (import "debug" "log") (param f64))
(func $f64.log_tee (import "debug" "log_tee") (param f64) (result f64))
;; i64 logging by splitting into two i32 limbs
(func $i64.log
(param $0 i64)
(call $i32x2.log
;; Upper limb
(i32.wrap/i64
(i64.shr_s (get_local $0)
(i64.const 32)))
;; Lower limb
(i32.wrap/i64 (get_local $0))))
(func $i64.log_tee
(param $0 i64)
(result i64)
(call $i64.log (get_local $0))
(return (get_local $0)))
(func $fe_sq (func $fe_sq
(param $f0 i64) (param $f0 i64)
@ -284,7 +311,7 @@
(i64.store32 offset=32 (get_local $h) (get_local $h8)) (i64.store32 offset=32 (get_local $h) (get_local $h8))
(i64.store32 offset=36 (get_local $h) (get_local $h9))) (i64.store32 offset=36 (get_local $h) (get_local $h9)))
(func $sq (export "sq") (param $f i32) (param $double i32) (param $repeat i32) (param $h i32) (func $sq (export "sq") (param $h i32) (param $f i32) (param $double i32) (param $repeat i32)
(i64.load32_u offset=0 (get_local $f)) (i64.load32_u offset=0 (get_local $f))
(i64.load32_u offset=4 (get_local $f)) (i64.load32_u offset=4 (get_local $f))
(i64.load32_u offset=8 (get_local $f)) (i64.load32_u offset=8 (get_local $f))

View File

@ -7,7 +7,7 @@ function loadWebAssembly (opts) {
if (!loadWebAssembly.supported) return null if (!loadWebAssembly.supported) return null
var imp = opts && opts.imports var imp = opts && opts.imports
var wasm = toUint8Array('AGFzbQEAAAABYAxgFX5+fn5+fn5+fn5+fn5+fn5+fn5+fwBgDX5+fn5+fn5+fn5/f38AYAF/AGABfwF/YAJ/fwBgAX0AYAF9AX1gAXwAYAF8AXxgAX4AYAF+AX5gCn9/f39/f39/f38BfwJuCAJqcwV0YWJsZQFwAAMFZGVidWcDbG9nAAIFZGVidWcHbG9nX3RlZQADBWRlYnVnA2xvZwAEBWRlYnVnA2xvZwAFBWRlYnVnB2xvZ190ZWUABgVkZWJ1ZwNsb2cABwVkZWJ1Zwdsb2dfdGVlAAgDBAMJCgsFAwEAAQcXAgZtZW1vcnkCAApzY2FsYXJtdWx0AAkK8RYDDQAgAEIgh6cgAKcQAgsJACAAEAcgAA8L1hYCB39MfiAFKQMAIRMgBSkDCCEUIAUpAxAhFSAFKQMYIRYgADUCACEXIAA1AgQhGCAANQIIIRkgADUCDCEaIAA1AhAhGyAANQIUIRwgADUCGCEdIAA1AhwhHiAANQIgIR8gADUCJCEgIAE1AgAhISABNQIEISIgATUCCCEjIAE1AgwhJCABNQIQISUgATUCFCEmIAE1AhghJyABNQIcISggATUCICEpIAE1AiQhKiACNQIAITUgAjUCBCE2IAI1AgghNyACNQIMITggAjUCECE5IAI1AhQhOiACNQIYITsgAjUCHCE8IAI1AiAhPSACNQIkIT4gAzUCACErIAM1AgQhLCADNQIIIS0gAzUCDCEuIAM1AhAhLyADNQIUITAgAzUCGCExIAM1AhwhMiADNQIgITMgAzUCJCE0IAQ1AgAhPyAENQIEIUAgBDUCCCFBIAQ1AgwhQiAENQIQIUMgBDUCFCFEIAQ1AhghRSAENQIcIUYgBDUCICFHIAQ1AiQhSEH+ASEMAkADQCAMQQBIDQECQAJAAkACQAJAAkAgDEHAAG4OAwECAwQLIBYhEgwECyAWIRIMAwsgFiESDAILIBYhEgwBCw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iBEhSEmICcgRYUhJyAoIEaFISggKSBHhSEpICogSIUhKiArIEmFISsgLCBKhSEsIC0gS4UhLSA4IEKFITggOSBDhSE5IDogRIUhOiA7IEWFITsgPCBGhSE8ID0gR4UhPSA+IEiFIT4gPyBJhSE/IEAgSoUhQCBBIEuFIUEgJCAlICYgJyAoICkgKiArICwgLSAGQQMRAgAgBjUCACAGNQIEIAY1AgggBjUCDCAGNQIQIAY1AhQgBjUCGCAGNQIcIAY1AiAgBjUCJCAaIBsgHCAdIB4gHyAgICEgIiAjIABBAREAAAs=')
var ready = null var ready = null
var mod = { var mod = {

View File

@ -1,5 +1,7 @@
(module (module
(import "js" "table" (table 3 anyfunc)) (import "js" "table" (table 3 anyfunc))
(import "js" "mem" (memory 1))
(type $fe_mul (func (type $fe_mul (func
(param $f_0 i64) (param $f_0 i64)
(param $f_1 i64) (param $f_1 i64)
@ -38,6 +40,19 @@
(param $repeat i32) (param $repeat i32)
(param $res i32))) (param $res i32)))
(type $fe_invert (func
(param $f_0 i64)
(param $f_1 i64)
(param $f_2 i64)
(param $f_3 i64)
(param $f_4 i64)
(param $f_5 i64)
(param $f_6 i64)
(param $f_7 i64)
(param $f_8 i64)
(param $f_9 i64)
(param $res i32)))
(func $i32.log (import "debug" "log") (param i32)) (func $i32.log (import "debug" "log") (param i32))
(func $i32.log_tee (import "debug" "log_tee") (param i32) (result i32)) (func $i32.log_tee (import "debug" "log_tee") (param i32) (result i32))
;; No i64 interop with JS yet - but maybe coming with WebAssembly BigInt ;; No i64 interop with JS yet - but maybe coming with WebAssembly BigInt
@ -66,24 +81,14 @@
(call $i64.log (get_local $0)) (call $i64.log (get_local $0))
(return (get_local $0))) (return (get_local $0)))
(memory $0 1) ;; (memory $0 1)
(export "memory" (memory $0)) ;; (export "memory" (memory $0))
(func $scalarmult (export "scalarmult") (func $scalarmult (export "scalarmult")
(param $ptr_x1 i32)
(param $ptr_x2 i32)
(param $ptr_x3 i32)
(param $ptr_z2 i32)
(param $ptr_z3 i32)
(param $ptr_t i32)
(param $res_x2 i32) (param $res_x2 i32)
(param $res_x3 i32)
(param $res_z2 i32)
(param $res_z3 i32)
(result i32) (param $ptr_x1 i32)
(param $ptr_t i32)
(local $swap i32) (local $swap i32)
(local $b i32) (local $b i32)
@ -179,6 +184,15 @@
(local $tmp1_8 i64) (local $tmp1_8 i64)
(local $tmp1_9 i64) (local $tmp1_9 i64)
(i32.const 400)
(set_local $ptr0)
(i32.const 440)
(set_local $ptr1)
(i32.const 480)
(set_local $ptr2)
(i32.const 520)
(set_local $ptr3)
(set_local $t_0 (i64.load offset=0 (get_local $ptr_t))) (set_local $t_0 (i64.load offset=0 (get_local $ptr_t)))
(set_local $t_1 (i64.load offset=8 (get_local $ptr_t))) (set_local $t_1 (i64.load offset=8 (get_local $ptr_t)))
(set_local $t_2 (i64.load offset=16 (get_local $ptr_t))) (set_local $t_2 (i64.load offset=16 (get_local $ptr_t)))
@ -195,49 +209,49 @@
(set_local $x1_8 (i64.load32_u offset=32 (get_local $ptr_x1))) (set_local $x1_8 (i64.load32_u offset=32 (get_local $ptr_x1)))
(set_local $x1_9 (i64.load32_u offset=36 (get_local $ptr_x1))) (set_local $x1_9 (i64.load32_u offset=36 (get_local $ptr_x1)))
(set_local $x2_0 (i64.load32_u offset=0 (get_local $ptr_x2))) (set_local $x2_0 (i64.const 1))
(set_local $x2_1 (i64.load32_u offset=4 (get_local $ptr_x2))) (set_local $x2_1 (i64.const 0))
(set_local $x2_2 (i64.load32_u offset=8 (get_local $ptr_x2))) (set_local $x2_2 (i64.const 0))
(set_local $x2_3 (i64.load32_u offset=12 (get_local $ptr_x2))) (set_local $x2_3 (i64.const 0))
(set_local $x2_4 (i64.load32_u offset=16 (get_local $ptr_x2))) (set_local $x2_4 (i64.const 0))
(set_local $x2_5 (i64.load32_u offset=20 (get_local $ptr_x2))) (set_local $x2_5 (i64.const 0))
(set_local $x2_6 (i64.load32_u offset=24 (get_local $ptr_x2))) (set_local $x2_6 (i64.const 0))
(set_local $x2_7 (i64.load32_u offset=28 (get_local $ptr_x2))) (set_local $x2_7 (i64.const 0))
(set_local $x2_8 (i64.load32_u offset=32 (get_local $ptr_x2))) (set_local $x2_8 (i64.const 0))
(set_local $x2_9 (i64.load32_u offset=36 (get_local $ptr_x2))) (set_local $x2_9 (i64.const 0))
(set_local $x3_0 (i64.load32_u offset=0 (get_local $ptr_x3))) (set_local $x3_0 (i64.load32_u offset=0 (get_local $ptr_x1)))
(set_local $x3_1 (i64.load32_u offset=4 (get_local $ptr_x3))) (set_local $x3_1 (i64.load32_u offset=4 (get_local $ptr_x1)))
(set_local $x3_2 (i64.load32_u offset=8 (get_local $ptr_x3))) (set_local $x3_2 (i64.load32_u offset=8 (get_local $ptr_x1)))
(set_local $x3_3 (i64.load32_u offset=12 (get_local $ptr_x3))) (set_local $x3_3 (i64.load32_u offset=12 (get_local $ptr_x1)))
(set_local $x3_4 (i64.load32_u offset=16 (get_local $ptr_x3))) (set_local $x3_4 (i64.load32_u offset=16 (get_local $ptr_x1)))
(set_local $x3_5 (i64.load32_u offset=20 (get_local $ptr_x3))) (set_local $x3_5 (i64.load32_u offset=20 (get_local $ptr_x1)))
(set_local $x3_6 (i64.load32_u offset=24 (get_local $ptr_x3))) (set_local $x3_6 (i64.load32_u offset=24 (get_local $ptr_x1)))
(set_local $x3_7 (i64.load32_u offset=28 (get_local $ptr_x3))) (set_local $x3_7 (i64.load32_u offset=28 (get_local $ptr_x1)))
(set_local $x3_8 (i64.load32_u offset=32 (get_local $ptr_x3))) (set_local $x3_8 (i64.load32_u offset=32 (get_local $ptr_x1)))
(set_local $x3_9 (i64.load32_u offset=36 (get_local $ptr_x3))) (set_local $x3_9 (i64.load32_u offset=36 (get_local $ptr_x1)))
(set_local $z2_0 (i64.load32_u offset=0 (get_local $ptr_z2))) (set_local $z2_0 (i64.const 0))
(set_local $z2_1 (i64.load32_u offset=4 (get_local $ptr_z2))) (set_local $z2_1 (i64.const 0))
(set_local $z2_2 (i64.load32_u offset=8 (get_local $ptr_z2))) (set_local $z2_2 (i64.const 0))
(set_local $z2_3 (i64.load32_u offset=12 (get_local $ptr_z2))) (set_local $z2_3 (i64.const 0))
(set_local $z2_4 (i64.load32_u offset=16 (get_local $ptr_z2))) (set_local $z2_4 (i64.const 0))
(set_local $z2_5 (i64.load32_u offset=20 (get_local $ptr_z2))) (set_local $z2_5 (i64.const 0))
(set_local $z2_6 (i64.load32_u offset=24 (get_local $ptr_z2))) (set_local $z2_6 (i64.const 0))
(set_local $z2_7 (i64.load32_u offset=28 (get_local $ptr_z2))) (set_local $z2_7 (i64.const 0))
(set_local $z2_8 (i64.load32_u offset=32 (get_local $ptr_z2))) (set_local $z2_8 (i64.const 0))
(set_local $z2_9 (i64.load32_u offset=36 (get_local $ptr_z2))) (set_local $z2_9 (i64.const 0))
(set_local $z3_0 (i64.load32_u offset=0 (get_local $ptr_z3))) (set_local $z3_0 (i64.const 1))
(set_local $z3_1 (i64.load32_u offset=4 (get_local $ptr_z3))) (set_local $z3_1 (i64.const 0))
(set_local $z3_2 (i64.load32_u offset=8 (get_local $ptr_z3))) (set_local $z3_2 (i64.const 0))
(set_local $z3_3 (i64.load32_u offset=12 (get_local $ptr_z3))) (set_local $z3_3 (i64.const 0))
(set_local $z3_4 (i64.load32_u offset=16 (get_local $ptr_z3))) (set_local $z3_4 (i64.const 0))
(set_local $z3_5 (i64.load32_u offset=20 (get_local $ptr_z3))) (set_local $z3_5 (i64.const 0))
(set_local $z3_6 (i64.load32_u offset=24 (get_local $ptr_z3))) (set_local $z3_6 (i64.const 0))
(set_local $z3_7 (i64.load32_u offset=28 (get_local $ptr_z3))) (set_local $z3_7 (i64.const 0))
(set_local $z3_8 (i64.load32_u offset=32 (get_local $ptr_z3))) (set_local $z3_8 (i64.const 0))
(set_local $z3_9 (i64.load32_u offset=36 (get_local $ptr_z3))) (set_local $z3_9 (i64.const 0))
(i32.const 254) (i32.const 254)
(set_local $pos) (set_local $pos)
@ -259,31 +273,32 @@
(get_local $pos) (get_local $pos)
(i32.const 64) (i32.const 64)
(i32.div_u) (i32.div_u)
(br_table $3 $2 $1 $0)) (br_table $0 $1 $2 $3)))
(get_local $t_3) (get_local $t_3)
(set_local $t) (set_local $t)
(br $break)) (br $break))
(get_local $t_3) (get_local $t_2)
(set_local $t) (set_local $t)
(br $break)) (br $break))
(get_local $t_3) (get_local $t_1)
(set_local $t) (set_local $t)
(br $break)) (br $break))
(get_local $t_3) (get_local $t_0)
(set_local $t) (set_local $t))
(br $break)))
;; end of switch statement ;; end of switch statement
(get_local $t) (get_local $t)
(get_local $pos) (get_local $pos)
(i32.const 8) (i32.const 8)
(i32.div_u) (i32.div_u)
(i32.const 64) (i32.const 8)
(i32.rem_u) (i32.rem_u)
(i32.const 8)
(i32.mul)
(i64.extend_u/i32) (i64.extend_u/i32)
(i64.shr_u) (i64.shr_u)
(i64.const 0xff) (i64.const 0xff)
@ -380,11 +395,6 @@
(set_local $tmp0_9) (set_local $tmp0_9)
(get_local $x2_0)
(get_local $tmp0_0)
(i64.xor)
(set_local $x2_0)
(get_local $x2_0) (get_local $x2_0)
(get_local $tmp0_0) (get_local $tmp0_0)
(i64.xor) (i64.xor)
@ -436,11 +446,6 @@
(set_local $x2_9) (set_local $x2_9)
(get_local $x3_0)
(get_local $tmp0_0)
(i64.xor)
(set_local $x3_0)
(get_local $x3_0) (get_local $x3_0)
(get_local $tmp0_0) (get_local $tmp0_0)
(i64.xor) (i64.xor)
@ -563,11 +568,6 @@
(set_local $tmp0_9) (set_local $tmp0_9)
(get_local $z2_0)
(get_local $tmp0_0)
(i64.xor)
(set_local $z2_0)
(get_local $z2_0) (get_local $z2_0)
(get_local $tmp0_0) (get_local $tmp0_0)
(i64.xor) (i64.xor)
@ -619,11 +619,6 @@
(set_local $z2_9) (set_local $z2_9)
(get_local $z3_0)
(get_local $tmp0_0)
(i64.xor)
(set_local $z3_0)
(get_local $z3_0) (get_local $z3_0)
(get_local $tmp0_0) (get_local $tmp0_0)
(i64.xor) (i64.xor)
@ -942,9 +937,9 @@
(get_local $tmp1_7) (get_local $tmp1_7)
(get_local $tmp1_8) (get_local $tmp1_8)
(get_local $tmp1_9) (get_local $tmp1_9)
(i32.const 0)
(i32.const 0)
(get_local $ptr2) (get_local $ptr2)
(i32.const 0)
(i32.const 0)
(i32.const 2) (i32.const 2)
(call_indirect (type $fe_sq)) (call_indirect (type $fe_sq))
@ -959,9 +954,9 @@
(get_local $x2_7) (get_local $x2_7)
(get_local $x2_8) (get_local $x2_8)
(get_local $x2_9) (get_local $x2_9)
(i32.const 0)
(i32.const 0)
(get_local $ptr3) (get_local $ptr3)
(i32.const 0)
(i32.const 0)
(i32.const 2) (i32.const 2)
(call_indirect (type $fe_sq)) (call_indirect (type $fe_sq))
@ -1136,7 +1131,7 @@
(get_local $tmp0_7) (get_local $tmp0_7)
(get_local $tmp0_8) (get_local $tmp0_8)
(get_local $tmp0_9) (get_local $tmp0_9)
(get_local $ptr1) (get_local $ptr0)
(i32.const 1) (i32.const 1)
(call_indirect (type $fe_mul)) (call_indirect (type $fe_mul))
@ -1202,9 +1197,9 @@
(get_local $z2_7) (get_local $z2_7)
(get_local $z2_8) (get_local $z2_8)
(get_local $z2_9) (get_local $z2_9)
(get_local $ptr0)
(i32.const 0) (i32.const 0)
(i32.const 0) (i32.const 0)
(get_local $ptr1)
(i32.const 2) (i32.const 2)
(call_indirect (type $fe_sq)) (call_indirect (type $fe_sq))
@ -1229,7 +1224,7 @@
(get_local $tmp1_7) (get_local $tmp1_7)
(get_local $tmp1_8) (get_local $tmp1_8)
(get_local $tmp1_9) (get_local $tmp1_9)
(get_local $ptr1) (get_local $ptr2)
(i32.const 1) (i32.const 1)
(call_indirect (type $fe_mul)) (call_indirect (type $fe_mul))
@ -1244,47 +1239,59 @@
(get_local $x3_7) (get_local $x3_7)
(get_local $x3_8) (get_local $x3_8)
(get_local $x3_9) (get_local $x3_9)
(get_local $ptr2)
(i32.const 0) (i32.const 0)
(i32.const 0) (i32.const 0)
(get_local $ptr3)
(i32.const 2) (i32.const 2)
(call_indirect (type $fe_sq)) (call_indirect (type $fe_sq))
;; tmp0 <- load(ptr2) ;; x2 <- load(ptr0)
(set_local $z2_0 (i64.load32_u offset=0 (get_local $ptr0))) (set_local $x2_0 (i64.load32_u offset=0 (get_local $ptr0)))
(set_local $z2_1 (i64.load32_u offset=4 (get_local $ptr0))) (set_local $x2_1 (i64.load32_u offset=4 (get_local $ptr0)))
(set_local $z2_2 (i64.load32_u offset=8 (get_local $ptr0))) (set_local $x2_2 (i64.load32_u offset=8 (get_local $ptr0)))
(set_local $z2_3 (i64.load32_u offset=12 (get_local $ptr0))) (set_local $x2_3 (i64.load32_u offset=12 (get_local $ptr0)))
(set_local $z2_4 (i64.load32_u offset=16 (get_local $ptr0))) (set_local $x2_4 (i64.load32_u offset=16 (get_local $ptr0)))
(set_local $z2_5 (i64.load32_u offset=20 (get_local $ptr0))) (set_local $x2_5 (i64.load32_u offset=20 (get_local $ptr0)))
(set_local $z2_6 (i64.load32_u offset=24 (get_local $ptr0))) (set_local $x2_6 (i64.load32_u offset=24 (get_local $ptr0)))
(set_local $z2_7 (i64.load32_u offset=28 (get_local $ptr0))) (set_local $x2_7 (i64.load32_u offset=28 (get_local $ptr0)))
(set_local $z2_8 (i64.load32_u offset=32 (get_local $ptr0))) (set_local $x2_8 (i64.load32_u offset=32 (get_local $ptr0)))
(set_local $z2_9 (i64.load32_u offset=36 (get_local $ptr0))) (set_local $x2_9 (i64.load32_u offset=36 (get_local $ptr0)))
;; tmp0 <- load(ptr2) ;; z2 <- load(ptr1)
(set_local $z3_0 (i64.load32_u offset=0 (get_local $ptr1))) (set_local $z2_0 (i64.load32_u offset=0 (get_local $ptr1)))
(set_local $z3_1 (i64.load32_u offset=4 (get_local $ptr1))) (set_local $z2_1 (i64.load32_u offset=4 (get_local $ptr1)))
(set_local $z3_2 (i64.load32_u offset=8 (get_local $ptr1))) (set_local $z2_2 (i64.load32_u offset=8 (get_local $ptr1)))
(set_local $z3_3 (i64.load32_u offset=12 (get_local $ptr1))) (set_local $z2_3 (i64.load32_u offset=12 (get_local $ptr1)))
(set_local $z3_4 (i64.load32_u offset=16 (get_local $ptr1))) (set_local $z2_4 (i64.load32_u offset=16 (get_local $ptr1)))
(set_local $z3_5 (i64.load32_u offset=20 (get_local $ptr1))) (set_local $z2_5 (i64.load32_u offset=20 (get_local $ptr1)))
(set_local $z3_6 (i64.load32_u offset=24 (get_local $ptr1))) (set_local $z2_6 (i64.load32_u offset=24 (get_local $ptr1)))
(set_local $z3_7 (i64.load32_u offset=28 (get_local $ptr1))) (set_local $z2_7 (i64.load32_u offset=28 (get_local $ptr1)))
(set_local $z3_8 (i64.load32_u offset=32 (get_local $ptr1))) (set_local $z2_8 (i64.load32_u offset=32 (get_local $ptr1)))
(set_local $z3_9 (i64.load32_u offset=36 (get_local $ptr1))) (set_local $z2_9 (i64.load32_u offset=36 (get_local $ptr1)))
;; tmp0 <- load(ptr2) ;; z3 <- load(ptr2)
(set_local $x3_0 (i64.load32_u offset=0 (get_local $ptr2))) (set_local $z3_0 (i64.load32_u offset=0 (get_local $ptr2)))
(set_local $x3_1 (i64.load32_u offset=4 (get_local $ptr2))) (set_local $z3_1 (i64.load32_u offset=4 (get_local $ptr2)))
(set_local $x3_2 (i64.load32_u offset=8 (get_local $ptr2))) (set_local $z3_2 (i64.load32_u offset=8 (get_local $ptr2)))
(set_local $x3_3 (i64.load32_u offset=12 (get_local $ptr2))) (set_local $z3_3 (i64.load32_u offset=12 (get_local $ptr2)))
(set_local $x3_4 (i64.load32_u offset=16 (get_local $ptr2))) (set_local $z3_4 (i64.load32_u offset=16 (get_local $ptr2)))
(set_local $x3_5 (i64.load32_u offset=20 (get_local $ptr2))) (set_local $z3_5 (i64.load32_u offset=20 (get_local $ptr2)))
(set_local $x3_6 (i64.load32_u offset=24 (get_local $ptr2))) (set_local $z3_6 (i64.load32_u offset=24 (get_local $ptr2)))
(set_local $x3_7 (i64.load32_u offset=28 (get_local $ptr2))) (set_local $z3_7 (i64.load32_u offset=28 (get_local $ptr2)))
(set_local $x3_8 (i64.load32_u offset=32 (get_local $ptr2))) (set_local $z3_8 (i64.load32_u offset=32 (get_local $ptr2)))
(set_local $x3_9 (i64.load32_u offset=36 (get_local $ptr2))) (set_local $z3_9 (i64.load32_u offset=36 (get_local $ptr2)))
;; x3 <- load(ptr3)
(set_local $x3_0 (i64.load32_u offset=0 (get_local $ptr3)))
(set_local $x3_1 (i64.load32_u offset=4 (get_local $ptr3)))
(set_local $x3_2 (i64.load32_u offset=8 (get_local $ptr3)))
(set_local $x3_3 (i64.load32_u offset=12 (get_local $ptr3)))
(set_local $x3_4 (i64.load32_u offset=16 (get_local $ptr3)))
(set_local $x3_5 (i64.load32_u offset=20 (get_local $ptr3)))
(set_local $x3_6 (i64.load32_u offset=24 (get_local $ptr3)))
(set_local $x3_7 (i64.load32_u offset=28 (get_local $ptr3)))
(set_local $x3_8 (i64.load32_u offset=32 (get_local $ptr3)))
(set_local $x3_9 (i64.load32_u offset=36 (get_local $ptr3)))
(get_local $tmp0_0) (get_local $tmp0_0)
(get_local $z3_0) (get_local $z3_0)
@ -1416,50 +1423,393 @@
(set_local $pos) (set_local $pos)
(br $start))) (br $start)))
;; (call $i32.log (get_local $res_x2)) ;; (call $i32.log (get_local $res_x2))
(i32.const 0)
(get_local $swap)
(i32.sub)
(i64.extend_u/i32)
(set_local $mask)
(i64.store32 offset=0 (get_local $res_x2) (get_local $x2_0)) (get_local $x2_0)
(i64.store32 offset=4 (get_local $res_x2) (get_local $x2_1)) (get_local $x3_0)
(i64.store32 offset=8 (get_local $res_x2) (get_local $x2_2)) (i64.xor)
(i64.store32 offset=12 (get_local $res_x2) (get_local $x2_3)) (get_local $mask)
(i64.store32 offset=16 (get_local $res_x2) (get_local $x2_4)) (i64.and)
(i64.store32 offset=20 (get_local $res_x2) (get_local $x2_5)) (set_local $tmp0_0)
(i64.store32 offset=24 (get_local $res_x2) (get_local $x2_6))
(i64.store32 offset=28 (get_local $res_x2) (get_local $x2_7))
(i64.store32 offset=32 (get_local $res_x2) (get_local $x2_8))
(i64.store32 offset=36 (get_local $res_x2) (get_local $x2_9))
(i64.store32 offset=0 (get_local $res_x3) (get_local $x3_0)) (get_local $x2_1)
(i64.store32 offset=4 (get_local $res_x3) (get_local $x3_1)) (get_local $x3_1)
(i64.store32 offset=8 (get_local $res_x3) (get_local $x3_2)) (i64.xor)
(i64.store32 offset=12 (get_local $res_x3) (get_local $x3_3)) (get_local $mask)
(i64.store32 offset=16 (get_local $res_x3) (get_local $x3_4)) (i64.and)
(i64.store32 offset=20 (get_local $res_x3) (get_local $x3_5)) (set_local $tmp0_1)
(i64.store32 offset=24 (get_local $res_x3) (get_local $x3_6))
(i64.store32 offset=28 (get_local $res_x3) (get_local $x3_7))
(i64.store32 offset=32 (get_local $res_x3) (get_local $x3_8))
(i64.store32 offset=36 (get_local $res_x3) (get_local $x3_9))
(i64.store32 offset=0 (get_local $res_z2) (get_local $z2_0)) (get_local $x2_2)
(i64.store32 offset=4 (get_local $res_z2) (get_local $z2_1)) (get_local $x3_2)
(i64.store32 offset=8 (get_local $res_z2) (get_local $z2_2)) (i64.xor)
(i64.store32 offset=12 (get_local $res_z2) (get_local $z2_3)) (get_local $mask)
(i64.store32 offset=16 (get_local $res_z2) (get_local $z2_4)) (i64.and)
(i64.store32 offset=20 (get_local $res_z2) (get_local $z2_5)) (set_local $tmp0_2)
(i64.store32 offset=24 (get_local $res_z2) (get_local $z2_6))
(i64.store32 offset=28 (get_local $res_z2) (get_local $z2_7))
(i64.store32 offset=32 (get_local $res_z2) (get_local $z2_8))
(i64.store32 offset=36 (get_local $res_z2) (get_local $z2_9))
(i64.store32 offset=0 (get_local $res_z3) (get_local $z3_0)) (get_local $x2_3)
(i64.store32 offset=4 (get_local $res_z3) (get_local $z3_1)) (get_local $x3_3)
(i64.store32 offset=8 (get_local $res_z3) (get_local $z3_2)) (i64.xor)
(i64.store32 offset=12 (get_local $res_z3) (get_local $z3_3)) (get_local $mask)
(i64.store32 offset=16 (get_local $res_z3) (get_local $z3_4)) (i64.and)
(i64.store32 offset=20 (get_local $res_z3) (get_local $z3_5)) (set_local $tmp0_3)
(i64.store32 offset=24 (get_local $res_z3) (get_local $z3_6))
(i64.store32 offset=28 (get_local $res_z3) (get_local $z3_7))
(i64.store32 offset=32 (get_local $res_z3) (get_local $z3_8))
(i64.store32 offset=36 (get_local $res_z3) (get_local $z3_9))
(get_local $swap))) (get_local $x2_4)
(get_local $x3_4)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_4)
(get_local $x2_5)
(get_local $x3_5)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_5)
(get_local $x2_6)
(get_local $x3_6)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_6)
(get_local $x2_7)
(get_local $x3_7)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_7)
(get_local $x2_8)
(get_local $x3_8)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_8)
(get_local $x2_9)
(get_local $x3_9)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_9)
(get_local $x2_0)
(get_local $tmp0_0)
(i64.xor)
(set_local $x2_0)
(get_local $x2_1)
(get_local $tmp0_1)
(i64.xor)
(set_local $x2_1)
(get_local $x2_2)
(get_local $tmp0_2)
(i64.xor)
(set_local $x2_2)
(get_local $x2_3)
(get_local $tmp0_3)
(i64.xor)
(set_local $x2_3)
(get_local $x2_4)
(get_local $tmp0_4)
(i64.xor)
(set_local $x2_4)
(get_local $x2_5)
(get_local $tmp0_5)
(i64.xor)
(set_local $x2_5)
(get_local $x2_6)
(get_local $tmp0_6)
(i64.xor)
(set_local $x2_6)
(get_local $x2_7)
(get_local $tmp0_7)
(i64.xor)
(set_local $x2_7)
(get_local $x2_8)
(get_local $tmp0_8)
(i64.xor)
(set_local $x2_8)
(get_local $x2_9)
(get_local $tmp0_9)
(i64.xor)
(set_local $x2_9)
(get_local $x3_0)
(get_local $tmp0_0)
(i64.xor)
(set_local $x3_0)
(get_local $x3_1)
(get_local $tmp0_1)
(i64.xor)
(set_local $x3_1)
(get_local $x3_2)
(get_local $tmp0_2)
(i64.xor)
(set_local $x3_2)
(get_local $x3_3)
(get_local $tmp0_3)
(i64.xor)
(set_local $x3_3)
(get_local $x3_4)
(get_local $tmp0_4)
(i64.xor)
(set_local $x3_4)
(get_local $x3_5)
(get_local $tmp0_5)
(i64.xor)
(set_local $x3_5)
(get_local $x3_6)
(get_local $tmp0_6)
(i64.xor)
(set_local $x3_6)
(get_local $x3_7)
(get_local $tmp0_7)
(i64.xor)
(set_local $x3_7)
(get_local $x3_8)
(get_local $tmp0_8)
(i64.xor)
(set_local $x3_8)
(get_local $x3_9)
(get_local $tmp0_9)
(i64.xor)
(set_local $x3_9)
(get_local $z2_0)
(get_local $z3_0)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_0)
(get_local $z2_1)
(get_local $z3_1)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_1)
(get_local $z2_2)
(get_local $z3_2)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_2)
(get_local $z2_3)
(get_local $z3_3)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_3)
(get_local $z2_4)
(get_local $z3_4)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_4)
(get_local $z2_5)
(get_local $z3_5)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_5)
(get_local $z2_6)
(get_local $z3_6)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_6)
(get_local $z2_7)
(get_local $z3_7)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_7)
(get_local $z2_8)
(get_local $z3_8)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_8)
(get_local $z2_9)
(get_local $z3_9)
(i64.xor)
(get_local $mask)
(i64.and)
(set_local $tmp0_9)
(get_local $z2_0)
(get_local $tmp0_0)
(i64.xor)
(set_local $z2_0)
(get_local $z2_1)
(get_local $tmp0_1)
(i64.xor)
(set_local $z2_1)
(get_local $z2_2)
(get_local $tmp0_2)
(i64.xor)
(set_local $z2_2)
(get_local $z2_3)
(get_local $tmp0_3)
(i64.xor)
(set_local $z2_3)
(get_local $z2_4)
(get_local $tmp0_4)
(i64.xor)
(set_local $z2_4)
(get_local $z2_5)
(get_local $tmp0_5)
(i64.xor)
(set_local $z2_5)
(get_local $z2_6)
(get_local $tmp0_6)
(i64.xor)
(set_local $z2_6)
(get_local $z2_7)
(get_local $tmp0_7)
(i64.xor)
(set_local $z2_7)
(get_local $z2_8)
(get_local $tmp0_8)
(i64.xor)
(set_local $z2_8)
(get_local $z2_9)
(get_local $tmp0_9)
(i64.xor)
(set_local $z2_9)
(get_local $z3_0)
(get_local $tmp0_0)
(i64.xor)
(set_local $z3_0)
(get_local $z3_1)
(get_local $tmp0_1)
(i64.xor)
(set_local $z3_1)
(get_local $z3_2)
(get_local $tmp0_2)
(i64.xor)
(set_local $z3_2)
(get_local $z3_3)
(get_local $tmp0_3)
(i64.xor)
(set_local $z3_3)
(get_local $z3_4)
(get_local $tmp0_4)
(i64.xor)
(set_local $z3_4)
(get_local $z3_5)
(get_local $tmp0_5)
(i64.xor)
(set_local $z3_5)
(get_local $z3_6)
(get_local $tmp0_6)
(i64.xor)
(set_local $z3_6)
(get_local $z3_7)
(get_local $tmp0_7)
(i64.xor)
(set_local $z3_7)
(get_local $z3_8)
(get_local $tmp0_8)
(i64.xor)
(set_local $z3_8)
(get_local $z3_9)
(get_local $tmp0_9)
(i64.xor)
(set_local $z3_9)
(get_local $z2_0)
(get_local $z2_1)
(get_local $z2_2)
(get_local $z2_3)
(get_local $z2_4)
(get_local $z2_5)
(get_local $z2_6)
(get_local $z2_7)
(get_local $z2_8)
(get_local $z2_9)
(get_local $ptr0)
(i32.const 3)
(call_indirect (type $fe_invert))
(i64.load32_u offset=0 (get_local $ptr0))
(i64.load32_u offset=4 (get_local $ptr0))
(i64.load32_u offset=8 (get_local $ptr0))
(i64.load32_u offset=12 (get_local $ptr0))
(i64.load32_u offset=16 (get_local $ptr0))
(i64.load32_u offset=20 (get_local $ptr0))
(i64.load32_u offset=24 (get_local $ptr0))
(i64.load32_u offset=28 (get_local $ptr0))
(i64.load32_u offset=32 (get_local $ptr0))
(i64.load32_u offset=36 (get_local $ptr0))
(get_local $x2_0)
(get_local $x2_1)
(get_local $x2_2)
(get_local $x2_3)
(get_local $x2_4)
(get_local $x2_5)
(get_local $x2_6)
(get_local $x2_7)
(get_local $x2_8)
(get_local $x2_9)
(get_local $res_x2)
(i32.const 1)
(call_indirect (type $fe_mul))))