Thu Dec 4 20:08:47 2014 UTC ()
Update netpgpverify to version 20141204

Changes since 20141129:

+ bring over lint changes from src/crypto version of this utility
+ add a helper function to get an element from a cursor
+ added a small compile and test script, which uses BSD makefiles
+ change WARNS level in BSD Makefile from 6 to 5 - changes to make
  WARNS=6 compile are way too intrusive and distracting to be useful
+ bump version to 20141204


(agc)
diff -r1.9 -r1.10 pkgsrc/security/netpgpverify/Makefile
diff -r1.2 -r1.3 pkgsrc/security/netpgpverify/files/Makefile.bsd
diff -r1.2 -r1.3 pkgsrc/security/netpgpverify/files/bzlib.c
diff -r1.1 -r1.2 pkgsrc/security/netpgpverify/files/bzlib_private.h
diff -r1.1 -r1.2 pkgsrc/security/netpgpverify/files/misc.c
diff -r1.1 -r1.2 pkgsrc/security/netpgpverify/files/misc.h
diff -r1.1 -r1.2 pkgsrc/security/netpgpverify/files/rsa.c
diff -r1.4 -r1.5 pkgsrc/security/netpgpverify/files/libverify.c
diff -r1.3 -r1.4 pkgsrc/security/netpgpverify/files/main.c
diff -r0 -r1.1 pkgsrc/security/netpgpverify/files/testit.sh
diff -r1.7 -r1.8 pkgsrc/security/netpgpverify/files/verify.h

cvs diff -r1.9 -r1.10 pkgsrc/security/netpgpverify/Makefile (expand / switch to context diff)
--- pkgsrc/security/netpgpverify/Makefile 2014/11/29 20:19:46 1.9
+++ pkgsrc/security/netpgpverify/Makefile 2014/12/04 20:08:47 1.10
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.9 2014/11/29 20:19:46 agc Exp $
+# $NetBSD: Makefile,v 1.10 2014/12/04 20:08:47 agc Exp $
 
-DISTNAME=		netpgpverify-20141129
+DISTNAME=		netpgpverify-20141204
 CATEGORIES=		security
 MASTER_SITES=		# empty
 DISTFILES=		# empty

cvs diff -r1.2 -r1.3 pkgsrc/security/netpgpverify/files/Makefile.bsd (expand / switch to context diff)
--- pkgsrc/security/netpgpverify/files/Makefile.bsd 2014/02/04 02:11:18 1.2
+++ pkgsrc/security/netpgpverify/files/Makefile.bsd 2014/12/04 20:08:47 1.3
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.bsd,v 1.2 2014/02/04 02:11:18 agc Exp $
+# $NetBSD: Makefile.bsd,v 1.3 2014/12/04 20:08:47 agc Exp $
 
 PROG=netpgpverify
 
@@ -18,7 +18,7 @@
 .endif
 
 MAN=	netpgpverify.1
-WARNS=	6
+WARNS=	5
 
 .include <bsd.prog.mk>
 

cvs diff -r1.2 -r1.3 pkgsrc/security/netpgpverify/files/bzlib.c (expand / switch to context diff)
--- pkgsrc/security/netpgpverify/files/bzlib.c 2014/03/05 04:51:37 1.2
+++ pkgsrc/security/netpgpverify/files/bzlib.c 2014/12/04 20:08:47 1.3
@@ -1,4 +1,4 @@
-/*	$NetBSD: bzlib.c,v 1.2 2014/03/05 04:51:37 agc Exp $	*/
+/*	$NetBSD: bzlib.c,v 1.3 2014/12/04 20:08:47 agc Exp $	*/
 
 
 /*-------------------------------------------------------------*/
@@ -35,7 +35,7 @@
 #include "bzlib_private.h"
 
 
-/*	$NetBSD: bzlib.c,v 1.2 2014/03/05 04:51:37 agc Exp $	*/
+/*	$NetBSD: bzlib.c,v 1.3 2014/12/04 20:08:47 agc Exp $	*/
 
 
 /*-------------------------------------------------------------*/
@@ -930,6 +930,8 @@
    int    smallMode     = 0;
    int    nUnused       = 0; 
 
