mirror of
https://github.com/python/cpython.git
synced 2025-08-29 05:05:03 +00:00
Issue #16136: Remove VMS support and VMS-related code
This commit is contained in:
parent
5255b86fba
commit
af01f66817
20 changed files with 27 additions and 325 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue