summaryrefslogtreecommitdiff
path: root/pipermail/pycrypto/attachments/20120120/20f7dd78/attachment.diff
blob: 933ddda6991d0b2a7aa0bb6bee5d78d925656671 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
diff --git a/lib/Crypto/Random/OSRNG/posix.py b/lib/Crypto/Random/OSRNG/posix.py
index f88cd77..234edfe 100644
--- a/lib/Crypto/Random/OSRNG/posix.py
+++ b/lib/Crypto/Random/OSRNG/posix.py
@@ -46,7 +46,6 @@ class DevURandomRNG(BaseRNG):
             raise TypeError("%r is not a character special device" % (self.name,))
 
         self.__file = f
-        self._read = f.read
 
         BaseRNG.__init__(self)
 
@@ -54,7 +53,10 @@ class DevURandomRNG(BaseRNG):
         self.__file.close()
 
     def _read(self, N):
-        return self.__file.read(N)
+        data = self.__file.read(N)
+        while len(data) < N:
+            data += self.__file.read(N - len(data))
+        return data
 
 def new(*args, **kwargs):
     return DevURandomRNG(*args, **kwargs)