Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/netpgp/dist/bindings/python update pytho...



details:   https://anonhg.NetBSD.org/src/rev/2ebd3b356f9f
branches:  trunk
changeset: 754347:2ebd3b356f9f
user:      agc <agc%NetBSD.org@localhost>
date:      Wed Apr 28 14:41:13 2010 +0000

description:
update python bindings to work with newer library interface

diffstat:

 crypto/external/bsd/netpgp/dist/bindings/python/Makefile            |    5 +-
 crypto/external/bsd/netpgp/dist/bindings/python/netpgp.h            |   24 +-
 crypto/external/bsd/netpgp/dist/bindings/python/netpgppython.py     |    9 +-
 crypto/external/bsd/netpgp/dist/bindings/python/netpgppython_wrap.c |  461 +++++++++-
 4 files changed, 468 insertions(+), 31 deletions(-)

diffs (truncated from 682 to 300 lines):

diff -r 14250e0766e7 -r 2ebd3b356f9f crypto/external/bsd/netpgp/dist/bindings/python/Makefile
--- a/crypto/external/bsd/netpgp/dist/bindings/python/Makefile  Wed Apr 28 14:23:57 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/bindings/python/Makefile  Wed Apr 28 14:41:13 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2009/12/02 00:32:06 agc Exp $
+# $NetBSD: Makefile,v 1.2 2010/04/28 14:41:13 agc Exp $
 # Automatically generated by swigit wrapper script
 
 PREFIX=/usr/pkg
@@ -13,3 +13,6 @@
 LDADD+=-lnetpgp
 
 .include <bsd.lib.mk>
+
+full:
+       ln libnetpgppython.so _netpgppython.so
diff -r 14250e0766e7 -r 2ebd3b356f9f crypto/external/bsd/netpgp/dist/bindings/python/netpgp.h
--- a/crypto/external/bsd/netpgp/dist/bindings/python/netpgp.h  Wed Apr 28 14:23:57 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/bindings/python/netpgp.h  Wed Apr 28 14:41:13 2010 +0000
@@ -66,13 +66,17 @@
 /* variables */
 int netpgp_setvar(netpgp_t *, const char *, const char *);
 char *netpgp_getvar(netpgp_t *, const char *);
+int netpgp_incvar(netpgp_t *, const char *, const int);
+int netpgp_unsetvar(netpgp_t *, const char *);
+
+/* set home directory information */
+int netpgp_set_homedir(netpgp_t *, char *, const char *, const int);
 
 /* key management */
-int netpgp_list_keys(netpgp_t *);
-int netpgp_list_sigs(netpgp_t *, const char *);
+int netpgp_list_keys(netpgp_t *, const int);
 int netpgp_find_key(netpgp_t *, char *);
-char *netpgp_get_key(netpgp_t *, const char *);
-int netpgp_export_key(netpgp_t *, char *);
+char *netpgp_get_key(netpgp_t *, const char *, const char *);
+char *netpgp_export_key(netpgp_t *, char *);
 int netpgp_import_key(netpgp_t *, char *);
 int netpgp_generate_key(netpgp_t *, char *, int);
 
@@ -82,9 +86,17 @@
 int netpgp_sign_file(netpgp_t *, const char *, const char *, char *, int, int, int);
 int netpgp_verify_file(netpgp_t *, const char *, const char *, int);
 
-/* memory signing */
+/* memory signing and encryption */
 int netpgp_sign_memory(netpgp_t *, const char *, char *, size_t, char *, size_t, const unsigned, const unsigned);
-int netpgp_verify_memory(netpgp_t *, const void *, const size_t, const int);
+int netpgp_verify_memory(netpgp_t *, const void *, const size_t, void *, size_t, const int);
+int netpgp_encrypt_memory(netpgp_t *, const char *, void *, const size_t, char *, size_t, int);
+int netpgp_decrypt_memory(netpgp_t *, const void *, const size_t, char *, size_t, const int);
+
+/* match and hkp-related functions */
+int netpgp_match_keys(netpgp_t *, char *, const char *, void *, const int);
+int netpgp_match_pubkeys(netpgp_t *, char *, void *);
+
+int netpgp_validate_sigs(netpgp_t *);
 
 __END_DECLS
 
diff -r 14250e0766e7 -r 2ebd3b356f9f crypto/external/bsd/netpgp/dist/bindings/python/netpgppython.py
--- a/crypto/external/bsd/netpgp/dist/bindings/python/netpgppython.py   Wed Apr 28 14:23:57 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/bindings/python/netpgppython.py   Wed Apr 28 14:41:13 2010 +0000
@@ -95,8 +95,10 @@
 netpgp_list_packets = _netpgppython.netpgp_list_packets
 netpgp_setvar = _netpgppython.netpgp_setvar
 netpgp_getvar = _netpgppython.netpgp_getvar
+netpgp_incvar = _netpgppython.netpgp_incvar
+netpgp_unsetvar = _netpgppython.netpgp_unsetvar
+netpgp_set_homedir = _netpgppython.netpgp_set_homedir
 netpgp_list_keys = _netpgppython.netpgp_list_keys
-netpgp_list_sigs = _netpgppython.netpgp_list_sigs
 netpgp_find_key = _netpgppython.netpgp_find_key
 netpgp_get_key = _netpgppython.netpgp_get_key
 netpgp_export_key = _netpgppython.netpgp_export_key
@@ -108,5 +110,10 @@
 netpgp_verify_file = _netpgppython.netpgp_verify_file
 netpgp_sign_memory = _netpgppython.netpgp_sign_memory
 netpgp_verify_memory = _netpgppython.netpgp_verify_memory
