Apply patch from Victor Stinner
diff --git a/ChangeLog b/ChangeLog
index 1d40f10..ab9810b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-03 Jean-Paul Calderone <exarkun@twistedmatrix.com>
+
+ * src/crypto/crypto.c: Expose X509_verify_cert_error_string. (patch
+ from Victor Stinner)
+
2008-02-22 Jean-Paul Calderone <exarkun@twistedmatrix.com>
* src/ssl/connection.c src/ssl/context.c src/ssl/ssl.c: Fix
diff --git a/src/crypto/crypto.c b/src/crypto/crypto.c
index 4fed5ba..257b478 100644
--- a/src/crypto/crypto.c
+++ b/src/crypto/crypto.c
@@ -647,6 +647,26 @@
return (PyObject *)crypto_NetscapeSPKI_New(spki, 1);
}
+static char crypto_X509_verify_cert_error_string_doc[] = "\n\
+Get X509 verify certificate error string.\n\
+\n\
+Arguments: errnum - Error number\n\
+Returns: Error string as a Python string\n\
+";
+
+static PyObject *
+crypto_X509_verify_cert_error_string(PyObject *spam, PyObject *args)
+{
+ int errnum;
+ const char *str;
+
+ if (!PyArg_ParseTuple(args, "i", &errnum))
+ return NULL;
+
+ str = X509_verify_cert_error_string(errnum);
+ return PyString_FromString(str);
+}
+
/* Methods in the OpenSSL.crypto module (i.e. none) */
static PyMethodDef crypto_methods[] = {
/* Module functions */
@@ -665,6 +685,7 @@
{ "PKey", (PyCFunction)crypto_PKey, METH_VARARGS, crypto_PKey_doc },
{ "X509Extension", (PyCFunction)crypto_X509Extension, METH_VARARGS, crypto_X509Extension_doc },
{ "NetscapeSPKI", (PyCFunction)crypto_NetscapeSPKI, METH_VARARGS, crypto_NetscapeSPKI_doc },
+ { "X509_verify_cert_error_string", (PyCFunction)crypto_X509_verify_cert_error_string, METH_VARARGS, crypto_X509_verify_cert_error_string_doc },
{ NULL, NULL }
};