diff options
author | David Shaw <[email protected]> | 2004-09-24 20:34:38 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2004-09-24 20:34:38 +0000 |
commit | 4d26ab92cc852f73e97ff4f977f2efd1f6808e14 (patch) | |
tree | 09ee9cbb6119e60870929c668963f3d2164f4845 | |
parent | * keyedit.c (keyedit_menu), gpgv.c (agent_scd_getattr (stub)), keygen.c (diff) | |
download | gnupg-4d26ab92cc852f73e97ff4f977f2efd1f6808e14.tar.gz gnupg-4d26ab92cc852f73e97ff4f977f2efd1f6808e14.zip |
* main.h: Create S2K_DIGEST_ALGO macro so we do not need to always set
opt.s2k_digest_algo. This helps fix a problem with PGP 2.x encrypted
symmetric messages. Change all callers (encode.c, g10.c, keyedit.c,
keygen.c, passphrase.c, sign.c).
* armor.c, cardglue.c, getkey.c, import.c, keygen.c: Be consistent in some
more quoted strings. Always use 'user ID', not 'user id', "quotes" for
user IDs, etc.
Diffstat (limited to '')
-rw-r--r-- | g10/ChangeLog | 9 | ||||
-rw-r--r-- | g10/armor.c | 12 | ||||
-rw-r--r-- | g10/cardglue.c | 2 | ||||
-rw-r--r-- | g10/encode.c | 4 | ||||
-rw-r--r-- | g10/g10.c | 9 | ||||
-rw-r--r-- | g10/getkey.c | 4 | ||||
-rw-r--r-- | g10/import.c | 10 | ||||
-rw-r--r-- | g10/keyedit.c | 2 | ||||
-rw-r--r-- | g10/keygen.c | 10 | ||||
-rw-r--r-- | g10/main.h | 13 | ||||
-rw-r--r-- | g10/passphrase.c | 2 | ||||
-rw-r--r-- | g10/sign.c | 2 |
12 files changed, 45 insertions, 34 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 559671a2a..db91da5dd 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,14 @@ 2004-09-24 David Shaw <[email protected]> + * main.h: Create S2K_DIGEST_ALGO macro so we do not need to always + set opt.s2k_digest_algo. This helps fix a problem with PGP 2.x + encrypted symmetric messages. Change all callers (encode.c, + g10.c, keyedit.c, keygen.c, passphrase.c, sign.c). + + * armor.c, cardglue.c, getkey.c, import.c, keygen.c: Be consistent + in some more quoted strings. Always use 'user ID', not 'user id', + "quotes" for user IDs, etc. + * keyedit.c (keyedit_menu), gpgv.c (agent_scd_getattr (stub)), keygen.c (copy_mpi, generate_raw_key): Fix a compile problem and a few warnings when building without card support. diff --git a/g10/armor.c b/g10/armor.c index 5cd798d83..6d2747237 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -562,7 +562,7 @@ fake_packet( armor_filter_context_t *afx, IOBUF a, ; /* this is okay */ else { if( type != BEGIN_SIGNATURE ) { - log_info(_("unexpected armor:")); + log_info(_("unexpected armor: ")); print_string( stderr, p, n, 0 ); putc('\n', stderr); } @@ -692,7 +692,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, break; } else if( (c = asctobin[(c2=c)]) == 255 ) { - log_error(_("invalid radix64 character %02x skipped\n"), c2); + log_error(_("invalid radix64 character %02X skipped\n"), c2); continue; } switch(idx) { @@ -781,7 +781,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, rc = invalid_crc(); } else if( mycrc != afx->crc ) { - log_info (_("CRC error; %06lx - %06lx\n"), + log_info (_("CRC error; %06lX - %06lX\n"), (ulong)afx->crc, (ulong)mycrc); rc = invalid_crc(); } @@ -801,7 +801,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, if( rc == -1 ) rc = 0; else if( rc == 2 ) { - log_error(_("premature eof (in Trailer)\n")); + log_error(_("premature eof (in trailer)\n")); rc = G10ERR_INVALID_ARMOR; } else { @@ -1277,7 +1277,7 @@ unarmor_pump (UnarmorPump x, int c) { int c2; if( (c = asctobin[(c2=c)]) == 255 ) { - log_error(_("invalid radix64 character %02x skipped\n"), c2); + log_error(_("invalid radix64 character %02X skipped\n"), c2); break; } } @@ -1314,7 +1314,7 @@ unarmor_pump (UnarmorPump x, int c) if( (c = asctobin[c]) == 255 ) { rval = -1; /* ready */ if( x->crc != x->mycrc ) { - log_info (_("CRC error; %06lx - %06lx\n"), + log_info (_("CRC error; %06lX - %06lX\n"), (ulong)x->crc, (ulong)x->mycrc); if ( invalid_crc() ) rval = -3; diff --git a/g10/cardglue.c b/g10/cardglue.c index a446a30a3..c5b76edcc 100644 --- a/g10/cardglue.c +++ b/g10/cardglue.c @@ -362,7 +362,7 @@ check_card_serialno (APP app, const char *serialno) else card_close (); tty_printf (_("Please remove the current card and " - "insert the one with the serial number:\n" + "insert the one with serial number:\n" " %.*s\n"), 32, serialno); sprintf (buf, "1 %.32s", serialno); diff --git a/g10/encode.c b/g10/encode.c index 1b83f244d..29b39975e 100644 --- a/g10/encode.c +++ b/g10/encode.c @@ -191,7 +191,7 @@ encode_simple( const char *filename, int mode, int use_seskey ) if( mode ) { s2k = m_alloc_clear( sizeof *s2k ); s2k->mode = RFC1991? 0:opt.s2k_mode; - s2k->hash_algo = opt.s2k_digest_algo; + s2k->hash_algo=S2K_DIGEST_ALGO; cfx.dek = passphrase_to_dek( NULL, 0, default_cipher_algo(), s2k, 2, NULL, NULL); @@ -380,7 +380,7 @@ setup_symkey(STRING2KEY **symkey_s2k,DEK **symkey_dek) { *symkey_s2k=m_alloc_clear(sizeof(STRING2KEY)); (*symkey_s2k)->mode = opt.s2k_mode; - (*symkey_s2k)->hash_algo = opt.s2k_digest_algo; + (*symkey_s2k)->hash_algo = S2K_DIGEST_ALGO; *symkey_dek=passphrase_to_dek(NULL,0,opt.s2k_cipher_algo, *symkey_s2k,2,NULL,NULL); @@ -1465,9 +1465,6 @@ parse_list_options(char *str) {NULL,0,NULL} }; - /* this is wrong since the show-sig-subpackets could have been set - from a previous incarnation of list-options */ - if(parse_options(str,&opt.list_options,lopts,1)) { if(opt.list_options&LIST_SHOW_SIG_SUBPACKETS) @@ -1587,7 +1584,6 @@ main( int argc, char **argv ) opt.cert_digest_algo = 0; opt.compress_algo = -1; /* defaults to DEFAULT_COMPRESS_ALGO */ opt.s2k_mode = 3; /* iterated+salted */ - opt.s2k_digest_algo = DIGEST_ALGO_SHA1; #ifdef USE_CAST5 opt.s2k_cipher_algo = CIPHER_ALGO_CAST5; #else @@ -2613,6 +2609,8 @@ main( int argc, char **argv ) opt.ask_cert_expire = 0; m_free(def_digest_string); def_digest_string = m_strdup("md5"); + m_free(s2k_digest_string); + s2k_digest_string = m_strdup("md5"); opt.compress_algo = COMPRESS_ALGO_ZIP; } } @@ -3784,8 +3782,7 @@ add_notation_data( const char *string, int which ) if(!saw_at && !opt.expert) { - log_error( - _("a user notation name must contain the '@' character\n")); + log_error(_("a user notation name must contain the '@' character\n")); return; } diff --git a/g10/getkey.c b/g10/getkey.c index 8676758f5..a3a1be8c3 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -183,7 +183,7 @@ get_primary_uid ( KBNODE keyblock, size_t *uidlen ) } /* fixme: returning translatable constants instead of a user ID is * not good because they are probably not utf-8 encoded. */ - s = _("[User id not found]"); + s = _("[User ID not found]"); *uidlen = strlen (s); return s; } @@ -2688,7 +2688,7 @@ get_user_id( u32 *keyid, size_t *rn ) } } } while( ++pass < 2 && !get_pubkey( NULL, keyid ) ); - p = m_strdup( _("[User id not found]") ); + p = m_strdup( _("[User ID not found]") ); *rn = strlen(p); return p; } diff --git a/g10/import.c b/g10/import.c index 97be67877..28ecb819a 100644 --- a/g10/import.c +++ b/g10/import.c @@ -719,7 +719,7 @@ import_one( const char *fname, KBNODE keyblock, char *user=utf8_to_native(node->pkt->pkt.user_id->name, node->pkt->pkt.user_id->len,0); node->flag |= 1; - log_info( _("key %s: accepted non self-signed user ID '%s'\n"), + log_info( _("key %s: accepted non self-signed user ID \"%s\"\n"), keystr_from_pk(pk),user); m_free(user); } @@ -1297,9 +1297,9 @@ chk_self_sigs( const char *fname, KBNODE keyblock, strlen(unode->pkt->pkt.user_id->name),0); log_info( rc == G10ERR_PUBKEY_ALGO ? _("key %s: unsupported public key " - "algorithm on user id \"%s\"\n"): + "algorithm on user ID \"%s\"\n"): _("key %s: invalid self-signature " - "on user id \"%s\"\n"), + "on user ID \"%s\"\n"), keystr(keyid),p); m_free(p); } @@ -1436,7 +1436,7 @@ delete_inv_parts( const char *fname, KBNODE keyblock, { char *p=utf8_to_native(node->pkt->pkt.user_id->name, node->pkt->pkt.user_id->len,0); - log_info( _("key %s: skipped user ID '%s'\n"), + log_info( _("key %s: skipped user ID \"%s\"\n"), keystr(keyid),p); m_free(p); } @@ -1485,7 +1485,7 @@ delete_inv_parts( const char *fname, KBNODE keyblock, * seems that this makes sense */ if(opt.verbose) log_info( _("key %s: non exportable signature" - " (class %02x) - skipped\n"), + " (class 0x%02X) - skipped\n"), keystr(keyid), node->pkt->pkt.signature->sig_class ); delete_kbnode( node ); } diff --git a/g10/keyedit.c b/g10/keyedit.c index b3067bf51..5da2f822e 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -1106,7 +1106,7 @@ change_passphrase( KBNODE keyblock ) set_next_passphrase( NULL ); for(;;) { s2k->mode = opt.s2k_mode; - s2k->hash_algo = opt.s2k_digest_algo; + s2k->hash_algo = S2K_DIGEST_ALGO; dek = passphrase_to_dek( NULL, 0, opt.s2k_cipher_algo, s2k, 2, errtext, NULL); if( !dek ) { diff --git a/g10/keygen.c b/g10/keygen.c index d75f0b826..d1c6e609b 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -1506,8 +1506,8 @@ ask_user_id( int mode ) if( !mode ) tty_printf( _("\n" -"You need a User-ID to identify your key; the software constructs the user id\n" -"from Real Name, Comment and Email Address in this form:\n" +"You need a user ID to identify your key; the software constructs the user ID\n" +"from the Real Name, Comment and Email Address in this form:\n" " \"Heinrich Heine (Der Dichter) <[email protected]>\"\n\n") ); uid = aname = acomment = amail = NULL; for(;;) { @@ -1676,7 +1676,7 @@ do_ask_passphrase( STRING2KEY **ret_s2k ) s2k = m_alloc_secure( sizeof *s2k ); for(;;) { s2k->mode = opt.s2k_mode; - s2k->hash_algo = opt.s2k_digest_algo; + s2k->hash_algo = S2K_DIGEST_ALGO; dek = passphrase_to_dek( NULL, 0, opt.s2k_cipher_algo, s2k,2, errtext, NULL); if( !dek ) { @@ -2012,7 +2012,7 @@ proc_parameter_file( struct para_data_s *para, const char *fname, s2k = m_alloc_secure( sizeof *s2k ); s2k->mode = opt.s2k_mode; - s2k->hash_algo = opt.s2k_digest_algo; + s2k->hash_algo = S2K_DIGEST_ALGO; set_next_passphrase( r->u.value ); dek = passphrase_to_dek( NULL, 0, opt.s2k_cipher_algo, s2k, 2, NULL, NULL); @@ -2912,7 +2912,7 @@ generate_subkeypair( KBNODE pub_keyblock, KBNODE sec_keyblock ) if( passphrase ) { s2k = m_alloc_secure( sizeof *s2k ); s2k->mode = opt.s2k_mode; - s2k->hash_algo = opt.s2k_digest_algo; + s2k->hash_algo = S2K_DIGEST_ALGO; set_next_passphrase( passphrase ); dek = passphrase_to_dek( NULL, 0, opt.s2k_cipher_algo, s2k, 2, NULL, NULL ); diff --git a/g10/main.h b/g10/main.h index 1326bd442..71c1a2b3e 100644 --- a/g10/main.h +++ b/g10/main.h @@ -28,10 +28,15 @@ /* It could be argued that the default cipher should be 3DES rather than CAST5, and the default compression should be 0 - (i.e. uncompressed) rather than 1 (zip). */ -#define DEFAULT_CIPHER_ALGO CIPHER_ALGO_CAST5 -#define DEFAULT_DIGEST_ALGO DIGEST_ALGO_SHA1 -#define DEFAULT_COMPRESS_ALGO COMPRESS_ALGO_ZIP + (i.e. uncompressed) rather than 1 (zip). However, the real world + issues of speed and size come into play here. */ + +#define DEFAULT_CIPHER_ALGO CIPHER_ALGO_CAST5 +#define DEFAULT_DIGEST_ALGO DIGEST_ALGO_SHA1 +#define DEFAULT_COMPRESS_ALGO COMPRESS_ALGO_ZIP +#define DEFAULT_S2K_DIGEST_ALGO DIGEST_ALGO_SHA1 + +#define S2K_DIGEST_ALGO (opt.s2k_digest_algo?opt.s2k_digest_algo:DEFAULT_S2K_DIGEST_ALGO) typedef struct { diff --git a/g10/passphrase.c b/g10/passphrase.c index e4546ee5a..7a3a394b5 100644 --- a/g10/passphrase.c +++ b/g10/passphrase.c @@ -1083,7 +1083,7 @@ passphrase_to_dek( u32 *keyid, int pubkey_algo, * Note: This must match the code in encode.c with opt.rfc1991 set */ s2k = &help_s2k; s2k->mode = 0; - s2k->hash_algo = opt.s2k_digest_algo; + s2k->hash_algo = S2K_DIGEST_ALGO; } /* If we do not have a passphrase available in NEXT_PW and status diff --git a/g10/sign.c b/g10/sign.c index 0dbf5a7d9..5942fa59b 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -1133,7 +1133,7 @@ sign_symencrypt_file (const char *fname, STRLIST locusr) /* prepare key */ s2k = m_alloc_clear( sizeof *s2k ); s2k->mode = RFC1991? 0:opt.s2k_mode; - s2k->hash_algo = opt.s2k_digest_algo; + s2k->hash_algo = S2K_DIGEST_ALGO; algo = default_cipher_algo(); if (!opt.quiet || !opt.batch) |