summaryrefslogtreecommitdiff
path: root/OpenSSL/crypto
diff options
context:
space:
mode:
authorJean-Paul Calderone <exarkun@twistedmatrix.com>2011-05-18 19:42:10 -0400
committerJean-Paul Calderone <exarkun@twistedmatrix.com>2011-05-18 19:42:10 -0400
commit2755fa56514d8f4fd84206023c68ebbca5aa19c9 (patch)
tree60fbb891dd42ae58b71ebfc28a1ed66cc84b7ceb /OpenSSL/crypto
parentff404b84ff478309c182801333b5e786931c5a69 (diff)
downloadpyopenssl-2755fa56514d8f4fd84206023c68ebbca5aa19c9.tar.gz
Put the get_signature_algorithm test in the right case; add a test for the undefined case and change the implementation to raise a ValueError for it instead of returning a stupid string
Diffstat (limited to 'OpenSSL/crypto')
-rw-r--r--OpenSSL/crypto/x509.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/OpenSSL/crypto/x509.c b/OpenSSL/crypto/x509.c
index f763695..4f29b97 100644
--- a/OpenSSL/crypto/x509.c
+++ b/OpenSSL/crypto/x509.c
@@ -539,6 +539,10 @@ crypto_X509_get_signature_algorithm(crypto_X509Obj *self, PyObject *args) {
alg = self->x509->cert_info->signature->algorithm;
nid = OBJ_obj2nid(alg);
+ if (nid == NID_undef) {
+ PyErr_SetString(PyExc_ValueError, "Undefined signature algorithm");
+ return NULL;
+ }
return PyString_FromString(OBJ_nid2ln(nid));
}