Permalink
Browse files

Import netpgp source into crypto/external - this is a heavily-modified

version of openpgpsdk, and will replace it. Differences between netpgp
and the NetBSD repository version of openpgpsdk are:

+ Wrap source code in GNU autoconf/configure
+ New high-level interface for libnetpgp(3) and netpgp(1)
+ Hide prolifery of local headers in the internal lib directory -
  there is now one exported header called netpgp.h
+ Hide all ops_* functions and structs behind __ops_* names
+ Fix long-standing bug - make decryption work with files > 8192 bytes
  (fix for signature verification of signed files > 8192 bytes was already
  brought forward from the NetBSD repository of openpgpsdk)
+ Use mmap(2) to read files, falls back to read(2) if can't do mmap
+ Compile portable package using libtool
+ Rationalise the number of source files - merge a number of smaller ones
+ Case-insensitive matching of key ids
+ Use PRIsize throughout
+ Use calloc(3) throughout to zero memory
+ Get rid of global symbols which abused a macro
+ Use more descriptive names - remove "_arg_" components, name things for their
  purpose, rather than what they are (their type)
+ No more --passphrase= argument to netpgp(1) - this is now always
  done through callbacks
+ Report source code date and build date in version number, as well as the
  version number itself

This will form the basis of the portable netpgp package.
  • Loading branch information...
