aboutsummaryrefslogtreecommitdiffstats
path: root/cipher/elgamal.c
diff options
context:
space:
mode:
Diffstat (limited to 'cipher/elgamal.c')
-rw-r--r--cipher/elgamal.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/cipher/elgamal.c b/cipher/elgamal.c
index c3f086238..5143ecc8c 100644
--- a/cipher/elgamal.c
+++ b/cipher/elgamal.c
@@ -374,6 +374,9 @@ decrypt(MPI output, MPI a, MPI b, ELG_secret_key *skey )
{
MPI t1 = mpi_alloc_secure( mpi_get_nlimbs( skey->p ) );
+ mpi_normalize (a);
+ mpi_normalize (b);
+
/* output = b/(a^x) mod p */
mpi_powm( t1, a, skey->x, skey->p );
mpi_invm( t1, t1, skey->p );