+   __USE(blockSize100k);
+
    if (mode == NULL) return NULL;
    while (*mode) {
       switch (*mode) {
@@ -1080,7 +1082,7 @@
 /*-------------------------------------------------------------*/
 /*--- end                                           bzlib.c ---*/
 /*-------------------------------------------------------------*/
-/*	$NetBSD: bzlib.c,v 1.2 2014/03/05 04:51:37 agc Exp $	*/
+/*	$NetBSD: bzlib.c,v 1.3 2014/12/04 20:08:47 agc Exp $	*/
 
 
 /*-------------------------------------------------------------*/
@@ -1726,7 +1728,7 @@
 /*-------------------------------------------------------------*/
 /*--- end                                      decompress.c ---*/
 /*-------------------------------------------------------------*/
-/*	$NetBSD: bzlib.c,v 1.2 2014/03/05 04:51:37 agc Exp $	*/
+/*	$NetBSD: bzlib.c,v 1.3 2014/12/04 20:08:47 agc Exp $	*/
 
 
 /*-------------------------------------------------------------*/
@@ -1830,7 +1832,7 @@
 /*-------------------------------------------------------------*/
 /*--- end                                        crctable.c ---*/
 /*-------------------------------------------------------------*/
-/*	$NetBSD: bzlib.c,v 1.2 2014/03/05 04:51:37 agc Exp $	*/
+/*	$NetBSD: bzlib.c,v 1.3 2014/12/04 20:08:47 agc Exp $	*/
 
 
 /*-------------------------------------------------------------*/

cvs diff -r1.1 -r1.2 pkgsrc/security/netpgpverify/files/bzlib_private.h (expand / switch to context diff)
--- pkgsrc/security/netpgpverify/files/bzlib_private.h 2013/03/16 07:32:34 1.1
+++ pkgsrc/security/netpgpverify/files/bzlib_private.h 2014/12/04 20:08:47 1.2
@@ -1,4 +1,4 @@
-/*	$NetBSD: bzlib_private.h,v 1.1 2013/03/16 07:32:34 agc Exp $	*/
+/*	$NetBSD: bzlib_private.h,v 1.2 2014/12/04 20:08:47 agc Exp $	*/
 
 
 /*-------------------------------------------------------------*/
@@ -57,7 +57,7 @@
 
 #ifndef BZ_NO_STDIO
 
-void BZ2_bz__AssertH__fail ( int errcode );
+void BZ2_bz__AssertH__fail ( int errcode ) __dead;
 #define AssertH(cond,errcode) \
    { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); }
 

cvs diff -r1.1 -r1.2 pkgsrc/security/netpgpverify/files/misc.c (expand / switch to context diff)
--- pkgsrc/security/netpgpverify/files/misc.c 2013/03/16 07:32:34 1.1
+++ pkgsrc/security/netpgpverify/files/misc.c 2014/12/04 20:08:47 1.2
@@ -65,18 +65,3 @@
 	free(ptr);
 #endif
 }
-
-#ifndef _KERNEL
-void
-logmessage(const int level, const char *fmt, ...)
-{
-	va_list	args;
-
-	USE_ARG(level);
-	if (fmt != NULL) {
-		va_start(args, fmt);
-		vfprintf(stderr, fmt, args);
-		va_end(args);
-	}
-}
-#endif

cvs diff -r1.1 -r1.2 pkgsrc/security/netpgpverify/files/misc.h (expand / switch to context diff)
--- pkgsrc/security/netpgpverify/files/misc.h 2013/03/16 07:32:34 1.1
+++ pkgsrc/security/netpgpverify/files/misc.h 2014/12/04 20:08:47 1.2
@@ -44,10 +44,6 @@
 void *netpgp_allocate(size_t /*n*/, size_t /*nels*/);
 void netpgp_deallocate(void */*ptr*/, size_t /*size*/);
 
-#ifndef _KERNEL
-void logmessage(const int /*level*/, const char */*fmt*/, ...);
-#endif
-
 __END_DECLS
 
 #endif

