summaryrefslogtreecommitdiff
path: root/mpi
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2015-03-16 09:29:27 +0100
committerWerner Koch <wk@gnupg.org>2015-03-16 09:31:03 +0100
commit0a9cdb8ae092d050ca12a7a4f2f50e25b82154ec (patch)
tree229524745d00e2787eab03d3856c90c66c422c37 /mpi
parentfbb97dcf763e28e81e01092ad4c934b3eaf88cc8 (diff)
downloadlibgcrypt-0a9cdb8ae092d050ca12a7a4f2f50e25b82154ec.tar.gz
mpi: Remove useless condition.
* mpi/mpi-pow.c: Remove condition rp==mp. -- MP has already been allocated and thus can't match RP. The followinf assert would have been triggred anyway due to the prior allocation. Detected by Stack 0.3.
Diffstat (limited to 'mpi')
-rw-r--r--mpi/mpi-pow.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/mpi/mpi-pow.c b/mpi/mpi-pow.c
index 70bf9e84..0be153fe 100644
--- a/mpi/mpi-pow.c
+++ b/mpi/mpi-pow.c
@@ -507,7 +507,8 @@ _gcry_mpi_powm (gcry_mpi_t res,
}
- /* Make BASE, EXPO and MOD not overlap with RES. */
+ /* Make BASE, EXPO not overlap with RES. We don't need to check MOD
+ because that has already been copied to the MP var. */
if ( rp == bp )
{
/* RES and BASE are identical. Allocate temp. space for BASE. */
@@ -523,14 +524,6 @@ _gcry_mpi_powm (gcry_mpi_t res,
ep = ep_marker = mpi_alloc_limb_space( esize, esec );
MPN_COPY(ep, rp, esize);
}
- if ( rp == mp )
- {
- /* RES and MOD are identical. Allocate temporary space for MOD.*/
- gcry_assert (!mp_marker);
- mp_nlimbs = msec?msize:0;
- mp = mp_marker = mpi_alloc_limb_space( msize, msec );
- MPN_COPY(mp, rp, msize);
- }
/* Copy base to the result. */
if (res->alloced < size)