[patch] minor bug in elgamal prime generator
Tommi Komulainen
Tommi.Komulainen@iki.fi
Sun Apr 1 22:50:01 2001
--KM+e2hnYAO+MCJ5e
Content-Type: multipart/mixed; boundary="i6vqABX3nJKXLk01"
Content-Disposition: inline
--i6vqABX3nJKXLk01
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Hi,
I stumbled into a little problem in cipher/primegen.c while poking around
with the code. A variable is (not) initialized in a wrong place and
another one is never freed. The attached patch should fix them both.
--=20
Tommi Komulainen Tommi.Komulainen@iki.fi
GPG 1024D/68388EE6 6FD6 DD79 EB38 BF6F 3533 09C0 04A8 9871 6838 8EE6
--i6vqABX3nJKXLk01
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="patch.gnupg.primegen"
Content-Transfer-Encoding: quoted-printable
--- cipher/primegen.c.orig Thu May 18 12:30:26 2000
+++ cipher/primegen.c Sun Apr 1 23:45:45 2001
@@ -227,8 +227,8 @@ generate_elg_prime( int mode, unsigned p
=20
if( ret_factors ) { /* caller wants the factors */
*ret_factors =3D m_alloc_clear( (n+2) * sizeof **ret_factors);
+ i =3D 0;
if( mode =3D=3D 1 ) {
- i =3D 0;
(*ret_factors)[i++] =3D mpi_copy( q_factor );
for(; i <=3D n; i++ )
(*ret_factors)[i] =3D mpi_copy( factors[i] );
@@ -283,6 +283,7 @@ generate_elg_prime( int mode, unsigned p
m_free( pool );
m_free(perms);
mpi_free(val_2);
+ mpi_free(q);
return prime;
}
=20
--i6vqABX3nJKXLk01--
--KM+e2hnYAO+MCJ5e
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE6x5RRBKiYcWg4juYRAk9aAKCHFTBWttChnJ1WFDsTA78WHkJqcQCgkbmx
20XvnVV1fCVA0KguD4ugBLo=
=CHxl
-----END PGP SIGNATURE-----
--KM+e2hnYAO+MCJ5e--