summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.rst3
-rw-r--r--doc/api.rst1
-rw-r--r--doc/api/rand.rst41
-rw-r--r--src/OpenSSL/rand.py7
4 files changed, 9 insertions, 43 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index ab1072d..f42f4d9 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -18,7 +18,8 @@ Backward-incompatible changes:
Deprecations:
^^^^^^^^^^^^^
-*none*
+- Deprecated ``OpenSSL.rand`` - callers should use ``os.urandom()`` instead.
+ `#658 <https://github.com/pyca/pyopenssl/pull/658>`_
Changes:
diff --git a/doc/api.rst b/doc/api.rst
index 826ec4d..b5ca3f2 100644
--- a/doc/api.rst
+++ b/doc/api.rst
@@ -14,5 +14,4 @@ OpenSSL library. The following modules are defined:
:maxdepth: 2
api/crypto
- api/rand
api/ssl
diff --git a/doc/api/rand.rst b/doc/api/rand.rst
deleted file mode 100644
index 47460a8..0000000
--- a/doc/api/rand.rst
+++ /dev/null
@@ -1,41 +0,0 @@
-.. _openssl-rand:
-
-:mod:`rand` --- An interface to the OpenSSL pseudo random number generator
-==========================================================================
-
-.. warning::
- Functions from this module shouldn't be used.
- `Use urandom <https://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers/>`_ instead.
-
-
-.. py:module:: OpenSSL.rand
- :synopsis: An interface to the OpenSSL pseudo random number generator
-
-
-This module handles the OpenSSL pseudo random number generator (PRNG) and declares the following:
-
-.. autofunction:: add
-
-.. autofunction:: bytes
-
-.. autofunction:: cleanup
-
-.. autofunction:: load_file(filename[, bytes])
-
-.. autofunction:: seed
-
-.. autofunction:: status
-
-.. autofunction:: write_file
-
-
-.. function:: screen
-
- Add the current contents of the screen to the PRNG state.
-
- Availability: Windows.
-
- :return: :obj:`None`
-
-
-.. autoexception:: Error
diff --git a/src/OpenSSL/rand.py b/src/OpenSSL/rand.py
index cf2053f..e2f6373 100644
--- a/src/OpenSSL/rand.py
+++ b/src/OpenSSL/rand.py
@@ -2,6 +2,7 @@
PRNG management routines, thin wrappers.
"""
+import warnings
from functools import partial
from six import integer_types as _integer_types
@@ -13,6 +14,12 @@ from OpenSSL._util import (
path_string as _path_string)
+warnings.warn(
+ "OpenSSL.rand is deprecated - you should use os.urandom instead",
+ DeprecationWarning, stacklevel=3
+)
+
+
class Error(Exception):
"""
An error occurred in an :mod:`OpenSSL.rand` API.