Module Name: src
Committed By: christos
Date: Sat Sep 3 09:31:22 UTC 2016
Modified Files:
src/crypto/external/bsd/netpgp/dist/src/netpgpverify: libverify.c
Log Message:
Fix the error handling so that we print the earliest error message.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.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/libverify.c
diff -u src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c:1.11 src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c:1.12
--- src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c:1.11 Sun Aug 28 11:52:22 2016
+++ src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c Sat Sep 3 05:31:22 2016
@@ -2085,8 +2085,10 @@ setup_data(pgpv_cursor_t *cursor, pgpv_t
{
FILE *fp;
char buf[BUFSIZ];
+ int rv;
if (cursor == NULL || pgp == NULL || p == NULL) {
+ snprintf(cursor->why, sizeof(cursor->why), "No input data");
return 0;
}
memset(cursor, 0x0, sizeof(*cursor));
@@ -2104,19 +2106,19 @@ setup_data(pgpv_cursor_t *cursor, pgpv_t
return 0;
}
if (is_armored(buf, sizeof(buf))) {
- read_ascii_armor_file(cursor, p);
+ rv = read_ascii_armor_file(cursor, p);
} else {
- read_binary_file(pgp, "signature", "%s", (const char *)p);
+ rv = read_binary_file(pgp, "signature", "%s", (const char *)p);
}
fclose(fp);
} else {
if (is_armored(p, (size_t)size)) {
- read_ascii_armor_memory(cursor, p, (size_t)size);
+ rv = read_ascii_armor_memory(cursor, p, (size_t)size);
} else {
- read_binary_memory(pgp, "signature", p, (size_t)size);
+ rv = read_binary_memory(pgp, "signature", p, (size_t)size);
}
}
- return 1;
+ return rv;
}
/* get the data and size from litdata packet */
@@ -2780,7 +2782,6 @@ pgpv_verify(pgpv_cursor_t *cursor, pgpv_
return 0;
}
if (!setup_data(cursor, pgp, p, size)) {
- snprintf(cursor->why, sizeof(cursor->why), "No input data");
return 0;
}
if (ARRAY_COUNT(cursor->pgp->pkts) == ARRAY_LAST(cursor->pgp->datastarts) + 1) {