summaryrefslogtreecommitdiff
path: root/SWIG/_m2crypto.i
diff options
context:
space:
mode:
Diffstat (limited to 'SWIG/_m2crypto.i')
-rw-r--r--SWIG/_m2crypto.i48
1 files changed, 36 insertions, 12 deletions
diff --git a/SWIG/_m2crypto.i b/SWIG/_m2crypto.i
index 3d779a1..e300a10 100644
--- a/SWIG/_m2crypto.i
+++ b/SWIG/_m2crypto.i
@@ -8,17 +8,47 @@
*
*/
-%module(threads=1) _m2crypto
+%module(threads=1) m2crypto
/* We really don't need threadblock (PyGILState_Ensure() etc.) anywhere.
Disable threadallow as well, only enable it for operations likely to
block. */
%nothreadblock;
%nothreadallow;
+#if SWIG_VERSION >= 0x030000
+#define __WCHAR_MAX__ __WCHAR_MAX
+#define __WCHAR_MIN__ __WCHAR_MIN
+#endif
+/* https://gitlab.com/m2crypto/m2crypto/issues/246 */
+%ignore WCHAR_MAX;
+%ignore WCHAR_MIN;
+/* http://swig.10945.n7.nabble.com/SWIG-AsVal-wchar-t-error-td2264.html */
+%{
+int SWIG_AsVal_wchar_t(PyObject *p, wchar_t *c) { return SWIG_OK; }
+PyObject *SWIG_From_wchar_t(wchar_t c) { return SWIG_Py_Void(); }
+%}
+
+%{
+#ifdef _WIN32
+#define _WINSOCKAPI_
+#include <WinSock2.h>
+#include <Windows.h>
+#pragma comment(lib, "Ws2_32")
+typedef unsigned __int64 uint64_t;
+#endif
+%}
+
%{
+#if defined __GNUC__ && __GNUC__ < 5
+#pragma GCC diagnostic ignored "-Wunused-label"
+#pragma GCC diagnostic warning "-Wstrict-prototypes"
+#endif
+
#include <openssl/err.h>
#include <openssl/rand.h>
#include <_lib.h>
+#include <libcrypto-compat.h>
+#include <py3k_compat.h>
#include "compile.h"
@@ -26,22 +56,15 @@ static PyObject *ssl_verify_cb_func;
static PyObject *ssl_info_cb_func;
static PyObject *ssl_set_tmp_dh_cb_func;
static PyObject *ssl_set_tmp_rsa_cb_func;
+static PyObject *x509_store_verify_cb_func;
%}
%include <openssl/opensslv.h>
-#if OPENSSL_VERSION_NUMBER >= 0x0090707fL
-#define CONST const
-#else
-#define CONST
-#endif
-
-#if OPENSSL_VERSION_NUMBER >= 0x0090800fL
-#define CONST098 const
-#else
-#define CONST098
-#endif
/* Bring in STACK_OF macro definition */
+#ifdef _WIN32
+%include <windows.i>
+#endif
%include <openssl/safestack.h>
/* Bring in LHASH_OF macro definition */
@@ -54,6 +77,7 @@ static PyObject *ssl_set_tmp_rsa_cb_func;
#define LHASH_OF(type) struct lhash_st_##type
#endif
+
%include constraints.i
%include _threads.i
%include _lib.i