-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New osrandom_engine in C #3229
New osrandom_engine in C #3229
Changes from all commits
e5ebfeb
1cf7222
247ea25
fcec330
cb6f9e2
4bb8742
ad2d09e
158ba3b
086ebbf
f6bc160
8575fb2
2abbab4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,12 @@ greater. | |
Activates the OS random engine. This will effectively disable OpenSSL's | ||
default CSPRNG. | ||
|
||
.. method:: osrandom_engine_implementation() | ||
|
||
.. versionadded:: 1.7 | ||
|
||
Returns the implementation of OS random engine. | ||
|
||
.. method:: activate_builtin_random() | ||
|
||
This will activate the default OpenSSL CSPRNG. | ||
|
@@ -81,6 +87,21 @@ details. | |
Linux uses its own PRNG design. ``/dev/urandom`` is a non-blocking source | ||
seeded from the same pool as ``/dev/random``. | ||
|
||
+------------------------------------------+------------------------------+ | ||
| Windows | ``CryptGenRandom()`` | | ||
+------------------------------------------+------------------------------+ | ||
| Linux >= 3.4.17 with working | ``getrandom(GRND_NONBLOCK)`` | | ||
| ``SYS_getrandom`` syscall | | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can drop the leading There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless you really insist, I'd rather keep |
||
+------------------------------------------+------------------------------+ | ||
| OpenBSD >= 5.6 | ``getentropy()`` | | ||
+------------------------------------------+------------------------------+ | ||
| BSD family (including macOS 10.12+) with | ``getentropy()`` | | ||
| ``SYS_getentropy`` in ``sys/syscall.h`` | | | ||
+------------------------------------------+------------------------------+ | ||
| fallback | ``/dev/urandom`` with | | ||
| | cached file descriptor | | ||
+------------------------------------------+------------------------------+ | ||
|
||
|
||
.. _`OpenSSL`: https://www.openssl.org/ | ||
.. _`initializing the RNG`: https://en.wikipedia.org/wiki/OpenSSL#Predictable_private_keys_.28Debian-specific.29 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This file is dual licensed under the terms of the Apache License, Version | ||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository | ||
# for complete details. | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
import os | ||
|
||
HERE = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
with open(os.path.join(HERE, "src/osrandom_engine.h")) as f: | ||
INCLUDES = f.read() | ||
|
||
TYPES = """ | ||
static const char *const Cryptography_osrandom_engine_name; | ||
static const char *const Cryptography_osrandom_engine_id; | ||
""" | ||
|
||
FUNCTIONS = """ | ||
int Cryptography_add_osrandom_engine(void); | ||
""" | ||
|
||
MACROS = """ | ||
""" | ||
|
||
with open(os.path.join(HERE, "src/osrandom_engine.c")) as f: | ||
CUSTOMIZATIONS = f.read() | ||
|
||
CONDITIONAL_NAMES = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. versionadded:: 1.7 please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed