diff options
author | Werner Koch <wk@gnupg.org> | 1999-01-09 16:06:59 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 1999-01-09 16:06:59 +0100 |
commit | 002b1a8632d2c2795deb4682ba6db8be120db9b4 (patch) | |
tree | 33a0e8c96550f24d9aa1747b05a9f471f975e7a7 /g10 | |
parent | See ChangeLog: Thu Jan 7 18:00:58 CET 1999 Werner Koch (diff) | |
download | gnupg2-002b1a8632d2c2795deb4682ba6db8be120db9b4.tar.xz gnupg2-002b1a8632d2c2795deb4682ba6db8be120db9b4.zip |
See ChangeLog: Sat Jan 9 16:02:23 CET 1999 Werner Koch
Diffstat (limited to 'g10')
-rw-r--r-- | g10/ChangeLog | 15 | ||||
-rw-r--r-- | g10/armor.c | 430 | ||||
-rw-r--r-- | g10/build-packet.c | 2 | ||||
-rw-r--r-- | g10/encr-data.c | 19 | ||||
-rw-r--r-- | g10/free-packet.c | 2 | ||||
-rw-r--r-- | g10/mainproc.c | 20 | ||||
-rw-r--r-- | g10/plaintext.c | 61 | ||||
-rw-r--r-- | g10/sig-check.c | 5 | ||||
-rw-r--r-- | g10/sign.c | 2 | ||||
-rw-r--r-- | g10/status.c | 6 | ||||
-rw-r--r-- | g10/status.h | 2 |
11 files changed, 73 insertions, 491 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 532fa472b..f42b743b1 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,18 @@ +Sat Jan 9 16:02:23 CET 1999 Werner Koch <wk@isil.d.shuttle.de> + + * sig-check.c (do_check): Output time diff on error + + * status.c (STATUS_VALIDSIG): New. + (is_status_enabled): New. + * mainproc.c (check_sig_and_print): Issue that status message. + + * plaintext.c (special_md_putc): Removed + + * armor.c (armor_filter): print error for truncated lines. + + * free-packet.c (free_encrypted): Revomed call to set_block_mode. + (free_plaintext): Ditto. + Thu Jan 7 18:00:58 CET 1999 Werner Koch <wk@isil.d.shuttle.de> * pkclist.c (add_ownertrust): Fixed return value. diff --git a/g10/armor.c b/g10/armor.c index be0e69bf0..1d58c4146 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -1,5 +1,5 @@ /* armor.c - Armor flter - * Copyright (C) 1998,1999 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -254,415 +254,6 @@ parse_hash_header( const char *line ) -#if 0 /* old code */ -/**************** - * parse an ascii armor. - * Returns: the state, - * the remaining bytes in BUF are returned in RBUFLEN. - * r_empty return the # of empty lines before the buffer - */ -static fhdr_state_t -find_header( fhdr_state_t state, byte *buf, size_t *r_buflen, - IOBUF a, size_t n, unsigned *r_empty, int *r_hashes, - int only_keyblocks, int *not_dashed ) -{ - int c=0, i; - const char *s; - byte *p; - size_t buflen; - int cont; - int clearsig=0; - int hdr_line=0; - unsigned empty = 0; - - buflen = *r_buflen; - assert(buflen >= 100 ); - buflen -= 4; /* reserved room for CR,LF, and two extra */ - do { - switch( state ) { - case fhdrHASArmor: - /* read at least the first byte to check whether it is armored - * or not */ - c = 0; - for(n=0; n < 28 && (c=iobuf_get(a)) != -1 && c != '\n'; ) - buf[n++] = c; - if( !n && c == '\n' ) - state = fhdrCHECKBegin; - else if( !n || c == -1 ) - state = fhdrNOArmor; /* too short */ - else if( !is_armored( buf ) ) { - state = fhdrNOArmor; - if( c == '\n' ) - buf[n++] = c; - } - else if( c == '\n' ) - state = fhdrCHECKBegin; - else - state = fhdrINITCont; - break; - - case fhdrINIT: /* read some stuff into buffer */ - n = 0; - case fhdrINITCont: /* read more stuff into buffer */ - c = 0; - for(; n < buflen && (c=iobuf_get(a)) != -1 && c != '\n'; ) - buf[n++] = c; - state = c == '\n' ? fhdrCHECKBegin : - c == -1 ? fhdrEOF : fhdrINITSkip; - break; - - case fhdrINITSkip: - if( c == '\n' ) - n = 0; - else { - while( (c=iobuf_get(a)) != -1 && c != '\n' ) - ; - } - state = c == -1? fhdrEOF : fhdrINIT; - break; - - case fhdrSKIPHeader: - while( (c=iobuf_get(a)) != -1 && c != '\n' ) - ; - state = c == -1? fhdrEOF : fhdrWAITHeader; - break; - - case fhdrWAITHeader: /* wait for Header lines */ - c = 0; - for(n=0; n < buflen && (c=iobuf_get(a)) != -1 && c != '\n'; ) - buf[n++] = c; - buf[n] = 0; - if( n < buflen || c == '\n' ) { - if( n && buf[0] != '\r') { /* maybe a header */ - if( strchr( buf, ':') ) { /* yes */ - int hashes=0; - if( buf[n-1] == '\r' ) - buf[--n] = 0; - if( opt.verbose ) { - log_info(_("armor header: ")); - print_string( stderr, buf, n, 0 ); - putc('\n', stderr); - } - if( clearsig && !(hashes=parse_hash_header( buf )) ) { - if( strlen(buf) > 15 - && !memcmp( buf, "NotDashEscaped:", 15 ) ) { - *not_dashed = 1; - state = fhdrWAITHeader; - } - else { - log_error(_("invalid clearsig header\n")); - state = fhdrERROR; - } - } - else { - state = fhdrWAITHeader; - if( r_hashes ) - *r_hashes |= hashes; - } - } - else if( clearsig && n > 15 && !memcmp(buf, "-----", 5 ) ) - state = fhdrNullClearsig; - else - state = fhdrCHECKDashEscaped3; - } - else if( !n || (buf[0] == '\r' && !buf[1]) ) { /* empty line */ - if( clearsig ) - state = fhdrWAITClearsig; - else { - /* this is not really correct: if we do not have - * a clearsig and no armor lines we are not allowed - * to have an empty line */ - n = 0; - state = fhdrTEXT; - } - } - else { - log_error(_("invalid armor header: ")); - print_string( stderr, buf, n, 0 ); - putc('\n', stderr); - state = fhdrERROR; - } - } - else if( c != -1 ) { - if( strchr( buf, ':') ) { /* buffer to short, but this is okay*/ - if( opt.verbose ) { - log_info(_("armor header: ")); - print_string( stderr, buf, n, 0 ); - fputs("[...]\n", stderr); /* indicate it is truncated */ - } - state = fhdrSKIPHeader; /* skip rest of line */ - } - else /* line too long */ - state = fhdrERROR; - } - else - state = fhdrEOF; - break; - - case fhdrWAITClearsig: /* skip the empty line (for clearsig) */ - c = 0; - for(n=0; n < buflen && (c=iobuf_get(a)) != -1 && c != '\n'; ) - buf[n++] = c; - if( c != -1 ) { - if( n > 15 && !memcmp(buf, "-----", 5 ) ) - state = fhdrNullClearsig; - else if( c != '\n' ) - state = fhdrREADClearsigNext; - else - state = fhdrCHECKDashEscaped3; - } - else { - /* fixme: we should check whether this line continues - * it is possible that we have only read ws until here - * and more stuff is to come */ - state = fhdrEOF; - } - break; - - case fhdrNullClearsig: /* zero length cleartext */ - state = fhdrENDClearsig; - break; - - case fhdrENDClearsig: - case fhdrCHECKBegin: - state = state == fhdrCHECKBegin ? fhdrINITSkip : fhdrERRORShow; - if( n < 15 ) - break; /* too short */ - if( memcmp( buf, "-----", 5 ) ) - break; - buf[n] = 0; - p = strstr(buf+5, "-----"); - if( !p ) - break; - *p = 0; - p += 5; - if( *p == '\r' ) - p++; - if( *p ) - break; /* garbage after dashes */ - p = buf+5; - for(i=0; (s=head_strings[i]); i++ ) - if( !strcmp(s, p) ) - break; - if( !s ) - break; /* unknown begin line */ - if( only_keyblocks && i != 1 && i != 5 && i != 6 ) - break; /* not a keyblock armor */ - - /* found the begin line */ - hdr_line = i; - state = fhdrWAITHeader; - *not_dashed = 0; - if( hdr_line == BEGIN_SIGNED_MSG_IDX ) - clearsig = 1; - if( opt.verbose > 1 ) - log_info(_("armor: %s\n"), head_strings[hdr_line]); - break; - - case fhdrCLEARSIGSimple: - /* we are at the begin of a new line */ - case fhdrCLEARSIGSimpleNext: - n = 0; - c = 0; - while( n < buflen && (c=iobuf_get(a)) != -1 ) { - buf[n++] = c; - if( c == '\n' ) - break; - } - buf[n] = 0; - if( c == -1 ) - state = fhdrEOF; - else if( state == fhdrCLEARSIGSimple - && n > 15 && !memcmp(buf, "-----", 5 ) ) { - if( c == '\n' ) - buf[n-1] = 0; - state = fhdrENDClearsig; - } - else if( c == '\n' ) - state = fhdrCLEARSIGSimple; - else - state = fhdrCLEARSIGSimpleNext; - break; - - case fhdrCLEARSIG: - case fhdrEMPTYClearsig: - case fhdrREADClearsig: - /* we are at the start of a line: read a clearsig into the buffer - * we have to look for a header line or dashed escaped text*/ - n = 0; - c = 0; - while( n < buflen && (c=iobuf_get(a)) != -1 && c != '\n' ) - buf[n++] = c; - buf[n] = 0; - if( c == -1 ) - state = fhdrEOF; - else if( !n || ( buf[0]=='\r' && !buf[1] ) ) { - state = fhdrEMPTYClearsig; - empty++; - } - else if( c == '\n' ) - state = fhdrCHECKClearsig2; - else - state = fhdrCHECKClearsig; - break; - - case fhdrCHECKDashEscaped3: - if( *not_dashed ) { - state = fhdrTEXTSimple; - break; - } - if( !(n > 1 && buf[0] == '-' && buf[1] == ' ' ) ) { - state = fhdrTEXT; - break; - } - /* fall through */ - case fhdrCHECKDashEscaped2: - case fhdrCHECKDashEscaped: - /* check dash escaped line */ - if( buf[2] == '-' || ( n > 6 && !memcmp(buf+2, "From ", 5))) { - for(i=2; i < n; i++ ) - buf[i-2] = buf[i]; - n -= 2; - buf[n] = 0; /* not really needed */ - state = state == fhdrCHECKDashEscaped3 ? fhdrTEXT : - state == fhdrCHECKDashEscaped2 ? - fhdrREADClearsig : fhdrTESTSpaces; - } - else { - log_error(_("invalid dash escaped line: ")); - print_string( stderr, buf, n, 0 ); - putc('\n', stderr); - state = fhdrERROR; - } - break; - - case fhdrCHECKClearsig: - /* check the clearsig line */ - if( n > 15 && !memcmp(buf, "-----", 5 ) ) - state = fhdrENDClearsig; - else if( buf[0] == '-' && buf[1] == ' ' && !*not_dashed ) - state = fhdrCHECKDashEscaped; - else { - state = fhdrTESTSpaces; - } - break; - - case fhdrCHECKClearsig2: - /* check the clearsig line */ - if( n > 15 && !memcmp(buf, "-----", 5 ) ) - state = fhdrENDClearsig; - else if( buf[0] == '-' && buf[1] == ' ' && !*not_dashed ) - state = fhdrCHECKDashEscaped2; - else { - state = fhdrREADClearsig; - } - break; - - case fhdrREADClearsigNext: - /* Read to the end of the line, do not care about checking - * for dashed escaped text of headers */ - c = 0; - n = 0; - while( n < buflen && (c=iobuf_get(a)) != -1 && c != '\n' ) - buf[n++] = c; - buf[n] = 0; - if( c == -1 ) - state = fhdrEOF; - else if( c == '\n' ) - state = fhdrREADClearsig; - else - state = fhdrTESTSpaces; - break; - - case fhdrTESTSpaces: { - /* but must check whether the rest of the line - * only contains white spaces; this is problematic - * since we may have to restore the stuff. simply - * counting spaces is not enough, because it may be a - * mix of different white space characters */ - IOBUF b = iobuf_temp(); - while( (c=iobuf_get(a)) != -1 && c != '\n' ) { - iobuf_put(b,c); - if( c != ' ' && c != '\t' && c != '\r' ) - break; - } - if( c == '\n' ) { - /* okay we can skip the rest of the line */ - iobuf_close(b); - state = fhdrREADClearsig; - } - else { - iobuf_unget_and_close_temp(a,b); - state = fhdrREADClearsigNext; - } - } break; - - case fhdrERRORShow: - log_error(_("invalid clear text header: ")); - print_string( stderr, buf, n, 0 ); - putc('\n', stderr); - state = fhdrERROR; - break; - - default: BUG(); - } - switch( state ) { - case fhdrINIT: - case fhdrINITCont: - case fhdrINITSkip: - case fhdrCHECKBegin: - case fhdrWAITHeader: - case fhdrWAITClearsig: - case fhdrSKIPHeader: - case fhdrEMPTYClearsig: - case fhdrCHECKClearsig: - case fhdrCHECKClearsig2: - case fhdrCHECKDashEscaped: - case fhdrCHECKDashEscaped2: - case fhdrCHECKDashEscaped3: - case fhdrTESTSpaces: - case fhdrERRORShow: - cont = 1; - break; - default: cont = 0; - } - } while( cont ); - - if( clearsig && state == fhdrTEXT ) { - state = fhdrCLEARSIG; - } - else if( clearsig && state == fhdrTEXTSimple ) { - state = fhdrCLEARSIGSimple; - buf[n] = '\n'; - n++; - } - - if( state == fhdrCLEARSIG || state == fhdrREADClearsig ) { - /* append CR,LF after removing trailing wspaces */ - for(p=buf+n-1; n; n--, p-- ) { - assert( *p != '\n' ); - if( *p != ' ' && *p != '\t' && *p != '\r' ) { - p[1] = '\r'; - p[2] = '\n'; - n += 2; - break; - } - } - if( !n ) { - buf[0] = '\r'; - buf[1] = '\n'; - n = 2; - } - } - - fprintf(stderr,"ARMOR READ (state=%d): %.*s", state, n, buf ); - - *r_buflen = n; - *r_empty = empty; - return state; -} -#endif - static unsigned trim_trailing_spaces( byte *line, unsigned len ) @@ -909,8 +500,10 @@ fake_packet( armor_filter_context_t *afx, IOBUF a, else { while( len < size && afx->buffer_pos < afx->buffer_len ) buf[len++] = afx->buffer[afx->buffer_pos++]; - buf[len++] = '\r'; - buf[len++] = '\n'; + if( afx->buffer_pos >= afx->buffer_len ) { + buf[len++] = '\r'; + buf[len++] = '\n'; + } if( len >= size ) continue; } @@ -948,8 +541,8 @@ fake_packet( armor_filter_context_t *afx, IOBUF a, putc('\n', stderr); } lastline = 1; - assert( len >= 4 ); - len -= 2; /* remove the last CR,LF */ + if( len >= 2 ) + len -= 2; /* remove the last CR,LF */ rc = -1; } } @@ -958,7 +551,7 @@ fake_packet( armor_filter_context_t *afx, IOBUF a, buf[0] = (len-2) >> 8; buf[1] = (len-2); if( lastline ) { /* write last (ending) length header */ - if( buf[0] && buf[1] ) { /* only if we have some text */ + if( buf[0] || buf[1] ) { /* only if we have some text */ buf[len++] = 0; buf[len++] = 0; } @@ -1134,7 +727,7 @@ armor_filter( void *opaque, int control, int idx, idx2; size_t n=0; u32 crc; - #if 1 + #if 0 static FILE *fp ; if( !fp ) { @@ -1232,7 +825,7 @@ armor_filter( void *opaque, int control, } else rc = radix64_read( afx, a, &n, buf, size ); - #if 1 + #if 0 if( n ) if( fwrite(buf, n, 1, fp ) != 1 ) BUG(); @@ -1367,6 +960,9 @@ armor_filter( void *opaque, int control, } else if( !afx->any_data && !afx->inp_bypass ) log_error(_("no valid OpenPGP data found.\n")); + if( afx->truncated ) + log_info(_("invalid armor: line longer than %d characters\n"), + MAX_LINELEN ); m_free( afx->buffer ); afx->buffer = NULL; } diff --git a/g10/build-packet.c b/g10/build-packet.c index 5b952f153..a1eb12623 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -426,7 +426,7 @@ do_plaintext( IOBUF out, int ctb, PKT_plaintext *pt ) { int i, rc = 0; u32 n; - byte buf[1000]; /* FIXME: this buffer has the plaintext! */ + byte buf[1000]; /* this buffer has the plaintext! */ int nbytes; write_header(out, ctb, calc_plaintext( pt ) ); diff --git a/g10/encr-data.c b/g10/encr-data.c index d44d6c245..c5967c23b 100644 --- a/g10/encr-data.c +++ b/g10/encr-data.c @@ -1,5 +1,5 @@ /* encr-data.c - process an encrypted data packet - * Copyright (C) 1998 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -79,10 +79,12 @@ decrypt_data( PKT_encrypted *ed, DEK *dek ) cipher_setiv( dfx.cipher_hd, NULL ); if( ed->len ) { - /*iobuf_set_limit( ed->buf, ed->len );*/ - - for(i=0; i < (blocksize+2) && ed->len; i++, ed->len-- ) - temp[i] = iobuf_get(ed->buf); + for(i=0; i < (blocksize+2) && ed->len; i++, ed->len-- ) { + if( (c=iobuf_get(ed->buf)) == -1 ) + break; + else + temp[i] = c; + } } else { for(i=0; i < (blocksize+2); i++ ) @@ -100,13 +102,6 @@ decrypt_data( PKT_encrypted *ed, DEK *dek ) } iobuf_push_filter( ed->buf, decode_filter, &dfx ); proc_packets(ed->buf); - #if 0 - iobuf_pop_filter( ed->buf, decode_filter, &dfx ); - if( ed->len ) - iobuf_set_limit( ed->buf, 0 ); /* disable the readlimit */ - else - iobuf_clear_eof( ed->buf ); - #endif ed->buf = NULL; cipher_close(dfx.cipher_hd); return 0; diff --git a/g10/free-packet.c b/g10/free-packet.c index 3e3c9d054..e953b0d45 100644 --- a/g10/free-packet.c +++ b/g10/free-packet.c @@ -264,7 +264,6 @@ free_encrypted( PKT_encrypted *ed ) if( iobuf_in_block_mode(ed->buf) ) { while( iobuf_get(ed->buf) != -1 ) ; - iobuf_set_block_mode(ed->buf, 0); } else { for( ; ed->len; ed->len-- ) /* skip the packet */ @@ -282,7 +281,6 @@ free_plaintext( PKT_plaintext *pt ) if( iobuf_in_block_mode(pt->buf) ) { while( iobuf_get(pt->buf) != -1 ) ; - iobuf_set_block_mode(pt->buf, 0); } else { for( ; pt->len; pt->len-- ) /* skip the packet */ diff --git a/g10/mainproc.c b/g10/mainproc.c index f1df39f2c..6b69eefa1 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -278,7 +278,7 @@ proc_plaintext( CTX c, PACKET *pkt ) md_enable( c->mfx.md, DIGEST_ALGO_SHA1 ); md_enable( c->mfx.md, DIGEST_ALGO_MD5 ); } - md_start_debug( c->mfx.md, "verify" ); + /*md_start_debug( c->mfx.md, "verify" );*/ rc = handle_plaintext( pt, &c->mfx, c->sigs_only, clearsig ); if( rc == G10ERR_CREATE_FILE && !c->sigs_only) { /* can't write output but we hash it anyway to @@ -849,6 +849,24 @@ check_sig_and_print( CTX c, KBNODE node ) print_keyid( stderr, sig->keyid ); putc('\"', stderr); putc('\n', stderr); + if( !rc && is_status_enabled() ) { + /* print a status response with the fingerprint */ + PKT_public_key *pk = m_alloc_clear( sizeof *pk ); + + if( !get_pubkey( pk, sig->keyid ) ) { + byte array[MAX_FINGERPRINT_LEN], *p; + char buf[MAX_FINGERPRINT_LEN*2+1]; + size_t i, n; + + fingerprint_from_pk( pk, array, &n ); + p = array; + for(i=0; i < n ; i++, p++ ) + sprintf(buf+2*i, "%02X", *p ); + write_status_text( STATUS_VALIDSIG, buf ); + } + free_public_key( pk ); + } + if( !rc ) rc = check_signatures_trust( sig ); if( rc ) diff --git a/g10/plaintext.c b/g10/plaintext.c index c5c6685f4..887b583f6 100644 --- a/g10/plaintext.c +++ b/g10/plaintext.c @@ -1,5 +1,5 @@ /* plaintext.c - process an plaintext packet - * Copyright (C) 1998 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -35,46 +35,6 @@ #include "i18n.h" -/**************** - * Defer the last CR,LF - */ -static void -special_md_putc( MD_HANDLE md, int c, int *state ) -{ - if( c == -1 ) { /* flush */ - if( *state == 1 ) { - md_putc(md, '\r'); - } - - *state = 0; - return; - } - again: - switch( *state ) { - case 0: - if( c == '\r' ) - *state = 1; - else - md_putc(md, c ); - break; - case 1: - if( c == '\n' ) - *state = 2; - else { - md_putc(md, '\r'); - *state = 0; - goto again; - } - break; - case 2: - md_putc(md, '\r'); - md_putc(md, '\n'); - *state = 0; - goto again; - default: BUG(); - } -} - /**************** * Handle a plaintext packet. If MFX is not NULL, update the MDs @@ -91,7 +51,6 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, int rc = 0; int c; int convert = pt->mode == 't'; - int special_state = 0; /* create the filename as C string */ if( nooutput ) @@ -137,12 +96,8 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, rc = G10ERR_READ_FILE; goto leave; } - if( mfx->md ) { - if( 0 && convert && clearsig ) - special_md_putc(mfx->md, c, &special_state ); - else - md_putc(mfx->md, c ); - } + if( mfx->md ) + md_putc(mfx->md, c ); if( convert && !clearsig && c == '\r' ) continue; /* fixme: this hack might be too simple */ if( fp ) { @@ -157,12 +112,8 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, } else { while( (c = iobuf_get(pt->buf)) != -1 ) { - if( mfx->md ) { - if( 0 && convert && clearsig ) - special_md_putc(mfx->md, c, &special_state ); - else - md_putc(mfx->md, c ); - } + if( mfx->md ) + md_putc(mfx->md, c ); if( convert && !clearsig && c == '\r' ) continue; /* fixme: this hack might be too simple */ if( fp ) { @@ -176,8 +127,6 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, } pt->buf = NULL; } - if( 0 && mfx->md && convert && clearsig ) - special_md_putc(mfx->md, -1, &special_state ); /* flush */ if( fp && fp != stdout && fclose(fp) ) { log_error("Error closing `%s': %s\n", fname, strerror(errno) ); diff --git a/g10/sig-check.c b/g10/sig-check.c index 2e9fd47eb..2460cd09a 100644 --- a/g10/sig-check.c +++ b/g10/sig-check.c @@ -162,7 +162,10 @@ do_check( PKT_public_key *pk, PKT_signature *sig, MD_HANDLE digest ) cur_time = make_timestamp(); if( pk->timestamp > cur_time ) { - log_info(_("public key created in future (time warp or clock problem)\n")); + ulong d = pk->timestamp - cur_time; + log_info(_("public key created %lu %s " + "in future (time warp or clock problem)\n"), + d, d==1? _("second"):_("seconds") ); return G10ERR_TIME_CONFLICT; } diff --git a/g10/sign.c b/g10/sign.c index 0fac451bf..abb6e9d44 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -637,7 +637,7 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile ) PKT_secret_key *sk = sk_rover->sk; md_enable(textmd, hash_for(sk->pubkey_algo)); } - md_start_debug( textmd, "create" ); + /*md_start_debug( textmd, "create" );*/ if( !opt.not_dash_escaped ) iobuf_push_filter( inp, text_filter, &tfx ); rc = write_dash_escaped( inp, out, textmd ); diff --git a/g10/status.c b/g10/status.c index 71a4e8341..4ed91d2d9 100644 --- a/g10/status.c +++ b/g10/status.c @@ -56,6 +56,11 @@ set_status_fd ( int newfd ) fd = newfd; } +int +is_status_enabled() +{ + return fd != -1; +} void write_status ( int no ) @@ -92,6 +97,7 @@ write_status_text ( int no, const char *text) case STATUS_SHM_GET_BOOL : s = "SHM_GET_BOOL\n"; break; case STATUS_SHM_GET_HIDDEN : s = "SHM_GET_HIDDEN\n"; break; case STATUS_NEED_PASSPHRASE: s = "NEED_PASSPHRASE\n"; break; + case STATUS_VALIDSIG : s = "VALIDSIG\n"; break; default: s = "?\n"; break; } diff --git a/g10/status.h b/g10/status.h index fa1583687..e0f552b60 100644 --- a/g10/status.h +++ b/g10/status.h @@ -48,9 +48,11 @@ #define STATUS_SHM_GET_HIDDEN 19 #define STATUS_NEED_PASSPHRASE 20 +#define STATUS_VALIDSIG 21 /*-- status.c --*/ void set_status_fd ( int fd ); +int is_status_enabled ( void ); void write_status ( int no ); void write_status_text ( int no, const char *text ); |