gnupg/g10 (ChangeLog g10.c options.h textfilter.c)

cvs user dshaw cvs at cvs.gnupg.org
Fri Dec 10 06:27:38 CET 2004


    Date: Friday, December 10, 2004 @ 06:35:54
  Author: dshaw
    Path: /cvs/gnupg/gnupg/g10

Modified: ChangeLog g10.c options.h textfilter.c

* 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.


--------------+
 ChangeLog    |   12 ++++++++++++
 g10.c        |    2 ++
 options.h    |    1 +
 textfilter.c |   31 ++++++++++++++++++++-----------
 4 files changed, 35 insertions(+), 11 deletions(-)


Index: gnupg/g10/ChangeLog
diff -u gnupg/g10/ChangeLog:1.649 gnupg/g10/ChangeLog:1.650
--- gnupg/g10/ChangeLog:1.649	Thu Dec  9 17:57:30 2004
+++ gnupg/g10/ChangeLog	Fri Dec 10 06:35:54 2004
@@ -1,3 +1,15 @@
+2004-12-09  David Shaw  <dshaw at 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 at g10code.com>
 
 	* passphrase.c (agent_get_passphrase): New args CUSTOM_PROMPT and
Index: gnupg/g10/g10.c
diff -u gnupg/g10/g10.c:1.290 gnupg/g10/g10.c:1.291
--- gnupg/g10/g10.c:1.290	Fri Nov 26 16:51:37 2004
+++ gnupg/g10/g10.c	Fri Dec 10 06:35:54 2004
@@ -2092,6 +2092,8 @@
 	    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. */
Index: gnupg/g10/options.h
diff -u gnupg/g10/options.h:1.128 gnupg/g10/options.h:1.129
--- gnupg/g10/options.h:1.128	Fri Nov 26 16:51:37 2004
+++ gnupg/g10/options.h	Fri Dec 10 06:35:54 2004
@@ -192,6 +192,7 @@
   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. */
Index: gnupg/g10/textfilter.c
diff -u gnupg/g10/textfilter.c:1.15 gnupg/g10/textfilter.c:1.16
--- gnupg/g10/textfilter.c:1.15	Sat May 24 23:50:33 2003
+++ gnupg/g10/textfilter.c	Fri Dec 10 06:35:54 2004
@@ -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 @@
     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 @@
 	    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';




More information about the Gnupg-commits mailing list