cvs diff -r1.1 -r1.2 pkgsrc/security/netpgpverify/files/rsa.c (expand / switch to context diff)
--- pkgsrc/security/netpgpverify/files/rsa.c 2013/03/16 07:32:35 1.1
+++ pkgsrc/security/netpgpverify/files/rsa.c 2014/12/04 20:08:47 1.2
@@ -29,7 +29,6 @@
 
 #ifdef _KERNEL
 # include <sys/kmem.h>
-# define logmessage	log
 #else
 # include <stdio.h>
 # include <stdlib.h>

cvs diff -r1.4 -r1.5 pkgsrc/security/netpgpverify/files/libverify.c (expand / switch to context diff)
--- pkgsrc/security/netpgpverify/files/libverify.c 2014/03/05 04:51:37 1.4
+++ pkgsrc/security/netpgpverify/files/libverify.c 2014/12/04 20:08:47 1.5
@@ -56,6 +56,14 @@
 #define USE_ARG(x)	/*LINTED*/(void)&(x)
 #endif
 
+#ifndef __dead
+#define __dead				__attribute__((__noreturn__))
+#endif
+
+#ifndef __printflike
+#define __printflike(n, m)		__attribute__((format(printf,n,m)))
+#endif
+
 #define BITS_TO_BYTES(b)		(((b) + (CHAR_BIT - 1)) / CHAR_BIT)
 
 /* packet types */
@@ -151,7 +159,7 @@
 
 /* Forward declarations */
 static int read_all_packets(pgpv_t */*pgp*/, pgpv_mem_t */*mem*/, const char */*op*/);
-static int read_binary_file(pgpv_t */*pgp*/, const char */*op*/, const char */*fmt*/, ...);
+static int read_binary_file(pgpv_t */*pgp*/, const char */*op*/, const char */*fmt*/, ...) __printflike(3, 4);
 static int read_binary_memory(pgpv_t */*pgp*/, const char */*op*/, const void */*memory*/, size_t /*size*/);
 
 /* read a file into the pgpv_mem_t struct */
@@ -1994,7 +2002,7 @@
 		if (is_armored(buf, sizeof(buf))) {
 			read_ascii_armor_file(cursor, p);
 		} else {
-			read_binary_file(pgp, "signature", "%s", p);
+			read_binary_file(pgp, "signature", "%s", (const char *)p);
 		}
 		fclose(fp);
 	} else {
@@ -2221,7 +2229,7 @@
 }
 
 /* read public key from the ssh pubkey file */
-static int
+static __printflike(3, 4) int
 read_ssh_file(pgpv_t *pgp, pgpv_primarykey_t *primary, const char *fmt, ...)
 {
 	pgpv_signed_userid_t	 userid;
@@ -2589,6 +2597,16 @@
 	return match_sig(cursor, signature, pubkey, data, insize);
 }
 
+/* get an element from the found array */
+int
+pgpv_get_cursor_element(pgpv_cursor_t *cursor, size_t element)
+{
+	if (cursor && element < ARRAY_COUNT(cursor->found)) {
+		return (int)ARRAY_ELEMENT(cursor->found, element);
+	}
+	return -1;
+}
+
 /* verify the signed packets we have */
 size_t
 pgpv_verify(pgpv_cursor_t *cursor, pgpv_t *pgp, const void *p, ssize_t size)
@@ -2672,7 +2690,7 @@
 	if (keyring) {
 		return (size > 0) ?
 			read_binary_memory(pgp, "pubring", keyring, (size_t)size) :
-			read_binary_file(pgp, "pubring", "%s", keyring);
+			read_binary_file(pgp, "pubring", "%s", (const char *)keyring);
 	}
 	return read_binary_file(pgp, "pubring", "%s/%s", nonnull_getenv("HOME"), ".gnupg/pubring.gpg");
 }
