Module Name:    src
Committed By:   christos
Date:           Mon Mar  5 02:20:19 UTC 2012

Modified Files:
        src/crypto/external/bsd/netpgp/dist/src/lib: compress.c errors.h misc.c
            packet-parse.c reader.c signature.c validate.c writer.c

Log Message:
Fix compilation:
kill PGP_ERROR() and make everything use a format.
XXX: Fixme to use __VA_ARGS__ instead of the silly PGP_ERROR_N() macros.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 \
    src/crypto/external/bsd/netpgp/dist/src/lib/compress.c
cvs rdiff -u -r1.6 -r1.7 src/crypto/external/bsd/netpgp/dist/src/lib/errors.h
cvs rdiff -u -r1.40 -r1.41 src/crypto/external/bsd/netpgp/dist/src/lib/misc.c
cvs rdiff -u -r1.50 -r1.51 \
    src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c
cvs rdiff -u -r1.48 -r1.49 \
    src/crypto/external/bsd/netpgp/dist/src/lib/reader.c
cvs rdiff -u -r1.33 -r1.34 \
    src/crypto/external/bsd/netpgp/dist/src/lib/signature.c
cvs rdiff -u -r1.43 -r1.44 \
    src/crypto/external/bsd/netpgp/dist/src/lib/validate.c
cvs rdiff -u -r1.32 -r1.33 \
    src/crypto/external/bsd/netpgp/dist/src/lib/writer.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/lib/compress.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.22 src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.23
--- src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.22	Sun Mar  4 14:52:02 2012
+++ src/crypto/external/bsd/netpgp/dist/src/lib/compress.c	Sun Mar  4 21:20:18 2012
@@ -57,7 +57,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: compress.c,v 1.22 2012/03/04 19:52:02 agc Exp $");
+__RCSID("$NetBSD: compress.c,v 1.23 2012/03/05 02:20:18 christos Exp $");
 #endif
 
 #ifdef HAVE_ZLIB_H
