CVS: crypto/src _fastmath.c,1.12,1.13

Joris Bontje <[email protected]> Fri, 04 Apr 2003 11:20:33 -0800
Newsgroups gmane.comp.python.cryptography.cvs
Message-ID <[email protected]>
Update of /cvsroot/pycrypto/crypto/src
In directory sc8-pr-cvs1:/tmp/cvs-serv17392/src

Modified Files:
	_fastmath.c 
Log Message:
calculate u if only p and q are given.
jbontje 2003-04-04


Index: _fastmath.c
===================================================================
RCS file: /cvsroot/pycrypto/crypto/src/_fastmath.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- _fastmath.c	4 Apr 2003 15:02:13 -0000	1.12
+++ _fastmath.c	4 Apr 2003 19:20:29 -0000	1.13
@@ -505,11 +505,15 @@
 		return (PyObject *) key;
 	}
 	longObjToMPZ (key->d, d);
-	if (p && q && u)
+	if (p && q)
 	{
-        longObjToMPZ (key->p, p);
-        longObjToMPZ (key->q, q);
-        longObjToMPZ (key->u, u);
+		longObjToMPZ (key->p, p);
+		longObjToMPZ (key->q, q);
+		if (u) {
+			longObjToMPZ (key->u, u);
+		} else {
+			mpz_invert (key->u, key->p, key->q);
+		}
 	}
 	return (PyObject *) key;
 }



-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/