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/dist Unbreak the creation of asci...
details: https://anonhg.NetBSD.org/src/rev/da2b049b5470
branches: trunk
changeset: 749168:da2b049b5470
user: agc <agc%NetBSD.org@localhost>
date: Fri Nov 20 07:17:07 2009 +0000
description:
Unbreak the creation of ascii-armoured signatures.
Add automatic detection of ascii-armoured signatures.
Add tests for same - with small and large source files.
diffstat:
crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c | 3 ++-
crypto/external/bsd/netpgp/dist/src/lib/signature.c | 10 ++++++----
crypto/external/bsd/netpgp/dist/src/lib/validate.c | 11 ++++++++---
crypto/external/bsd/netpgp/dist/src/lib/writer.c | 4 ++--
crypto/external/bsd/netpgp/dist/tst | 14 ++++++++++++--
5 files changed, 30 insertions(+), 12 deletions(-)
diffs (158 lines):
diff -r fcbe9cccb450 -r da2b049b5470 crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c Fri Nov 20 03:12:13 2009 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c Fri Nov 20 07:17:07 2009 +0000
@@ -58,7 +58,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: packet-parse.c,v 1.26 2009/10/09 06:02:55 agc Exp $");
+__RCSID("$NetBSD: packet-parse.c,v 1.27 2009/11/20 07:17:07 agc Exp $");
#endif
#ifdef HAVE_OPENSSL_CAST_H
@@ -2637,6 +2637,7 @@
j - OPS_SALT_SIZE);
}
}
+ break;
default:
break;
}
diff -r fcbe9cccb450 -r da2b049b5470 crypto/external/bsd/netpgp/dist/src/lib/signature.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/signature.c Fri Nov 20 03:12:13 2009 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/signature.c Fri Nov 20 07:17:07 2009 +0000
@@ -57,7 +57,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: signature.c,v 1.22 2009/11/19 21:56:00 agc Exp $");
+__RCSID("$NetBSD: signature.c,v 1.23 2009/11/20 07:17:07 agc Exp $");
#endif
#include <sys/types.h>
@@ -1071,15 +1071,17 @@
__ops_add_birthtime(sig, time(NULL));
/* add key id to signature */
__ops_keyid(keyid, OPS_KEY_ID_SIZE, &seckey->pubkey);
- ret = __ops_add_issuer_keyid(sig, keyid) &&
- __ops_end_hashed_subpkts(sig) &&
- __ops_write_sig(output, sig, &seckey->pubkey, seckey);
+ __ops_add_issuer_keyid(sig, keyid);
+ __ops_end_hashed_subpkts(sig);
+ __ops_write_sig(output, sig, &seckey->pubkey, seckey);
/* tidy up */
__ops_teardown_file_write(output, fd_out);
__ops_create_sig_delete(sig);
__ops_memory_free(infile);
+
+ ret = 1;
}
return ret;
diff -r fcbe9cccb450 -r da2b049b5470 crypto/external/bsd/netpgp/dist/src/lib/validate.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/validate.c Fri Nov 20 03:12:13 2009 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/validate.c Fri Nov 20 07:17:07 2009 +0000
@@ -54,7 +54,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: validate.c,v 1.22 2009/11/19 21:56:01 agc Exp $");
+__RCSID("$NetBSD: validate.c,v 1.23 2009/11/20 07:17:07 agc Exp $");
#endif
#include <sys/types.h>
@@ -695,12 +695,14 @@
int64_t sigsize;
char origfile[MAXPATHLEN];
char *detachname;
+ int realarmour;
int outfd = 0;
int infd;
int cc;
#define SIG_OVERHEAD 284 /* XXX - depends on sig size? */
+ realarmour = armoured;
if (stat(infile, &st) < 0) {
(void) fprintf(io->errs, "can't validate \"%s\"\n", infile);
return 0;
@@ -715,6 +717,9 @@
detachname = strdup(origfile);
}
}
+ if (strcmp(&origfile[cc - 4], ".asc") == 0) {
+ realarmour = 1;
+ }
(void) memset(&validation, 0x0, sizeof(validation));
@@ -735,7 +740,7 @@
/* is never used. */
validation.reader = parse->readinfo.arg;
- if (armoured) {
+ if (realarmour) {
__ops_reader_push_dearmour(parse);
}
@@ -743,7 +748,7 @@
__ops_parse(parse, !printerrors);
/* Tidy up */
- if (armoured) {
+ if (realarmour) {
__ops_reader_pop_dearmour(parse);
}
__ops_teardown_file_read(parse, infd);
diff -r fcbe9cccb450 -r da2b049b5470 crypto/external/bsd/netpgp/dist/src/lib/writer.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/writer.c Fri Nov 20 03:12:13 2009 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/writer.c Fri Nov 20 07:17:07 2009 +0000
@@ -58,7 +58,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: writer.c,v 1.15 2009/10/07 16:19:51 agc Exp $");
+__RCSID("$NetBSD: writer.c,v 1.16 2009/11/20 07:17:07 agc Exp $");
#endif
#include <sys/types.h>
@@ -747,7 +747,7 @@
return 0;
}
- return __ops_stacked_write(trailer, sizeof(trailer)-1, errors, writer);
+ return __ops_stacked_write(trailer, strlen(trailer), errors, writer);
}
/**
diff -r fcbe9cccb450 -r da2b049b5470 crypto/external/bsd/netpgp/dist/tst
--- a/crypto/external/bsd/netpgp/dist/tst Fri Nov 20 03:12:13 2009 +0000
+++ b/crypto/external/bsd/netpgp/dist/tst Fri Nov 20 07:17:07 2009 +0000
@@ -31,7 +31,7 @@
su root -c "make install"'
passed=0
-total=19
+total=23
echo "======> sign/verify 180938 file"
cp configure a
/usr/bin/netpgp --sign a
@@ -94,5 +94,15 @@
/usr/bin/netpgpverify --version
echo "======> find specific key information"
/usr/bin/netpgpkeys --get-key c0596823 agc%netbsd.org@localhost && passed=$(expr $passed + 1)
-rm -f a a.gpg b b.gpg c c.gpg d d.gpg e f f.sig a2 a3
+echo "======> ascii armoured signature"
+cp Makefile.am g
+/usr/bin/netpgp --sign --armor g && passed=$(expr $passed + 1)
+echo "======> ascii armoured sig detection and verification"
+/usr/bin/netpgp --verify g.asc && passed=$(expr $passed + 1)
+echo "======> ascii armoured signature of large file"
+cp Makefile.in g
+/usr/bin/netpgp --sign --armor g && passed=$(expr $passed + 1)
+echo "======> ascii armoured sig detection and verification of large file"
+/usr/bin/netpgp --verify g.asc && passed=$(expr $passed + 1)
+rm -f a a.gpg b b.gpg c c.gpg d d.gpg e f f.sig g g.asc a2 a3
echo "Passed ${passed}/${total} tests"
Home |
Main Index |
Thread Index |
Old Index