-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* New osrandom_engine in C Inspired by Python/random.c and the old implementation. Signed-off-by: Christian Heimes <[email protected]> * osrandom_engine * Fix naming bug caused by search 'n replace mistake * Make it easier to override osrandom auto-detection * Add engine ctrl and backend API to get implementation from ENGINE Signed-off-by: Christian Heimes <[email protected]> * Better test coverage, documentation, LICENSE Signed-off-by: Christian Heimes <[email protected]> * Coverage is hard. Signed-off-by: Christian Heimes <[email protected]> * * enable win32 check * read() returns size_t Signed-off-by: Christian Heimes <[email protected]> * Add macOS to spelling list. Remove dead code from header file. Signed-off-by: Christian Heimes <[email protected]> * remove CCRandomGenerateBytes path and update getentropy to work on macOS This change allows us to test all the engines in our CI: * getentropy (tested by macOS sierra) * getrandom (tested on several linux builders) * /dev/urandom (tested on FreeBSD, OS X 10.11 and below, & older linux) * CryptGenRandom (tested on windows builders) I also fixed bugs preventing compilation in the getentropy code * getentropy() returns int and is restricted to 256 bytes on macOS, too. Signed-off-by: Christian Heimes <[email protected]> * add versionadded * Re-add import of os module * Fixes related to Alex's recent review. Signed-off-by: Christian Heimes <[email protected]> * Add error reporting and fail for EAGAIN Add error reporting strings for various error cases. This gives us much nicer and understandable error messages. SYS_getrandom() EAGAIN is now an error. Cryptography refuses to initialize its osrandom engine when the Kernel's CPRNG hasn't been seeded yet. Signed-off-by: Christian Heimes <[email protected]>
- Loading branch information
1 parent
0cf3690
commit 2e71776
Showing
10 changed files
with
775 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = {} |
Oops, something went wrong.