Module Name: src
Committed By: agc
Date: Tue Mar 16 04:14:30 UTC 2010
Modified Files:
src/crypto/external/bsd/netpgp/dist: TODO configure configure.ac
src/crypto/external/bsd/netpgp/dist/include: netpgp.h
src/crypto/external/bsd/netpgp/dist/src/hkpclient: tst
src/crypto/external/bsd/netpgp/dist/src/hkpd: hkpd.c
src/crypto/external/bsd/netpgp/dist/src/lib: keyring.h netpgp.c
packet-print.c version.h
src/crypto/external/bsd/netpgp/dist/src/netpgpverify: verify.c
Log Message:
Changes to 2.99.2/20100315
+ make subkey sigs available by hkp as well as on the command line
+ use the sketchily-defined vindex option to the hkp protocol to
return the subkey signature information
+ add a netpgp_unsetvar() function as a corollary to netpgp_setvar()
+ use a variable name of ''subkey sigs'' to denote that subkey
signatures should be returned with the pubkey uids
To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/crypto/external/bsd/netpgp/dist/TODO
cvs rdiff -u -r1.27 -r1.28 src/crypto/external/bsd/netpgp/dist/configure
cvs rdiff -u -r1.28 -r1.29 src/crypto/external/bsd/netpgp/dist/configure.ac
cvs rdiff -u -r1.17 -r1.18 \
src/crypto/external/bsd/netpgp/dist/include/netpgp.h
cvs rdiff -u -r1.1 -r1.2 \
src/crypto/external/bsd/netpgp/dist/src/hkpclient/tst
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/netpgp/dist/src/hkpd/hkpd.c
cvs rdiff -u -r1.23 -r1.24 \
src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h
cvs rdiff -u -r1.43 -r1.44 \
src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
cvs rdiff -u -r1.29 -r1.30 \
src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c
cvs rdiff -u -r1.30 -r1.31 \
src/crypto/external/bsd/netpgp/dist/src/lib/version.h
cvs rdiff -u -r1.7 -r1.8 \
src/crypto/external/bsd/netpgp/dist/src/netpgpverify/verify.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/TODO
diff -u src/crypto/external/bsd/netpgp/dist/TODO:1.35 src/crypto/external/bsd/netpgp/dist/TODO:1.36
--- src/crypto/external/bsd/netpgp/dist/TODO:1.35 Sat Mar 13 23:30:40 2010
+++ src/crypto/external/bsd/netpgp/dist/TODO Tue Mar 16 04:14:29 2010
@@ -93,3 +93,4 @@
trust subpackets
add revocation information to public key display
--list-sigs - these come out in __ops_check_subkey_sig()
+hkp to include sigs too
Index: src/crypto/external/bsd/netpgp/dist/configure
diff -u src/crypto/external/bsd/netpgp/dist/configure:1.27 src/crypto/external/bsd/netpgp/dist/configure:1.28
--- src/crypto/external/bsd/netpgp/dist/configure:1.27 Sat Mar 13 23:30:40 2010
+++ src/crypto/external/bsd/netpgp/dist/configure Tue Mar 16 04:14:29 2010
@@ -1,7 +1,7 @@
#! /bin/sh
-# From configure.ac Revision: 1.27 .
+# From configure.ac Revision: 1.28 .
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for netpgp 20100313.
+# Generated by GNU Autoconf 2.63 for netpgp 20100315.
#
# Report bugs to <Alistair Crooks <[email protected]> c0596823>.
#
@@ -751,8 +751,8 @@
# Identity of this package.
PACKAGE_NAME='netpgp'
PACKAGE_TARNAME='netpgp'
-PACKAGE_VERSION='20100313'
-PACKAGE_STRING='netpgp 20100313'
+PACKAGE_VERSION='20100315'
+PACKAGE_STRING='netpgp 20100315'
PACKAGE_BUGREPORT='Alistair Crooks <[email protected]> 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 20100313 to adapt to many kinds of systems.
+\`configure' configures netpgp 20100315 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 20100313:";;
+ short | recursive ) echo "Configuration of netpgp 20100315:";;
esac
cat <<\_ACEOF
@@ -1660,7 +1660,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-netpgp configure 20100313
+netpgp configure 20100315
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 20100313, which was
+It was created by netpgp $as_me 20100315, 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='20100313'
+ VERSION='20100315'
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 20100313, which was
+This file was extended by netpgp $as_me 20100315, 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 20100313
+netpgp config.status 20100315
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
Index: src/crypto/external/bsd/netpgp/dist/configure.ac
diff -u src/crypto/external/bsd/netpgp/dist/configure.ac:1.28 src/crypto/external/bsd/netpgp/dist/configure.ac:1.29
--- src/crypto/external/bsd/netpgp/dist/configure.ac:1.28 Sat Mar 13 23:30:40 2010
+++ src/crypto/external/bsd/netpgp/dist/configure.ac Tue Mar 16 04:14:29 2010
@@ -1,10 +1,10 @@
-# $NetBSD: configure.ac,v 1.28 2010/03/13 23:30:40 agc Exp $
+# $NetBSD: configure.ac,v 1.29 2010/03/16 04:14:29 agc Exp $
#
# Process this file with autoconf to produce a configure script.
-AC_INIT([netpgp],[20100313],[Alistair Crooks <[email protected]> c0596823])
+AC_INIT([netpgp],[20100315],[Alistair Crooks <[email protected]> c0596823])
AC_PREREQ(2.63)
-AC_REVISION([$Revision: 1.28 $])
+AC_REVISION([$Revision: 1.29 $])
AS_SHELL_SANITIZE
Index: src/crypto/external/bsd/netpgp/dist/include/netpgp.h
diff -u src/crypto/external/bsd/netpgp/dist/include/netpgp.h:1.17 src/crypto/external/bsd/netpgp/dist/include/netpgp.h:1.18
--- src/crypto/external/bsd/netpgp/dist/include/netpgp.h:1.17 Sat Mar 13 23:30:40 2010
+++ src/crypto/external/bsd/netpgp/dist/include/netpgp.h Tue Mar 16 04:14:29 2010
@@ -67,6 +67,7 @@
int netpgp_setvar(netpgp_t *, const char *, const char *);
char *netpgp_getvar(netpgp_t *, const char *);
int netpgp_incvar(netpgp_t *, const char *, const int);
+int netpgp_unsetvar(netpgp_t *, const char *);
/* set home directory information */
int netpgp_set_homedir(netpgp_t *, char *, const char *, const int);
Index: src/crypto/external/bsd/netpgp/dist/src/hkpclient/tst
diff -u src/crypto/external/bsd/netpgp/dist/src/hkpclient/tst:1.1 src/crypto/external/bsd/netpgp/dist/src/hkpclient/tst:1.2
--- src/crypto/external/bsd/netpgp/dist/src/hkpclient/tst:1.1 Mon Mar 1 07:52:21 2010
+++ src/crypto/external/bsd/netpgp/dist/src/hkpclient/tst Tue Mar 16 04:14:29 2010
@@ -16,6 +16,10 @@
done
./hkpclient.lua -s ${host} [email protected]
+./hkpclient.lua -s ${host} --mr 0xc0596823
+./hkpclient.lua -s ${host} 0xc0596823
./hkpclient.lua --op index -s ${host} 0xc0596823
./hkpclient.lua -o index -s ${host} --mr 0xc0596823
+./hkpclient.lua -o index -s ${host} --mr 0xc0596823
+./hkpclient.lua -o vindex -s ${host} --mr agc@
./hkpclient.lua -o index -s ${host} dhklsbcldshjkcdlsjhcvdsljhvcdsljhcvdjlshvcdsc
Index: src/crypto/external/bsd/netpgp/dist/src/hkpd/hkpd.c
diff -u src/crypto/external/bsd/netpgp/dist/src/hkpd/hkpd.c:1.3 src/crypto/external/bsd/netpgp/dist/src/hkpd/hkpd.c:1.4
--- src/crypto/external/bsd/netpgp/dist/src/hkpd/hkpd.c:1.3 Tue Mar 16 00:24:49 2010
+++ src/crypto/external/bsd/netpgp/dist/src/hkpd/hkpd.c Tue Mar 16 04:14:29 2010
@@ -98,8 +98,10 @@
static int
response(int sock, const int code, const char *search, const int get, char *buf, int cc, int mr)
{
- char outbuf[BUFSIZ * 8];
+ char outbuf[1024 * 512];
char item[BUFSIZ];
+ int tot;
+ int wc;
int n;
if (buf == NULL) {
@@ -116,8 +118,7 @@
mr,
buf);
}
- if (write(sock, outbuf, n) != n) {
- (void) fprintf(stderr, "Short write\n");
+ for (tot = 0 ; (wc = write(sock, &outbuf[tot], n - tot)) > 0 && tot < n ; tot += wc) {
}
return 1;
}
@@ -282,9 +283,18 @@
sizeof(search));
code = HKP_NOT_FOUND;
cc = 0;
- if (strncmp(&buf[opmatches[1].rm_so], "vindex", 6) == 0 ||
- strncmp(&buf[opmatches[1].rm_so], "index", 5) == 0) {
+ if (strncmp(&buf[opmatches[1].rm_so], "vindex", 6) == 0) {
cc = 0;
+ netpgp_setvar(netpgp, "subkey sigs", "yes");
+ if ((cp = netpgp_get_key(netpgp, search, (mr) ? "mr" : "")) != NULL) {
+ cc = strlen(cp);
+ code = HKP_SUCCESS;
+ }
+ response(newsock, code, search, 0, cp, cc, mr);
+ netpgp_unsetvar(netpgp, "subkey sigs");
+ } else if (strncmp(&buf[opmatches[1].rm_so], "index", 5) == 0) {
+ cc = 0;
+ netpgp_unsetvar(netpgp, "subkey sigs");
if ((cp = netpgp_get_key(netpgp, search, (mr) ? "mr" : "")) != NULL) {
cc = strlen(cp);
code = HKP_SUCCESS;
Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.23 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.24
--- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.23 Sat Mar 13 23:30:41 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h Tue Mar 16 04:14:29 2010
@@ -119,8 +119,9 @@
int __ops_sprint_keydata(__ops_io_t *, const __ops_keyring_t *,
const __ops_key_t *, char **, const char *,
const __ops_pubkey_t *, const int);
-int __ops_hkp_sprint_keydata(const __ops_key_t *, char **,
- const __ops_pubkey_t *);
+int __ops_hkp_sprint_keydata(__ops_io_t *, const __ops_keyring_t *,
+ const __ops_key_t *, char **,
+ const __ops_pubkey_t *, const int);
void __ops_print_keydata(__ops_io_t *, const __ops_keyring_t *, const __ops_key_t *,
const char *, const __ops_pubkey_t *, const int);
void __ops_print_sig(__ops_io_t *, const __ops_key_t *, const char *,
Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.43 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.44
--- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.43 Sat Mar 13 23:30:41 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Tue Mar 16 04:14:29 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.43 2010/03/13 23:30:41 agc Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.44 2010/03/16 04:14:29 agc Exp $");
#endif
#include <sys/types.h>
@@ -566,9 +566,9 @@
ALLOC(char *, pubs.v, pubs.size, pubs.c, 10, 10,
"netpgp_match_keys", return 0);
if (strcmp(fmt, "mr") == 0) {
- __ops_hkp_sprint_keydata(
+ __ops_hkp_sprint_keydata(netpgp->io, netpgp->pubring,
key, &pubs.v[pubs.c],
- &key->key.pubkey);
+ &key->key.pubkey, psigs);
} else {
__ops_sprint_keydata(netpgp->io, netpgp->pubring,
key, &pubs.v[pubs.c],
@@ -659,12 +659,15 @@
return NULL;
}
if (strcmp(fmt, "mr") == 0) {
- return (__ops_hkp_sprint_keydata(key, &newkey,
- &key->key.pubkey) > 0) ? newkey : NULL;
+ return (__ops_hkp_sprint_keydata(netpgp->io, netpgp->pubring,
+ key, &newkey,
+ &key->key.pubkey,
+ netpgp_getvar(netpgp, "subkey sigs") != NULL) > 0) ? newkey : NULL;
}
return (__ops_sprint_keydata(netpgp->io, netpgp->pubring,
key, &newkey, "pub",
- &key->key.pubkey, 0) > 0) ? newkey : NULL;
+ &key->key.pubkey,
+ netpgp_getvar(netpgp, "subkey sigs") != NULL) > 0) ? newkey : NULL;
}
/* export a given key */
@@ -1250,6 +1253,23 @@
return 1;
}
+/* unset a variable */
+int
+netpgp_unsetvar(netpgp_t *netpgp, const char *name)
+{
+ int i;
+
+ if ((i = findvar(netpgp, name)) >= 0) {
+ if (netpgp->value[i]) {
+ free(netpgp->value[i]);
+ netpgp->value[i] = NULL;
+ }
+ netpgp->value[i] = NULL;
+ return 1;
+ }
+ return 0;
+}
+
/* get a variable's value (NULL if not set) */
char *
netpgp_getvar(netpgp_t *netpgp, const char *name)
Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c:1.29 src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c:1.30
--- src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c:1.29 Sat Mar 13 23:30:41 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c Tue Mar 16 04:14:29 2010
@@ -58,7 +58,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: packet-print.c,v 1.29 2010/03/13 23:30:41 agc Exp $");
+__RCSID("$NetBSD: packet-print.c,v 1.30 2010/03/16 04:14:29 agc Exp $");
#endif
#include <string.h>
@@ -496,20 +496,58 @@
}
int
-__ops_hkp_sprint_keydata(const __ops_key_t *key, char **buf,
- const __ops_pubkey_t *pubkey)
+__ops_hkp_sprint_keydata(__ops_io_t *io, const __ops_keyring_t *keyring,
+ const __ops_key_t *key, char **buf,
+ const __ops_pubkey_t *pubkey, const int psigs)
{
- unsigned i;
- char uidbuf[KB(128)];
- char fp[(OPS_FINGERPRINT_SIZE * 3) + 1];
- int n;
+ const __ops_key_t *trustkey;
+ unsigned from;
+ unsigned i;
+ unsigned j;
+ char keyid[OPS_KEY_ID_SIZE * 3];
+ char uidbuf[KB(128)];
+ char fp[(OPS_FINGERPRINT_SIZE * 3) + 1];
+ int n;
+ if (key->revoked) {
+ return -1;
+ }
for (i = 0, n = 0; i < key->uidc; i++) {
n += snprintf(&uidbuf[n], sizeof(uidbuf) - n,
- "uid:%s:%lld:%lld:\n",
- key->uids[i].userid,
+ "uid:%lld:%lld:%s\n",
(long long)pubkey->birthtime,
- (long long)pubkey->duration);
+ (long long)pubkey->duration,
+ key->uids[i].userid);
+ for (j = 0 ; j < key->subsigc ; j++) {
+ if (psigs) {
+ if (key->subsigs[j].uid != i) {
+ continue;
+ }
+ } else {
+ if (!(key->subsigs[j].sig.info.version == 4 &&
+ key->subsigs[j].sig.info.type == OPS_SIG_SUBKEY &&
+ i == key->uidc - 1)) {
+ continue;
+ }
+ }
+ from = 0;
+ trustkey = __ops_getkeybyid(io, keyring, key->subsigs[j].sig.info.signer_id, &from);
+ if (key->subsigs[j].sig.info.version == 4 &&
+ key->subsigs[j].sig.info.type == OPS_SIG_SUBKEY) {
+ n += snprintf(&uidbuf[n], sizeof(uidbuf) - n, "sub:%d:%d:%s:%lld:%lld\n",
+ numkeybits(pubkey),
+ key->subsigs[j].sig.info.key_alg,
+ strhexdump(keyid, key->subsigs[j].sig.info.signer_id, OPS_KEY_ID_SIZE, ""),
+ (long long)(key->subsigs[j].sig.info.birthtime),
+ (long long)pubkey->duration);
+ } else {
+ n += snprintf(&uidbuf[n], sizeof(uidbuf) - n,
+ "sig:%s:%lld:%s\n",
+ strhexdump(keyid, key->subsigs[j].sig.info.signer_id, OPS_KEY_ID_SIZE, ""),
+ (long long)key->subsigs[j].sig.info.birthtime,
+ (trustkey) ? (char *)trustkey->uids[trustkey->uid0].userid : "");
+ }
+ }
}
return __ops_asprintf(buf, "pub:%s:%d:%d:%lld:%lld\n%s",
strhexdump(fp, key->fingerprint.fingerprint, OPS_FINGERPRINT_SIZE, ""),
Index: src/crypto/external/bsd/netpgp/dist/src/lib/version.h
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/version.h:1.30 src/crypto/external/bsd/netpgp/dist/src/lib/version.h:1.31
--- src/crypto/external/bsd/netpgp/dist/src/lib/version.h:1.30 Sat Mar 13 23:30:41 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/version.h Tue Mar 16 04:14:29 2010
@@ -58,7 +58,7 @@
#endif
/* development versions have .99 suffix */
-#define NETPGP_BASE_VERSION "2.99.1"
+#define NETPGP_BASE_VERSION "2.99.2"
#define NETPGP_VERSION_CAT(a, b) "NetPGP portable " a "/[" b "]"
#define NETPGP_VERSION_STRING \
Index: src/crypto/external/bsd/netpgp/dist/src/netpgpverify/verify.c
diff -u src/crypto/external/bsd/netpgp/dist/src/netpgpverify/verify.c:1.7 src/crypto/external/bsd/netpgp/dist/src/netpgpverify/verify.c:1.8
--- src/crypto/external/bsd/netpgp/dist/src/netpgpverify/verify.c:1.7 Sat Mar 13 23:30:41 2010
+++ src/crypto/external/bsd/netpgp/dist/src/netpgpverify/verify.c Tue Mar 16 04:14:30 2010
@@ -55,7 +55,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: verify.c,v 1.7 2010/03/13 23:30:41 agc Exp $");
+__RCSID("$NetBSD: verify.c,v 1.8 2010/03/16 04:14:30 agc Exp $");
#endif
#include <sys/types.h>
@@ -161,7 +161,7 @@
#undef USE_SHA384
/* development versions have .99 suffix */
-#define NETPGP_BASE_VERSION "2.99.1"
+#define NETPGP_BASE_VERSION "2.99.2"
#define NETPGP_VERSION_CAT(a, b) "NetPGP portable " a "/[" b "]"
#define NETPGP_VERSION_STRING \