diff options
author | Glyph <glyph@twistedmatrix.com> | 2015-06-27 19:06:17 -0700 |
---|---|---|
committer | Glyph <glyph@twistedmatrix.com> | 2015-06-27 19:06:17 -0700 |
commit | 9f6d7b53470f19410aaf9cbeca773cc2f582a546 (patch) | |
tree | 1ff2abbadf0e6dec7852345e6b0db96b3d9e5453 /src | |
parent | 9ad8a9443323c6702bc3e7a4d0afe0c4d400ab84 (diff) | |
download | cryptography-9f6d7b53470f19410aaf9cbeca773cc2f582a546.tar.gz cryptography-9f6d7b53470f19410aaf9cbeca773cc2f582a546.tar.bz2 cryptography-9f6d7b53470f19410aaf9cbeca773cc2f582a546.zip |
do the hokey pokey
you put the functions in, you take the functions out, you make the
linter work, and you shake it all about
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/hazmat/bindings/openssl/binding.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/cryptography/hazmat/bindings/openssl/binding.py b/src/cryptography/hazmat/bindings/openssl/binding.py index aa072b4c..7943962f 100644 --- a/src/cryptography/hazmat/bindings/openssl/binding.py +++ b/src/cryptography/hazmat/bindings/openssl/binding.py @@ -10,6 +10,19 @@ import threading from cryptography.hazmat.bindings._openssl import ffi, lib +@ffi.callback("int (*)(unsigned char *, int)", error=-1) +def _osrandom_rand_bytes(buf, size): + signed = ffi.cast("char *", buf) + result = os.urandom(size) + signed[0:size] = result + return 1 + + +@ffi.callback("int (*)(void)") +def _osrandom_rand_status(): + return 1 + + class Binding(object): """ OpenSSL API wrapper. @@ -29,19 +42,6 @@ class Binding(object): def __init__(self): self._ensure_ffi_initialized() - @ffi.callback("int (*)(unsigned char *, int)", error=-1) - @staticmethod - def _osrandom_rand_bytes(buf, size): - signed = ffi.cast("char *", buf) - result = os.urandom(size) - signed[0:size] = result - return 1 - - @ffi.callback("int (*)(void)") - @staticmethod - def _osrandom_rand_status(): - return 1 - _osrandom_method = ffi.new( "RAND_METHOD *", dict(bytes=_osrandom_rand_bytes, pseudorand=_osrandom_rand_bytes, |