summaryrefslogtreecommitdiffstats
path: root/Python/random.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-12-21 15:19:10 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-12-21 15:19:10 (GMT)
commitaf01f668173d4061893148b54a0f01b91c7716c2 (patch)
tree0931bce7ed986e784415b587ae4b4823e7a6c753 /Python/random.c
parent5255b86fba38a5e22a0991772a3c1bbf3edd66cc (diff)
downloadcpython-af01f668173d4061893148b54a0f01b91c7716c2.zip
cpython-af01f668173d4061893148b54a0f01b91c7716c2.tar.gz
cpython-af01f668173d4061893148b54a0f01b91c7716c2.tar.bz2
Issue #16136: Remove VMS support and VMS-related code
Diffstat (limited to 'Python/random.c')
-rw-r--r--Python/random.c37
1 files changed, 4 insertions, 33 deletions
diff --git a/Python/random.c b/Python/random.c
index de8e9e7..cdace00 100644
--- a/Python/random.c
+++ b/Python/random.c
@@ -68,28 +68,7 @@ win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise)
#endif /* MS_WINDOWS */
-#ifdef __VMS
-/* Use openssl random routine */
-#include <openssl/rand.h>
-static int
-vms_urandom(unsigned char *buffer, Py_ssize_t size, int raise)
-{
- if (RAND_pseudo_bytes(buffer, size) < 0) {
- if (raise) {
- PyErr_Format(PyExc_ValueError,
- "RAND_pseudo_bytes");
- } else {
- Py_FatalError("Failed to initialize the randomized hash "
- "secret using RAND_pseudo_bytes");
- }
- return -1;
- }
- return 0;
-}
-#endif /* __VMS */
-
-
-#if !defined(MS_WINDOWS) && !defined(__VMS)
+#ifndef MS_WINDOWS
static int urandom_fd = -1;
/* Read size bytes from /dev/urandom into buffer.
@@ -195,7 +174,7 @@ dev_urandom_close(void)
}
}
-#endif /* !defined(MS_WINDOWS) && !defined(__VMS) */
+#endif /* MS_WINDOWS */
/* Fill buffer with pseudo-random bytes generated by a linear congruent
generator (LCG):
@@ -237,11 +216,7 @@ _PyOS_URandom(void *buffer, Py_ssize_t size)
#ifdef MS_WINDOWS
return win32_urandom((unsigned char *)buffer, size, 1);
#else
-# ifdef __VMS
- return vms_urandom((unsigned char *)buffer, size, 1);
-# else
return dev_urandom_python((char*)buffer, size);
-# endif
#endif
}
@@ -285,12 +260,8 @@ _PyRandom_Init(void)
else {
#ifdef MS_WINDOWS
(void)win32_urandom(secret, secret_size, 0);
-#else /* #ifdef MS_WINDOWS */
-# ifdef __VMS
- vms_urandom(secret, secret_size, 0);
-# else
+#else
dev_urandom_noraise(secret, secret_size);
-# endif
#endif
}
}
@@ -298,7 +269,7 @@ _PyRandom_Init(void)
void
_PyRandom_Fini(void)
{
-#if !defined(MS_WINDOWS) && !defined(__VMS)
+#ifndef MS_WINDOWS
dev_urandom_close();
#endif
}