summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2014-04-20 20:19:55 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2014-04-20 20:19:55 +0200
commit09221cfefe6f7c1d4fff320b6bcee56a23deb54d (patch)
tree52d3f1374ac84ab2f7de375945492c8b6f67f727
downloadm2crypto_ext-09221cfefe6f7c1d4fff320b6bcee56a23deb54d.tar.gz
m2crypto_ext-09221cfefe6f7c1d4fff320b6bcee56a23deb54d.tar.bz2
m2crypto_ext-09221cfefe6f7c1d4fff320b6bcee56a23deb54d.zip
inital commit
-rw-r--r--.gitignore5
-rw-r--r--M2Crypto_ext.i17
-rw-r--r--Makefile20
3 files changed, 42 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6cb93c7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*.c
+*.o
+*.so
+*.py
+*.pyc
diff --git a/M2Crypto_ext.i b/M2Crypto_ext.i
new file mode 100644
index 0000000..f538eed
--- /dev/null
+++ b/M2Crypto_ext.i
@@ -0,0 +1,17 @@
+%module M2Crypto_ext
+
+%{
+#include <openssl/x509.h>
+#include <openssl/x509v3.h>
+%}
+
+%include <openssl/safestack.h>
+%include "constraints.i"
+
+%apply Pointer NONNULL { X509_REQ * };
+
+%inline %{
+STACK_OF(X509_EXTENSIO) *x509_req_get_extensions(X509_REQ *req) {
+ return X509_REQ_get_extensions(req);
+}
+%}
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b682e4d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,20 @@
+PYTHON_INCLUDES=$(shell python-config --includes)
+
+all: M2Crypto_ext
+
+clean:
+ $(RM) _M2Crypto_ext.so M2Crypto_ext.py* M2Crypto_ext_wrap.c M2Crypto_ext_wrap.o
+
+M2Crypto_ext: _M2Crypto_ext.so M2Crypto_ext.py
+
+M2Crypto_ext.py: M2Crypto_ext.i
+ swig -python -I/usr/include $<
+
+M2Crypto_ext_wrap.c: M2Crypto_ext.i
+ swig -python -I/usr/include $<
+
+M2Crypto_ext_wrap.o: M2Crypto_ext_wrap.c
+ gcc -O2 -fPIC -o $@ -c $< $(PYTHON_INCLUDES)
+
+_M2Crypto_ext.so: M2Crypto_ext_wrap.o
+ gcc -shared -o $@ $<