mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-21 14:47:03 +01: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:
parent
9e52cf2758
commit
1c334577f3
@ -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>
|
2004-12-09 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* passphrase.c (agent_get_passphrase): New args CUSTOM_PROMPT and
|
* passphrase.c (agent_get_passphrase): New args CUSTOM_PROMPT and
|
||||||
|
@ -2092,6 +2092,8 @@ main( int argc, char **argv )
|
|||||||
opt.escape_from = 1;
|
opt.escape_from = 1;
|
||||||
break;
|
break;
|
||||||
case oRFC2440:
|
case oRFC2440:
|
||||||
|
opt.strict_2440_line_endings=1;
|
||||||
|
/* fall through */
|
||||||
case oOpenPGP:
|
case oOpenPGP:
|
||||||
/* TODO: When 2440bis becomes a RFC, these may need
|
/* TODO: When 2440bis becomes a RFC, these may need
|
||||||
changing. */
|
changing. */
|
||||||
|
@ -192,6 +192,7 @@ struct
|
|||||||
unsigned int screen_columns;
|
unsigned int screen_columns;
|
||||||
unsigned int screen_lines;
|
unsigned int screen_lines;
|
||||||
byte *show_subpackets;
|
byte *show_subpackets;
|
||||||
|
int strict_2440_line_endings;
|
||||||
|
|
||||||
#ifdef ENABLE_CARD_SUPPORT
|
#ifdef ENABLE_CARD_SUPPORT
|
||||||
const char *ctapi_driver; /* Library to access the ctAPI. */
|
const char *ctapi_driver; /* Library to access the ctAPI. */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* textfilter.c
|
/* 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.
|
* 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;
|
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
|
static int
|
||||||
standard( text_filter_context_t *tfx, IOBUF a,
|
standard( text_filter_context_t *tfx, IOBUF a,
|
||||||
byte *buf, size_t size, size_t *ret_len)
|
byte *buf, size_t size, size_t *ret_len)
|
||||||
@ -101,7 +92,25 @@ standard( text_filter_context_t *tfx, IOBUF a,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
lf_seen = tfx->buffer[tfx->buffer_len-1] == '\n';
|
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 ) {
|
if( lf_seen ) {
|
||||||
tfx->buffer[tfx->buffer_len++] = '\r';
|
tfx->buffer[tfx->buffer_len++] = '\r';
|
||||||
tfx->buffer[tfx->buffer_len++] = '\n';
|
tfx->buffer[tfx->buffer_len++] = '\n';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user