From e334f711688336ab8bb1a9c887012064254e1bf4 Mon Sep 17 00:00:00 2001 From: Anthony Uk Date: Mon, 31 Oct 2011 14:40:16 +0100 Subject: Fix segfault on PKey.check() when there is no private key --- OpenSSL/crypto/pkey.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSSL') diff --git a/OpenSSL/crypto/pkey.c b/OpenSSL/crypto/pkey.c index 27ea4d4..711306d 100644 --- a/OpenSSL/crypto/pkey.c +++ b/OpenSSL/crypto/pkey.c @@ -124,6 +124,11 @@ crypto_PKey_check(crypto_PKeyObj *self, PyObject *args) { return NULL; } + if (self->only_public) { + PyErr_SetString(PyExc_TypeError, "public key only"); + return NULL; + } + if (self->pkey->type == EVP_PKEY_RSA) { RSA *rsa; rsa = EVP_PKEY_get1_RSA(self->pkey); -- cgit v1.2.1