diff options
author | jperkin <jperkin@pkgsrc.org> | 2015-08-17 11:37:55 +0000 |
---|---|---|
committer | jperkin <jperkin@pkgsrc.org> | 2015-08-17 11:37:55 +0000 |
commit | d7dbb910418fe3bc3ae213c60e0a12ffa14a2bba (patch) | |
tree | 684e2b2a5eaf53d576a52c38e5cf660d58f39d06 /security/netpgpverify | |
parent | 6ec6b5fcb92048bff7a5653a451e4a533c88b366 (diff) | |
download | pkgsrc-d7dbb910418fe3bc3ae213c60e0a12ffa14a2bba.tar.gz |
Portability fixes. Add a test target and additional tests.
Reviewed by agc.
Diffstat (limited to 'security/netpgpverify')
-rw-r--r-- | security/netpgpverify/Makefile | 4 | ||||
-rw-r--r-- | security/netpgpverify/files/Makefile.in | 21 | ||||
-rw-r--r-- | security/netpgpverify/files/bignum.c | 5 | ||||
-rw-r--r-- | security/netpgpverify/files/libverify.c | 5 | ||||
-rw-r--r-- | security/netpgpverify/files/md5.h | 12 | ||||
-rw-r--r-- | security/netpgpverify/files/md5c.c | 3 | ||||
-rw-r--r-- | security/netpgpverify/files/rmd160.c | 4 | ||||
-rw-r--r-- | security/netpgpverify/files/rmd160.h | 13 | ||||
-rw-r--r-- | security/netpgpverify/files/sha1.c | 4 | ||||
-rw-r--r-- | security/netpgpverify/files/sha1.h | 13 | ||||
-rw-r--r-- | security/netpgpverify/files/sha2.c | 4 | ||||
-rw-r--r-- | security/netpgpverify/files/sha2.h | 12 |
12 files changed, 78 insertions, 22 deletions
diff --git a/security/netpgpverify/Makefile b/security/netpgpverify/Makefile index 1f3f2fe8029..31709534a68 100644 --- a/security/netpgpverify/Makefile +++ b/security/netpgpverify/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.13 2015/02/05 00:21:57 agc Exp $ +# $NetBSD: Makefile,v 1.14 2015/08/17 11:37:55 jperkin Exp $ DISTNAME= netpgpverify-20150205 CATEGORIES= security @@ -13,6 +13,8 @@ LICENSE= modified-bsd AUTO_MKDIRS= yes GNU_CONFIGURE= yes +TEST_TARGET= tst + do-extract: @${CP} -R ${FILESDIR} ${WRKSRC} diff --git a/security/netpgpverify/files/Makefile.in b/security/netpgpverify/files/Makefile.in index b5ba487a01d..11055f597ae 100644 --- a/security/netpgpverify/files/Makefile.in +++ b/security/netpgpverify/files/Makefile.in @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.in,v 1.3 2014/03/05 04:51:37 agc Exp $ +# $NetBSD: Makefile.in,v 1.4 2015/08/17 11:37:55 jperkin Exp $ PROG=netpgpverify @@ -26,8 +26,23 @@ tst: ./${PROG} -k pubring.gpg NetBSD-6.0_RC1_hashes.asc ./${PROG} -k pubring.gpg NetBSD-6.0_RC1_hashes.gpg ./${PROG} -v - ./${PROG} -S testkey.pub data.gpg - ./${PROG} -S testkey.pub data.sig + ./${PROG} -S sshtest-20140202.pub data.gpg + ./${PROG} -S sshtest-20140202.pub data.sig + @echo "expected failure, to check bad signatures fail to verify" + -sed -e 's|A|B|' data.gpg | ./${PROG} -S sshtest-20140202.pub + @echo "" + @echo "expected failure, no valid key for verification" + -./${PROG} -k /dev/null NetBSD-6.0_RC1_hashes.gpg + @echo "dumping now" + ./${PROG} -c dump -k pubring.gpg NetBSD-6.0_RC1_hashes.asc > /dev/null + @echo "dumping ssh now" + ./${PROG} -c dump -S sshtest-20140202.pub data.gpg + @echo "testing pubring with one key" + uudecode 1keytest.gpg.uu + ./${PROG} -k 1keypubring.gpg 1keytest.gpg + rm -f 1keytest.gpg + @echo "testing signing with a subkey" + ./chk.sh -k joyent-pubring.gpg digest-20121220.tgz clean: rm -rf *.core ${OBJS} ${PROG} diff --git a/security/netpgpverify/files/bignum.c b/security/netpgpverify/files/bignum.c index f02b512d0fe..91b6cc3a51d 100644 --- a/security/netpgpverify/files/bignum.c +++ b/security/netpgpverify/files/bignum.c @@ -45,6 +45,7 @@ # include <sys/kmem.h> #else # include <arpa/inet.h> +# include <limits.h> # include <stdarg.h> # include <stdio.h> # include <stdlib.h> @@ -88,6 +89,10 @@ #define __arraycount(__x) (sizeof(__x) / sizeof(__x[0])) #endif +#ifndef MIN +#define MIN(a,b) (((a)<(b))?(a):(b)) +#endif + #define MP_ISZERO(a) (((a)->used == 0) ? MP_YES : MP_NO) typedef int mp_err; diff --git a/security/netpgpverify/files/libverify.c b/security/netpgpverify/files/libverify.c index 55bf7882f15..24d7d1eeb7f 100644 --- a/security/netpgpverify/files/libverify.c +++ b/security/netpgpverify/files/libverify.c @@ -32,6 +32,7 @@ #include <arpa/inet.h> #include <inttypes.h> +#include <limits.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -64,6 +65,10 @@ #define __printflike(n, m) __attribute__((format(printf,n,m))) #endif +#ifndef MIN +#define MIN(a,b) (((a)<(b))?(a):(b)) +#endif + #define BITS_TO_BYTES(b) (((b) + (CHAR_BIT - 1)) / CHAR_BIT) /* packet types */ diff --git a/security/netpgpverify/files/md5.h b/security/netpgpverify/files/md5.h index ef08778d357..2b25e54c9a0 100644 --- a/security/netpgpverify/files/md5.h +++ b/security/netpgpverify/files/md5.h @@ -1,4 +1,4 @@ -/* $NetBSD: md5.h,v 1.1 2013/03/16 07:32:34 agc Exp $ */ +/* $NetBSD: md5.h,v 1.2 2015/08/17 11:37:55 jperkin Exp $ */ /* * This file is derived from the RSA Data Security, Inc. MD5 Message-Digest @@ -39,6 +39,16 @@ #define MD5_DIGEST_LENGTH 16 #define MD5_DIGEST_STRING_LENGTH 33 +#ifndef __BEGIN_DECLS +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +# else +# define __BEGIN_DECLS +# define __END_DECLS +# endif +#endif + /* MD5 context. */ typedef struct MD5Context { uint32_t state[4]; /* state (ABCD) */ diff --git a/security/netpgpverify/files/md5c.c b/security/netpgpverify/files/md5c.c index 36d440ceb49..75703079d22 100644 --- a/security/netpgpverify/files/md5c.c +++ b/security/netpgpverify/files/md5c.c @@ -1,4 +1,4 @@ -/* $NetBSD: md5c.c,v 1.1 2013/03/16 07:32:34 agc Exp $ */ +/* $NetBSD: md5c.c,v 1.2 2015/08/17 11:37:55 jperkin Exp $ */ /* * This file is derived from the RSA Data Security, Inc. MD5 Message-Digest @@ -29,7 +29,6 @@ * documentation and/or software. */ -#include <sys/cdefs.h> #include <sys/types.h> #include <assert.h> #include <string.h> diff --git a/security/netpgpverify/files/rmd160.c b/security/netpgpverify/files/rmd160.c index 2ccc3917ef5..25081bf0ae6 100644 --- a/security/netpgpverify/files/rmd160.c +++ b/security/netpgpverify/files/rmd160.c @@ -1,4 +1,4 @@ -/* $NetBSD: rmd160.c,v 1.1 2013/03/16 07:32:35 agc Exp $ */ +/* $NetBSD: rmd160.c,v 1.2 2015/08/17 11:37:55 jperkin Exp $ */ /* $KAME: rmd160.c,v 1.2 2003/07/25 09:37:55 itojun Exp $ */ /* $OpenBSD: rmd160.c,v 1.3 2001/09/26 21:40:13 markus Exp $ */ /* @@ -30,8 +30,6 @@ * ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf */ -#include <sys/cdefs.h> - #include <string.h> #include <sys/types.h> diff --git a/security/netpgpverify/files/rmd160.h b/security/netpgpverify/files/rmd160.h index 07d291a1d99..75e4a3e057f 100644 --- a/security/netpgpverify/files/rmd160.h +++ b/security/netpgpverify/files/rmd160.h @@ -1,4 +1,4 @@ -/* $NetBSD: rmd160.h,v 1.1 2013/03/16 07:32:35 agc Exp $ */ +/* $NetBSD: rmd160.h,v 1.2 2015/08/17 11:37:55 jperkin Exp $ */ /* $KAME: rmd160.h,v 1.2 2003/07/25 09:37:55 itojun Exp $ */ /* $OpenBSD: rmd160.h,v 1.3 2002/03/14 01:26:51 millert Exp $ */ /* @@ -27,7 +27,6 @@ #ifndef _RMD160_H #define _RMD160_H -#include <sys/cdefs.h> #include <sys/types.h> #include <inttypes.h> @@ -35,6 +34,16 @@ #define RMD160_DIGEST_LENGTH 20 #define RMD160_DIGEST_STRING_LENGTH 41 +#ifndef __BEGIN_DECLS +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +# else +# define __BEGIN_DECLS +# define __END_DECLS +# endif +#endif + /* RMD160 context. */ typedef struct RMD160Context { uint32_t state[5]; /* state */ diff --git a/security/netpgpverify/files/sha1.c b/security/netpgpverify/files/sha1.c index 4f4af2638b1..2c8271034f7 100644 --- a/security/netpgpverify/files/sha1.c +++ b/security/netpgpverify/files/sha1.c @@ -1,4 +1,4 @@ -/* $NetBSD: sha1.c,v 1.1 2013/03/16 07:32:35 agc Exp $ */ +/* $NetBSD: sha1.c,v 1.2 2015/08/17 11:37:55 jperkin Exp $ */ /* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */ /* @@ -17,8 +17,6 @@ #define SHA1HANDSOFF /* Copies data before messing with it. */ -#include <sys/cdefs.h> - #include <string.h> #include <sys/types.h> diff --git a/security/netpgpverify/files/sha1.h b/security/netpgpverify/files/sha1.h index 5087597253b..5ed86f47142 100644 --- a/security/netpgpverify/files/sha1.h +++ b/security/netpgpverify/files/sha1.h @@ -1,4 +1,4 @@ -/* $NetBSD: sha1.h,v 1.1 2013/03/16 07:32:35 agc Exp $ */ +/* $NetBSD: sha1.h,v 1.2 2015/08/17 11:37:55 jperkin Exp $ */ /* * SHA-1 in C @@ -9,7 +9,6 @@ #ifndef _SYS_SHA1_H_ #define _SYS_SHA1_H_ -#include <sys/cdefs.h> #include <sys/types.h> #include <inttypes.h> @@ -17,6 +16,16 @@ #define SHA1_DIGEST_LENGTH 20 #define SHA1_DIGEST_STRING_LENGTH 41 +#ifndef __BEGIN_DECLS +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +# else +# define __BEGIN_DECLS +# define __END_DECLS +# endif +#endif + typedef struct { uint32_t state[5]; uint32_t count[2]; diff --git a/security/netpgpverify/files/sha2.c b/security/netpgpverify/files/sha2.c index 7e4f8c753c3..15f3ae1f010 100644 --- a/security/netpgpverify/files/sha2.c +++ b/security/netpgpverify/files/sha2.c @@ -1,4 +1,4 @@ -/* $NetBSD: sha2.c,v 1.2 2013/03/24 16:48:17 joerg Exp $ */ +/* $NetBSD: sha2.c,v 1.3 2015/08/17 11:37:55 jperkin Exp $ */ /* $KAME: sha2.c,v 1.9 2003/07/20 00:28:38 itojun Exp $ */ /* @@ -36,8 +36,6 @@ * */ -#include <sys/cdefs.h> - #include <sys/types.h> #include <inttypes.h> diff --git a/security/netpgpverify/files/sha2.h b/security/netpgpverify/files/sha2.h index 1217fce4384..1e4bfa33b1f 100644 --- a/security/netpgpverify/files/sha2.h +++ b/security/netpgpverify/files/sha2.h @@ -1,4 +1,4 @@ -/* $NetBSD: sha2.h,v 1.1 2013/03/16 07:32:35 agc Exp $ */ +/* $NetBSD: sha2.h,v 1.2 2015/08/17 11:37:55 jperkin Exp $ */ /* $KAME: sha2.h,v 1.4 2003/07/20 00:28:38 itojun Exp $ */ /* @@ -40,7 +40,6 @@ #define __SHA2_H__ #include <sys/types.h> -#include <sys/cdefs.h> /*** SHA-224/256/384/512 Various Length Definitions ***********************/ #define SHA224_BLOCK_LENGTH 64 @@ -56,6 +55,15 @@ #define SHA512_DIGEST_LENGTH 64 #define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) +#ifndef __BEGIN_DECLS +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +# else +# define __BEGIN_DECLS +# define __END_DECLS +# endif +#endif /*** SHA-256/384/512 Context Structures *******************************/ typedef struct _SHA256_CTX { |