Source-Changes-HG archive

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

[src/agc-netpgp-standalone]: src/crypto/external/bsd/netpgp/dist/src change t...



details:   https://anonhg.NetBSD.org/src/rev/ef1e0c672bcf
branches:  agc-netpgp-standalone
changeset: 777826:ef1e0c672bcf
user:      agc <agc%NetBSD.org@localhost>
date:      Thu Oct 25 04:03:16 2012 +0000

description:
change the signature (ha!) of the pgpv_read_pubring() function to allow a
key to be specified as a string in memory, as well as in a file. as always,
the pubring must precede the signature.

diffstat:

 crypto/external/bsd/netpgp/dist/src/libverify/libnetpgpverify.3 |  9 +++++++--
 crypto/external/bsd/netpgp/dist/src/libverify/libverify.c       |  6 ++++--
 crypto/external/bsd/netpgp/dist/src/libverify/verify.h          |  6 ++++--
 crypto/external/bsd/netpgp/dist/src/netpgpverify/main.c         |  2 +-
 4 files changed, 16 insertions(+), 7 deletions(-)

diffs (97 lines):

diff -r b925a6864c8a -r ef1e0c672bcf crypto/external/bsd/netpgp/dist/src/libverify/libnetpgpverify.3
--- a/crypto/external/bsd/netpgp/dist/src/libverify/libnetpgpverify.3   Wed Oct 24 03:13:12 2012 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/libverify/libnetpgpverify.3   Thu Oct 25 04:03:16 2012 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: libnetpgpverify.3,v 1.1.2.4 2012/10/23 15:00:56 agc Exp $
+.\" $NetBSD: libnetpgpverify.3,v 1.1.2.5 2012/10/25 04:03:16 agc Exp $
 .\"
 .\" Copyright (c) 2012 Alistair Crooks <agc%NetBSD.org@localhost>
 .\" All rights reserved.
@@ -35,7 +35,7 @@
 .In netpgp/verify.h
 .Ft int
 .Fo pgpv_read_pubring
-.Fa "pgpv_t *pgp" "const char *keyring"
+.Fa "pgpv_t *pgp" "const void *keyring" "ssize_t size"
 .Fc
 .Ft size_t
 .Fo pgpv_verify
@@ -67,6 +67,7 @@
 This library has enough functionality to parse a pubkey keyring,
 using
 .Fn pgpv_read_pubring
+to read the public keys of trusted identities,
 and to read files or memory which has already been signed.
 The
 .Fn pgpv_verify 
@@ -125,6 +126,10 @@
 .Xr bn 3 ,
 .Xr zlib 3 ,
 .Xr bzlib2 3
+.Sh STANDARDS
+The
+.Nm
+utility is designed to conform to IETF RFC 4880.
 .Sh HISTORY
 The
 .Nm
diff -r b925a6864c8a -r ef1e0c672bcf crypto/external/bsd/netpgp/dist/src/libverify/libverify.c
--- a/crypto/external/bsd/netpgp/dist/src/libverify/libverify.c Wed Oct 24 03:13:12 2012 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/libverify/libverify.c Thu Oct 25 04:03:16 2012 +0000
@@ -2134,10 +2134,12 @@
 
 /* set up the pubkey keyring */
 int
-pgpv_read_pubring(pgpv_t *pgp, const char *keyring)
+pgpv_read_pubring(pgpv_t *pgp, const void *keyring, ssize_t size)
 {
        if (keyring) {
-               return read_binary_file(pgp, "pubring", "%s", keyring);
+               return (size > 0) ?
+                       read_binary_memory(pgp, "pubring", keyring, (size_t)size) :
+                       read_binary_file(pgp, "pubring", "%s", keyring);
        }
        return read_binary_file(pgp, "pubring", "%s/%s", getenv("HOME"), ".gnupg/pubring.gpg");
 }
diff -r b925a6864c8a -r ef1e0c672bcf crypto/external/bsd/netpgp/dist/src/libverify/verify.h
--- a/crypto/external/bsd/netpgp/dist/src/libverify/verify.h    Wed Oct 24 03:13:12 2012 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/libverify/verify.h    Thu Oct 25 04:03:16 2012 +0000
@@ -240,6 +240,8 @@
        const char                      *op;            /* the operation we're doing */
 } pgpv_t;
 
+#define PGPV_REASON_LEN                        128
+
 /* when searching, we define a cursor, and fill in an array of subscripts */
 typedef struct pgpv_cursor_t {
        pgpv_t                  *pgp;                   /* pointer to pgp tree */
@@ -250,7 +252,7 @@
        PGPV_ARRAY(uint32_t,     found);                /* array of matched subscripts */
        PGPV_ARRAY(size_t,       datacookies);          /* cookies to retrieve matched data */
        int64_t                  sigtime;               /* time of signature */
-       char                     why[128];              /* reason for bad signature */
+       char                     why[PGPV_REASON_LEN];  /* reason for bad signature */
 } pgpv_cursor_t;
 
 #ifndef __BEGIN_DECLS
@@ -265,7 +267,7 @@
 
 __BEGIN_DECLS
 
-int pgpv_read_pubring(pgpv_t */*pgp*/, const char */*keyring*/);
+int pgpv_read_pubring(pgpv_t */*pgp*/, const void */*keyringfile/mem*/, ssize_t /*size*/);
 
 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*/);
diff -r b925a6864c8a -r ef1e0c672bcf crypto/external/bsd/netpgp/dist/src/netpgpverify/main.c
--- a/crypto/external/bsd/netpgp/dist/src/netpgpverify/main.c   Wed Oct 24 03:13:12 2012 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/netpgpverify/main.c   Thu Oct 25 04:03:16 2012 +0000
@@ -147,7 +147,7 @@
        if (cmd == NULL) {
                cmd = "verify";
        }
-       if (!pgpv_read_pubring(&pgp, keyring)) {
+       if (!pgpv_read_pubring(&pgp, keyring, -1)) {
                errx(EXIT_FAILURE, "can't read keyring");
        }
        if (optind == argc) {



Home | Main Index | Thread Index | Old Index