Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/netpgp Bring over the 20141204 portable ...



details:   https://anonhg.NetBSD.org/src/rev/3d29f7422ff1
branches:  trunk
changeset: 334746:3d29f7422ff1
user:      agc <agc%NetBSD.org@localhost>
date:      Fri Dec 05 04:42:36 2014 +0000

description:
Bring over the 20141204 portable version of netpgpverify from pkgsrc

+ Remove unused logmessage helper function

+ Add pgpv_get_cursor_element for easier manipulation of results
returned.

+ libnetpgpverify(3) man page improvements

+ Standardise on WARNS=5 settings (6 is too intrusive and distracting)

+ Also install the library and header file for netpgpverify.  This
allows scripting languages to use the same verification methods via a
shared library, rather than being forced to exec the netpgpverify(1)
command line utility.

+ libnetpgpverify is now a standalone library, and requires no
pre-requsisite libraries to function

diffstat:

 crypto/external/bsd/netpgp/bin/netpgpverify/Makefile               |   4 +-
 crypto/external/bsd/netpgp/dist/src/netpgpverify/Makefile.bsd      |   4 +-
 crypto/external/bsd/netpgp/dist/src/netpgpverify/libnetpgpverify.3 |  14 +++-
 crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c       |  10 +++
 crypto/external/bsd/netpgp/dist/src/netpgpverify/main.c            |   6 +-
 crypto/external/bsd/netpgp/dist/src/netpgpverify/misc.c            |  15 -----
 crypto/external/bsd/netpgp/dist/src/netpgpverify/misc.h            |   4 -
 crypto/external/bsd/netpgp/dist/src/netpgpverify/rsa.c             |   1 -
 crypto/external/bsd/netpgp/dist/src/netpgpverify/verify.h          |   5 +-
 crypto/external/bsd/netpgp/lib/verify/Makefile                     |  29 ++++++---
 crypto/external/bsd/netpgp/lib/verify/config.h                     |  12 ++++
 11 files changed, 59 insertions(+), 45 deletions(-)

diffs (263 lines):

diff -r 0462d64fa3f9 -r 3d29f7422ff1 crypto/external/bsd/netpgp/bin/netpgpverify/Makefile
--- a/crypto/external/bsd/netpgp/bin/netpgpverify/Makefile      Fri Dec 05 01:50:47 2014 +0000
+++ b/crypto/external/bsd/netpgp/bin/netpgpverify/Makefile      Fri Dec 05 04:42:36 2014 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.12 2014/03/13 12:54:49 joerg Exp $
+#      $NetBSD: Makefile,v 1.13 2014/12/05 04:42:36 agc Exp $
 
 PROG=netpgpverify
 BINDIR=                /usr/bin
@@ -20,7 +20,7 @@
 .endif
 
 MAN=   netpgpverify.1
-WARNS= 4
+WARNS= 5
 
 EXTDIST=${.CURDIR}/../../dist
 
diff -r 0462d64fa3f9 -r 3d29f7422ff1 crypto/external/bsd/netpgp/dist/src/netpgpverify/Makefile.bsd
--- a/crypto/external/bsd/netpgp/dist/src/netpgpverify/Makefile.bsd     Fri Dec 05 01:50:47 2014 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/netpgpverify/Makefile.bsd     Fri Dec 05 04:42:36 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.bsd,v 1.1 2014/03/09 00:15:45 agc Exp $
+# $NetBSD: Makefile.bsd,v 1.2 2014/12/05 04:42:36 agc Exp $
 
 PROG=netpgpverify
 
@@ -18,7 +18,7 @@
 .endif
 
 MAN=   netpgpverify.1
-WARNS= 6
+WARNS= 5
 
 .include <bsd.prog.mk>
 
diff -r 0462d64fa3f9 -r 3d29f7422ff1 crypto/external/bsd/netpgp/dist/src/netpgpverify/libnetpgpverify.3
--- a/crypto/external/bsd/netpgp/dist/src/netpgpverify/libnetpgpverify.3        Fri Dec 05 01:50:47 2014 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/netpgpverify/libnetpgpverify.3        Fri Dec 05 04:42:36 2014 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: libnetpgpverify.3,v 1.1 2014/03/09 00:15:45 agc Exp $
+.\" $NetBSD: libnetpgpverify.3,v 1.2 2014/12/05 04:42:36 agc Exp $
 .\"
 .\" Copyright (c) 2014 Alistair Crooks <agc%NetBSD.org@localhost>
 .\" All rights reserved.
@@ -23,7 +23,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 16, 2014
+.Dd December 4, 2014
 .Dt LIBNETPGPVERIFY 3
 .Os
 .Sh NAME
@@ -32,7 +32,7 @@
 .Sh LIBRARY
 .Lb libnetpgpverify
 .Sh SYNOPSIS
-.In netpgpverify.h
+.In netpgp/verify.h
 .Ft int
 .Fo pgpv_read_pubring
 .Fa "pgpv_t *pgp" "const void *keyring" "ssize_t size"
@@ -47,11 +47,15 @@
 .Fc
 .Ft size_t
 .Fo pgpv_get_verified
-.Fa "pgpv_cursor_t *cursor" "size_t cookie " "char **ret"
+.Fa "pgpv_cursor_t *cursor" "size_t cookie" "char **ret"
+.Fc
+.Ft size_t
+.Fo pgpv_get_cursor_element
+.Fa "pgpv_cursor_t *cursor" "size_t element"
 .Fc
 .Ft size_t
 .Fo pgpv_get_entry
