summaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1999-05-20 14:11:41 +0200
committerWerner Koch <wk@gnupg.org>1999-05-20 14:11:41 +0200
commit77d6309e2189254cf7a45884fb7ef6a415761988 (patch)
tree60da5c2556a5b7cb9c8d65dedd7a293eec2a35e8 /g10
parentSee ChangeLog: Wed May 19 16:04:30 CEST 1999 Werner Koch (diff)
downloadgnupg2-77d6309e2189254cf7a45884fb7ef6a415761988.tar.xz
gnupg2-77d6309e2189254cf7a45884fb7ef6a415761988.zip
See ChangeLog: Thu May 20 14:04:08 CEST 1999 Werner Koch
Diffstat (limited to 'g10')
-rw-r--r--g10/ChangeLog13
-rw-r--r--g10/armor.c12
-rw-r--r--g10/filter.h3
-rw-r--r--g10/misc.c5
-rw-r--r--g10/sig-check.c2
-rw-r--r--g10/sign.c2
-rw-r--r--g10/textfilter.c18
7 files changed, 42 insertions, 13 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 4b8d98942..7cebaabd2 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,16 @@
+Thu May 20 14:04:08 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
+
+ * misc.c (pull_in_libs): do the volatile only for gcc
+
+ * sig-check (signature_check): Emit SIG_iD only for classes 0 and 1.
+
+ * armor.c (armor_filter): Add detection of PGP2 created clearsigs.
+ (fake_packet): A tab is not a WS for pgp2 - handle this.
+ * textfilter.c (len_without_trailing_chars): New.
+ (copy_clearsig_text): Add pgp2mode arg.
+ * sign.c (clearsign_file): pass old_style to the above fnc.
+
+
Wed May 19 16:04:30 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
* g10.c: New option --interactive.
diff --git a/g10/armor.c b/g10/armor.c
index c49dc5cad..38c48fbbe 100644
--- a/g10/armor.c
+++ b/g10/armor.c
@@ -425,9 +425,8 @@ check_input( armor_filter_context_t *afx, IOBUF a )
if( rc )
invalid_armor();
- else if( afx->in_cleartext ) {
+ else if( afx->in_cleartext )
afx->faked = 1;
- }
else {
afx->inp_checked = 1;
afx->crc = CRCINIT;
@@ -480,7 +479,10 @@ fake_packet( armor_filter_context_t *afx, IOBUF a,
if( !maxlen )
afx->truncated++;
if( !afx->not_dash_escaped ) {
- afx->buffer_len = trim_trailing_ws( afx->buffer, afx->buffer_len );
+ /* PGP2 does not treat a tab as white space character */
+ afx->buffer_len =
+ trim_trailing_chars( afx->buffer, afx->buffer_len,
+ afx->pgp2mode ? " \r\n" : " \t\r\n");
/* the buffer is always allocated with enough space to append
* a CR, LF, Nul */
afx->buffer[afx->buffer_len++] = '\r';
@@ -809,8 +811,10 @@ armor_filter( void *opaque, int control,
* is easy to construct the packets */
hashes &= 1|2|4|8;
- if( !hashes )
+ if( !hashes ) {
hashes |= 4; /* default to MD 5 */
+ afx->pgp2mode = 1;
+ }
n=0;
do {
/* first some onepass signature packets */
diff --git a/g10/filter.h b/g10/filter.h
index 30a59d199..86a8e45b8 100644
--- a/g10/filter.h
+++ b/g10/filter.h
@@ -44,6 +44,7 @@ typedef struct {
int faked; /* we are faking a literal data packet */
int truncated; /* number of truncated lines */
int qp_detected;
+ int pgp2mode;
byte *buffer; /* malloced buffer */
unsigned buffer_size; /* and size of this buffer */
@@ -119,7 +120,7 @@ int cipher_filter( void *opaque, int control,
int text_filter( void *opaque, int control,
IOBUF chain, byte *buf, size_t *ret_len);
int copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md,
- int escape_dash, int escape_from );
+ int escape_dash, int escape_from, int pgp2mode );
diff --git a/g10/misc.c b/g10/misc.c
index 47420638d..07d166940 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -41,7 +41,10 @@ const char *g10m_revision_string(int);
const char *g10c_revision_string(int);
const char *g10u_revision_string(int);
-volatile void
+#ifdef __GNUC__
+volatile
+#endif
+ void
pull_in_libs(void)
{
g10m_revision_string(0);
diff --git a/g10/sig-check.c b/g10/sig-check.c
index 068035cf4..b8d2f7f21 100644
--- a/g10/sig-check.c
+++ b/g10/sig-check.c
@@ -64,7 +64,7 @@ signature_check( PKT_signature *sig, MD_HANDLE digest )
free_public_key( pk );
- if( !rc && is_status_enabled() ) {
+ if( !rc && sig->sig_class < 2 && is_status_enabled() ) {
/* This signature id works best with DLP algorithms because
* they use a random parameter for every signature. Instead of
* this sig-id we could have also used the hash of the document
diff --git a/g10/sign.c b/g10/sign.c
index afc1dafc1..a74ee867e 100644
--- a/g10/sign.c
+++ b/g10/sign.c
@@ -548,7 +548,7 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
}
/*md_start_debug( textmd, "sign" );*/
copy_clearsig_text( out, inp, textmd,
- !opt.not_dash_escaped, opt.escape_from );
+ !opt.not_dash_escaped, opt.escape_from, old_style );
/* fixme: check for read errors */
/* now write the armor */
diff --git a/g10/textfilter.c b/g10/textfilter.c
index 5896c3f32..3125925b6 100644
--- a/g10/textfilter.c
+++ b/g10/textfilter.c
@@ -37,14 +37,14 @@
/* to make sure that a warning is displayed while */
/* creating a message */
-unsigned
-len_without_trailing_ws( byte *line, unsigned len )
+static unsigned
+len_without_trailing_chars( byte *line, unsigned len, const char *trimchars )
{
byte *p, *mark;
unsigned n;
for(mark=NULL, p=line, n=0; n < len; n++, p++ ) {
- if( strchr(" \t\r\n", *p ) ) {
+ if( strchr( trimchars, *p ) ) {
if( !mark )
mark = p;
}
@@ -55,6 +55,12 @@ len_without_trailing_ws( byte *line, unsigned 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" );
+}
+
@@ -136,7 +142,7 @@ text_filter( void *opaque, int control,
*/
int
copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md,
- int escape_dash, int escape_from )
+ int escape_dash, int escape_from, int pgp2mode )
{
unsigned maxlen;
byte *buffer = NULL; /* malloced buffer */
@@ -163,7 +169,9 @@ copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md,
md_putc( md, '\r' );
md_putc( md, '\n' );
}
- md_write( md, buffer, len_without_trailing_ws( buffer, n ) );
+ md_write( md, buffer,
+ len_without_trailing_chars( buffer, n,
+ pgp2mode? " \r\n":" \t\r\n"));
}
else
md_write( md, buffer, n );