diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-02-19 09:14:16 -0600 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-02-19 09:14:16 -0600 |
commit | 16a95ead463cea2bc36391394bec226633ef20ca (patch) | |
tree | af9703cd7a12cd471f40f421879fcfd16fefe0f1 | |
parent | 21bb2480b97d44982eb3f80ef908d152c5d2630a (diff) | |
download | cryptography-16a95ead463cea2bc36391394bec226633ef20ca.tar.gz cryptography-16a95ead463cea2bc36391394bec226633ef20ca.tar.bz2 cryptography-16a95ead463cea2bc36391394bec226633ef20ca.zip |
conditionally bind EGD for libressl
-rw-r--r-- | src/cryptography/hazmat/bindings/openssl/rand.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/cryptography/hazmat/bindings/openssl/rand.py b/src/cryptography/hazmat/bindings/openssl/rand.py index c30af921..6330482c 100644 --- a/src/cryptography/hazmat/bindings/openssl/rand.py +++ b/src/cryptography/hazmat/bindings/openssl/rand.py @@ -9,6 +9,7 @@ INCLUDES = """ """ TYPES = """ +static const long Cryptography_HAS_EGD; """ FUNCTIONS = """ @@ -16,9 +17,6 @@ void ERR_load_RAND_strings(void); void RAND_seed(const void *, int); void RAND_add(const void *, int, double); int RAND_status(void); -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 *); @@ -28,9 +26,26 @@ int RAND_pseudo_bytes(unsigned char *, int); """ MACROS = """ +int RAND_egd(const char *); +int RAND_egd_bytes(const char *, int); +int RAND_query_egd_bytes(const char *, unsigned char *, int); """ CUSTOMIZATIONS = """ +#if defined(LIBRESSL_VERSION_NUMBER) +static const long Cryptography_HAS_EGD = 0; +int (*RAND_egd)(const char *) = NULL; +int (*RAND_egd_bytes)(const char *, int) = NULL; +int (*RAND_query_egd_bytes)(const char *, unsigned char *, int) = NULL; +#else +static const long Cryptography_HAS_EGD = 1; +#endif """ -CONDITIONAL_NAMES = {} +CONDITIONAL_NAMES = { + "Cryptography_HAS_EGD": [ + "RAND_egd", + "RAND_egd_bytes", + "RAND_query_egd_bytes", + ] +} |