-.Fa "pgpv_t *pgp" "unsigned ent" "char **ret"
+.Fa "pgpv_t *pgp" "unsigned ent" "char **ret" "const char *modifiers"
 .Fc
 .Ft int
 .Fo pgpv_close
diff -r 0462d64fa3f9 -r 3d29f7422ff1 crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c
--- a/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c      Fri Dec 05 01:50:47 2014 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c      Fri Dec 05 04:42:36 2014 +0000
@@ -2597,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)
diff -r 0462d64fa3f9 -r 3d29f7422ff1 crypto/external/bsd/netpgp/dist/src/netpgpverify/main.c
--- a/crypto/external/bsd/netpgp/dist/src/netpgpverify/main.c   Fri Dec 05 01:50:47 2014 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/netpgpverify/main.c   Fri Dec 05 04:42:36 2014 +0000
@@ -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);
diff -r 0462d64fa3f9 -r 3d29f7422ff1 crypto/external/bsd/netpgp/dist/src/netpgpverify/misc.c
--- a/crypto/external/bsd/netpgp/dist/src/netpgpverify/misc.c   Fri Dec 05 01:50:47 2014 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/netpgpverify/misc.c   Fri Dec 05 04:42:36 2014 +0000
@@ -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
diff -r 0462d64fa3f9 -r 3d29f7422ff1 crypto/external/bsd/netpgp/dist/src/netpgpverify/misc.h
--- a/crypto/external/bsd/netpgp/dist/src/netpgpverify/misc.h   Fri Dec 05 01:50:47 2014 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/netpgpverify/misc.h   Fri Dec 05 04:42:36 2014 +0000
@@ -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*/, ...) __printflike(2, 3);
-#endif
-
 __END_DECLS
 
 #endif
diff -r 0462d64fa3f9 -r 3d29f7422ff1 crypto/external/bsd/netpgp/dist/src/netpgpverify/rsa.c
--- a/crypto/external/bsd/netpgp/dist/src/netpgpverify/rsa.c    Fri Dec 05 01:50:47 2014 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/netpgpverify/rsa.c    Fri Dec 05 04:42:36 2014 +0000
@@ -29,7 +29,6 @@
 
 #ifdef _KERNEL
 # include <sys/kmem.h>
-# define logmessage    log
 #else
 # include <stdio.h>
 # include <stdlib.h>
diff -r 0462d64fa3f9 -r 3d29f7422ff1 crypto/external/bsd/netpgp/dist/src/netpgpverify/verify.h
--- a/crypto/external/bsd/netpgp/dist/src/netpgpverify/verify.h Fri Dec 05 01:50:47 2014 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/netpgpverify/verify.h Fri Dec 05 04:42:36 2014 +0000
@@ -23,9 +23,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #ifndef NETPGP_VERIFY_H_
-#define NETPGP_VERIFY_H_       20140304
+#define NETPGP_VERIFY_H_       20141204
 
-#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*/);
 
diff -r 0462d64fa3f9 -r 3d29f7422ff1 crypto/external/bsd/netpgp/lib/verify/Makefile
--- a/crypto/external/bsd/netpgp/lib/verify/Makefile    Fri Dec 05 01:50:47 2014 +0000
+++ b/crypto/external/bsd/netpgp/lib/verify/Makefile    Fri Dec 05 04:42:36 2014 +0000
@@ -1,24 +1,31 @@
-# $NetBSD: Makefile,v 1.6 2013/09/11 09:57:09 joerg Exp $
+# $NetBSD: Makefile,v 1.7 2014/12/05 04:42:36 agc Exp $
 
 LIB=netpgpverify
-SRCS=libverify.c b64.c pgpsum.c
-SRCS+=digest.c tiger.c
-SRCS+=bignum.c misc.c
-CPPFLAGS+=-I${EXTDIST}/src/libbn
-CPPFLAGS+=-I${EXTDIST}/src/libdigest
-CPPFLAGS+=-I${EXTDIST}/src/librsa
+SRCS+=b64.c
+SRCS+=bignum.c
+SRCS+=bufgap.c
+SRCS+=digest.c
+SRCS+=libverify.c
+SRCS+=misc.c
+SRCS+=pgpsum.c
+SRCS+=rsa.c
+SRCS+=bzlib.c
+SRCS+=zlib.c
+SRCS+=sha1.c
+SRCS+=sha2.c
+SRCS+=md5c.c
+SRCS+=rmd160.c
+SRCS+=tiger.c
+CPPFLAGS+=-I${.CURDIR} -I${EXTDIST}/src/netpgpverify
 MAN=libnetpgpverify.3
 WARNS=5
 
 EXTDIST=${.CURDIR}/../../dist
-.PATH: ${EXTDIST}/src/libverify ${EXTDIST}/src/libdigest ${EXTDIST}/src/libbn ${EXTDIST}/src/librsa
+.PATH: ${EXTDIST}/src/netpgpverify
 
 INCS=verify.h
 INCSDIR=/usr/include/netpgp
 
-LIBDPLIBS+=    z               ${NETBSDSRCDIR}/lib/libz
-LIBDPLIBS+=    bz2             ${NETBSDSRCDIR}/lib/libbz2
-
 .include <bsd.lib.mk>
 
 .if ${HAVE_GCC:U} == "45" && ${MACHINE_CPU} == "ia64"
diff -r 0462d64fa3f9 -r 3d29f7422ff1 crypto/external/bsd/netpgp/lib/verify/config.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/external/bsd/netpgp/lib/verify/config.h    Fri Dec 05 04:42:36 2014 +0000
@@ -0,0 +1,12 @@
+#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_ */



Home | Main Index | Thread Index | Old Index