diff options
Diffstat (limited to 'OpenSSL/crypto/crl.c')
-rw-r--r-- | OpenSSL/crypto/crl.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/OpenSSL/crypto/crl.c b/OpenSSL/crypto/crl.c index 614a606..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,6 +137,20 @@ crypto_CRL_export(crypto_CRLObj *self, PyObject *args, PyObject *keywds) { return NULL; } + +#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(); if (!tmptm) { |