From 8878e543e2f5555a1a56a73279de38baeb0684df Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 31 Mar 2014 16:01:46 +0100 Subject: [PATCH] pub/dsa-misc.c: Include a magic prefix in the hashing. To prevent protocol interference. In practice, I think including the private key should be enough, because nobody would use that in any other kind of hash, right...? --- pub/dsa-misc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pub/dsa-misc.c b/pub/dsa-misc.c index 4f68c7bc..8b03271b 100644 --- a/pub/dsa-misc.c +++ b/pub/dsa-misc.c @@ -84,6 +84,7 @@ mp *dsa_nonce(mp *d, mp *q, mp *x, const octet *m, size_t bsz = 2*n + 2*ch->hashsz; octet *b = XS_ALLOC(bsz); octet *kb = b, *rb = kb + n, *hb = rb + ch->hashsz; + static const char prefix[] = "catacomb-dsa-nonce"; ghash *h; mp_storeb(x, kb, n); @@ -92,6 +93,7 @@ mp *dsa_nonce(mp *d, mp *q, mp *x, const octet *m, do { for (j = 0; j < n; j += ch->hashsz) { h = GH_INIT(ch); + GH_HASH(h, prefix, sizeof(prefix)); GH_HASHBUF32(h, kb, n); GH_HASHBUF32(h, m, ch->hashsz); if (r) GH_HASHBUF32(h, rb, ch->hashsz); -- 2.11.0