From: Mark Wooding Date: Mon, 31 Mar 2014 15:01:46 +0000 (+0100) Subject: pub/dsa-misc.c: Include a magic prefix in the hashing. X-Git-Tag: 2.2.0~11 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/catacomb/commitdiff_plain/8878e543e2f5555a1a56a73279de38baeb0684df 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...? --- 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);