From 92830105db0d416402852851c25979a7c34bd8c4 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 5 Oct 2013 19:14:36 -0500 Subject: rand bindings for openssl (refs #77) These bindings should be used with care as there are many opportunities to shoot yourself in the foot. Take special care to re-seed on process fork and for the love of god don't use DUAL_EC_DRBG --- cryptography/bindings/openssl/api.py | 1 + cryptography/bindings/openssl/rand.py | 37 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 cryptography/bindings/openssl/rand.py diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index 0da1af61..12927782 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -30,6 +30,7 @@ class API(object): "dh", "dsa", "evp", + "rand", "rsa", "opensslv", ] diff --git a/cryptography/bindings/openssl/rand.py b/cryptography/bindings/openssl/rand.py new file mode 100644 index 00000000..e4f6be23 --- /dev/null +++ b/cryptography/bindings/openssl/rand.py @@ -0,0 +1,37 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +INCLUDES = """ +#include +""" + +TYPES = """ +""" + +FUNCTIONS = """ +void RAND_seed(const void *, int); +void RAND_add(const void *, int, double); +int RAND_status(); +int RAND_egd(const char *); +int RAND_egd_bytes(const char *, int); +int RAND_query_egd_bytes(const char *, unsigned char *, int); +const char *RAND_file_name(char *, size_t); +int RAND_load_file(const char *, long); +int RAND_write_file(const char *); +void RAND_cleanup(); +int RAND_bytes(unsigned char *, int); +int RAND_pseudo_bytes(unsigned char *, int); +""" + +MACROS = """ +""" -- cgit v1.2.3