aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-03-04 19:10:10 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2014-03-04 19:10:10 -0800
commit664030c13c0b62b872e6f1e9169ec5b570b73533 (patch)
tree8818c1f0635bafbf6702eff156550355969eb861
parenta5c58b9b590b0a2f6e94d371c1c18963e3ca1df7 (diff)
downloadcryptography-664030c13c0b62b872e6f1e9169ec5b570b73533.tar.gz
cryptography-664030c13c0b62b872e6f1e9169ec5b570b73533.tar.bz2
cryptography-664030c13c0b62b872e6f1e9169ec5b570b73533.zip
Fix for systems without EC
-rw-r--r--cryptography/hazmat/bindings/openssl/ec.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/cryptography/hazmat/bindings/openssl/ec.py b/cryptography/hazmat/bindings/openssl/ec.py
index c0c4f887..c3ca6e93 100644
--- a/cryptography/hazmat/bindings/openssl/ec.py
+++ b/cryptography/hazmat/bindings/openssl/ec.py
@@ -23,10 +23,7 @@ TYPES = """
static const int Cryptography_HAS_EC;
typedef ... EC_KEY;
-typedef struct {
- int nid;
- const char *comment;
-} EC_builtin_curve;
+typedef ... EC_builtin_curve;
static const int NID_X9_62_prime192v1;
static const int NID_X9_62_prime192v2;
@@ -45,6 +42,8 @@ EC_KEY *EC_KEY_new_by_curve_name(int);
void EC_KEY_free(EC_KEY *);
size_t EC_get_builtin_curves(EC_builtin_curve *, size_t);
+
+int Cryptography_EC_builtin_curve_get_nid(EC_builtin_curve);
"""
CUSTOMIZATIONS = """
@@ -55,8 +54,13 @@ typedef void EC_builtin_curve;
EC_KEY* (*EC_KEY_new_by_curve_name)(int) = NULL;
void (*EC_KEY_free)(EC_KEY *) = NULL;
size_t (*EC_get_builtin_curves)(EC_builtin_curve *, size_t) = NULL;
+int (*Cryptography_EC_builtin_curve_get_nid)(EC_builtin_curve) = NULL;
#else
static const long Cryptography_HAS_EC = 1;
+
+int Cryptography_EC_builtin_curve_get_nid(EC_builtin_curve c) {
+ return c.nid;
+}
#endif
"""
@@ -64,5 +68,8 @@ CONDITIONAL_NAMES = {
"Cryptography_HAS_EC": [
"EC_KEY_new_by_curve_name",
"EC_KEY_free",
+ "EC_get_builtin_curves",
+
+ "Cryptography_EC_builtin_curve_get_nid",
],
}