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
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 @@
 
     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));
 }