aboutsummaryrefslogtreecommitdiff
path: root/src/test/ed25519_exts_ref.py
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2017-08-04 12:37:48 +0300
committerNick Mathewson <nickm@torproject.org>2017-08-08 20:29:34 -0400
commit4ad4467fa13a0e6333fa0016a63060d5b9dd9715 (patch)
tree2be3e046037a0983d034ab428bafdda0950f47df /src/test/ed25519_exts_ref.py
parentb89d2fa1db2379bffd2e2b4c851c3facc57b6ed8 (diff)
downloadtor-4ad4467fa13a0e6333fa0016a63060d5b9dd9715.tar.gz
tor-4ad4467fa13a0e6333fa0016a63060d5b9dd9715.zip
Don't double hash the ed25519 blind key parameter.
We used to do: h = H(BLIND_STRING | H(A | s | B | N ) when we should be doing: h = H(BLIND_STRING | A | s | B | N) Change the logic so that hs_common.c does the hashing, and our ed25519 libraries just receive the hashed parameter ready-made. That's easier than doing the hashing on the ed25519 libraries, since that means we would have to pass them a variable-length param (depending on whether 's' is set or not). Also fix the ed25519 test vectors since they were also double hashing.
Diffstat (limited to 'src/test/ed25519_exts_ref.py')
-rw-r--r--src/test/ed25519_exts_ref.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/test/ed25519_exts_ref.py b/src/test/ed25519_exts_ref.py
index 1898256540..f84d3002d3 100644
--- a/src/test/ed25519_exts_ref.py
+++ b/src/test/ed25519_exts_ref.py
@@ -32,8 +32,7 @@ def curve25519ToEd25519(c, sign):
return encodepoint([x,y])
def blindESK(esk, param):
- h = H("Derive temporary signing key" + param)
- mult = 2**(b-2) + sum(2**i * bit(h,i) for i in range(3,b-2))
+ mult = 2**(b-2) + sum(2**i * bit(param,i) for i in range(3,b-2))
s = decodeint(esk[:32])
s_prime = (s * mult) % ell
k = esk[32:]
@@ -42,8 +41,7 @@ def blindESK(esk, param):
return encodeint(s_prime) + k_prime
def blindPK(pk, param):
- h = H("Derive temporary signing key" + param)
- mult = 2**(b-2) + sum(2**i * bit(h,i) for i in range(3,b-2))
+ mult = 2**(b-2) + sum(2**i * bit(param,i) for i in range(3,b-2))
P = decodepoint(pk)
return encodepoint(scalarmult(P, mult))