Module Name:    src
Committed By:   agc
Date:           Tue Oct 23 15:03:37 UTC 2012

Modified Files:
        src/crypto/external/bsd/netpgp/dist/src/netpgpverify 
[agc-netpgp-standalone]:
            main.c

Log Message:
Fix a tyop in the getopt string so that it specifies that -k takes an
argument - makes the specification of public keyrings work again.

Make pgpv_verify return a cookie if the signature matches, rather than
just a plain pseudo-boolean value.  The cookie can be used
subsequently to retrieve the verified data

Use the cookie as input to pgp_get_verified()

Add tests for DSA key verification


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \
    src/crypto/external/bsd/netpgp/dist/src/netpgpverify/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/netpgpverify/main.c
diff -u src/crypto/external/bsd/netpgp/dist/src/netpgpverify/main.c:1.1.2.2 src/crypto/external/bsd/netpgp/dist/src/netpgpverify/main.c:1.1.2.3
--- src/crypto/external/bsd/netpgp/dist/src/netpgpverify/main.c:1.1.2.2	Sat Oct 20 05:55:43 2012
+++ src/crypto/external/bsd/netpgp/dist/src/netpgpverify/main.c	Tue Oct 23 15:03:37 2012
@@ -87,16 +87,17 @@ getstdin(ssize_t *cc, size_t *size)
 
 /* verify memory or file */
 static int
-verify_data(pgpv_t *pgp, const char *cmd, const char *inname, char *in, size_t cc, unsigned n)
+verify_data(pgpv_t *pgp, const char *cmd, const char *inname, char *in, ssize_t cc)
 {
 	pgpv_cursor_t	 cursor;
 	size_t		 size;
+	size_t		 cookie;
 	char		*data;
 
 	memset(&cursor, 0x0, sizeof(cursor));
 	if (strcasecmp(cmd, "cat") == 0) {
-		if (pgpv_verify(&cursor, pgp, in, cc)) {
-			if ((size = pgpv_get_verified(&cursor, ARRAY_ELEMENT(cursor.datacookies, n), &data)) > 0) {
+		if ((cookie = pgpv_verify(&cursor, pgp, in, cc)) != 0) {
+			if ((size = pgpv_get_verified(&cursor, cookie, &data)) > 0) {
 				printf("%.*s", (int)size, data);
 			}
 			return 1;
@@ -131,7 +132,7 @@ main(int argc, char **argv)
 	cmd = NULL;
 	keyring = NULL;
 	ok = 1;
-	while ((i = getopt(argc, argv, "c:k")) != -1) {
+	while ((i = getopt(argc, argv, "c:k:")) != -1) {
 		switch(i) {
 		case 'c':
 			cmd = optarg;
@@ -151,10 +152,10 @@ main(int argc, char **argv)
 	}
 	if (optind == argc) {
 		in = getstdin(&cc, &size);
-		ok = verify_data(&pgp, cmd, "[stdin]", in, cc, 0);
+		ok = verify_data(&pgp, cmd, "[stdin]", in, cc);
 	} else {
 		for (ok = 1, i = optind ; i < argc ; i++) {
-			if (!verify_data(&pgp, cmd, argv[i], argv[i], -1, i)) {
+			if (!verify_data(&pgp, cmd, argv[i], argv[i], -1)) {
 				ok = 0;
 			}
 		}

Reply via email to