From: Nikos Mavrogiannopoulos Date: Wed, 11 Jan 2012 02:01:43 +0000 (+0100) Subject: corrected issue in ECDH key generation. X-Git-Tag: gnutls-3_0_12~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=388524a37dbc278a697e543bd24260679ff3858f;p=thirdparty%2Fgnutls.git corrected issue in ECDH key generation. This issue prevented an ECDH key that was smaller than the prime from being correctly aligned. --- diff --git a/lib/nettle/ecc_shared_secret.c b/lib/nettle/ecc_shared_secret.c index 46a0793bc8..4e3ef358e1 100644 --- a/lib/nettle/ecc_shared_secret.c +++ b/lib/nettle/ecc_shared_secret.c @@ -76,8 +76,7 @@ ecc_shared_secret (ecc_key * private_key, ecc_key * public_key, err = -1; goto done; } - memset (out, 0, x); - nettle_mpz_get_str_256(x, out + (x - nettle_mpz_sizeinbase_256_u (result->x)), result->x); + nettle_mpz_get_str_256(x, out, result->x); err = 0; *outlen = x;