]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
corrected issue in ECDH key generation.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 11 Jan 2012 02:01:43 +0000 (03:01 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 11 Jan 2012 02:02:07 +0000 (03:02 +0100)
This issue prevented an ECDH key that was smaller than the
prime from being correctly aligned.

lib/nettle/ecc_shared_secret.c

index 46a0793bc8b7e5fc61986ca5a16b7936db72b1dc..4e3ef358e13603556217fcd6967bd0c1411021a5 100644 (file)
@@ -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;