From b7a2f831419aaa2cbed0b61a9e757bd8c70bae3e Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Sun, 19 Dec 1999 14:23:19 +0000 Subject: [PATCH] See ChangeLog: Sun Dec 19 15:22:26 CET 1999 Werner Koch --- NEWS | 3 +++ TODO | 3 +++ VERSION | 2 +- doc/gpg.sgml | 4 ++-- g10/ChangeLog | 17 ++++++++++++++++ g10/armor.c | 44 +++++++++++++++++++++++++++++------------ g10/plaintext.c | 14 +++++++++---- g10/sign.c | 8 +++++++- g10/signal.c | 15 ++++++++------ g10/textfilter.c | 19 +++++++++++++----- mpi/ChangeLog | 5 +++++ mpi/power/mpih-add1.S | 3 ++- mpi/power/mpih-lshift.S | 3 ++- mpi/power/mpih-mul1.S | 2 ++ mpi/power/mpih-mul2.S | 3 ++- mpi/power/mpih-mul3.S | 3 ++- mpi/power/mpih-rshift.S | 3 ++- mpi/power/mpih-sub1.S | 3 ++- 18 files changed, 116 insertions(+), 38 deletions(-) diff --git a/NEWS b/NEWS index 789c16190..cf97a7bac 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ + + * Some fixes for the W32 version + Noteworthy changes in version 1.0.1 (1999-12-16) ----------------------------------- diff --git a/TODO b/TODO index 27b7664de..f2d5816c2 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,7 @@ + * don't allow certain commands in the edit menu when the secret key is + selected. + Scheduled for 1.1 ----------------- * With option -i prompt before adding a key to the keyring and show some diff --git a/VERSION b/VERSION index 7dea76edb..69bbb3f6b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.1 +1.0.1a diff --git a/doc/gpg.sgml b/doc/gpg.sgml index 3415b23c6..eace2582a 100644 --- a/doc/gpg.sgml +++ b/doc/gpg.sgml @@ -1491,9 +1491,9 @@ is *very* easy to spy out your passphrase! On many systems this program should be installed as setuid(root). This is necessary to lock memory pages. Locking memory pages prevents the operating system from writing memory pages to disk. If you get no -warning message about insecure memory your operating system supports +warning message about insecure memory then your operating system supports locking without being root. The program drops root privileges as soon -as locked memory is allocated. +as the locked memory is allocated. diff --git a/g10/ChangeLog b/g10/ChangeLog index 70e3e17ba..3b8c6a0fb 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,20 @@ +Sun Dec 19 15:22:26 CET 1999 Werner Koch + + * armor.c (LF): Use this new macro at all places where a line LF + is needed. This way DOSish textfiles should be created when the + input data is also in dos mode. + * sign.c (LF): Ditto. + * textfilter.c (LF): Ditto. + (copy_clearsig_text): Disabled the forcing of CR,LF sequences + for DOS systems. + + * plaintext.c (handle_plaintext): Fixes for line endings on DOS. + and react on a LF in cleartext. + * armor.c (fake_packet): Restore the original line ending after + removing trailing spaces. + + * signal.c (got_fatal_signal): DOS fix. + Thu Dec 16 10:07:58 CET 1999 Werner Koch * mainproc.c (print_failed_pkenc): Fix for unknown algorithm. diff --git a/g10/armor.c b/g10/armor.c index 3fa52e617..7ef8f336d 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -37,6 +37,11 @@ #include "status.h" #include "i18n.h" +#ifdef HAVE_DOSISH_SYSTEM + #define LF "\r\n" +#else + #define LF "\n" +#endif #define MAX_LINELEN 20000 @@ -485,13 +490,26 @@ fake_packet( armor_filter_context_t *afx, IOBUF a, if( !maxlen ) afx->truncated++; if( !afx->not_dash_escaped ) { + int crlf; + p = afx->buffer; + n = afx->buffer_len; + crlf = n > 1 && p[n-2] == '\r' && p[n-1]=='\n'; + /* PGP2 does not treat a tab as white space character */ - afx->buffer_len = - trim_trailing_chars( afx->buffer, afx->buffer_len, + afx->buffer_len = trim_trailing_chars( p, n, 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'; + * the removed [CR], LF and a Nul + * The reason for this complicated procedure is to keep at least + * the original tupe of lineending - handling of the removed + * trailing spaces seems to be impossible in our method + * of faking a packet; either we have to use a temporary file + * or calculate the hash here in this module and somehow find + * a way to send the hash down the processing line (well, a special + * faked packet could do the job). + */ + if( crlf ) + afx->buffer[afx->buffer_len++] = '\r'; afx->buffer[afx->buffer_len++] = '\n'; afx->buffer[afx->buffer_len] = 0; } @@ -880,10 +898,10 @@ armor_filter( void *opaque, int control, log_bug("afx->what=%d", afx->what); iobuf_writestr(a, "-----"); iobuf_writestr(a, head_strings[afx->what] ); - iobuf_writestr(a, "-----\n"); + iobuf_writestr(a, "-----" LF ); if( !opt.no_version ) iobuf_writestr(a, "Version: GnuPG v" VERSION " (" - PRINTABLE_OS_NAME ")\n"); + PRINTABLE_OS_NAME ")" LF ); if( opt.comment_string ) { const char *s = opt.comment_string; @@ -899,15 +917,15 @@ armor_filter( void *opaque, int control, else iobuf_put(a, *s ); } - iobuf_put(a, '\n' ); + iobuf_writestr(a, LF ); } } else iobuf_writestr(a, - "Comment: For info see http://www.gnupg.org\n"); + "Comment: For info see http://www.gnupg.org" LF); if( afx->hdrlines ) iobuf_writestr(a, afx->hdrlines); - iobuf_put(a, '\n'); + iobuf_writestr(a, LF ); afx->status++; afx->idx = 0; afx->idx2 = 0; @@ -936,7 +954,7 @@ armor_filter( void *opaque, int control, c = bintoasc[radbuf[2]&077]; iobuf_put(a, c); if( ++idx2 >= (64/4) ) { /* pgp doesn't like 72 here */ - iobuf_put(a, '\n'); + iobuf_writestr(a, LF ); idx2=0; } } @@ -980,13 +998,13 @@ armor_filter( void *opaque, int control, iobuf_put(a, '='); } if( ++idx2 >= (64/4) ) { /* pgp doesn't like 72 here */ - iobuf_put(a, '\n'); + iobuf_writestr(a, LF ); idx2=0; } } /* may need a linefeed */ if( idx2 ) - iobuf_put(a, '\n'); + iobuf_writestr(a, LF ); /* write the CRC */ iobuf_put(a, '='); radbuf[0] = crc >>16; @@ -1006,7 +1024,7 @@ armor_filter( void *opaque, int control, log_bug("afx->what=%d", afx->what); iobuf_writestr(a, "-----"); iobuf_writestr(a, tail_strings[afx->what] ); - iobuf_writestr(a, "-----\n"); + iobuf_writestr(a, "-----" LF ); } else if( !afx->any_data && !afx->inp_bypass ) { log_error(_("no valid OpenPGP data found.\n")); diff --git a/g10/plaintext.c b/g10/plaintext.c index 9deda8652..eb74da3d3 100644 --- a/g10/plaintext.c +++ b/g10/plaintext.c @@ -107,8 +107,10 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, } if( mfx->md ) md_putc(mfx->md, c ); - if( c == '\r' ) - continue; /* fixme: this hack might be too simple */ + #ifndef HAVE_DOSISH_SYSTEM + if( c == '\r' ) /* convert to native line ending */ + continue; /* fixme: this hack might be too simple */ + #endif if( fp ) { if( putc( c, fp ) == EOF ) { log_error("Error writing to `%s': %s\n", @@ -152,8 +154,10 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, while( (c = iobuf_get(pt->buf)) != -1 ) { if( mfx->md ) md_putc(mfx->md, c ); + #ifndef HAVE_DOSISH_SYSTEM if( convert && c == '\r' ) continue; /* fixme: this hack might be too simple */ + #endif if( fp ) { if( putc( c, fp ) == EOF ) { log_error("Error writing to `%s': %s\n", @@ -169,10 +173,10 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, int eof; for( eof=0; !eof; ) { /* Why do we check for len < 32768: - * If we wonŽ we would practically read 2 EOFS but + * If we won't, we would practically read 2 EOFs but * the first one has already popped the block_filter * off and therefore we don't catch the boundary. - * Always assume EOF if iobuf_read returns less bytes + * So, always assume EOF if iobuf_read returns less bytes * then requested */ int len = iobuf_read( pt->buf, buffer, 32768 ); if( len == -1 ) @@ -217,6 +221,8 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, if( !state ) { if( c == '\r' ) state = 1; + else if( c == '\n' ) + state = 2; else md_putc(mfx->md, c ); } diff --git a/g10/sign.c b/g10/sign.c index 3b7183677..0d3e50372 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -39,6 +39,12 @@ #include "i18n.h" +#ifdef HAVE_DOSISH_SYSTEM + #define LF "\r\n" +#else + #define LF "\n" +#endif + /**************** * Create a notation. It is assumed that the stings in STRLIST @@ -582,7 +588,7 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile ) else if( (rc = open_outfile( fname, 1, &out )) ) goto leave; - iobuf_writestr(out, "-----BEGIN PGP SIGNED MESSAGE-----\n" ); + iobuf_writestr(out, "-----BEGIN PGP SIGNED MESSAGE-----" LF ); for( sk_rover = sk_list; sk_rover; sk_rover = sk_rover->next ) { PKT_secret_key *sk = sk_rover->sk; diff --git a/g10/signal.c b/g10/signal.c index ea837c3e7..5397f076d 100644 --- a/g10/signal.c +++ b/g10/signal.c @@ -53,7 +53,6 @@ static RETSIGTYPE got_fatal_signal( int sig ) { const char *s; - struct sigaction nact; if( caught_fatal_sig ) raise( sig ); @@ -67,11 +66,15 @@ got_fatal_signal( int sig ) s = get_signal_name(sig); write(2, s, strlen(s) ); write(2, " caught ... exiting\n", 21 ); - /* reset action to default action and raise signal again */ - nact.sa_handler = SIG_DFL; - sigemptyset( &nact.sa_mask ); - nact.sa_flags = 0; - sigaction( sig, &nact, NULL); + #ifndef HAVE_DOSISH_SYSTEM + { /* reset action to default action and raise signal again */ + struct sigaction nact; + nact.sa_handler = SIG_DFL; + sigemptyset( &nact.sa_mask ); + nact.sa_flags = 0; + sigaction( sig, &nact, NULL); + } + #endif raise( sig ); } diff --git a/g10/textfilter.c b/g10/textfilter.c index dc143b354..9280680e5 100644 --- a/g10/textfilter.c +++ b/g10/textfilter.c @@ -32,6 +32,11 @@ #include "filter.h" #include "i18n.h" +#ifdef HAVE_DOSISH_SYSTEM + #define LF "\r\n" +#else + #define LF "\n" +#endif #define MAX_LINELEN 19995 /* a little bit smaller than in armor.c */ /* to make sure that a warning is displayed while */ @@ -183,7 +188,14 @@ copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md, iobuf_put( out, '-' ); iobuf_put( out, ' ' ); } - #ifdef __MINGW32__ + + #if 0 /*defined(HAVE_DOSISH_SYSTEM)*/ + /* We don't use this anymore because my interpretation of rfc2440 7.1 + * is that there is no conversion needed. If one decides to + * clearsign a unix file on a DOS box he will get a mixed line endings. + * If at some point it turns out, that a conversion is a nice feature + * we can make an option out of it. + */ /* make sure the lines do end in CR,LF */ if( n > 1 && ( (buffer[n-2] == '\r' && buffer[n-1] == '\n' ) || (buffer[n-2] == '\n' && buffer[n-1] == '\r'))) { @@ -206,10 +218,7 @@ copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md, /* at eof */ if( !pending_lf ) { /* make sure that the file ends with a LF */ - #ifndef __MINGW32__ - iobuf_put( out, '\r'); - #endif - iobuf_put( out, '\n'); + iobuf_writestr( out, LF ); if( !escape_dash ) md_putc( md, '\n' ); } diff --git a/mpi/ChangeLog b/mpi/ChangeLog index 48e49d5cb..80b2d8de5 100644 --- a/mpi/ChangeLog +++ b/mpi/ChangeLog @@ -1,3 +1,8 @@ +Sun Dec 19 15:22:26 CET 1999 Werner Koch + + * power/ : Converted more comments to C comments because some AS + complain about ' in comments. + Thu Dec 16 10:07:58 CET 1999 Werner Koch * Makefile.am: c/SFLAGS/ASFLAGS/. This has only been used by the diff --git a/mpi/power/mpih-add1.S b/mpi/power/mpih-add1.S index f7918c6e7..ad27f3d81 100644 --- a/mpi/power/mpih-add1.S +++ b/mpi/power/mpih-add1.S @@ -22,12 +22,13 @@ #include "sysdep.h" #include "asm-syntax.h" - +/* # INPUT PARAMETERS # res_ptr r3 # s1_ptr r4 # s2_ptr r5 # size r6 + */ .toc .extern mpihelp_add_n[DS] diff --git a/mpi/power/mpih-lshift.S b/mpi/power/mpih-lshift.S index c01b0fcda..5c53a0ae6 100644 --- a/mpi/power/mpih-lshift.S +++ b/mpi/power/mpih-lshift.S @@ -22,12 +22,13 @@ #include "sysdep.h" #include "asm-syntax.h" - +/* # INPUT PARAMETERS # res_ptr r3 # s_ptr r4 # size r5 # cnt r6 + */ .toc .extern mpihelp_lshift[DS] diff --git a/mpi/power/mpih-mul1.S b/mpi/power/mpih-mul1.S index 6d1f1910a..3b71b5aa9 100644 --- a/mpi/power/mpih-mul1.S +++ b/mpi/power/mpih-mul1.S @@ -23,6 +23,7 @@ #include "sysdep.h" #include "asm-syntax.h" +/* # INPUT PARAMETERS # res_ptr r3 # s1_ptr r4 @@ -38,6 +39,7 @@ # iteration, so we have to compute the compensation carefully (the natural, # srai+and doesn't work). Since the POWER architecture has a branch unit # we can branch in zero cycles, so that's how we perform the additions. + */ .toc .csect .mpihelp_mul_1[PR] diff --git a/mpi/power/mpih-mul2.S b/mpi/power/mpih-mul2.S index 6e4ae6f81..19ddee86d 100644 --- a/mpi/power/mpih-mul2.S +++ b/mpi/power/mpih-mul2.S @@ -25,7 +25,7 @@ - +/* # INPUT PARAMETERS # res_ptr r3 # s1_ptr r4 @@ -41,6 +41,7 @@ # iteration, so we have to compute the compensation carefully (the natural, # srai+and doesn't work). Since the POWER architecture has a branch unit # we can branch in zero cycles, so that's how we perform the additions. + */ .toc .csect .mpihelp_addmul_1[PR] diff --git a/mpi/power/mpih-mul3.S b/mpi/power/mpih-mul3.S index 8860c50e5..e875e88ea 100644 --- a/mpi/power/mpih-mul3.S +++ b/mpi/power/mpih-mul3.S @@ -24,7 +24,7 @@ #include "asm-syntax.h" - +/* # INPUT PARAMETERS # res_ptr r3 @@ -41,6 +41,7 @@ # iteration, so we have to compute the compensation carefully (the natural, # srai+and doesn't work). Since the POWER architecture has a branch unit # we can branch in zero cycles, so that's how we perform the additions. + */ .toc .csect .mpihelp_submul_1[PR] diff --git a/mpi/power/mpih-rshift.S b/mpi/power/mpih-rshift.S index d78d00d15..e29645072 100644 --- a/mpi/power/mpih-rshift.S +++ b/mpi/power/mpih-rshift.S @@ -23,12 +23,13 @@ #include "asm-syntax.h" - +/* # INPUT PARAMETERS # res_ptr r3 # s_ptr r4 # size r5 # cnt r6 +*/ .toc .extern mpihelp_rshift[DS] diff --git a/mpi/power/mpih-sub1.S b/mpi/power/mpih-sub1.S index 2de8af2fa..a3605533e 100644 --- a/mpi/power/mpih-sub1.S +++ b/mpi/power/mpih-sub1.S @@ -22,12 +22,13 @@ #include "sysdep.h" #include "asm-syntax.h" - +/* # INPUT PARAMETERS # res_ptr r3 # s1_ptr r4 # s2_ptr r5 # size r6 + */ .toc .extern mpihelp_sub_n[DS]