When writing an ascii-armoured message, push the linebreak writer onto
the write function stack for the body of the message as well as the headers. This means that an ascii-armoured signed file created by netpgp conforms to RFC 4880 (and 2440, thanks, moof[1]), and can be verified by gpg now, as well as netpgp. [1] Are there any other RFCs which are superceded by their double?
This commit is contained in:
parent
251fbb35dc
commit
33ee8138ba
|
@ -58,7 +58,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: writer.c,v 1.16 2009/11/20 07:17:07 agc Exp $");
|
||||
__RCSID("$NetBSD: writer.c,v 1.17 2009/11/20 15:21:18 agc Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -650,11 +650,11 @@ linebreak_writer(const unsigned char *src,
|
|||
linebreak_t *linebreak = __ops_writer_get_arg(writer);
|
||||
unsigned n;
|
||||
|
||||
printf("in linebreak writer, len %d\n", len);
|
||||
for (n = 0; n < len; ++n, ++linebreak->pos) {
|
||||
if (src[n] == '\r' || src[n] == '\n') {
|
||||
linebreak->pos = 0;
|
||||
}
|
||||
|
||||
if (linebreak->pos == BREAKPOS) {
|
||||
if (!__ops_stacked_write("\r\n", 2, errors, writer)) {
|
||||
return 0;
|
||||
|
@ -759,18 +759,28 @@ void
|
|||
__ops_writer_push_armor_msg(__ops_output_t *output)
|
||||
{
|
||||
static const char header[] = "-----BEGIN PGP MESSAGE-----\r\n";
|
||||
linebreak_t *linebreak;
|
||||
base64_t *base64;
|
||||
|
||||
__ops_write(output, header, sizeof(header) - 1);
|
||||
__ops_write(output, "\r\n", 2);
|
||||
if ((base64 = calloc(1, sizeof(*base64))) == NULL) {
|
||||
(void) fprintf(stderr, "__ops_writer_push_armor_msg: bad alloc\n");
|
||||
} else {
|
||||
base64->checksum = CRC24_INIT;
|
||||
__ops_writer_push(output, base64_writer,
|
||||
armoured_message_finaliser, generic_destroyer,
|
||||
base64);
|
||||
if ((linebreak = calloc(1, sizeof(*linebreak))) == NULL) {
|
||||
(void) fprintf(stderr,
|
||||
"__ops_writer_push_armor_msg: bad lb alloc\n");
|
||||
return;
|
||||
}
|
||||
__ops_writer_push(output, linebreak_writer, NULL,
|
||||
generic_destroyer,
|
||||
linebreak);
|
||||
if ((base64 = calloc(1, sizeof(*base64))) == NULL) {
|
||||
(void) fprintf(stderr,
|
||||
"__ops_writer_push_armor_msg: bad alloc\n");
|
||||
return;
|
||||
}
|
||||
base64->checksum = CRC24_INIT;
|
||||
__ops_writer_push(output, base64_writer,
|
||||
armoured_message_finaliser, generic_destroyer,
|
||||
base64);
|
||||
}
|
||||
|
||||
static unsigned
|
||||
|
|
Loading…
Reference in New Issue