summaryrefslogtreecommitdiff
path: root/Lib/os.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2012-02-20 20:42:21 -0500
committerBarry Warsaw <barry@python.org>2012-02-20 20:42:21 -0500
commit1e13eb084f72d5993cbb726e45b36bdb69c83a24 (patch)
tree1db691c15c5980a870bcc2606a6d2afc77e28bad /Lib/os.py
parentf5a5beb33985b4b55480de267084b90d89a5c5c4 (diff)
downloadcpython-git-1e13eb084f72d5993cbb726e45b36bdb69c83a24.tar.gz
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
environment variable, to provide an opt-in way to protect against denial of service attacks due to hash collisions within the dict and set types. Patch by David Malcolm, based on work by Victor Stinner.
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py19
1 files changed, 0 insertions, 19 deletions
diff --git a/Lib/os.py b/Lib/os.py
index 88adc1555a..a3fd71185f 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -742,22 +742,3 @@ try:
_make_statvfs_result)
except NameError: # statvfs_result may not exist
pass
-
-if not _exists("urandom"):
- def urandom(n):
- """urandom(n) -> str
-
- Return a string of n random bytes suitable for cryptographic use.
-
- """
- try:
- _urandomfd = open("/dev/urandom", O_RDONLY)
- except (OSError, IOError):
- raise NotImplementedError("/dev/urandom (or equivalent) not found")
- try:
- bs = b""
- while n - len(bs) >= 1:
- bs += read(_urandomfd, n - len(bs))
- finally:
- close(_urandomfd)
- return bs