agc
agc committed Apr 23, 2009
1 parent a2bca40 commit 1cc2adc795e357117d908a826dae63d3884d261a
Showing with 87,629 additions and 0 deletions.
  1. +7 −0 crypto/external/bsd/netpgp/Makefile
  2. +23 −0 crypto/external/bsd/netpgp/bin/Makefile
  3. +36 −0 crypto/external/bsd/netpgp/dist/Licence
  4. +118 −0 crypto/external/bsd/netpgp/dist/Makefile
  5. +118 −0 crypto/external/bsd/netpgp/dist/Makefile.in
  6. +43 −0 crypto/external/bsd/netpgp/dist/TODO
  7. +6,266 −0 crypto/external/bsd/netpgp/dist/autom4te.cache/output.0
  8. +63 −0 crypto/external/bsd/netpgp/dist/autom4te.cache/requests
  9. +394 −0 crypto/external/bsd/netpgp/dist/autom4te.cache/traces.0
  10. +1,516 −0 crypto/external/bsd/netpgp/dist/config.guess
  11. +1,134 −0 crypto/external/bsd/netpgp/dist/config.log
  12. +873 −0 crypto/external/bsd/netpgp/dist/config.status
  13. +1,622 −0 crypto/external/bsd/netpgp/dist/config.sub
  14. +6,266 −0 crypto/external/bsd/netpgp/dist/configure
  15. +46 −0 crypto/external/bsd/netpgp/dist/configure.ac
  16. +15 −0 crypto/external/bsd/netpgp/dist/doc/Makefile
  17. +122 −0 crypto/external/bsd/netpgp/dist/doc/deliverable.txt
  18. +1,215 −0 crypto/external/bsd/netpgp/dist/doc/doxygen-user.cfg
  19. +37 −0 crypto/external/bsd/netpgp/dist/doc/spec.txt
  20. +63 −0 crypto/external/bsd/netpgp/dist/include/netpgp.h
  21. +251 −0 crypto/external/bsd/netpgp/dist/install-sh
  22. +7,983 −0 crypto/external/bsd/netpgp/dist/libtool
  23. BIN crypto/external/bsd/netpgp/dist/presentations/openpgpsdk-euroscon.pdf
  24. BIN crypto/external/bsd/netpgp/dist/presentations/openpgpsdk.ppt
  25. +4,022 −0 crypto/external/bsd/netpgp/dist/ref/draft-ietf-openpgp-rfc2440bis-12-ben.txt
  26. +78 −0 crypto/external/bsd/netpgp/dist/ref/draft-ietf-openpgp-rfc2440bis-12-comments.txt
  27. +4,034 −0 crypto/external/bsd/netpgp/dist/ref/draft-ietf-openpgp-rfc2440bis-12.txt
  28. +4,028 −0 crypto/external/bsd/netpgp/dist/ref/draft-ietf-openpgp-rfc2440bis-13.txt
  29. +4,034 −0 crypto/external/bsd/netpgp/dist/ref/draft-ietf-openpgp-rfc2440bis-14.txt
  30. +4,092 −0 crypto/external/bsd/netpgp/dist/ref/draft-ietf-openpgp-rfc2440bis-15.txt
  31. +4,762 −0 crypto/external/bsd/netpgp/dist/ref/draft-ietf-openpgp-rfc2440bis-22.txt
  32. +1,179 −0 crypto/external/bsd/netpgp/dist/ref/rfc1991.txt
  33. +2,187 −0 crypto/external/bsd/netpgp/dist/ref/rfc2437.txt
  34. +3,643 −0 crypto/external/bsd/netpgp/dist/ref/rfc2440.txt
  35. +5,043 −0 crypto/external/bsd/netpgp/dist/ref/rfc4880.txt
  36. +150 −0 crypto/external/bsd/netpgp/dist/src/bin/Makefile
  37. +150 −0 crypto/external/bsd/netpgp/dist/src/bin/Makefile.in
  38. BIN crypto/external/bsd/netpgp/dist/src/bin/netpgp
  39. +271 −0 crypto/external/bsd/netpgp/dist/src/bin/netpgp.1
  40. +303 −0 crypto/external/bsd/netpgp/dist/src/bin/netpgp.c
  41. +161 −0 crypto/external/bsd/netpgp/dist/src/lib/Makefile
  42. +161 −0 crypto/external/bsd/netpgp/dist/src/lib/Makefile.in
  43. +409 −0 crypto/external/bsd/netpgp/dist/src/lib/compress.c
  44. +166 −0 crypto/external/bsd/netpgp/dist/src/lib/config.h
  45. +165 −0 crypto/external/bsd/netpgp/dist/src/lib/config.h.in
  46. +1,266 −0 crypto/external/bsd/netpgp/dist/src/lib/create.c
  47. +82 −0 crypto/external/bsd/netpgp/dist/src/lib/create.h
  48. +389 −0 crypto/external/bsd/netpgp/dist/src/lib/crypto.c
  49. +152 −0 crypto/external/bsd/netpgp/dist/src/lib/crypto.h
  50. +139 −0 crypto/external/bsd/netpgp/dist/src/lib/errors.h
  51. +1,046 −0 crypto/external/bsd/netpgp/dist/src/lib/keyring.c
  52. +92 −0 crypto/external/bsd/netpgp/dist/src/lib/keyring.h
  53. +64 −0 crypto/external/bsd/netpgp/dist/src/lib/keyring_local.h
  54. +208 −0 crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3
  55. +2 −0 crypto/external/bsd/netpgp/dist/src/lib/loccreate.h
  56. +57 −0 crypto/external/bsd/netpgp/dist/src/lib/memory.h
  57. +1,105 −0 crypto/external/bsd/netpgp/dist/src/lib/misc.c
  58. +40 −0 crypto/external/bsd/netpgp/dist/src/lib/mkinstalldirs
  59. +430 −0 crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
  60. +76 −0 crypto/external/bsd/netpgp/dist/src/lib/netpgpdefs.h
  61. +69 −0 crypto/external/bsd/netpgp/dist/src/lib/netpgpsdk.h
  62. +826 −0 crypto/external/bsd/netpgp/dist/src/lib/openssl_crypto.c
  63. +3,295 −0 crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c
  64. +133 −0 crypto/external/bsd/netpgp/dist/src/lib/packet-parse.h
  65. +1,731 −0 crypto/external/bsd/netpgp/dist/src/lib/packet-print.c
  66. +66 −0 crypto/external/bsd/netpgp/dist/src/lib/packet-show-cast.h
  67. +893 −0 crypto/external/bsd/netpgp/dist/src/lib/packet-show.c
  68. +85 −0 crypto/external/bsd/netpgp/dist/src/lib/packet-show.h
  69. +1,037 −0 crypto/external/bsd/netpgp/dist/src/lib/packet.h
  70. +121 −0 crypto/external/bsd/netpgp/dist/src/lib/parse_local.h
  71. +2,137 −0 crypto/external/bsd/netpgp/dist/src/lib/reader.c
  72. +98 −0 crypto/external/bsd/netpgp/dist/src/lib/readerwriter.h
  73. +1,358 −0 crypto/external/bsd/netpgp/dist/src/lib/signature.c
  74. +122 −0 crypto/external/bsd/netpgp/dist/src/lib/signature.h
  75. +570 −0 crypto/external/bsd/netpgp/dist/src/lib/symmetric.c
  76. +74 −0 crypto/external/bsd/netpgp/dist/src/lib/types.h
  77. +685 −0 crypto/external/bsd/netpgp/dist/src/lib/validate.c
  78. +78 −0 crypto/external/bsd/netpgp/dist/src/lib/validate.h
  79. +31 −0 crypto/external/bsd/netpgp/dist/src/lib/version.h
  80. +1,646 −0 crypto/external/bsd/netpgp/dist/src/lib/writer.c
  81. +105 −0 crypto/external/bsd/netpgp/dist/src/lib/writer.h
  82. +33 −0 crypto/external/bsd/netpgp/dist/tst
  83. +27 −0 crypto/external/bsd/netpgp/lib/Makefile
  84. +2 −0 crypto/external/bsd/netpgp/lib/shlib_version
  85. +10 −0 crypto/external/bsd/netpgp/mkdist
