Rename X25519c secret key arguments
This commit is contained in:
parent
f605de3f0d
commit
d06c4309cf
10
x25519c.lua
10
x25519c.lua
|
@ -97,22 +97,22 @@ function mod.secretKeyDecode(str)
|
||||||
return out
|
return out
|
||||||
end
|
end
|
||||||
|
|
||||||
function mod.secretKeyRemask(sk)
|
function mod.secretKeyRemask(sks)
|
||||||
local sum = fq.num(0)
|
local sum = fq.num(0)
|
||||||
local out = {}
|
local out = {}
|
||||||
|
|
||||||
for i = 1, ORDER - 1 do
|
for i = 1, ORDER - 1 do
|
||||||
local element = fqRandom()
|
local element = fqRandom()
|
||||||
out[i] = fq.add(sk[i], element)
|
out[i] = fq.add(sks[i], element)
|
||||||
sum = fq.add(sum, element)
|
sum = fq.add(sum, element)
|
||||||
end
|
end
|
||||||
|
|
||||||
out[ORDER] = fq.add(sk[ORDER], fq.neg(sum))
|
out[ORDER] = fq.add(sks[ORDER], fq.neg(sum))
|
||||||
|
|
||||||
return out
|
return out
|
||||||
end
|
end
|
||||||
|
|
||||||
function mod.exchange(sk, pk, mc)
|
function mod.exchange(sks, pk, mc)
|
||||||
expect(2, pk, "string")
|
expect(2, pk, "string")
|
||||||
assert(#pk == 32, "public key length must be 32")
|
assert(#pk == 32, "public key length must be 32")
|
||||||
expect(3, mc, "string")
|
expect(3, mc, "string")
|
||||||
|
@ -124,7 +124,7 @@ function mod.exchange(sk, pk, mc)
|
||||||
-- Multiply secret key members and add them together.
|
-- Multiply secret key members and add them together.
|
||||||
-- This unwraps into the "true" secret key times the multiplier (mod q).
|
-- This unwraps into the "true" secret key times the multiplier (mod q).
|
||||||
local skmt = fq.num(0)
|
local skmt = fq.num(0)
|
||||||
for i = 1, #sk do skmt = fq.add(skmt, fq.mul(sk[i], mc)) end
|
for i = 1, #sks do skmt = fq.add(skmt, fq.mul(sks[i], mc)) end
|
||||||
|
|
||||||
-- Get bits.
|
-- Get bits.
|
||||||
-- We have our exponent modulo q. We also know that its value is 0 modulo 8.
|
-- We have our exponent modulo q. We also know that its value is 0 modulo 8.
|
||||||
|
|
Loading…
Reference in a new issue