+netpgp_encrypt_memory = _netpgppython.netpgp_encrypt_memory
+netpgp_decrypt_memory = _netpgppython.netpgp_decrypt_memory
+netpgp_match_keys = _netpgppython.netpgp_match_keys
+netpgp_match_pubkeys = _netpgppython.netpgp_match_pubkeys
+netpgp_validate_sigs = _netpgppython.netpgp_validate_sigs
 
 
diff -r 14250e0766e7 -r 2ebd3b356f9f crypto/external/bsd/netpgp/dist/bindings/python/netpgppython_wrap.c
--- a/crypto/external/bsd/netpgp/dist/bindings/python/netpgppython_wrap.c       Wed Apr 28 14:23:57 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/bindings/python/netpgppython_wrap.c       Wed Apr 28 14:41:13 2010 +0000
@@ -3533,29 +3533,50 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_netpgp_list_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_netpgp_incvar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   netpgp_t *arg1 = (netpgp_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
   int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int val3 ;
+  int ecode3 = 0 ;
   PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:netpgp_list_keys",&obj0)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOO:netpgp_incvar",&obj0,&obj1,&obj2)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_netpgp_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "netpgp_list_keys" "', argument " "1"" of type '" "netpgp_t *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "netpgp_incvar" "', argument " "1"" of type '" "netpgp_t *""'"); 
   }
   arg1 = (netpgp_t *)(argp1);
-  result = (int)netpgp_list_keys(arg1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "netpgp_incvar" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = (char *)(buf2);
+  ecode3 = SWIG_AsVal_int(obj2, &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "netpgp_incvar" "', argument " "3"" of type '" "int""'");
+  } 
+  arg3 = (int)(val3);
+  result = (int)netpgp_incvar(arg1,(char const *)arg2,arg3);
   resultobj = SWIG_From_int((int)(result));
+  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
   return resultobj;
 fail:
+  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_netpgp_list_sigs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_netpgp_unsetvar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   netpgp_t *arg1 = (netpgp_t *) 0 ;
   char *arg2 = (char *) 0 ;
@@ -3568,18 +3589,18 @@
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:netpgp_list_sigs",&obj0,&obj1)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OO:netpgp_unsetvar",&obj0,&obj1)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_netpgp_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "netpgp_list_sigs" "', argument " "1"" of type '" "netpgp_t *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "netpgp_unsetvar" "', argument " "1"" of type '" "netpgp_t *""'"); 
   }
   arg1 = (netpgp_t *)(argp1);
   res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "netpgp_list_sigs" "', argument " "2"" of type '" "char const *""'");
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "netpgp_unsetvar" "', argument " "2"" of type '" "char const *""'");
   }
   arg2 = (char *)(buf2);
-  result = (int)netpgp_list_sigs(arg1,(char const *)arg2);
+  result = (int)netpgp_unsetvar(arg1,(char const *)arg2);
   resultobj = SWIG_From_int((int)(result));
   if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
   return resultobj;
@@ -3589,6 +3610,92 @@
 }
 
 
+SWIGINTERN PyObject *_wrap_netpgp_set_homedir(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  netpgp_t *arg1 = (netpgp_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int val4 ;
+  int ecode4 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:netpgp_set_homedir",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_netpgp_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "netpgp_set_homedir" "', argument " "1"" of type '" "netpgp_t *""'"); 
+  }
+  arg1 = (netpgp_t *)(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "netpgp_set_homedir" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = (char *)(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "netpgp_set_homedir" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = (char *)(buf3);
+  ecode4 = SWIG_AsVal_int(obj3, &val4);
+  if (!SWIG_IsOK(ecode4)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "netpgp_set_homedir" "', argument " "4"" of type '" "int""'");
+  } 
+  arg4 = (int)(val4);
+  result = (int)netpgp_set_homedir(arg1,arg2,(char const *)arg3,arg4);
+  resultobj = SWIG_From_int((int)(result));
+  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_netpgp_list_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  netpgp_t *arg1 = (netpgp_t *) 0 ;
+  int arg2 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:netpgp_list_keys",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_netpgp_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "netpgp_list_keys" "', argument " "1"" of type '" "netpgp_t *""'"); 
+  }
+  arg1 = (netpgp_t *)(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "netpgp_list_keys" "', argument " "2"" of type '" "int""'");
+  } 
+  arg2 = (int)(val2);
+  result = (int)netpgp_list_keys(arg1,arg2);
+  resultobj = SWIG_From_int((int)(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_netpgp_find_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   netpgp_t *arg1 = (netpgp_t *) 0 ;
@@ -3627,16 +3734,21 @@
   PyObject *resultobj = 0;
   netpgp_t *arg1 = (netpgp_t *) 0 ;
   char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
   char *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 ;
   char *buf2 = 0 ;
   int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:netpgp_get_key",&obj0,&obj1)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOO:netpgp_get_key",&obj0,&obj1,&obj2)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_netpgp_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "netpgp_get_key" "', argument " "1"" of type '" "netpgp_t *""'"); 
@@ -3647,12 +3759,19 @@
     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "netpgp_get_key" "', argument " "2"" of type '" "char const *""'");
   }
   arg2 = (char *)(buf2);
-  result = (char *)netpgp_get_key(arg1,(char const *)arg2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "netpgp_get_key" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = (char *)(buf3);
+  result = (char *)netpgp_get_key(arg1,(char const *)arg2,(char const *)arg3);
   resultobj = SWIG_FromCharPtr((const char *)result);
   if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
   return resultobj;



Home | Main Index | Thread Index | Old Index