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.
This commit is contained in:
christos 2012-03-05 02:20:18 +00:00
parent 2f142eb3e0
commit 94fcde8eaf
8 changed files with 104 additions and 90 deletions

View File

@ -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 *stream, void *dest, size_t length,
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_t *stream, void *dest, size_t length,
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,

View File

@ -150,9 +150,6 @@ int pgp_has_error(pgp_error_t *, pgp_errcode_t);
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)

View File

@ -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, pgp_cbdata_t *cbinfo)
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);
}

View File

@ -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, uint8_t *dest,
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 *region, pgp_stream_t *stream)
}
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_stream_t *stream, unsigned warn)
/* 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;
}

View File

@ -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 *dearmour, char *hdr, pgp_error_t **errors)
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 *stream, dearmour_t *dearmour,
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 *stream, dearmour_t *dearmour,
}
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 *stream, dearmour_t *dearmour,
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 *stream, dearmour_t *dearmour,
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, dearmour_t *dearmour, pgp_error_t **errors,
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, dearmour_t *dearmour, pgp_error_t **errors,
* 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, dearmour_t *dearmour, pgp_error_t **errors,
} 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_t *dearmour, pgp_error_t **errors,
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_t *dearmour, pgp_error_t **errors,
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_t *dearmour, pgp_error_t **errors,
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_t *dearmour, pgp_error_t **errors,
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_t *dearmour, pgp_error_t **errors,
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_t *dearmour, pgp_error_t **errors,
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_t *dearmour, pgp_error_t **errors,
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_t *dearmour, pgp_error_t **errors,
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, void *dest_,
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, void *dest_,
(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;
}

View File

@ -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 */

View File

@ -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 *pkt, pgp_cbdata_t *cbinfo)
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, pgp_cbdata_t *cbinfo)
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, pgp_cbdata_t *cbinfo)
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, pgp_cbdata_t *cbinfo)
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;

View File

@ -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 *output, pgp_create_sig_t *sig)
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 *output, pgp_create_sig_t *sig)
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 *output)
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;
}