Module Name:    src
Committed By:   agc
Date:           Thu Feb 11 17:46:09 UTC 2010

Modified Files:
        src/crypto/external/bsd/netpgp/dist: configure.ac
        src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c version.h

Log Message:
changes to 1.99.18/20100211

small steps, but lots of them - this is the first one.

+ print out the correct key information when signing files and memory.
  what used to be printed out was the copy of the public key which is
  stored as part of the private key(!). does not address the info shown
  when decrypting, since that is done in a different way, by callback.
  this whole part needs to be re-written, but will have to wait for two
  good hands.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/crypto/external/bsd/netpgp/dist/configure.ac
cvs rdiff -u -r1.37 -r1.38 \
    src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
cvs rdiff -u -r1.24 -r1.25 \
    src/crypto/external/bsd/netpgp/dist/src/lib/version.h

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/configure.ac
diff -u src/crypto/external/bsd/netpgp/dist/configure.ac:1.22 src/crypto/external/bsd/netpgp/dist/configure.ac:1.23
--- src/crypto/external/bsd/netpgp/dist/configure.ac:1.22	Mon Feb  8 17:19:12 2010
+++ src/crypto/external/bsd/netpgp/dist/configure.ac	Thu Feb 11 17:46:09 2010
@@ -1,10 +1,10 @@
-# $NetBSD: configure.ac,v 1.22 2010/02/08 17:19:12 agc Exp $
+# $NetBSD: configure.ac,v 1.23 2010/02/11 17:46:09 agc Exp $
 #
 # Process this file with autoconf to produce a configure script.
 
-AC_INIT([netpgp],[20100208],[Alistair Crooks <[email protected]> c0596823])
+AC_INIT([netpgp],[20100211],[Alistair Crooks <[email protected]> c0596823])
 AC_PREREQ(2.63)
-AC_REVISION([$Revision: 1.22 $])
+AC_REVISION([$Revision: 1.23 $])
 
 AS_SHELL_SANITIZE
 

Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.37 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.38
--- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.37	Sat Feb  6 02:24:33 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c	Thu Feb 11 17:46:09 2010
@@ -34,7 +34,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: netpgp.c,v 1.37 2010/02/06 02:24:33 agc Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.38 2010/02/11 17:46:09 agc Exp $");
 #endif
 
 #include <sys/types.h>
@@ -389,7 +389,7 @@
 		(void) memset(&limit, 0x0, sizeof(limit));
 		if (setrlimit(RLIMIT_CORE, &limit) != 0) {
 			(void) fprintf(stderr,
-			"netpgp_init: warning - can't turn off core dumps\n");
+			"netpgp: warning - can't turn off core dumps\n");
 			coredumps = 1;
 		}
 	}
@@ -814,6 +814,7 @@
 		int detached)
 {
 	const __ops_key_t	*keypair;
+	const __ops_key_t	*pubkey;
 	__ops_seckey_t		*seckey;
 	const unsigned		 overwrite = 1;
 	__ops_io_t		*io;
@@ -832,7 +833,7 @@
 	/* get key with which to sign */
 	keypair = __ops_getkeybyname(io, netpgp->secring, userid);
 	if (keypair == NULL) {
-		(void) fprintf(io->errs, "Userid '%s' not found in keyring\n",
+		(void) fprintf(io->errs, "Userid '%s' not found in secring\n",
 				userid);
 		return 0;
 	}
@@ -840,7 +841,15 @@
 	do {
 		if (netpgp->passfp == NULL) {
 			/* print out the user id */
-			__ops_print_keydata(io, keypair, "pub", &keypair->key.pubkey);
+			pubkey = __ops_getkeybyname(io, netpgp->pubring, userid);
+			if (pubkey == NULL) {
+				(void) fprintf(io->errs,
+					"netpgp: warning - using pubkey from secring\n");
+				__ops_print_keydata(io, keypair, "pub",
+					&keypair->key.seckey.pubkey);
+			} else {
+				__ops_print_keydata(io, pubkey, "pub", &pubkey->key.pubkey);
+			}
 		}
 		if (netpgp_getvar(netpgp, "ssh keys") == NULL) {
 			/* now decrypt key */
@@ -918,6 +927,7 @@
 		const unsigned cleartext)
 {
 	const __ops_key_t	*keypair;
+	const __ops_key_t	*pubkey;
 	__ops_seckey_t		*seckey;
 	__ops_memory_t		*signedmem;
 	__ops_io_t		*io;
@@ -944,7 +954,15 @@
 	do {
 		if (netpgp->passfp == NULL) {
 			/* print out the user id */
-			__ops_print_keydata(io, keypair, "pub", &keypair->key.pubkey);
+			pubkey = __ops_getkeybyname(io, netpgp->pubring, userid);
+			if (pubkey == NULL) {
+				(void) fprintf(io->errs,
+					"netpgp: warning - using pubkey from secring\n");
+				__ops_print_keydata(io, keypair, "pub",
+					&keypair->key.seckey.pubkey);
+			} else {
+				__ops_print_keydata(io, pubkey, "pub", &pubkey->key.pubkey);
+			}
 		}
 		/* now decrypt key */
 		seckey = __ops_decrypt_seckey(keypair, netpgp->passfp);

Index: src/crypto/external/bsd/netpgp/dist/src/lib/version.h
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/version.h:1.24 src/crypto/external/bsd/netpgp/dist/src/lib/version.h:1.25
--- src/crypto/external/bsd/netpgp/dist/src/lib/version.h:1.24	Mon Feb  8 17:19:12 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/version.h	Thu Feb 11 17:46:09 2010
@@ -58,7 +58,7 @@
 #endif
 
 /* development versions have .99 suffix */
-#define NETPGP_BASE_VERSION	"1.99.17"
+#define NETPGP_BASE_VERSION	"1.99.18"
 
 #define NETPGP_VERSION_CAT(a, b)	"NetPGP portable " a "/[" b "]"
 #define NETPGP_VERSION_STRING \

Reply via email to