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 Add language bindin...



details:   https://anonhg.NetBSD.org/src/rev/feb5aba33084
branches:  trunk
changeset: 749504:feb5aba33084
user:      agc <agc%NetBSD.org@localhost>
date:      Tue Dec 01 06:43:57 2009 +0000

description:
Add language bindings for tcl and perl

diffstat:

 crypto/external/bsd/netpgp/dist/bindings/perl/Makefile          |    15 +
 crypto/external/bsd/netpgp/dist/bindings/perl/netpgp.h          |    91 +
 crypto/external/bsd/netpgp/dist/bindings/perl/netpgp.pl         |    29 +
 crypto/external/bsd/netpgp/dist/bindings/perl/netpgpperl.i      |     5 +
 crypto/external/bsd/netpgp/dist/bindings/perl/netpgpperl.pm     |   131 +
 crypto/external/bsd/netpgp/dist/bindings/perl/netpgpperl_wrap.c |  3715 ++++++++++
 crypto/external/bsd/netpgp/dist/bindings/perl/shlib_version     |    22 +
 crypto/external/bsd/netpgp/dist/bindings/tcl/Makefile           |    15 +
 crypto/external/bsd/netpgp/dist/bindings/tcl/netpgp.h           |    91 +
 crypto/external/bsd/netpgp/dist/bindings/tcl/netpgp.tcl         |    15 +
 crypto/external/bsd/netpgp/dist/bindings/tcl/netpgptcl.i        |     5 +
 crypto/external/bsd/netpgp/dist/bindings/tcl/netpgptcl_wrap.c   |  3467 +++++++++
 crypto/external/bsd/netpgp/dist/bindings/tcl/shlib_version      |    20 +
 13 files changed, 7621 insertions(+), 0 deletions(-)

diffs (truncated from 7673 to 300 lines):

