CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua
Module Name:src Committed By: sevan Date: Mon Apr 30 22:17:47 UTC 2018 Modified Files: src/crypto/external/bsd/netpgp/dist/bindings/lua: netpgp.lua Log Message: The secret key is required for decryption and signing. Indicate it by setting the "need seckey" variable before calling init. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 \ src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.5 src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.6 --- src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.5 Sun Apr 29 23:30:59 2018 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua Mon Apr 30 22:17:46 2018 @@ -32,7 +32,7 @@ -- command line args dofile "optparse.lua" -opt = OptionParser{usage="%prog [options] file", version="20180428"} +opt = OptionParser{usage="%prog [options] file", version="20180430"} opt.add_option{"-s", "--sign", action="store_true", dest="sign", help="--sign [--detached] [--armour] file"} opt.add_option{"-v", "--verify", action="store_true", dest="verify", help="--verify [--armour] file"} @@ -72,6 +72,9 @@ end if options.homedir then netpgp.homedir(pgp, options.homedir) end +if options.decrypt or options.sign then +netpgp.setvar(pgp, "need seckey", 1) +end -- initialise everything netpgp.init(pgp)
CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua
Module Name:src Committed By: sevan Date: Mon Apr 30 21:40:59 UTC 2018 Modified Files: src/crypto/external/bsd/netpgp/dist/bindings/lua: optparse.lua Log Message: Unbreak script for Lua 5.3. This change breaks support for older releases of Lua but it is deemed ok. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/crypto/external/bsd/netpgp/dist/bindings/lua/optparse.lua Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/optparse.lua diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/optparse.lua:1.1 src/crypto/external/bsd/netpgp/dist/bindings/lua/optparse.lua:1.2 --- src/crypto/external/bsd/netpgp/dist/bindings/lua/optparse.lua:1.1 Mon Oct 12 02:55:46 2009 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/optparse.lua Mon Apr 30 21:40:59 2018 @@ -42,7 +42,7 @@ function OptionParser(t) end function o.parse_args() -- expand options (e.g. "--input=file" -> "--input", "file") -local arg = {unpack(arg)} +local arg = {table.unpack(arg)} for i=#arg,1,-1 do local v = arg[i] local flag, val = v:match('^(%-%-%w+)=(.*)') if flag then
CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua
Module Name:src Committed By: sevan Date: Sun Apr 29 23:31:00 UTC 2018 Modified Files: src/crypto/external/bsd/netpgp/dist/bindings/lua: netpgp.lua Log Message: sign_file function expects 5 parameters, include the output filename. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.4 src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.5 --- src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.4 Mon Oct 19 01:07:08 2009 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua Sun Apr 29 23:30:59 2018 @@ -32,7 +32,7 @@ -- command line args dofile "optparse.lua" -opt = OptionParser{usage="%prog [options] file", version="20090711"} +opt = OptionParser{usage="%prog [options] file", version="20180428"} opt.add_option{"-s", "--sign", action="store_true", dest="sign", help="--sign [--detached] [--armour] file"} opt.add_option{"-v", "--verify", action="store_true", dest="verify", help="--verify [--armour] file"} @@ -89,7 +89,7 @@ for i = 1, #args do end if options.sign then -- detached signature - netpgp.sign_file(pgp, args[1], output, armour, detached) + netpgp.sign_file(pgp, args[1], args[1] .. ".sig", armour, detached) os.execute("ls -l " .. args[1] .. ".sig") end if options.verify then
CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua
Module Name:src Committed By: sevan Date: Sun Apr 29 19:34:57 UTC 2018 Modified Files: src/crypto/external/bsd/netpgp/dist/bindings/lua: glue.c Log Message: Add support for Lua 5.3 To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.4 src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.5 --- src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.4 Sun Apr 29 19:31:38 2018 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c Sun Apr 29 19:34:57 2018 @@ -334,7 +334,7 @@ l_getvar(lua_State *L) return 1; } -const struct luaL_reg libluanetpgp[] = { +const struct luaL_Reg libluanetpgp[] = { { "new", l_new }, { "init", l_init }, @@ -358,6 +358,10 @@ const struct luaL_reg libluanetpgp[] = { int luaopen_netpgp(lua_State *L) { - luaL_openlib(L, "netpgp", libluanetpgp, 0); +#if LUA_VERSION_NUM >= 502 + luaL_newlib(L, libluanetpgp); +#else + luaL_register(L, "netpgp", libluanetpgp); +#endif return 1; }
CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua
Module Name:src Committed By: sevan Date: Sun Apr 29 19:31:38 UTC 2018 Modified Files: src/crypto/external/bsd/netpgp/dist/bindings/lua: glue.c Log Message: Enable checking arguments for validity. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.3 src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.4 --- src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.3 Sun Apr 29 19:28:11 2018 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c Sun Apr 29 19:31:38 2018 @@ -38,6 +38,7 @@ #include #define LUA_LIB +#define LUA_USE_APICHECK #include #include #include
CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua
Module Name:src Committed By: sevan Date: Sun Apr 29 19:28:11 UTC 2018 Modified Files: src/crypto/external/bsd/netpgp/dist/bindings/lua: glue.c Log Message: Utilise the passed output filename rather that using a hardcoded name To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.2 src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.3 --- src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.2 Sun Oct 18 07:14:19 2009 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c Sun Apr 29 19:28:11 2018 @@ -161,7 +161,7 @@ l_encrypt_file(lua_State *L) } armour = findtype(armourtypes, luaL_checkstring(L, 4)); ret = netpgp_encrypt_file(netpgp, netpgp_getvar(netpgp, "userid"), -f, __UNCONST("a.gpg"), armour); +f, __UNCONST(output), armour); lua_pushnumber(L, ret); return 1; }
CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua
Module Name:src Committed By: agc Date: Sun Oct 18 07:14:19 UTC 2009 Modified Files: src/crypto/external/bsd/netpgp/dist/bindings/lua: glue.c Log Message: Minor renaming of lua array Zero allocated storage after return from lua_newuserdata() To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.1 src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.2 --- src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.1 Mon Oct 12 02:55:46 2009 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c Sun Oct 18 07:14:19 2009 @@ -104,6 +104,7 @@ netpgp_t *netpgp; netpgp = lua_newuserdata(L, sizeof(*netpgp)); + (void) memset(netpgp, 0x0, sizeof(*netpgp)); set_homedir(netpgp, getenv(HOME), /.gnupg, 1); netpgp_setvar(netpgp, hash, DEFAULT_HASH_ALG); return 1; @@ -332,7 +333,7 @@ return 1; } -const struct luaL_reg libnetpgp[] = { +const struct luaL_reg libluanetpgp[] = { { new, l_new }, { init, l_init }, @@ -356,6 +357,6 @@ int luaopen_netpgp(lua_State *L) { - luaL_openlib(L, netpgp, libnetpgp, 0); + luaL_openlib(L, netpgp, libluanetpgp, 0); return 1; }
CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua
Module Name:src Committed By: agc Date: Sun Oct 18 07:14:55 UTC 2009 Added Files: src/crypto/external/bsd/netpgp/dist/bindings/lua: shlib_version Log Message: Create .so from the lua interface library To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 \ src/crypto/external/bsd/netpgp/dist/bindings/lua/shlib_version Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/shlib_version diff -u /dev/null src/crypto/external/bsd/netpgp/dist/bindings/lua/shlib_version:1.1 --- /dev/null Sun Oct 18 07:14:55 2009 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/shlib_version Sun Oct 18 07:14:55 2009 @@ -0,0 +1,2 @@ +major=0 +minor=0
CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua
Module Name:src Committed By: agc Date: Sun Oct 18 07:15:43 UTC 2009 Modified Files: src/crypto/external/bsd/netpgp/dist/bindings/lua: Makefile Log Message: Link in the netpgp shared library to the lua glue library To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile:1.1 src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile:1.2 --- src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile:1.1 Mon Oct 12 02:55:46 2009 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile Sun Oct 18 07:15:43 2009 @@ -1,10 +1,13 @@ #PREFIX=/Users/agcrooks PREFIX=/usr +#LIBDIR=/usr/lib + LIB=luanetpgp SRCS=glue.c MKMAN=no CPPFLAGS+=-g -I${PREFIX}/pkg/include +LDADD+= -lnetpgp WARNS=4 .include bsd.lib.mk
CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua
Module Name:src Committed By: agc Date: Sun Oct 18 07:17:28 UTC 2009 Modified Files: src/crypto/external/bsd/netpgp/dist/bindings/lua: netpgp.lua Log Message: Minor changes to find lua glue library, and to set the home directory on the correct C/Lua structure To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.1 src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.2 --- src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.1 Mon Oct 12 02:55:46 2009 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua Sun Oct 18 07:17:28 2009 @@ -50,7 +50,8 @@ extension = .dylib io.close(f) end -glupkg = package.loadlib(libluanetpgp .. extension, luaopen_netpgp) +glupkg = package.loadlib(./ .. libluanetpgp .. extension, + luaopen_netpgp) netpgp = glupkg() -- initialise @@ -70,7 +71,7 @@ detached = detached end if options.homedir then - netpgp.homedir(netpgp, options.homedir) + netpgp.homedir(pgp, options.homedir) end -- initialise everything
CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua
Module Name:src Committed By: agc Date: Sun Oct 18 07:23:37 UTC 2009 Modified Files: src/crypto/external/bsd/netpgp/dist/bindings/lua: netpgp.lua Log Message: Use a lua for loop in preference to a while and increment in the lua example code - suggested by Marc Balmer. % make USETOOLS=no t cp Makefile a ./netpgp.lua --sign --detached a netpgp: default key set to C0596823 pub 2048/RSA (Encrypt or Sign) 1b68dcfcc0596823 2004-01-12 Key fingerprint: d415 9deb 336d e4cc cdfa 00cd 1b68 dcfc c059 6823 uid Alistair Crooks a...@netbsd.org uid Alistair Crooks a...@pkgsrc.org uid Alistair Crooks a...@alistaircrooks.com uid Alistair Crooks alist...@hockley-crooks.com netpgp passphrase: -rw-r--r-- 1 agc agc 287 Oct 17 15:58 a.sig ./netpgp.lua --verify a.sig netpgp: default key set to C0596823 netpgp: assuming signed data in a Good signature for a.sig made Sat Oct 17 15:58:09 2009 using RSA (Encrypt or Sign) key 1b68dcfcc0596823 pub 2048/RSA (Encrypt or Sign) 1b68dcfcc0596823 2004-01-12 Key fingerprint: d415 9deb 336d e4cc cdfa 00cd 1b68 dcfc c059 6823 uid Alistair Crooks alist...@hockley-crooks.com uid Alistair Crooks a...@pkgsrc.org uid Alistair Crooks a...@netbsd.org uid Alistair Crooks a...@alistaircrooks.com % To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.2 src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.3 --- src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.2 Sun Oct 18 07:17:28 2009 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua Sun Oct 18 07:23:37 2009 @@ -77,8 +77,8 @@ -- initialise everything netpgp.init(pgp) -local i = 1 -while i = #args do +local i +for i = 1, #args do if options.encrypt then -- encrypt a file netpgp.encrypt_file(pgp, args[1], output, armour) @@ -97,5 +97,4 @@ -- verification of detached signature netpgp.verify_file(pgp, args[1], armour) end - i = i + 1 end
CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua
Module Name:src Committed By: agc Date: Mon Oct 19 01:07:08 UTC 2009 Modified Files: src/crypto/external/bsd/netpgp/dist/bindings/lua: Makefile netpgp.lua Log Message: Use LD_LIBRARY_PATH to manage the library path, and don't try to second guess from the lua driver program To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile cvs rdiff -u -r1.3 -r1.4 \ src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile:1.2 src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile:1.3 --- src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile:1.2 Sun Oct 18 07:15:43 2009 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile Mon Oct 19 01:07:08 2009 @@ -11,6 +11,9 @@ WARNS=4 .include bsd.lib.mk +.include bsd.own.mk + +LUANETPGPOBJDIR != cd ${.CURDIR} ${PRINTOBJDIR} OPSYS!= uname -s @@ -28,6 +31,6 @@ .else t: cp Makefile a - ./netpgp.lua --sign --detached a - ./netpgp.lua --verify a.sig + env LD_LIBRARY_PATH=${LUANETPGPOBJDIR}:/lib:/usr/lib:${PREFIX}/lib ./netpgp.lua --sign --detached a + env LD_LIBRARY_PATH=${LUANETPGPOBJDIR}:/lib:/usr/lib:${PREFIX}/lib ./netpgp.lua --verify a.sig .endif Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.3 src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.4 --- src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.3 Sun Oct 18 07:23:37 2009 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua Mon Oct 19 01:07:08 2009 @@ -50,8 +50,7 @@ extension = .dylib io.close(f) end -glupkg = package.loadlib(./ .. libluanetpgp .. extension, - luaopen_netpgp) +glupkg = package.loadlib(libluanetpgp .. extension, luaopen_netpgp) netpgp = glupkg() -- initialise
CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua
Module Name:src Committed By: agc Date: Mon Oct 19 05:17:46 UTC 2009 Modified Files: src/crypto/external/bsd/netpgp/dist/bindings/lua: Makefile Log Message: Add 'a' and 'a.sig' to CLEANFILES - from Marc Balmer Wrap long lines To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile:1.3 src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile:1.4 --- src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile:1.3 Mon Oct 19 01:07:08 2009 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile Mon Oct 19 05:17:46 2009 @@ -9,6 +9,7 @@ CPPFLAGS+=-g -I${PREFIX}/pkg/include LDADD+= -lnetpgp WARNS=4 +CLEANFILES+= a a.sig .include bsd.lib.mk .include bsd.own.mk @@ -31,6 +32,8 @@ .else t: cp Makefile a - env LD_LIBRARY_PATH=${LUANETPGPOBJDIR}:/lib:/usr/lib:${PREFIX}/lib ./netpgp.lua --sign --detached a - env LD_LIBRARY_PATH=${LUANETPGPOBJDIR}:/lib:/usr/lib:${PREFIX}/lib ./netpgp.lua --verify a.sig + env LD_LIBRARY_PATH=${LUANETPGPOBJDIR}:/lib:/usr/lib:${PREFIX}/lib \ + ./netpgp.lua --sign --detached a + env LD_LIBRARY_PATH=${LUANETPGPOBJDIR}:/lib:/usr/lib:${PREFIX}/lib \ + ./netpgp.lua --verify a.sig .endif
CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua
Module Name:src Committed By: agc Date: Mon Oct 12 02:55:46 UTC 2009 Added Files: src/crypto/external/bsd/netpgp/dist/bindings/lua: Makefile glue.c netpgp.lua optparse.lua Log Message: Add lua language bindings for netpgp To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 \ src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile \ src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c \ src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua \ src/crypto/external/bsd/netpgp/dist/bindings/lua/optparse.lua Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile diff -u /dev/null src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile:1.1 --- /dev/null Mon Oct 12 02:55:46 2009 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/Makefile Mon Oct 12 02:55:46 2009 @@ -0,0 +1,30 @@ +#PREFIX=/Users/agcrooks +PREFIX=/usr + +LIB=luanetpgp +SRCS=glue.c +MKMAN=no +CPPFLAGS+=-g -I${PREFIX}/pkg/include +WARNS=4 + +.include bsd.lib.mk + +OPSYS!= uname -s + +.if ${OPSYS} == Darwin +.sinclude bsd.warns.mk + +lib${LIB}.dylib: + libtool -dynamic -o ${.TARGET} ${OBJS} ${PREFIX}/pkg/lib/liblua.dylib /usr/lib/libc.dylib ${PREFIX}/pkg/lib/libnetpgp.dylib + +t: lib${LIB}.dylib + cp Makefile a + ./netpgp.lua --sign --detached a + ./netpgp.lua --verify a.sig + +.else +t: + cp Makefile a + ./netpgp.lua --sign --detached a + ./netpgp.lua --verify a.sig +.endif Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c diff -u /dev/null src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.1 --- /dev/null Mon Oct 12 02:55:46 2009 +++ src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c Mon Oct 12 02:55:46 2009 @@ -0,0 +1,361 @@ +/*- + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Alistair Crooks (a...@netbsd.org) + * + * 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. + */ +#include sys/types.h +#include sys/param.h +#include sys/stat.h + +#include inttypes.h +#include netpgp.h +#include string.h +#include stdio.h +#include stdlib.h +#include unistd.h + +#define LUA_LIB +#include lua.h +#include lauxlib.h +#include lualib.h + +#ifndef __UNCONST +#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) +#endif /* !__UNCONST */ + +#define DEFAULT_HASH_ALGSHA256 + +int luaopen_netpgp(lua_State *); + +typedef struct strarg_t { + const char *s; /* string */ + const int n; /* corresponding int value */ +} strarg_t; + +/* map a string onto an int */ +static int +findtype(strarg_t *strs, const char *s) +{ + strarg_t *sp; + + for (sp = strs ; sp-s strcasecmp(sp-s, s) != 0 ; sp++) { + } + return sp-n; +} + +/* set the home directory value to home/subdir */ +static int +set_homedir(netpgp_t *netpgp, char *home, const char *subdir, const int quiet) +{ + struct stat st; + char d[MAXPATHLEN]; + + if (home == NULL) { + if (!quiet) { + (void) fprintf(stderr, NULL HOME directory\n); + } + return 0; + } + (void) snprintf(d, sizeof(d), %s%s, home, (subdir) ? subdir : ); + if (stat(d, st) == 0) { + if ((st.st_mode S_IFMT) == S_IFDIR) { + netpgp_setvar(netpgp, homedir, d); + return 1; + } + (void) fprintf(stderr, netpgp: homedir \%s\ is not a dir\n, + d); + return 0; + } + if (!quiet) { + (void) fprintf(stderr, + netpgp: warning homedir \%s\ not found\n, d); + } + return 1; +} + + +/* init() */ +static int +l_new(lua_State *L) +{ + netpgp_t *netpgp; + + netpgp = lua_newuserdata(L, sizeof(*netpgp)); + set_homedir(netpgp, getenv(HOME),