diff options
author | agc <agc@pkgsrc.org> | 2016-06-15 03:34:15 +0000 |
---|---|---|
committer | agc <agc@pkgsrc.org> | 2016-06-15 03:34:15 +0000 |
commit | 9ca3d548282c5d11d33b1a4156cccc7cd7944b8b (patch) | |
tree | df5e37d46e0be4ba37340692e8672c3258afa991 /security | |
parent | 59223a25bddd7891941aa2c42aef5eddf87a1124 (diff) | |
download | pkgsrc-9ca3d548282c5d11d33b1a4156cccc7cd7944b8b.tar.gz |
Update netpgpverify and libnetpgpverify to 20160615:
Simplify the method of finding the end of the versioning information
in the signature - back up to the "\n" character at the end of the
signature start:
"-----BEGIN PGP SIGNATURE-----\n"
and then find the "\n\n" character sequence to denote the start of the
signature itself. The previous version worked, but this is more efficient.
Diffstat (limited to 'security')
-rw-r--r-- | security/netpgpverify/files/libverify.c | 18 | ||||
-rw-r--r-- | security/netpgpverify/files/verify.h | 6 |
2 files changed, 10 insertions, 14 deletions
diff --git a/security/netpgpverify/files/libverify.c b/security/netpgpverify/files/libverify.c index 81de971ab4e..0260fd9d4b9 100644 --- a/security/netpgpverify/files/libverify.c +++ b/security/netpgpverify/files/libverify.c @@ -2021,18 +2021,14 @@ read_ascii_armor(pgpv_cursor_t *cursor, pgpv_mem_t *mem, const char *filename) return 0; } litdata.u.litdata.len = litdata.s.size = (size_t)(p - datastart); - p += strlen(SIGSTART); - /* Work out whther there's a version line */ - if (memcmp(p, "Version:", 8) == 0) { - if ((p = find_bin_string(p, mem->size, "\n\n", 2)) == NULL) { - snprintf(cursor->why, sizeof(cursor->why), - "malformed armed signature at %zu", (size_t)(p - mem->mem)); - return 0; - } - p += 2; - } else { - p += 1; + /* this puts p at the newline character, so it will find \n\n if no version */ + p += strlen(SIGSTART) - 1; + if ((p = find_bin_string(p, mem->size, "\n\n", 2)) == NULL) { + snprintf(cursor->why, sizeof(cursor->why), + "malformed armed signature at %zu", (size_t)(p - mem->mem)); + return 0; } + p += 2; sigend = find_bin_string(p, mem->size, SIGEND, strlen(SIGEND)); binsigsize = b64decode((char *)p, (size_t)(sigend - p), binsig, sizeof(binsig)); diff --git a/security/netpgpverify/files/verify.h b/security/netpgpverify/files/verify.h index 83fd14ed592..e4539b7fe90 100644 --- a/security/netpgpverify/files/verify.h +++ b/security/netpgpverify/files/verify.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012,2013,2014,2015 Alistair Crooks <agc@NetBSD.org> + * Copyright (c) 2012,2013,2014,2015,2016 Alistair Crooks <agc@NetBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -23,9 +23,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef NETPGP_VERIFY_H_ -#define NETPGP_VERIFY_H_ 20160614 +#define NETPGP_VERIFY_H_ 20160615 -#define NETPGPVERIFY_VERSION "netpgpverify portable 20160614" +#define NETPGPVERIFY_VERSION "netpgpverify portable 20160615" #include <sys/types.h> |