See ChangeLog: Tue Mar 2 16:44:57 CET 1999 Werner Koch

This commit is contained in:
Werner Koch 1999-03-02 15:48:37 +00:00
parent c27c7416d5
commit 20bb42bfe7
12 changed files with 103 additions and 102 deletions

2
NEWS
View File

@ -2,6 +2,8 @@
* New configure option --enable-static-rnd=[egd|linux|unix|none]
to select a random gathering module for static linking.
* The original text is now verbatim copied to a cleartext signed message.
Noteworthy changes in version 0.9.3
-----------------------------------

4
TODO
View File

@ -1,9 +1,6 @@
* Implement 256 bit key Twofish.
* clearsig: keep lineendings as they are. Remember that trailings
blanks are not hashed.
* Check revocation and expire stuff. [I'm currently working on this.]
* Check calculation of key validity. [I'm currently working on this.]
@ -23,6 +20,7 @@
Nice to have
------------
* clearsig: Keep lineendings while writing the output of a clearsig
* preferences of hash algorithms are not yet used.
* new menu to delete signatures and list signature in menu
* Replace the SIGUSR1 stuff by semaphores to avoid loss of a signal.

View File

@ -71,12 +71,8 @@ open_device( const char *name, int minor )
g10_log_fatal("can't open %s: %s\n", name, strerror(errno) );
if( fstat( fd, &sb ) )
g10_log_fatal("stat() off %s failed: %s\n", name, strerror(errno) );
#if defined(__sparc__) && defined(__linux__)
#warning something is wrong with UltraPenguin /dev/random
#else
if( !S_ISCHR(sb.st_mode) )
g10_log_fatal("invalid random device!\n" );
#endif
return fd;
}

View File

@ -322,3 +322,11 @@
is required by the protocol.
Q: What does the "You are using the xxxx character set." mean?
A: This note is printed when UTF8 mapping has to be done. Make sure that
the displayed charset is the one you have activated on your system
"iso-8859-1" is the most used one, so this is the default. You can
change the charset with the option "--charset". It is important that
you active characterset matches the one displayed - if not restrict
yourself to plain 7 bit ASCII and no mapping has to be done.

View File

@ -1,3 +1,11 @@
Tue Mar 2 16:44:57 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* textfilter.c (copy_clearsig_text): New.
(clearsign): Removed.
* sign.c (clearsign_file): does not use textfiler anymore.
* keygen.c (ask_user_id): print a note about the used charset.
Tue Mar 2 10:38:42 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* sig-check.c (signature_check): sig-id now works for all algos.

View File

@ -86,7 +86,6 @@ typedef struct {
unsigned buffer_len; /* used length of the buffer */
unsigned buffer_pos; /* read position */
int truncated; /* number of truncated lines */
int clearsign;
int not_dash_escaped;
int escape_from;
MD_HANDLE md;
@ -117,6 +116,8 @@ int cipher_filter( void *opaque, int control,
/*-- textfilter.c --*/
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 );

View File

@ -651,6 +651,14 @@ ask_user_id( int mode )
if( quick_random_gen(-1) )
strcpy(p, " (INSECURE!)" );
/* print a note in case that UTF8 mapping has to be done */
for(p=uid; *p; p++ ) {
if( *p & 0x80 ) {
tty_printf(_("You are using the `%s' character set.\n"),
get_native_charset() );
break;
}
}
tty_printf(_("You selected this USER-ID:\n \"%s\"\n\n"), uid);
/* fixme: add a warning if this user-id already exists */

View File

@ -463,7 +463,6 @@ int
clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
{
armor_filter_context_t afx;
text_filter_context_t tfx;
MD_HANDLE textmd = NULL;
IOBUF inp = NULL, out = NULL;
PACKET pkt;
@ -472,10 +471,8 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
SK_LIST sk_rover = NULL;
int old_style = opt.rfc1991;
int only_md5 = 0;
int c;
memset( &afx, 0, sizeof afx);
memset( &tfx, 0, sizeof tfx);
init_packet( &pkt );
if( (rc=build_sk_list( locusr, &sk_list, 1, PUBKEY_USAGE_SIG )) )
@ -547,19 +544,8 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
md_enable(textmd, hash_for(sk->pubkey_algo));
}
/*md_start_debug( textmd, "sign" );*/
tfx.clearsign = 1;
tfx.not_dash_escaped = opt.not_dash_escaped;
tfx.escape_from = opt.escape_from;
tfx.md = textmd;
iobuf_push_filter( inp, text_filter, &tfx );
/* read input and write it to the output. The textfilter handles
* the calculation of the hash and the dash escaping */
while( (c=iobuf_get(inp)) != -1 ) {
if( iobuf_put(out, c) == -1 ) {
rc = G10ERR_WRITE_FILE;
goto leave;
}
}
copy_clearsig_text( out, inp, textmd,
!opt.not_dash_escaped, opt.escape_from );
/* fixme: check for read errors */
/* now write the armor */

View File

@ -99,81 +99,7 @@ standard( text_filter_context_t *tfx, IOBUF a,
return rc;
}
static int
clearsign( text_filter_context_t *tfx, IOBUF a,
byte *buf, size_t size, size_t *ret_len)
{
int rc=0;
size_t len = 0;
unsigned maxlen;
assert( size > 2 );
size -= 3; /* reserve for dash escaping and extra LF */
while( !rc && len < size ) {
unsigned n;
byte *p;
if( tfx->pending_esc ) {
buf[len++] = '-';
buf[len++] = ' ';
tfx->pending_esc = 0;
}
while( len < size && tfx->buffer_pos < tfx->buffer_len )
buf[len++] = tfx->buffer[tfx->buffer_pos++];
if( len >= size )
continue;
/* read the next line */
maxlen = MAX_LINELEN;
tfx->buffer_pos = 0;
tfx->buffer_len = iobuf_read_line( a, &tfx->buffer,
&tfx->buffer_size, &maxlen );
p = tfx->buffer;
n = tfx->buffer_len;
if( !maxlen )
tfx->truncated++;
if( !n ) { /* readline has returned eof */
/* don't hash a pending lf here because the last one is
* not part of the signed material. OpenPGP does not
* hash the last LF because it may have to add an
* extra one in case that the original material
* does not end with one. The clear signed text
* must end in a LF, so that the following armor
* line can be detected by the parser
*/
if( !tfx->pending_lf ) {
/* make sure that the file ends with a LF */
buf[len++] = '\n';
if( tfx->not_dash_escaped )
md_putc(tfx->md, '\n' );
tfx->pending_lf = 1;
}
if( !len )
rc = -1; /* eof */
break;
}
if( tfx->md ) {
if( tfx->not_dash_escaped )
md_write( tfx->md, p, n );
else {
if( tfx->pending_lf ) {
md_putc(tfx->md, '\r' );
md_putc(tfx->md, '\n' );
}
md_write( tfx->md, p, len_without_trailing_ws( p, n ) );
}
}
tfx->pending_lf = p[n-1] == '\n';
if( tfx->not_dash_escaped )
;
else if( *p == '-' )
tfx->pending_esc = 1;
else if( tfx->escape_from && n > 4 && !memcmp(p, "From ", 5 ) )
tfx->pending_esc = 1;
}
*ret_len = len;
return rc;
}
/****************
@ -189,10 +115,7 @@ text_filter( void *opaque, int control,
int rc=0;
if( control == IOBUFCTRL_UNDERFLOW ) {
if( tfx->clearsign )
rc = clearsign( tfx, a, buf, size, ret_len );
else
rc = standard( tfx, a, buf, size, ret_len );
rc = standard( tfx, a, buf, size, ret_len );
}
else if( control == IOBUFCTRL_FREE ) {
if( tfx->truncated )
@ -207,4 +130,64 @@ text_filter( void *opaque, int control,
}
/****************
* Copy data from INP to OUT and do some escaping if requested.
* md is updated as required by rfc2440
*/
int
copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md,
int escape_dash, int escape_from )
{
unsigned maxlen;
byte *buffer = NULL; /* malloced buffer */
unsigned bufsize; /* and size of this buffer */
unsigned n;
int truncated = 0;
int pending_lf = 0;
if( !escape_dash )
escape_from = 0;
for(;;) {
maxlen = MAX_LINELEN;
n = iobuf_read_line( inp, &buffer, &bufsize, &maxlen );
if( !maxlen )
truncated++;
if( !n )
break; /* read_line has returned eof */
/* update the message digest */
if( escape_dash ) {
if( pending_lf ) {
md_putc( md, '\r' );
md_putc( md, '\n' );
}
md_write( md, buffer, len_without_trailing_ws( buffer, n ) );
}
else
md_write( md, buffer, n );
pending_lf = buffer[n-1] == '\n';
/* write the output */
if( ( escape_dash && *buffer == '-')
|| ( escape_from && n > 4 && !memcmp(buffer, "From ", 5 ) ) ) {
iobuf_put( out, '-' );
iobuf_put( out, ' ' );
}
iobuf_write( out, buffer, n );
}
/* at eof */
if( !pending_lf ) { /* make sure that the file ends with a LF */
iobuf_put( out, '\n');
if( !escape_dash )
md_putc( md, '\n' );
}
if( truncated )
log_info(_("input line longer than %d characters\n"), MAX_LINELEN );
return 0; /* okay */
}

View File

@ -166,6 +166,7 @@ char *trim_spaces( char *string );
unsigned trim_trailing_ws( byte *line, unsigned len );
int string_count_chr( const char *string, int c );
int set_native_charset( const char *newset );
const char* get_native_charset(void);
char *native_to_utf8( const char *string );
char *utf8_to_native( const char *string );
int check_utf8_string( const char *string );

View File

@ -1,3 +1,7 @@
Tue Mar 2 16:44:57 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* strgutil.c (get_native_charset): New.
Fri Feb 26 17:55:41 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* secmem.c (memblock_struct): Force align (Rémi Guyomarch)

View File

@ -244,6 +244,12 @@ set_native_charset( const char *newset )
return 0;
}
const char*
get_native_charset()
{
return use_koi8? "koi8-r" : "iso-8859-1";
}
/****************
* Convert string, which is in native encoding to UTF8 and return the
* new allocated UTF8 string.