diff -r d26e5d12078c -r feb5aba33084 crypto/external/bsd/netpgp/dist/bindings/perl/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/external/bsd/netpgp/dist/bindings/perl/Makefile    Tue Dec 01 06:43:57 2009 +0000
@@ -0,0 +1,15 @@
+# $NetBSD: Makefile,v 1.1 2009/12/01 06:43:57 agc Exp $
+# Automatically generated by swigit wrapper script
+
+PREFIX=/usr/pkg
+
+LIB=netpgpperl
+SRCS=netpgpperl_wrap.c
+WARNS=0
+MKMAN=no
+CPPFLAGS+=-I${PREFIX}/include
+CPPFLAGS+=-I/usr/pkg/lib/perl5/5.10.0/i386-netbsd-thread-multi/CORE
+LDFLAGS+=-L${PREFIX}/lib
+LDADD+=-lnetpgp
+
+.include <bsd.lib.mk>
diff -r d26e5d12078c -r feb5aba33084 crypto/external/bsd/netpgp/dist/bindings/perl/netpgp.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/external/bsd/netpgp/dist/bindings/perl/netpgp.h    Tue Dec 01 06:43:57 2009 +0000
@@ -0,0 +1,91 @@
+/*-
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Alistair Crooks (agc%netbsd.org@localhost)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef NETPGP_H_
+#define NETPGP_H_
+
+#ifndef __BEGIN_DECLS
+#  if defined(__cplusplus)
+#  define __BEGIN_DECLS           extern "C" {
+#  define __END_DECLS             }
+#  else
+#  define __BEGIN_DECLS
+#  define __END_DECLS
+#  endif
+#endif
+
+__BEGIN_DECLS
+
+/* structure used to hold (key,value) pair information */
+typedef struct netpgp_t {
+       unsigned          c;            /* # of elements used */
+       unsigned          size;         /* size of array */
+       char            **name;         /* key names */
+       char            **value;        /* value information */
+       void             *pubring;      /* public key ring */
+       void             *secring;      /* s3kr1t key ring */
+       void             *io;           /* the io struct for results/errs */
+       void             *passfp;       /* file pointer for password input */
+} netpgp_t;
+
+/* begin and end */
+int netpgp_init(netpgp_t *);
+int netpgp_end(netpgp_t *);
+
+/* debugging, reflection and information */
+int netpgp_set_debug(const char *);
+int netpgp_get_debug(const char *);
+const char *netpgp_get_info(const char *);
+int netpgp_list_packets(netpgp_t *, char *, int, char *);
+
+/* variables */
+int netpgp_setvar(netpgp_t *, const char *, const char *);
+char *netpgp_getvar(netpgp_t *, const char *);
+
+/* key management */
+int netpgp_list_keys(netpgp_t *);
+int netpgp_list_sigs(netpgp_t *, const char *);
+int netpgp_find_key(netpgp_t *, char *);
+char *netpgp_get_key(netpgp_t *, const char *);
+int netpgp_export_key(netpgp_t *, char *);
+int netpgp_import_key(netpgp_t *, char *);
+int netpgp_generate_key(netpgp_t *, char *, int);
+
+/* file management */
+int netpgp_encrypt_file(netpgp_t *, const char *, const char *, char *, int);
+int netpgp_decrypt_file(netpgp_t *, const char *, char *, int);
+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 */
+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);
+
+__END_DECLS
+
+#endif /* !NETPGP_H_ */
diff -r d26e5d12078c -r feb5aba33084 crypto/external/bsd/netpgp/dist/bindings/perl/netpgp.pl
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/external/bsd/netpgp/dist/bindings/perl/netpgp.pl   Tue Dec 01 06:43:57 2009 +0000
@@ -0,0 +1,29 @@
+#! /usr/pkg/bin/perl -wT
+
+# netpgp bindings for perl
+
+use lib "/usr/src/crypto/external/bsd/netpgp-bindings/dist/bindings/perl";
+
+use netpgpperl;
+
+# initializations
+$n = netpgpperlc::new_netpgp_t();
+netpgpperlc::netpgp_setvar($n, "homedir", "/home/agc/.gnupg");
+netpgpperlc::netpgp_setvar($n, "hash", "SHA256");
+netpgpperlc::netpgp_init($n);
+
+# get the default userid
+$userid = netpgpperlc::netpgp_getvar($n, "userid");
+
+foreach $i (0 .. $#ARGV) {
+       # set up file names
+       #my $in = $ARGV[$i];
+       #my $out = $in . ".gpg";
+
+       # sign the file, output is in $out
+       #netpgpperlc::netpgp_sign_file($n, $userid, $in, $out, 0, 0, 0);
+       netpgpperlc::netpgp_sign_file($n, $userid, "a", "a.gpg", 0, 0, 0);
+
+       # verify the signed file $out
+       netpgpperlc::netpgp_verify_file($n, "a.gpg", "/dev/null", 0);
+}
diff -r d26e5d12078c -r feb5aba33084 crypto/external/bsd/netpgp/dist/bindings/perl/netpgpperl.i
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/external/bsd/netpgp/dist/bindings/perl/netpgpperl.i        Tue Dec 01 06:43:57 2009 +0000
@@ -0,0 +1,5 @@
+%module netpgpperl
+%{
+#include <netpgp.h>
+%}
+%include netpgp.h
diff -r d26e5d12078c -r feb5aba33084 crypto/external/bsd/netpgp/dist/bindings/perl/netpgpperl.pm
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/external/bsd/netpgp/dist/bindings/perl/netpgpperl.pm       Tue Dec 01 06:43:57 2009 +0000
@@ -0,0 +1,131 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 1.3.31
+#
+# Don't modify this file, modify the SWIG interface instead.
+
+package netpgpperl;
+require Exporter;
+require DynaLoader;
+@ISA = qw(Exporter DynaLoader);
+package netpgpperlc;
+bootstrap netpgpperl;
+package netpgpperl;
+@EXPORT = qw( );
+
+# ---------- BASE METHODS -------------
+
+package netpgpperl;
+
+sub TIEHASH {
+    my ($classname,$obj) = @_;
+    return bless $obj, $classname;
+}
+
+sub CLEAR { }
+
+sub FIRSTKEY { }
+
+sub NEXTKEY { }
+
+sub FETCH {
+    my ($self,$field) = @_;
+    my $member_func = "swig_${field}_get";
+    $self->$member_func();
+}
+
+sub STORE {
+    my ($self,$field,$newval) = @_;
+    my $member_func = "swig_${field}_set";
+    $self->$member_func($newval);
+}
+
+sub this {
+    my $ptr = shift;
+    return tied(%$ptr);
+}
+
+
+# ------- FUNCTION WRAPPERS --------
+
+package netpgpperl;
+
+*netpgp_init = *netpgpperlc::netpgp_init;
+*netpgp_end = *netpgpperlc::netpgp_end;
+*netpgp_set_debug = *netpgpperlc::netpgp_set_debug;
+*netpgp_get_debug = *netpgpperlc::netpgp_get_debug;
+*netpgp_get_info = *netpgpperlc::netpgp_get_info;
+*netpgp_list_packets = *netpgpperlc::netpgp_list_packets;
+*netpgp_setvar = *netpgpperlc::netpgp_setvar;
+*netpgp_getvar = *netpgpperlc::netpgp_getvar;
+*netpgp_list_keys = *netpgpperlc::netpgp_list_keys;
+*netpgp_list_sigs = *netpgpperlc::netpgp_list_sigs;
+*netpgp_find_key = *netpgpperlc::netpgp_find_key;
+*netpgp_get_key = *netpgpperlc::netpgp_get_key;
+*netpgp_export_key = *netpgpperlc::netpgp_export_key;
+*netpgp_import_key = *netpgpperlc::netpgp_import_key;
+*netpgp_generate_key = *netpgpperlc::netpgp_generate_key;
+*netpgp_encrypt_file = *netpgpperlc::netpgp_encrypt_file;
+*netpgp_decrypt_file = *netpgpperlc::netpgp_decrypt_file;
+*netpgp_sign_file = *netpgpperlc::netpgp_sign_file;
+*netpgp_verify_file = *netpgpperlc::netpgp_verify_file;
+*netpgp_sign_memory = *netpgpperlc::netpgp_sign_memory;
+*netpgp_verify_memory = *netpgpperlc::netpgp_verify_memory;
+
+############# Class : netpgpperl::netpgp_t ##############
+
+package netpgpperl::netpgp_t;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+@ISA = qw( netpgpperl );
+%OWNER = ();
+%ITERATORS = ();
+*swig_c_get = *netpgpperlc::netpgp_t_c_get;
+*swig_c_set = *netpgpperlc::netpgp_t_c_set;
+*swig_size_get = *netpgpperlc::netpgp_t_size_get;
+*swig_size_set = *netpgpperlc::netpgp_t_size_set;
+*swig_name_get = *netpgpperlc::netpgp_t_name_get;
+*swig_name_set = *netpgpperlc::netpgp_t_name_set;
+*swig_value_get = *netpgpperlc::netpgp_t_value_get;
+*swig_value_set = *netpgpperlc::netpgp_t_value_set;
+*swig_pubring_get = *netpgpperlc::netpgp_t_pubring_get;
+*swig_pubring_set = *netpgpperlc::netpgp_t_pubring_set;
+*swig_secring_get = *netpgpperlc::netpgp_t_secring_get;
+*swig_secring_set = *netpgpperlc::netpgp_t_secring_set;
+*swig_io_get = *netpgpperlc::netpgp_t_io_get;
+*swig_io_set = *netpgpperlc::netpgp_t_io_set;
+*swig_passfp_get = *netpgpperlc::netpgp_t_passfp_get;
+*swig_passfp_set = *netpgpperlc::netpgp_t_passfp_set;
+sub new {
+    my $pkg = shift;
+    my $self = netpgpperlc::new_netpgp_t(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        netpgpperlc::delete_netpgp_t($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+# ------- VARIABLE STUBS --------
+
+package netpgpperl;
+
+1;
diff -r d26e5d12078c -r feb5aba33084 crypto/external/bsd/netpgp/dist/bindings/perl/netpgpperl_wrap.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/external/bsd/netpgp/dist/bindings/perl/netpgpperl_wrap.c   Tue Dec 01 06:43:57 2009 +0000
@@ -0,0 +1,3715 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.31
+ * 
+ * This file is not intended to be easily readable and contains a number of 



Home | Main Index | Thread Index | Old Index