diff options
author | agc <agc@pkgsrc.org> | 2014-12-04 20:08:47 +0000 |
---|---|---|
committer | agc <agc@pkgsrc.org> | 2014-12-04 20:08:47 +0000 |
commit | 6d32fe5773cf972de772b98bd5219b4143d2010f (patch) | |
tree | 0ed50d5c7da2aba027643cbfc5612730f1262202 /security | |
parent | 7719b9314acf9964b5e1c1139e5b58df0b3c18a1 (diff) | |
download | pkgsrc-6d32fe5773cf972de772b98bd5219b4143d2010f.tar.gz |
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
Diffstat (limited to 'security')
-rw-r--r-- | security/netpgpverify/Makefile | 4 | ||||
-rw-r--r-- | security/netpgpverify/files/Makefile.bsd | 4 | ||||
-rw-r--r-- | security/netpgpverify/files/bzlib.c | 12 | ||||
-rw-r--r-- | security/netpgpverify/files/bzlib_private.h | 4 | ||||
-rw-r--r-- | security/netpgpverify/files/libverify.c | 30 | ||||
-rw-r--r-- | security/netpgpverify/files/main.c | 8 | ||||
-rw-r--r-- | security/netpgpverify/files/misc.c | 15 | ||||
-rw-r--r-- | security/netpgpverify/files/misc.h | 4 | ||||
-rw-r--r-- | security/netpgpverify/files/rsa.c | 1 | ||||
-rwxr-xr-x | security/netpgpverify/files/testit.sh | 21 | ||||
-rw-r--r-- | security/netpgpverify/files/verify.h | 3 |
11 files changed, 63 insertions, 43 deletions
diff --git a/security/netpgpverify/Makefile b/security/netpgpverify/Makefile index f751f05332d..1f771a3de24 100644 --- a/security/netpgpverify/Makefile +++ b/security/netpgpverify/Makefile @@ -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 diff --git a/security/netpgpverify/files/Makefile.bsd b/security/netpgpverify/files/Makefile.bsd index 327bc74e877..0664fb8375b 100644 --- a/security/netpgpverify/files/Makefile.bsd +++ b/security/netpgpverify/files/Makefile.bsd @@ -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 @@ LDFLAGS+=-g -O0 .endif MAN= netpgpverify.1 -WARNS= 6 +WARNS= 5 .include <bsd.prog.mk> diff --git a/security/netpgpverify/files/bzlib.c b/security/netpgpverify/files/bzlib.c index c607adfd030..e0a0d58a144 100644 --- a/security/netpgpverify/files/bzlib.c +++ b/security/netpgpverify/files/bzlib.c @@ -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 @@ BZFILE * bzopen_or_bzdopen int smallMode = 0; int nUnused = 0; + __USE(blockSize100k); + if (mode == NULL) return NULL; while (*mode) { switch (*mode) { @@ -1080,7 +1082,7 @@ const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum) /*-------------------------------------------------------------*/ /*--- 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 @@ Int32 BZ2_decompress ( DState* s ) /*-------------------------------------------------------------*/ /*--- 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 @@ UInt32 BZ2_crc32Table[256] = { /*-------------------------------------------------------------*/ /*--- 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 $ */ /*-------------------------------------------------------------*/ diff --git a/security/netpgpverify/files/bzlib_private.h b/security/netpgpverify/files/bzlib_private.h index 91b29384890..815926d82c1 100644 --- a/security/netpgpverify/files/bzlib_private.h +++ b/security/netpgpverify/files/bzlib_private.h @@ -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 @@ typedef unsigned short UInt16; #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 ); } diff --git a/security/netpgpverify/files/libverify.c b/security/netpgpverify/files/libverify.c index 9bd02f4ce63..3252a29e8ea 100644 --- a/security/netpgpverify/files/libverify.c +++ b/security/netpgpverify/files/libverify.c @@ -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 @@ setup_data(pgpv_cursor_t *cursor, pgpv_t *pgp, const void *p, ssize_t size) 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 @@ findstr(str_t *array, const char *name) } /* 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 @@ match_sig_id(pgpv_cursor_t *cursor, pgpv_signature_t *signature, pgpv_litdata_t 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 @@ pgpv_read_pubring(pgpv_t *pgp, const void *keyring, ssize_t size) 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 @@ pgpv_read_ssh_pubkeys(pgpv_t *pgp, const void *keyring, ssize_t size) 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); diff --git a/security/netpgpverify/files/main.c b/security/netpgpverify/files/main.c index 40cc1755c49..21385f62162 100644 --- a/security/netpgpverify/files/main.c +++ b/security/netpgpverify/files/main.c @@ -35,8 +35,6 @@ #include "verify.h" -#include "array.h" - /* print the time nicely */ static void ptime(int64_t secs) @@ -95,6 +93,7 @@ verify_data(pgpv_t *pgp, const char *cmd, const char *inname, char *in, ssize_t size_t size; size_t cookie; char *data; + int el; memset(&cursor, 0x0, sizeof(cursor)); if (strcasecmp(cmd, "cat") == 0) { @@ -109,7 +108,8 @@ verify_data(pgpv_t *pgp, const char *cmd, const char *inname, char *in, ssize_t 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 @@ verify_data(pgpv_t *pgp, const char *cmd, const char *inname, char *in, ssize_t int main(int argc, char **argv) { - const char *modifiers; const char *keyring; const char *cmd; ssize_t cc; @@ -138,7 +137,6 @@ main(int argc, char **argv) ssh = 0; ok = 1; cmd = "verify"; - modifiers = NULL; while ((i = getopt(argc, argv, "S:c:k:v")) != -1) { switch(i) { case 'S': diff --git a/security/netpgpverify/files/misc.c b/security/netpgpverify/files/misc.c index b3bb5ea68f8..9a0b698fd47 100644 --- a/security/netpgpverify/files/misc.c +++ b/security/netpgpverify/files/misc.c @@ -65,18 +65,3 @@ netpgp_deallocate(void *ptr, size_t size) 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 diff --git a/security/netpgpverify/files/misc.h b/security/netpgpverify/files/misc.h index dbace86fdcf..e74bbdcd3bb 100644 --- a/security/netpgpverify/files/misc.h +++ b/security/netpgpverify/files/misc.h @@ -44,10 +44,6 @@ __BEGIN_DECLS 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 diff --git a/security/netpgpverify/files/rsa.c b/security/netpgpverify/files/rsa.c index 3b98ec96846..0a8bc90c140 100644 --- a/security/netpgpverify/files/rsa.c +++ b/security/netpgpverify/files/rsa.c @@ -29,7 +29,6 @@ #ifdef _KERNEL # include <sys/kmem.h> -# define logmessage log #else # include <stdio.h> # include <stdlib.h> diff --git a/security/netpgpverify/files/testit.sh b/security/netpgpverify/files/testit.sh new file mode 100755 index 00000000000..a17232e027c --- /dev/null +++ b/security/netpgpverify/files/testit.sh @@ -0,0 +1,21 @@ +#! /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} diff --git a/security/netpgpverify/files/verify.h b/security/netpgpverify/files/verify.h index 95c212f2de1..bc82935b709 100644 --- a/security/netpgpverify/files/verify.h +++ b/security/netpgpverify/files/verify.h @@ -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 @@ int pgpv_read_ssh_pubkeys(pgpv_t */*pgp*/, const void */*keyring*/, ssize_t /*si 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*/); |