diff options
author | Jean-Paul Calderone <exarkun@twistedmatrix.com> | 2012-03-09 15:25:48 -0800 |
---|---|---|
committer | Jean-Paul Calderone <exarkun@twistedmatrix.com> | 2012-03-09 15:25:48 -0800 |
commit | 7e8dab02ce8a8acf750153c46c19215223dcc67c (patch) | |
tree | a8a3aa790ee026158eaa1b502a8e56dd861545b9 /OpenSSL/crypto | |
parent | 15f3a8683af475c0fdd0ecddbaf6d3df5c1e8bf5 (diff) | |
download | pyopenssl-7e8dab02ce8a8acf750153c46c19215223dcc67c.tar.gz |
Add a version check, since older versions of OpenSSL are missing ameth
Diffstat (limited to 'OpenSSL/crypto')
-rw-r--r-- | OpenSSL/crypto/crl.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/OpenSSL/crypto/crl.c b/OpenSSL/crypto/crl.c index 543708e..3f56d83 100644 --- a/OpenSSL/crypto/crl.c +++ b/OpenSSL/crypto/crl.c @@ -2,7 +2,6 @@ #define crypto_MODULE #include "crypto.h" - static X509_REVOKED * X509_REVOKED_dup(X509_REVOKED *orig) { X509_REVOKED *dupe = NULL; @@ -138,15 +137,19 @@ crypto_CRL_export(crypto_CRLObj *self, PyObject *args, PyObject *keywds) { return NULL; } - /* Some versions of OpenSSL check for this, but more recent versions seem - * not to. + +#if OPENSSL_VERSION_NUMBER >= 0x01000000L + /* Older versions of OpenSSL had no problem with trying to export using an + * uninitialized key. Newer versions segfault, instead. We can only check + * on the new versions, though, because the old versions don't even have the + * field that the segfault is triggered by. */ if (!key->pkey->ameth) { PyErr_SetString( crypto_Error, "Cannot export with an unitialized key"); return NULL; } - +#endif bio = BIO_new(BIO_s_mem()); tmptm = ASN1_TIME_new(); |