@@ -170,13 +170,14 @@ zlib_compressed_data_reader(pgp_stream_t
 			if (ret == Z_STREAM_END) {
 				if (!z->region->indeterminate &&
 				    z->region->readc != z->region->length) {
-					PGP_ERROR(cbinfo->errors,
+					PGP_ERROR_1(cbinfo->errors,
 						PGP_E_P_DECOMPRESSION_ERROR,
+						"%s",
 						"Compressed stream ended before packet end.");
 				}
 			} else if (ret != Z_OK) {
 				(void) fprintf(stderr, "ret=%d\n", ret);
-				PGP_ERROR(cbinfo->errors,
+				PGP_ERROR_1(cbinfo->errors,
 					PGP_E_P_DECOMPRESSION_ERROR, "%s",
 					z->zstream.msg);
 			}
@@ -250,8 +251,9 @@ bzip2_compressed_data_reader(pgp_stream_
 			if (ret == BZ_STREAM_END) {
 				if (!bz->region->indeterminate &&
 				    bz->region->readc != bz->region->length)
-					PGP_ERROR(cbinfo->errors,
+					PGP_ERROR_1(cbinfo->errors,
 						PGP_E_P_DECOMPRESSION_ERROR,
+						"%s",
 						"Compressed stream ended before packet end.");
 			} else if (ret != BZ_OK) {
 				PGP_ERROR_1(cbinfo->errors,

Index: src/crypto/external/bsd/netpgp/dist/src/lib/errors.h
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/errors.h:1.6 src/crypto/external/bsd/netpgp/dist/src/lib/errors.h:1.7
--- src/crypto/external/bsd/netpgp/dist/src/lib/errors.h:1.6	Sun Nov  7 03:39:59 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/errors.h	Sun Mar  4 21:20:18 2012
@@ -150,9 +150,6 @@ int  pgp_has_error(pgp_error_t *, pgp_er
 	fprintf(stderr, "Memory error\n");				\
 }				/* \todo placeholder for better error
 				 * handling */
-#define PGP_ERROR(err,code,fmt)	do {					\
-	pgp_push_error(err,code,0,__FILE__,__LINE__,fmt);		\
-} while(/*CONSTCOND*/0)
 #define PGP_ERROR_1(err,code,fmt,arg)	do {				\
 	pgp_push_error(err,code,0,__FILE__,__LINE__,fmt,arg);		\
 } while(/*CONSTCOND*/0)

Index: src/crypto/external/bsd/netpgp/dist/src/lib/misc.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.40 src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.41
--- src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.40	Mon Nov 29 01:21:40 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/misc.c	Sun Mar  4 21:20:18 2012
@@ -57,7 +57,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: misc.c,v 1.40 2010/11/29 06:21:40 agc Exp $");
+__RCSID("$NetBSD: misc.c,v 1.41 2012/03/05 02:20:18 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -132,7 +132,8 @@ accumulate_cb(const pgp_packet_t *pkt, p
 					keyring->keyc - 1);
 		}
 		if (keyring->keyc == 0) {
-			PGP_ERROR(cbinfo->errors, PGP_E_P_NO_USERID, "No userid found");
+			PGP_ERROR_1(cbinfo->errors, PGP_E_P_NO_USERID, "%s",
+			    "No userid found");
 		} else {
 			pgp_add_userid(&keyring->keys[keyring->keyc - 1], content->userid);
 		}

Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.50 src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.51
--- src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.50	Mon Nov 15 03:56:30 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c	Sun Mar  4 21:20:18 2012
@@ -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.50 2010/11/15 08:56:30 agc Exp $");
+__RCSID("$NetBSD: packet-parse.c,v 1.51 2012/03/05 02:20:18 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -406,16 +406,17 @@ pgp_limited_read(pgp_stream_t *stream, u
 
 	if (!region->indeterminate &&
 	    region->readc + length > region->length) {
-		PGP_ERROR(errors, PGP_E_P_NOT_ENOUGH_DATA, "Not enough data");
+		PGP_ERROR_1(errors, PGP_E_P_NOT_ENOUGH_DATA, "%s",
+		    "Not enough data");
 		return 0;
 	}
 	r = full_read(stream, dest, length, &lr, errors, readinfo, cbinfo);
 	if (lr < 0) {
-		PGP_ERROR(errors, PGP_E_R_READ_FAILED, "Read failed");
+		PGP_ERROR_1(errors, PGP_E_R_READ_FAILED, "%s", "Read failed");
 		return 0;
 	}
 	if (!region->indeterminate && r != length) {
-		PGP_ERROR(errors, PGP_E_R_READ_FAILED, "Read failed");
+		PGP_ERROR_1(errors, PGP_E_R_READ_FAILED, "%s", "Read failed");
 		return 0;
 	}
 	region->last_read = (unsigned)r;
@@ -683,7 +684,8 @@ limread_mpi(BIGNUM **pbn, pgp_region_t *
 	}
 	if (((unsigned)buf[0] >> nonzero) != 0 ||
 	    !((unsigned)buf[0] & (1U << (nonzero - 1U)))) {
-		PGP_ERROR(&stream->errors, PGP_E_P_MPI_FORMAT_ERROR, "MPI Format error");
+		PGP_ERROR_1(&stream->errors, PGP_E_P_MPI_FORMAT_ERROR,
+		    "%s", "MPI Format error");
 		/* XXX: Ben, one part of
 		 * this constraint does
 		 * not apply to
@@ -2321,14 +2323,14 @@ consume_packet(pgp_region_t *region, pgp
 		/* now throw it away */
 		pgp_data_free(&remainder);
 		if (warn) {
-			PGP_ERROR(&stream->errors, PGP_E_P_PACKET_CONSUMED,
-				"Warning: packet consumer");
+			PGP_ERROR_1(&stream->errors, PGP_E_P_PACKET_CONSUMED,
+			    "%s", "Warning: packet consumer");
 		}
 		return 1;
 	}
-	PGP_ERROR(&stream->errors, PGP_E_P_PACKET_NOT_CONSUMED,
-			(warn) ? "Warning: Packet was not consumed" :
-				"Packet was not consumed");
+	PGP_ERROR_1(&stream->errors, PGP_E_P_PACKET_NOT_CONSUMED,
+	    "%s", (warn) ? "Warning: Packet was not consumed" :
+	    "Packet was not consumed");
 	return warn;
 }
 

Index: src/crypto/external/bsd/netpgp/dist/src/lib/reader.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.48 src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.49
--- src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.48	Sat Jan  1 17:29:00 2011
+++ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c	Sun Mar  4 21:20:18 2012
@@ -54,7 +54,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: reader.c,v 1.48 2011/01/01 22:29:00 agc Exp $");
+__RCSID("$NetBSD: reader.c,v 1.49 2012/03/05 02:20:18 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -396,34 +396,34 @@ set_lastseen_headerline(dearmour_t *dear
 
 	case END_PGP_MESSAGE:
 		if (prev != BEGIN_PGP_MESSAGE) {
-			PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
+			PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT, "%s",
 				"Got END PGP MESSAGE, but not after BEGIN");
 		}
 		break;
 
 	case END_PGP_PUBLIC_KEY_BLOCK:
 		if (prev != BEGIN_PGP_PUBLIC_KEY_BLOCK) {
-			PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
+			PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT, "%s",
 			"Got END PGP PUBLIC KEY BLOCK, but not after BEGIN");
 		}
 		break;
 
 	case END_PGP_PRIVATE_KEY_BLOCK:
 		if (prev != BEGIN_PGP_PRIVATE_KEY_BLOCK) {
-			PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
+			PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT, "%s",
 			"Got END PGP PRIVATE KEY BLOCK, but not after BEGIN");
 		}
 		break;
 
 	case BEGIN_PGP_MULTI:
 	case END_PGP_MULTI:
-		PGP_ERROR(errors, PGP_E_R_UNSUPPORTED,
+		PGP_ERROR_1(errors, PGP_E_R_UNSUPPORTED, "%s",
 			"Multi-part messages are not yet supported");
 		break;
 
 	case END_PGP_SIGNATURE:
 		if (prev != BEGIN_PGP_SIGNATURE) {
-			PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
+			PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT, "%s",
 			"Got END PGP SIGNATURE, but not after BEGIN");
 		}
 		break;
@@ -588,7 +588,7 @@ process_dash_escaped(pgp_stream_t *strea
 
 	body = &content.u.cleartext_body;
 	if ((hash = calloc(1, sizeof(*hash))) == NULL) {
-		PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
+		PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT, "%s",
 			"process_dash_escaped: bad alloc");
 		return -1;
 	}
@@ -615,7 +615,7 @@ process_dash_escaped(pgp_stream_t *strea
 	}
 
 	if (!hash->init(hash)) {
-		PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
+		PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT, "%s",
 			"can't initialise hash");
 		return -1;
 	}
@@ -638,8 +638,8 @@ process_dash_escaped(pgp_stream_t *strea
 			if (c != ' ') {
 				/* then this had better be a trailer! */
 				if (c != '-') {
-					PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
-						"Bad dash-escaping");
+					PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT,
+					    "%s", "Bad dash-escaping");
 				}
 				for (count = 2; count < 5; ++count) {
 					if ((c = read_char(stream, dearmour, errors,
@@ -647,8 +647,8 @@ process_dash_escaped(pgp_stream_t *strea
 						return -1;
 					}
 					if (c != '-') {
-						PGP_ERROR(errors,
-						PGP_E_R_BAD_FORMAT,
+						PGP_ERROR_1(errors,
+						PGP_E_R_BAD_FORMAT, "%s",
 						"Bad dash-escaping (2)");
 					}
 				}
@@ -756,7 +756,8 @@ parse_headers(pgp_stream_t *stream, dear
 		int             c;
 
 		if ((c = read_char(stream, dearmour, errors, readinfo, cbinfo, 1)) < 0) {
-			PGP_ERROR(errors, PGP_E_R_BAD_FORMAT, "Unexpected EOF");
+			PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT,
+			    "%s", "Unexpected EOF");
 			ret = -1;
 			break;
 		}
@@ -780,13 +781,17 @@ parse_headers(pgp_stream_t *stream, dear
 					 * then we have seriously malformed
 					 * armour
 					 */
-					PGP_ERROR(errors, PGP_E_R_BAD_FORMAT, "No colon in armour header");
+					PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT,
+					    "%s", "No colon in armour header");
 					ret = -1;
 					break;
 				} else {
 					if (first &&
 					    !(dearmour->allow_headers_without_gap || dearmour->allow_no_gap)) {
-						PGP_ERROR(errors, PGP_E_R_BAD_FORMAT, "No colon in armour header (2)");
+						PGP_ERROR_1(errors,
+						    PGP_E_R_BAD_FORMAT,
+						    "%s", "No colon in"
+						    " armour header (2)");
 						/*
 						 * then we have a nasty
 						 * armoured block with no
@@ -802,7 +807,8 @@ parse_headers(pgp_stream_t *stream, dear
 			} else {
 				*s = '\0';
 				if (s[1] != ' ') {
-					PGP_ERROR(errors, PGP_E_R_BAD_FORMAT, "No space in armour header");
+					PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT,
+					    "%s", "No space in armour header");
 					ret = -1;
 					goto end;
 				}
@@ -906,13 +912,14 @@ decode64(pgp_stream_t *stream, dearmour_
 
 	ret = read4(stream, dearmour, errors, readinfo, cbinfo, &c, &n, &l);
 	if (ret < 0) {
-		PGP_ERROR(errors, PGP_E_R_BAD_FORMAT, "Badly formed base64");
+		PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT, "%s",
+		    "Badly formed base64");
 		return 0;
 	}
 	if (n == 3) {
 		if (c != '=') {
-			PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
-					"Badly terminated base64 (2)");
+			PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT,
+			    "%s", "Badly terminated base64 (2)");
 			return 0;
 		}
 		dearmour->buffered = 2;
@@ -920,8 +927,8 @@ decode64(pgp_stream_t *stream, dearmour_
 		l >>= 2;
 	} else if (n == 2) {
 		if (c != '=') {
-			PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
-					"Badly terminated base64 (3)");
+			PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT,
+			    "%s", "Badly terminated base64 (3)");
 			return 0;
 		}
 		dearmour->buffered = 1;
@@ -929,14 +936,14 @@ decode64(pgp_stream_t *stream, dearmour_
 		l >>= 4;
 		c = read_char(stream, dearmour, errors, readinfo, cbinfo, 0);
 		if (c != '=') {
-			PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
-					"Badly terminated base64");
+			PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT,
+			    "%s", "Badly terminated base64");
 			return 0;
 		}
 	} else if (n == 0) {
 		if (!dearmour->prev_nl || c != '=') {
-			PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
-					"Badly terminated base64 (4)");
+			PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT,
+			    "%s", "Badly terminated base64 (4)");
 			return 0;
 		}
 		dearmour->buffered = 0;
@@ -962,14 +969,14 @@ decode64(pgp_stream_t *stream, dearmour_
 		c = read_and_eat_whitespace(stream, dearmour, errors, readinfo, cbinfo,
 				1);
 		if (c != '\n') {
-			PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
-				"No newline at base64 end");
+			PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT,
+			    "%s", "No newline at base64 end");
 			return 0;
 		}
 		c = read_char(stream, dearmour, errors, readinfo, cbinfo, 0);
 		if (c != '=') {
-			PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
-				"No checksum at base64 end");
+			PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT,
+			    "%s", "No checksum at base64 end");
 			return 0;
 		}
 	}
@@ -978,8 +985,8 @@ decode64(pgp_stream_t *stream, dearmour_
 		ret = read4(stream, dearmour, errors, readinfo, cbinfo, &c, &n,
 				&dearmour->read_checksum);
 		if (ret < 0 || n != 4) {
-			PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
-					"Error in checksum");
+			PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT,
+			    "%s", "Error in checksum");
 			return 0;
 		}
 		c = read_char(stream, dearmour, errors, readinfo, cbinfo, 1);
@@ -987,14 +994,14 @@ decode64(pgp_stream_t *stream, dearmour_
 			c = eat_whitespace(stream, c, dearmour, errors, readinfo, cbinfo,
 					1);
 		if (c != '\n') {
-			PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
-					"Badly terminated checksum");
+			PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT,
+			    "%s", "Badly terminated checksum");
 			return 0;
 		}
 		c = read_char(stream, dearmour, errors, readinfo, cbinfo, 0);
 		if (c != '-') {
-			PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
-					"Bad base64 trailer (2)");
+			PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT,
+			    "%s", "Bad base64 trailer (2)");
 			return 0;
 		}
 	}
@@ -1002,8 +1009,8 @@ decode64(pgp_stream_t *stream, dearmour_
 		for (n = 0; n < 4; ++n)
 			if (read_char(stream, dearmour, errors, readinfo, cbinfo,
 						0) != '-') {
-				PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
-						"Bad base64 trailer");
+				PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT, "%s",
+				    "Bad base64 trailer");
 				return 0;
 			}
 		dearmour->eof64 = 1;
@@ -1024,7 +1031,8 @@ decode64(pgp_stream_t *stream, dearmour_
 					dearmour->buffer[n2]);
 
 	if (dearmour->eof64 && dearmour->read_checksum != dearmour->checksum) {
-		PGP_ERROR(errors, PGP_E_R_BAD_FORMAT, "Checksum mismatch");
+		PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT, "%s",
+		    "Checksum mismatch");
 		return 0;
 	}
 	return 1;
@@ -1243,8 +1251,8 @@ got_minus:
 				buf[n++] = c;
 			}
 			/* then I guess this wasn't a proper trailer */
-			PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
-					"Bad ASCII armour trailer");
+			PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT, "%s",
+			    "Bad ASCII armour trailer");
 			break;
 
 got_minus2:
@@ -1262,8 +1270,9 @@ got_minus2:
 				}
 				if (c != '-') {
 					/* wasn't a trailer after all */
-					PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
-						"Bad ASCII armour trailer (2)");
+					PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT,
+					    "%s",
+					    "Bad ASCII armour trailer (2)");
 				}
 			}
 
