[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Don"t use stdio to read from /dev/urandom; glibc stdio ...



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv24336/lib/mixminion

Modified Files:
	Crypto.py 
Log Message:
Don't use stdio to read from /dev/urandom; glibc stdio does weird
stuff with ioctl for no good reason.


Index: Crypto.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Crypto.py,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- Crypto.py	3 Jan 2004 07:35:23 -0000	1.61
+++ Crypto.py	21 Apr 2004 20:49:41 -0000	1.62
@@ -775,9 +775,9 @@
         if _TRNG_FILENAME is None:
             configure_trng(None)
 
-        f = open(_TRNG_FILENAME, 'rb')
-        d = f.read(n)
-        f.close()
+        fd = os.open(_TRNG_FILENAME, os.O_RDONLY|getattr(os,"O_BINARY",0))
+        d = os.read(fd, n)
+        os.close(fd)
         return d
 
     def getBytes(self, n):