From 7248ebd1bd9963280c061f8b3604c0a2bbff01bb Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Wed, 5 Feb 2014 16:12:23 -0800 Subject: Make the filename match --- cryptography/hazmat/bindings/openssl/osrandom_engine.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cryptography/hazmat/bindings/openssl/osrandom_engine.py b/cryptography/hazmat/bindings/openssl/osrandom_engine.py index 6e7e172e..6bc95a0b 100644 --- a/cryptography/hazmat/bindings/openssl/osrandom_engine.py +++ b/cryptography/hazmat/bindings/openssl/osrandom_engine.py @@ -53,7 +53,9 @@ static int osrandom_rand_bytes(unsigned char *buffer, int size) { } if (!CryptGenRandom(hCryptProv, (DWORD)size, buffer)) { - ERR_put_error(ERR_LIB_RAND, 0, ERR_R_RAND_LIB, "osrandom.py", 0); + ERR_put_error( + ERR_LIB_RAND, 0, ERR_R_RAND_LIB, "osrandom_engine.py", 0 + ); return 0; } return 1; @@ -109,7 +111,9 @@ static int osrandom_rand_bytes(unsigned char *buffer, int size) { n = read(urandom_fd, buffer, (size_t)size); } while (n < 0 && errno == EINTR); if (n <= 0) { - ERR_put_error(ERR_LIB_RAND, 0, ERR_R_RAND_LIB, "osrandom.py", 0); + ERR_put_error( + ERR_LIB_RAND, 0, ERR_R_RAND_LIB, "osrandom_engine.py", 0 + ); return 0; } buffer += n; -- cgit v1.2.3 From 0f63388d7298981045a18304c94029a5eee873df Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Wed, 5 Feb 2014 16:32:16 -0800 Subject: Rewrite this to be more streamlined --- cryptography/hazmat/bindings/openssl/osrandom_engine.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cryptography/hazmat/bindings/openssl/osrandom_engine.py b/cryptography/hazmat/bindings/openssl/osrandom_engine.py index 6bc95a0b..23f2e17a 100644 --- a/cryptography/hazmat/bindings/openssl/osrandom_engine.py +++ b/cryptography/hazmat/bindings/openssl/osrandom_engine.py @@ -149,9 +149,9 @@ static const char *Cryptography_osrandom_engine_id = "osrandom"; static const char *Cryptography_osrandom_engine_name = "osrandom_engine"; #if defined(_WIN32) -""" + WIN32_CUSTOMIZATIONS + """ +%(WIN32_CUSTOMIZATIONS)s #else -""" + POSIX_CUSTOMIZATIONS + """ +%(POSIX_CUSTOMIZATIONS)s #endif /* This replicates the behavior of the OpenSSL FIPS RNG, which returns a @@ -197,6 +197,9 @@ int Cryptography_add_osrandom_engine(void) { return 1; } -""" +""" % { + "WIN32_CUSTOMIZATIONS": WIN32_CUSTOMIZATIONS, + "POSIX_CUSTOMIZATIONS": POSIX_CUSTOMIZATIONS, +} CONDITIONAL_NAMES = {} -- cgit v1.2.3