@@ -1280,8 +1289,8 @@ got_minus2:
 			}
 			if (c != '\n') {
 				/* wasn't a trailer line after all */
-				PGP_ERROR(errors, PGP_E_R_BAD_FORMAT,
-					"Bad ASCII armour trailer (3)");
+				PGP_ERROR_1(errors, PGP_E_R_BAD_FORMAT,
+				    "%s", "Bad ASCII armour trailer (3)");
 			}
 
 			if (strncmp(buf, "BEGIN ", 6) == 0) {
@@ -1628,8 +1637,9 @@ se_ip_data_reader(pgp_stream_t *stream, 
 			fprintf(stderr,
 			"Bad symmetric decrypt (%02x%02x vs %02x%02x)\n",
 				buf[b - 2], buf[b - 1], buf[b], buf[b + 1]);
-			PGP_ERROR(errors, PGP_E_PROTO_BAD_SYMMETRIC_DECRYPT,
-			"Bad symmetric decrypt when parsing SE IP packet");
+			PGP_ERROR_1(errors, PGP_E_PROTO_BAD_SYMMETRIC_DECRYPT,
+			    "%s", "Bad symmetric decrypt when parsing SE IP"
+			    " packet");
 			free(buf);
 			return -1;
 		}
@@ -1653,8 +1663,8 @@ se_ip_data_reader(pgp_stream_t *stream, 
 				(unsigned)sz_plaintext, hashed);
 
 		if (memcmp(mdc_hash, hashed, PGP_SHA1_HASH_SIZE) != 0) {
-			PGP_ERROR(errors, PGP_E_V_BAD_HASH,
-					"Bad hash in MDC packet");
+			PGP_ERROR_1(errors, PGP_E_V_BAD_HASH, "%s",
+			    "Bad hash in MDC packet");
 			free(buf);
 			return 0;
 		}

Index: src/crypto/external/bsd/netpgp/dist/src/lib/signature.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.33 src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.34
--- src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.33	Sun Nov  7 03:39:59 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/signature.c	Sun Mar  4 21:20:18 2012
@@ -57,7 +57,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: signature.c,v 1.33 2010/11/07 08:39:59 agc Exp $");
+__RCSID("$NetBSD: signature.c,v 1.34 2012/03/05 02:20:18 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -825,7 +825,8 @@ pgp_write_sig(pgp_output_t *output, 
 	pgp_memory_free(sig->mem);
 
 	if (ret == 0) {
-		PGP_ERROR(&output->errors, PGP_E_W, "Cannot write signature");
+		PGP_ERROR_1(&output->errors, PGP_E_W, "%s",
+		    "Cannot write signature");
 	}
 	return ret;
 }
@@ -1020,8 +1021,8 @@ pgp_sign_file(pgp_io_t *io,
 		pgp_teardown_file_write(output, fd_out);
 
 		if (ret == 0) {
-			PGP_ERROR(&output->errors, PGP_E_W,
-					"Cannot sign file as cleartext");
+			PGP_ERROR_1(&output->errors, PGP_E_W, "%s",
+			    "Cannot sign file as cleartext");
 		}
 	} else {
 		/* set armoured/not armoured here */

Index: src/crypto/external/bsd/netpgp/dist/src/lib/validate.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/validate.c:1.43 src/crypto/external/bsd/netpgp/dist/src/lib/validate.c:1.44
--- src/crypto/external/bsd/netpgp/dist/src/lib/validate.c:1.43	Wed Nov 10 19:58:04 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/validate.c	Sun Mar  4 21:20:18 2012
@@ -54,7 +54,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: validate.c,v 1.43 2010/11/11 00:58:04 agc Exp $");
+__RCSID("$NetBSD: validate.c,v 1.44 2012/03/05 02:20:18 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -379,15 +379,16 @@ pgp_validate_key_cb(const pgp_packet_t *
 			if (!add_sig_to_list(&content->sig.info,
 				&key->result->valid_sigs,
 				&key->result->validc)) {
-				PGP_ERROR(errors, PGP_E_UNIMPLEMENTED,
+				PGP_ERROR_1(errors, PGP_E_UNIMPLEMENTED, "%s",
 				    "Can't add good sig to list\n");
 			}
 		} else {
-			PGP_ERROR(errors, PGP_E_V_BAD_SIGNATURE, "Bad Sig");
+			PGP_ERROR_1(errors, PGP_E_V_BAD_SIGNATURE, "%s",
+			    "Bad Sig");
 			if (!add_sig_to_list(&content->sig.info,
 				&key->result->invalid_sigs,
 				&key->result->invalidc)) {
-				PGP_ERROR(errors, PGP_E_UNIMPLEMENTED,
+				PGP_ERROR_1(errors, PGP_E_UNIMPLEMENTED, "%s",
 				    "Can't add good sig to list\n");
 			}
 		}
@@ -482,13 +483,13 @@ validate_data_cb(const pgp_packet_t *pkt
 		signer = pgp_getkeybyid(io, data->keyring,
 					 content->sig.info.signer_id, &from, &sigkey);
 		if (!signer) {
-			PGP_ERROR(errors, PGP_E_V_UNKNOWN_SIGNER,
-					"Unknown Signer");
+			PGP_ERROR_1(errors, PGP_E_V_UNKNOWN_SIGNER,
+			    "%s", "Unknown Signer");
 			if (!add_sig_to_list(&content->sig.info,
 					&data->result->unknown_sigs,
 					&data->result->unknownc)) {
-				PGP_ERROR(errors, PGP_E_V_UNKNOWN_SIGNER,
-					"Can't add unknown sig to list");
+				PGP_ERROR_1(errors, PGP_E_V_UNKNOWN_SIGNER,
+				    "%s", "Can't add unknown sig to list");
 			}
 			break;
 		}
@@ -537,16 +538,16 @@ validate_data_cb(const pgp_packet_t *pkt
 			if (!add_sig_to_list(&content->sig.info,
 					&data->result->valid_sigs,
 					&data->result->validc)) {
-				PGP_ERROR(errors, PGP_E_V_BAD_SIGNATURE,
-					"Can't add good sig to list");
+				PGP_ERROR_1(errors, PGP_E_V_BAD_SIGNATURE,
+				    "%s", "Can't add good sig to list");
 			}
 		} else {
-			PGP_ERROR(errors, PGP_E_V_BAD_SIGNATURE,
-					"Bad Signature");
+			PGP_ERROR_1(errors, PGP_E_V_BAD_SIGNATURE,
+			    "%s", "Bad Signature");
 			if (!add_sig_to_list(&content->sig.info,
 					&data->result->invalid_sigs,
 					&data->result->invalidc)) {
-				PGP_ERROR(errors, PGP_E_V_BAD_SIGNATURE,
+				PGP_ERROR_1(errors, PGP_E_V_BAD_SIGNATURE, "%s",
 					"Can't add good sig to list");
 			}
 		}
@@ -564,7 +565,7 @@ validate_data_cb(const pgp_packet_t *pkt
 		break;
 
 	default:
-		PGP_ERROR(errors, PGP_E_V_NO_SIGNATURE, "No signature");
+		PGP_ERROR_1(errors, PGP_E_V_NO_SIGNATURE, "%s", "No signature");
 		break;
 	}
 	return PGP_RELEASE_MEMORY;

Index: src/crypto/external/bsd/netpgp/dist/src/lib/writer.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/writer.c:1.32 src/crypto/external/bsd/netpgp/dist/src/lib/writer.c:1.33
--- src/crypto/external/bsd/netpgp/dist/src/lib/writer.c:1.32	Mon Nov 15 03:50:32 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/writer.c	Sun Mar  4 21:20:18 2012
@@ -58,7 +58,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: writer.c,v 1.32 2010/11/15 08:50:32 agc Exp $");
+__RCSID("$NetBSD: writer.c,v 1.33 2012/03/05 02:20:18 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -507,7 +507,7 @@ pgp_writer_push_clearsigned(pgp_output_t
 
 	hash = pgp_text_from_hash(pgp_sig_get_hash(sig));
 	if ((dash = calloc(1, sizeof(*dash))) == NULL) {
-		PGP_ERROR(&output->errors, PGP_E_W, "Bad alloc");
+		PGP_ERROR_1(&output->errors, PGP_E_W, "%s", "Bad alloc");
 		return 0;
 	}
 	ret = (pgp_write(output, header, (unsigned)(sizeof(header) - 1)) &&
@@ -515,7 +515,7 @@ pgp_writer_push_clearsigned(pgp_output_t
 		pgp_write(output, "\r\n\r\n", 4));
 
 	if (ret == 0) {
-		PGP_ERROR(&output->errors, PGP_E_W,
+		PGP_ERROR_1(&output->errors, PGP_E_W, "%s",
 			"Error pushing clearsigned header");
 		free(dash);
 		return ret;
@@ -689,12 +689,12 @@ pgp_writer_use_armored_sig(pgp_output_t 
 
 	pgp_writer_pop(output);
 	if (pgp_write(output, header, (unsigned)(sizeof(header) - 1)) == 0) {
-		PGP_ERROR(&output->errors, PGP_E_W,
+		PGP_ERROR_1(&output->errors, PGP_E_W, "%s",
 			"Error switching to armoured signature");
 		return 0;
 	}
 	if ((linebreak = calloc(1, sizeof(*linebreak))) == NULL) {
-		PGP_ERROR(&output->errors, PGP_E_W,
+		PGP_ERROR_1(&output->errors, PGP_E_W, "%s",
 			"pgp_writer_use_armored_sig: Bad alloc");
 		return 0;
 	}

Reply via email to