@@ -0,0 +1,7 @@
+# $NetBSD: Makefile,v 1.1.1.1 2009/04/23 06:31:55 agc Exp $
+
+SUBDIR= lib .WAIT
+
+SUBDIR+= bin
+
+.include <bsd.subdir.mk>
@@ -0,0 +1,23 @@
+# $NetBSD: Makefile,v 1.1.1.1 2009/04/23 06:31:55 agc Exp $
+
+.include <bsd.own.mk>
+
+PROG= netpgp
+BINDIR= /usr/bin
+
+CPPFLAGS+= -I${.CURDIR}/../dist/include
+
+LIBNETPGPDIR!= cd ${.CURDIR}/../lib && ${PRINTOBJDIR}
+LDADD+= -L${LIBNETPGPDIR} -lnetpgp
+DPADD+= ${LIBNETPGPDIR}/libnetpgp.a
+
+MAN= netpgp.1
+
+# although the code is/was WARNS=4 clean, when linking, there is a warning
+# about libidea being a patented algorithm, and WARNS>0 treats warnings as
+# errors. For now, just set WARNS off.
+WARNS= 0
+
+.PATH: ${.CURDIR}/../dist/src/bin
+
+.include <bsd.prog.mk>
@@ -0,0 +1,36 @@
+Copyright (c) 2005 Nominet UK (www.nic.uk)
+All rights reserved.
+Contributors: Ben Laurie, Rachel Willmer. The Contributors have asserted
+their moral rights under the UK Copyright Design and Patents Act 1988 to
+be recorded as the authors of this copyright work.
+
+This is a BSD-style Open Source licence.
+
+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.
+
+3. The name of Nominet UK or the contributors may not be used to
+ endorse or promote products derived from this software without specific
+ prior written permission;
+
+and provided that the user accepts the terms of the following disclaimer:
+
+THIS SOFTWARE IS PROVIDED BY NOMINET UK 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 NOMINET UK 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.
@@ -0,0 +1,118 @@
+# $Id: Makefile,v 1.1.1.1 2009/04/23 06:31:56 agc Exp $
+
+
+SHELL = /bin/sh
+
+
+PACKAGE_NAME= netpgp
+PACKAGE_VERSION= 20090408
+
+srcdir = .
+
+prefix = /Users/agcrooks/netpgp
+exec_prefix = ${prefix}
+
+bindir = ${exec_prefix}/bin
+mandir = ${prefix}/share/man
+top_builddir = .
+
+AUTOCONF = ./missing --run autoconf
+AUTOHEADER = ./missing --run autoheader
+mkinstalldirs = $(SHELL) $(srcdir)/mkinstalldirs
+install_sh = $(SHELL) $(srcdir)/install-sh
+
+INSTALL = /usr/bin/install -c
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = s,x,x,
+host_alias =
+host_triplet = i386-apple-darwin9.6.0
+CANONICAL_HOST = i386-apple-darwin9.6.0
+
+CC = gcc
+CCLD= $(CC)
+LIBS=
+CPPFLAGS=
+DEFS= -DHAVE_CONFIG_H -I. -I. -DHOST=\"$(CANONICAL_HOST)\" -DVERSION=\"$(PACKAGE_VERSION)\"
+CFLAGS= -g -O2
+LDFLAGS=
+
+LINK= $(CCLD) $(CFLAGS) $(LDFLAGS) -o $@
+COMPILE= $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS)
+
+all: lib bin
+
+lib:
+ cd src/lib && ${MAKE}
+
+bin:
+ cd src/bin && ${MAKE}
+
+install: all
+ cd src/lib && ${MAKE} install
+ cd src/bin && ${MAKE} install
+
+clean:
+ cd src/lib && ${MAKE} clean
+ cd src/bin && ${MAKE} clean
+
+GZIP_ENV= --best
+TAR= tar
+distdir= $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+
+distdir: $(DISTFILES)
+ -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+ mkdir $(distdir)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+
+dist: distdir
+ $(TAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+
+distcheck: dist
+ -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(TAR) xf -
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/=build
+ mkdir $(distdir)/=inst
+ chmod a-w $(distdir)
+ dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \
+ && cd $(distdir)/=build \
+ && ../configure --srcdir=.. --prefix=$$dc_install_base \
+ && $(MAKE) \
+ && $(MAKE) check \
+ && $(MAKE) install \
+ && $(MAKE) uninstall \
+ && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
+ || (echo "Error: files left after uninstall" 1>&2; \
+ exit 1) ) \
+ && $(MAKE) dist \
+ && $(MAKE) distclean \
+ && rm -f $(distdir).tar.gz \
+ && (test `find . -type f -print | wc -l` -eq 0 \
+ || (echo "Error: files left after distclean" 1>&2; \
+ exit 1) )
+ -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+ @echo "$(distdir).tar.gz is ready for distribution" | \
+ sed 'h;s/./=/g;p;x;p;x'
@@ -0,0 +1,118 @@
+# $Id: Makefile.in,v 1.1.1.1 2009/04/23 06:31:56 agc Exp $
+
+@SET_MAKE@
+SHELL = @SHELL@
+VPATH=@srcdir@
+
+PACKAGE_NAME= @PACKAGE_NAME@
+PACKAGE_VERSION= @PACKAGE_VERSION@
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+mandir = @mandir@
+top_builddir = .
+
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+mkinstalldirs = $(SHELL) $(srcdir)/mkinstalldirs
+install_sh = $(SHELL) $(srcdir)/install-sh
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+host_alias = @host_alias@
+host_triplet = @host@
+CANONICAL_HOST = @CANONICAL_HOST@
+
+CC = @CC@
+CCLD= $(CC)
+LIBS= @LIBS@
+CPPFLAGS= @CPPFLAGS@
+DEFS= @DEFS@ -I. -I@srcdir@ -DHOST=\"$(CANONICAL_HOST)\" -DVERSION=\"$(PACKAGE_VERSION)\"
+CFLAGS= @CFLAGS@
+LDFLAGS= @LDFLAGS@
+
+LINK= $(CCLD) $(CFLAGS) $(LDFLAGS) -o $@
+COMPILE= $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS)
+
+all: lib bin
+
+lib:
+ cd src/lib && ${MAKE}
+
+bin:
+ cd src/bin && ${MAKE}
+
+install: all
+ cd src/lib && ${MAKE} install
+ cd src/bin && ${MAKE} install
+
+clean:
+ cd src/lib && ${MAKE} clean
+ cd src/bin && ${MAKE} clean
+
+GZIP_ENV= --best
+TAR= tar
+distdir= $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+
+distdir: $(DISTFILES)
+ -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+ mkdir $(distdir)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ $(mkinstalldirs) "$(distdir)/$$dir"; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+
+dist: distdir
+ $(TAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+
+distcheck: dist
+ -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(TAR) xf -
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/=build
+ mkdir $(distdir)/=inst
+ chmod a-w $(distdir)
+ dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \
+ && cd $(distdir)/=build \
+ && ../configure --srcdir=.. --prefix=$$dc_install_base \
+ && $(MAKE) \
+ && $(MAKE) check \
+ && $(MAKE) install \
+ && $(MAKE) uninstall \
+ && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
+ || (echo "Error: files left after uninstall" 1>&2; \
+ exit 1) ) \
+ && $(MAKE) dist \
+ && $(MAKE) distclean \
+ && rm -f $(distdir).tar.gz \
+ && (test `find . -type f -print | wc -l` -eq 0 \
+ || (echo "Error: files left after distclean" 1>&2; \
+ exit 1) )
+ -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+ @echo "$(distdir).tar.gz is ready for distribution" | \
+ sed 'h;s/./=/g;p;x;p;x'
@@ -0,0 +1,43 @@
+To Do
+=====
+need a netpgp_set_{pub,sec}key()? vs _init()?
+default compression when signing
+get rid of ops_memory after used literal_data_body
+sort out callback - ops_export_key, packet-parse callback etc
+Simplify IO
+Make into SHA1Init, SHA1End, SHA1File style of calls
+Work out a way to get text out of a signed file
+Multiple recipients for encryption
+Look at inefficiencies - read() etc
+
+Done
+====
+autoconf
+libtool
+name change
+content_ naming scheme
+Brief test script
+get rid of C global
+put all readers and writers together in one file
+Add mmapped method
+merge mmap'ed and fd reads - if mmap fails, fall back to read
+Make sure all openpgpsdk changes are brought forward
+look at header file fun
+new version number in autoconf
+Make decrypt work with files > 8192 bytes
+dynamically size literal_data_body before decompressing?
+restore ops_export_key functionality
+match keyids using case insensitive matching - (c0596823 == C0596823)
+use PRIsize appropriately
+make a high-level interface
+get rid of multiple local headers
+get rid of long identifier names - all done internally now
+Finish name change for everything
+work out what's exported and what's not
+finish off main header file
+init(&netpgp, userid, pubring, secring)
+__ops
+real naming scheme
+get rid of malloc() instances -> calloc()
+change include directory
+Install man pages
Oops, something went wrong.

0 comments on commit 1cc2adc

Please sign in to comment.