aboutsummaryrefslogtreecommitdiffstats
path: root/cipher/elgamal.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1999-04-18 08:18:52 +0000
committerWerner Koch <[email protected]>1999-04-18 08:18:52 +0000
commit1feae2011ccd122ffb9a8f28013a13e57fc0b4fd (patch)
tree981a2000ffe3b4349bf3f2b8dbe845a60c15c95a /cipher/elgamal.c
parentSee ChangeLog: Fri Apr 9 12:26:25 CEST 1999 Werner Koch (diff)
downloadgnupg-1feae2011ccd122ffb9a8f28013a13e57fc0b4fd.tar.gz
gnupg-1feae2011ccd122ffb9a8f28013a13e57fc0b4fd.zip
See ChangeLog: Sun Apr 18 10:11:28 CEST 1999 Werner Koch
Diffstat (limited to '')
-rw-r--r--cipher/elgamal.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cipher/elgamal.c b/cipher/elgamal.c
index 90d5aca18..9d9058f97 100644
--- a/cipher/elgamal.c
+++ b/cipher/elgamal.c
@@ -245,11 +245,16 @@ encrypt(MPI a, MPI b, MPI input, ELG_public_key *pkey )
{
MPI k;
+ /* Note: maybe we should change the interface, so that it
+ * is possible to check that input is < p and return an
+ * error code.
+ */
+
k = gen_k( pkey->p );
mpi_powm( a, pkey->g, k, pkey->p );
/* b = (y^k * input) mod p
* = ((y^k mod p) * (input mod p)) mod p
- * and because input is < p (FIXME: check this!)
+ * and because input is < p
* = ((y^k mod p) * input) mod p
*/
mpi_powm( b, pkey->y, k, pkey->p );