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 Netpgp changes to 1.99.15/20091221
details: https://anonhg.NetBSD.org/src/rev/2bf459abafdb
branches: trunk
changeset: 750243:2bf459abafdb
user: agc <agc%NetBSD.org@localhost>
date: Tue Dec 22 06:03:24 2009 +0000
description:
Netpgp changes to 1.99.15/20091221
+ some ssh host keys do not have the username of the generator included
in the key itself. If there is no username in there, create one.
+ added netpgp_encrypt_memory() and netpgp_decrypt_memory()
+ overhaul netpgp(1) to work with stdin/stdout if no filenames specified:
% netpgp --encrypt < a | netpgp --decrypt > b
netpgp: default key set to "C0596823"
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 <agc%netbsd.org@localhost>
uid Alistair Crooks <agc%pkgsrc.org@localhost>
uid Alistair Crooks <agc%alistaircrooks.com@localhost>
uid Alistair Crooks <alistair%hockley-crooks.com@localhost>
netpgp passphrase:
% diff a b
% ls -al a b
-rw-r--r-- 1 agc agc 15243 Dec 20 08:55 a
-rw-r--r-- 1 agc agc 15243 Dec 21 17:15 b
%
% netpgp --sign < a | netpgp --cat > b
netpgp: default key set to "C0596823"
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 <agc%netbsd.org@localhost>
uid Alistair Crooks <agc%pkgsrc.org@localhost>
uid Alistair Crooks <agc%alistaircrooks.com@localhost>
uid Alistair Crooks <alistair%hockley-crooks.com@localhost>
netpgp passphrase:
Good signature for <stdin> made Mon Dec 21 18:25:02 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 <alistair%hockley-crooks.com@localhost>
uid Alistair Crooks <agc%pkgsrc.org@localhost>
uid Alistair Crooks <agc%netbsd.org@localhost>
uid Alistair Crooks <agc%alistaircrooks.com@localhost>
uid Alistair Crooks (Yahoo!) <agcrooks%yahoo-inc.com@localhost>
%
+ add explanations of memory-based operations to manual pages
diffstat:
crypto/external/bsd/netpgp/dist/TODO | 6 +-
crypto/external/bsd/netpgp/dist/configure | 22 +-
crypto/external/bsd/netpgp/dist/configure.ac | 6 +-
crypto/external/bsd/netpgp/dist/include/netpgp.h | 6 +-
crypto/external/bsd/netpgp/dist/src/lib/Makefile.in | 13 +-
crypto/external/bsd/netpgp/dist/src/lib/crypto.c | 220 ++++++++++---
crypto/external/bsd/netpgp/dist/src/lib/crypto.h | 16 +
crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 | 103 ++++--
crypto/external/bsd/netpgp/dist/src/lib/netpgp.c | 127 +++++++-
crypto/external/bsd/netpgp/dist/src/lib/signature.c | 6 +-
crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c | 16 +-
crypto/external/bsd/netpgp/dist/src/lib/validate.c | 15 +-
crypto/external/bsd/netpgp/dist/src/lib/validate.h | 1 +
crypto/external/bsd/netpgp/dist/src/lib/version.h | 2 +-
crypto/external/bsd/netpgp/dist/src/netpgp/Makefile | 8 +-
crypto/external/bsd/netpgp/dist/src/netpgp/netpgp.1 | 40 ++-
crypto/external/bsd/netpgp/dist/src/netpgp/netpgp.c | 145 ++++++++-
crypto/external/bsd/netpgp/dist/src/netpgpverify/Makefile | 8 +-
crypto/external/bsd/netpgp/lib/config.h | 6 +-
19 files changed, 592 insertions(+), 174 deletions(-)
diffs (truncated from 1306 to 300 lines):
diff -r 04472c85a64d -r 2bf459abafdb crypto/external/bsd/netpgp/dist/TODO
--- a/crypto/external/bsd/netpgp/dist/TODO Mon Dec 21 22:49:18 2009 +0000
+++ b/crypto/external/bsd/netpgp/dist/TODO Tue Dec 22 06:03:24 2009 +0000
@@ -10,10 +10,8 @@
separate from libcrypto?
64-bit offsets
thresholds
-Multiple recipients for encryption - ssss
default compression when signing?
elgamal enc/decryption?
-convert tests from ./tst to the autotest ./tests/
hkpd
Done
@@ -76,3 +74,7 @@
don't complain if no .gnupg dir (even when using --homedir)
make it work with ssh host keys
regex matching for names and signatures
+in memory encryption and decryption
+netpgpagent
+ssss
+make netpgp work from stdin/to stdout
diff -r 04472c85a64d -r 2bf459abafdb crypto/external/bsd/netpgp/dist/configure
--- a/crypto/external/bsd/netpgp/dist/configure Mon Dec 21 22:49:18 2009 +0000
+++ b/crypto/external/bsd/netpgp/dist/configure Tue Dec 22 06:03:24 2009 +0000
@@ -1,7 +1,7 @@
#! /bin/sh
-# From configure.ac Revision: 1.18 .
+# From configure.ac Revision: 1.19 .
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for netpgp 20091210.
+# Generated by GNU Autoconf 2.63 for netpgp 20091221.
#
# Report bugs to <Alistair Crooks <agc%netbsd.org@localhost> c0596823>.
#
@@ -751,8 +751,8 @@
# Identity of this package.
PACKAGE_NAME='netpgp'
PACKAGE_TARNAME='netpgp'
-PACKAGE_VERSION='20091210'
-PACKAGE_STRING='netpgp 20091210'
+PACKAGE_VERSION='20091221'
+PACKAGE_STRING='netpgp 20091221'
PACKAGE_BUGREPORT='Alistair Crooks <agc%netbsd.org@localhost> c0596823'
ac_unique_file="src/netpgp/netpgp.c"
@@ -1483,7 +1483,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures netpgp 20091210 to adapt to many kinds of systems.
+\`configure' configures netpgp 20091221 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1553,7 +1553,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of netpgp 20091210:";;
+ short | recursive ) echo "Configuration of netpgp 20091221:";;
esac
cat <<\_ACEOF
@@ -1660,7 +1660,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-netpgp configure 20091210
+netpgp configure 20091221
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1674,7 +1674,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by netpgp $as_me 20091210, which was
+It was created by netpgp $as_me 20091221, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -2561,7 +2561,7 @@
# Define the identity of the package.
PACKAGE='netpgp'
- VERSION='20091210'
+ VERSION='20091221'
cat >>confdefs.h <<_ACEOF
@@ -22306,7 +22306,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by netpgp $as_me 20091210, which was
+This file was extended by netpgp $as_me 20091221, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -22369,7 +22369,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-netpgp config.status 20091210
+netpgp config.status 20091221
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff -r 04472c85a64d -r 2bf459abafdb crypto/external/bsd/netpgp/dist/configure.ac
--- a/crypto/external/bsd/netpgp/dist/configure.ac Mon Dec 21 22:49:18 2009 +0000
+++ b/crypto/external/bsd/netpgp/dist/configure.ac Tue Dec 22 06:03:24 2009 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: configure.ac,v 1.19 2009/12/14 23:29:56 agc Exp $
+# $NetBSD: configure.ac,v 1.20 2009/12/22 06:03:24 agc Exp $
#
# Process this file with autoconf to produce a configure script.
-AC_INIT([netpgp],[20091210],[Alistair Crooks <agc%netbsd.org@localhost> c0596823])
+AC_INIT([netpgp],[20091221],[Alistair Crooks <agc%netbsd.org@localhost> c0596823])
AC_PREREQ(2.63)
-AC_REVISION([$Revision: 1.19 $])
+AC_REVISION([$Revision: 1.20 $])
AS_SHELL_SANITIZE
diff -r 04472c85a64d -r 2bf459abafdb crypto/external/bsd/netpgp/dist/include/netpgp.h
--- a/crypto/external/bsd/netpgp/dist/include/netpgp.h Mon Dec 21 22:49:18 2009 +0000
+++ b/crypto/external/bsd/netpgp/dist/include/netpgp.h Tue Dec 22 06:03:24 2009 +0000
@@ -86,9 +86,11 @@
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);
__END_DECLS
diff -r 04472c85a64d -r 2bf459abafdb crypto/external/bsd/netpgp/dist/src/lib/Makefile.in
--- a/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in Mon Dec 21 22:49:18 2009 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in Tue Dec 22 06:03:24 2009 +0000
@@ -52,17 +52,16 @@
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libnetpgp_la_LIBADD =
-am_libnetpgp_la_OBJECTS = libnetpgp_la-compress.lo \
- libnetpgp_la-bufgap.lo \
- libnetpgp_la-create.lo libnetpgp_la-crypto.lo \
- libnetpgp_la-fastctype.lo \
+am_libnetpgp_la_OBJECTS = libnetpgp_la-bufgap.lo \
+ libnetpgp_la-compress.lo libnetpgp_la-create.lo \
+ libnetpgp_la-crypto.lo libnetpgp_la-fastctype.lo \
libnetpgp_la-keyring.lo libnetpgp_la-misc.lo \
libnetpgp_la-netpgp.lo libnetpgp_la-openssl_crypto.lo \
libnetpgp_la-packet-parse.lo libnetpgp_la-packet-print.lo \
libnetpgp_la-packet-show.lo libnetpgp_la-reader.lo \
- libnetpgp_la-signature.lo libnetpgp_la-symmetric.lo \
- libnetpgp_la-ssh2pgp.lo \
- libnetpgp_la-validate.lo libnetpgp_la-writer.lo
+ libnetpgp_la-signature.lo libnetpgp_la-ssh2pgp.lo \
+ libnetpgp_la-symmetric.lo libnetpgp_la-validate.lo \
+ libnetpgp_la-writer.lo
libnetpgp_la_OBJECTS = $(am_libnetpgp_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/buildaux/depcomp
diff -r 04472c85a64d -r 2bf459abafdb crypto/external/bsd/netpgp/dist/src/lib/crypto.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/crypto.c Mon Dec 21 22:49:18 2009 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/crypto.c Tue Dec 22 06:03:24 2009 +0000
@@ -54,7 +54,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: crypto.c,v 1.17 2009/10/06 02:26:05 agc Exp $");
+__RCSID("$NetBSD: crypto.c,v 1.18 2009/12/22 06:03:24 agc Exp $");
#endif
#include <sys/types.h>
@@ -215,8 +215,68 @@
return 1;
}
-static __ops_cb_ret_t
-callback_write_parsed(const __ops_packet_t *, __ops_cbdata_t *);
+static __ops_cb_ret_t
+write_parsed_cb(const __ops_packet_t *pkt, __ops_cbdata_t *cbinfo)
+{
+ const __ops_contents_t *content = &pkt->u;
+ static unsigned skipping; /* XXX - put skipping into pkt? */
+
+ if (__ops_get_debug_level(__FILE__)) {
+ printf("write_parsed_cb: ");
+ __ops_print_packet(pkt);
+ }
+ if (pkt->tag != OPS_PTAG_CT_UNARMOURED_TEXT && skipping) {
+ puts("...end of skip");
+ skipping = 0;
+ }
+ switch (pkt->tag) {
+ case OPS_PTAG_CT_UNARMOURED_TEXT:
+ printf("OPS_PTAG_CT_UNARMOURED_TEXT\n");
+ if (!skipping) {
+ puts("Skipping...");
+ skipping = 1;
+ }
+ fwrite(content->unarmoured_text.data, 1,
+ content->unarmoured_text.length, stdout);
+ break;
+
+ case OPS_PTAG_CT_PK_SESSION_KEY:
+ return pk_sesskey_cb(pkt, cbinfo);
+
+ case OPS_GET_SECKEY:
+ return get_seckey_cb(pkt, cbinfo);
+
+ case OPS_GET_PASSPHRASE:
+ return cbinfo->cryptinfo.getpassphrase(pkt, cbinfo);
+
+ case OPS_PTAG_CT_LITDATA_BODY:
+ return litdata_cb(pkt, cbinfo);
+
+ case OPS_PTAG_CT_ARMOUR_HEADER:
+ case OPS_PTAG_CT_ARMOUR_TRAILER:
+ case OPS_PTAG_CT_ENCRYPTED_PK_SESSION_KEY:
+ case OPS_PTAG_CT_COMPRESSED:
+ case OPS_PTAG_CT_LITDATA_HEADER:
+ case OPS_PTAG_CT_SE_IP_DATA_BODY:
+ case OPS_PTAG_CT_SE_IP_DATA_HEADER:
+ case OPS_PTAG_CT_SE_DATA_BODY:
+ case OPS_PTAG_CT_SE_DATA_HEADER:
+ /* Ignore these packets */
+ /* They're handled in __ops_parse_packet() */
+ /* and nothing else needs to be done */
+ break;
+
+ default:
+ if (__ops_get_debug_level(__FILE__)) {
+ fprintf(stderr, "Unexpected packet tag=%d (0x%x)\n",
+ pkt->tag,
+ pkt->tag);
+ }
+ break;
+ }
+
+ return OPS_RELEASE_MEMORY;
+}
/**
\ingroup HighLevel_Crypto
@@ -269,6 +329,44 @@
return 1;
}
+/* encrypt the contents of the input buffer, and return the mem structure */
+__ops_memory_t *
+__ops_encrypt_buf(__ops_io_t *io,
+ const void *input,
+ const size_t insize,
+ const __ops_key_t *pubkey,
+ const unsigned use_armour)
+{
+ __ops_output_t *output;
+ __ops_memory_t *outmem;
+
+ __OPS_USED(io);
+ if (input == NULL) {
+ (void) fprintf(io->errs,
+ "__ops_encrypt_buf: null memory\n");
+ return 0;
+ }
+
+ __ops_setup_memory_write(&output, &outmem, insize);
+
+ /* set armoured/not armoured here */
+ if (use_armour) {
+ __ops_writer_push_armor_msg(output);
+ }
+
+ /* Push the encrypted writer */
+ __ops_push_enc_se_ip(output, pubkey);
+
+ /* This does the writing */
+ __ops_write(output, input, insize);
+
+ /* tidy up */
+ __ops_writer_close(output);
+ __ops_output_delete(output);
+
+ return outmem;
+}
+
/**
\ingroup HighLevel_Crypto
\brief Decrypt a file.
@@ -299,7 +397,7 @@
/* setup for reading from given input file */
Home |
Main Index |
Thread Index |
Old Index