1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-25 01:42:45 +02:00

* options.h, g10.c (main), textfilter.c (len_without_trailing_ws): Removed

(not used). (standard): 2440 says that textmode hashes should canonicalize
line endings to CRLF and remove spaces and tabs.  2440bis-12 says to just
canonicalize to CRLF.  So, we default to the 2440bis-12 behavior, but
revert to the strict 2440 behavior if the user specifies --rfc2440.  In
practical terms this makes no difference to any signatures in the real
world except for a textmode detached signature.
This commit is contained in:
David Shaw 2004-12-10 05:35:54 +00:00
parent 9e52cf2758
commit 1c334577f3
4 changed files with 35 additions and 11 deletions

View File

@ -1,3 +1,15 @@
2004-12-09 David Shaw <dshaw@jabberwocky.com>
* options.h, g10.c (main), textfilter.c (len_without_trailing_ws):
Removed (not used).
(standard): 2440 says that textmode hashes should canonicalize
line endings to CRLF and remove spaces and tabs. 2440bis-12 says
to just canonicalize to CRLF. So, we default to the 2440bis-12
behavior, but revert to the strict 2440 behavior if the user
specifies --rfc2440. In practical terms this makes no difference
to any signatures in the real world except for a textmode detached
signature.
2004-12-09 Werner Koch <wk@g10code.com>
* passphrase.c (agent_get_passphrase): New args CUSTOM_PROMPT and

View File

@ -2092,6 +2092,8 @@ main( int argc, char **argv )
opt.escape_from = 1;
break;
case oRFC2440:
opt.strict_2440_line_endings=1;
/* fall through */
case oOpenPGP:
/* TODO: When 2440bis becomes a RFC, these may need
changing. */

View File

@ -192,6 +192,7 @@ struct
unsigned int screen_columns;
unsigned int screen_lines;
byte *show_subpackets;
int strict_2440_line_endings;
#ifdef ENABLE_CARD_SUPPORT
const char *ctapi_driver; /* Library to access the ctAPI. */

View File

@ -1,5 +1,5 @@
/* textfilter.c
* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
* Copyright (C) 1998, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@ -61,15 +61,6 @@ len_without_trailing_chars( byte *line, unsigned len, const char *trimchars )
return mark? (mark - line) : len;
}
unsigned
len_without_trailing_ws( byte *line, unsigned len )
{
return len_without_trailing_chars( line, len, " \t\r\n" );
}
static int
standard( text_filter_context_t *tfx, IOBUF a,
byte *buf, size_t size, size_t *ret_len)
@ -101,7 +92,25 @@ standard( text_filter_context_t *tfx, IOBUF a,
break;
}
lf_seen = tfx->buffer[tfx->buffer_len-1] == '\n';
tfx->buffer_len = trim_trailing_ws( tfx->buffer, tfx->buffer_len );
/* The story behind this is that 2440 says that textmode
hashes should canonicalize line endings to CRLF and remove
spaces and tabs. 2440bis-12 says to just canonicalize to
CRLF. So, we default to the 2440bis-12 behavior, but
revert to the strict 2440 behavior if the user specifies
--rfc2440. In practical terms this makes no difference to
any signatures in the real world except for a textmode
detached signature. PGP always used the 2440bis-12 (1991)
behavior (ignoring 2440 itself), so this actually makes us
compatible with PGP textmode detached signatures for the
first time. */
if(opt.strict_2440_line_endings)
tfx->buffer_len=trim_trailing_chars(tfx->buffer,tfx->buffer_len,
" \t\r\n");
else
tfx->buffer_len=trim_trailing_chars(tfx->buffer,tfx->buffer_len,
"\r\n");
if( lf_seen ) {
tfx->buffer[tfx->buffer_len++] = '\r';
tfx->buffer[tfx->buffer_len++] = '\n';