summaryrefslogtreecommitdiff
path: root/src/ext/ed25519/ref10
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/ext/ed25519/ref10
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/ext/ed25519/ref10')
-rw-r--r--src/ext/ed25519/ref10/blinding.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ext/ed25519/ref10/blinding.c b/src/ext/ed25519/ref10/blinding.c
index 31332a2719..a3b32fa80c 100644
--- a/src/ext/ed25519/ref10/blinding.c
+++ b/src/ext/ed25519/ref10/blinding.c
@@ -12,8 +12,8 @@
static void
ed25519_ref10_gettweak(unsigned char *out, const unsigned char *param)
{
- const char str[] = "Derive temporary signing key";
- crypto_hash_sha512_2(out, (const unsigned char*)str, strlen(str), param, 32);
+ memcpy(out, param, 32);
+
out[0] &= 248; /* Is this necessary necessary ? */
out[31] &= 63;
out[31] |= 64;