diff options
author | Georg Brandl <georg@python.org> | 2013-10-06 16:43:19 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2013-10-06 16:43:19 (GMT) |
commit | c0edadee84ea87c1b0f8eb3bfe26a023d303bb4a (patch) | |
tree | 564831fd033baa4cb47e866469df316bca4e4c5d | |
parent | 4bfc96bf4362c89bbc5573f3eefbf3bed27f4ec5 (diff) | |
download | cpython-c0edadee84ea87c1b0f8eb3bfe26a023d303bb4a.zip cpython-c0edadee84ea87c1b0f8eb3bfe26a023d303bb4a.tar.gz cpython-c0edadee84ea87c1b0f8eb3bfe26a023d303bb4a.tar.bz2 |
Closes #15213: update comment for _PyOS_URandom
-rw-r--r-- | Doc/library/os.rst | 5 | ||||
-rw-r--r-- | Python/random.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 64d7874..3d48722 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2501,8 +2501,9 @@ Miscellaneous Functions This function returns random bytes from an OS-specific randomness source. The returned data should be unpredictable enough for cryptographic applications, though its exact quality depends on the OS implementation. On a UNIX-like - system this will query /dev/urandom, and on Windows it will use CryptGenRandom. - If a randomness source is not found, :exc:`NotImplementedError` will be raised. + system this will query ``/dev/urandom``, and on Windows it will use + ``CryptGenRandom()``. If a randomness source is not found, + :exc:`NotImplementedError` will be raised. For an easy-to-use interface to the random number generator provided by your platform, please see :class:`random.SystemRandom`. diff --git a/Python/random.c b/Python/random.c index 73e3cc3..d615923 100644 --- a/Python/random.c +++ b/Python/random.c @@ -224,8 +224,9 @@ lcg_urandom(unsigned int x0, unsigned char *buffer, size_t size) } } -/* Fill buffer with size pseudo-random bytes, not suitable for cryptographic - use, from the operating random number generator (RNG). +/* Fill buffer with size pseudo-random bytes from the operating system random + number generator (RNG). It is suitable for for most cryptographic purposes + except long living private keys for asymmetric encryption. Return 0 on success, raise an exception and return -1 on error. */ int |