aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Paul Calderone <exarkun@twistedmatrix.com>2013-12-23 15:18:47 -0500
committerJean-Paul Calderone <exarkun@twistedmatrix.com>2013-12-23 15:18:47 -0500
commitcf99cc77f863a7254d449ecb5f80a35ad7db11ab (patch)
tree2a0b10cdfbda58bc7f1d219dba99c21ebac27b72
parent84b1f534791289dd855bde72bc512ee7e47f0f79 (diff)
downloadcryptography-cf99cc77f863a7254d449ecb5f80a35ad7db11ab.tar.gz
cryptography-cf99cc77f863a7254d449ecb5f80a35ad7db11ab.tar.bz2
cryptography-cf99cc77f863a7254d449ecb5f80a35ad7db11ab.zip
Switch two types which were declared as opaque but are actually integers to an integer type so they can be passed to functions
-rw-r--r--cryptography/hazmat/backends/openssl/asn1.py9
-rw-r--r--cryptography/hazmat/backends/openssl/bignum.py9
2 files changed, 16 insertions, 2 deletions
diff --git a/cryptography/hazmat/backends/openssl/asn1.py b/cryptography/hazmat/backends/openssl/asn1.py
index b56932fa..385c5e8c 100644
--- a/cryptography/hazmat/backends/openssl/asn1.py
+++ b/cryptography/hazmat/backends/openssl/asn1.py
@@ -16,7 +16,14 @@ INCLUDES = """
"""
TYPES = """
-typedef ... time_t;
+/*
+ * XXX This typedef is wrong.
+ * https://bitbucket.org/cffi/cffi/issue/69/support-for-using-typedef-with-primitive
+ * http://paste.pound-python.org/show/iJcTUMkKeBeS6yXpZWUU/
+ * < fijal> exarkun: I think you want to declare your value too large (e.g. long)
+ * < fijal> exarkun: that way you'll never pass garbage
+ */
+typedef long time_t;
typedef int ASN1_BOOLEAN;
typedef ... ASN1_INTEGER;
diff --git a/cryptography/hazmat/backends/openssl/bignum.py b/cryptography/hazmat/backends/openssl/bignum.py
index 68d0c3a2..4885d5b4 100644
--- a/cryptography/hazmat/backends/openssl/bignum.py
+++ b/cryptography/hazmat/backends/openssl/bignum.py
@@ -17,7 +17,14 @@ INCLUDES = """
TYPES = """
typedef ... BIGNUM;
-typedef ... BN_ULONG;
+/*
+ * XXX This typedef is wrong.
+ * https://bitbucket.org/cffi/cffi/issue/69/support-for-using-typedef-with-primitive
+ * http://paste.pound-python.org/show/iJcTUMkKeBeS6yXpZWUU/
+ * < fijal> exarkun: I think you want to declare your value too large (e.g. long)
+ * < fijal> exarkun: that way you'll never pass garbage
+ */
+typedef unsigned long long BN_ULONG;
"""
FUNCTIONS = """