@@ -2687,10 +2705,10 @@
 		return 0;
 	}
 	if (keyring) {
-		if (!read_ssh_file(pgp, &primary, "%s", keyring)) {
+		if (!read_ssh_file(pgp, &primary, "%s", (const char *)keyring)) {
 			return 0;
 		}
-	} else if (!read_ssh_file(pgp, &primary, "pubring", "%s/%s", nonnull_getenv("HOME"), ".ssh/id_rsa.pub")) {
+	} else if (!read_ssh_file(pgp, &primary, "%s/%s", nonnull_getenv("HOME"), ".ssh/id_rsa.pub")) {
 		return 0;
 	}
 	ARRAY_APPEND(pgp->primaries, primary);

cvs diff -r1.3 -r1.4 pkgsrc/security/netpgpverify/files/main.c (expand / switch to context diff)
--- pkgsrc/security/netpgpverify/files/main.c 2014/02/04 02:11:18 1.3
+++ pkgsrc/security/netpgpverify/files/main.c 2014/12/04 20:08:47 1.4
@@ -35,8 +35,6 @@
 
 #include "verify.h"
 
-#include "array.h"
-
 /* print the time nicely */
 static void
 ptime(int64_t secs)
@@ -95,6 +93,7 @@
 	size_t		 size;
 	size_t		 cookie;
 	char		*data;
+	int		 el;
 
 	memset(&cursor, 0x0, sizeof(cursor));
 	if (strcasecmp(cmd, "cat") == 0) {
@@ -109,7 +108,8 @@
 		if (pgpv_verify(&cursor, pgp, in, cc)) {
 			printf("Good signature for %s made ", inname);
 			ptime(cursor.sigtime);
-			pentry(pgp, ARRAY_ELEMENT(cursor.found, 0), modifiers);
+			el = pgpv_get_cursor_element(&cursor, 0);
+			pentry(pgp, el, modifiers);
 			return 1;
 		}
 		fprintf(stderr, "Signature did not match contents -- %s\n", cursor.why);
@@ -122,7 +122,6 @@
 int
 main(int argc, char **argv)
 {
-	const char	*modifiers;
 	const char	*keyring;
 	const char	*cmd;
 	ssize_t		 cc;
@@ -138,7 +137,6 @@
 	ssh = 0;
 	ok = 1;
 	cmd = "verify";
-	modifiers = NULL;
 	while ((i = getopt(argc, argv, "S:c:k:v")) != -1) {
 		switch(i) {
 		case 'S':

File Added: pkgsrc/security/netpgpverify/files/testit.sh
#! /bin/sh

tmp=$(mktemp -d ../netpgpverify-test.XXXXXX)
mkdir ${tmp}
pax -rwpp . ${tmp}
cat > ${tmp}/config.h <<EOF
#ifndef CONFIG_H_
#define CONFIG_H_ 20141204

#ifndef __UNCONST
#define __UNCONST(a)   ((void *)(unsigned long)(const void *)(a))
#endif /* __UNCONST */

#ifndef USE_ARG
#define USE_ARG(x)       /*LINTED*/(void)&(x)
#endif /* USE_ARG */

#endif /* CONFIG_H_ */
EOF
(cd ${tmp} && make -f Makefile.bsd && make -f Makefile.bsd tst)
rm -rf ${tmp}

cvs diff -r1.7 -r1.8 pkgsrc/security/netpgpverify/files/verify.h (expand / switch to context diff)
--- pkgsrc/security/netpgpverify/files/verify.h 2014/11/29 20:19:46 1.7
+++ pkgsrc/security/netpgpverify/files/verify.h 2014/12/04 20:08:47 1.8
@@ -25,7 +25,7 @@
 #ifndef NETPGP_VERIFY_H_
 #define NETPGP_VERIFY_H_	20140304
 
-#define NETPGPVERIFY_VERSION	"netpgpverify portable 20141129"
+#define NETPGPVERIFY_VERSION	"netpgpverify portable 20141204"
 
 #include <sys/types.h>
 
@@ -286,6 +286,7 @@
 
 size_t pgpv_verify(pgpv_cursor_t */*cursor*/, pgpv_t */*pgp*/, const void */*mem/file*/, ssize_t /*size*/);
 size_t pgpv_get_verified(pgpv_cursor_t */*cursor*/, size_t /*cookie*/, char **/*ret*/);
+int pgpv_get_cursor_element(pgpv_cursor_t */*cursor*/, size_t /*element*/);
 
 size_t pgpv_get_entry(pgpv_t */*pgp*/, unsigned /*ent*/, char **/*ret*/, const char */*modifiers*/);