summaryrefslogtreecommitdiffstats
path: root/Python/random.c
diff options
context:
space:
mode:
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
}