mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-11 21:48:50 +01:00
* 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.
This commit is contained in:
parent
680be9be10
commit
4d26ab92cc
@ -1,5 +1,14 @@
|
|||||||
2004-09-24 David Shaw <dshaw@jabberwocky.com>
|
2004-09-24 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* 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)),
|
* keyedit.c (keyedit_menu), gpgv.c (agent_scd_getattr (stub)),
|
||||||
keygen.c (copy_mpi, generate_raw_key): Fix a compile problem and a
|
keygen.c (copy_mpi, generate_raw_key): Fix a compile problem and a
|
||||||
few warnings when building without card support.
|
few warnings when building without card support.
|
||||||
|
12
g10/armor.c
12
g10/armor.c
@ -562,7 +562,7 @@ fake_packet( armor_filter_context_t *afx, IOBUF a,
|
|||||||
; /* this is okay */
|
; /* this is okay */
|
||||||
else {
|
else {
|
||||||
if( type != BEGIN_SIGNATURE ) {
|
if( type != BEGIN_SIGNATURE ) {
|
||||||
log_info(_("unexpected armor:"));
|
log_info(_("unexpected armor: "));
|
||||||
print_string( stderr, p, n, 0 );
|
print_string( stderr, p, n, 0 );
|
||||||
putc('\n', stderr);
|
putc('\n', stderr);
|
||||||
}
|
}
|
||||||
@ -692,7 +692,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if( (c = asctobin[(c2=c)]) == 255 ) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
switch(idx) {
|
switch(idx) {
|
||||||
@ -781,7 +781,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
|
|||||||
rc = invalid_crc();
|
rc = invalid_crc();
|
||||||
}
|
}
|
||||||
else if( mycrc != afx->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);
|
(ulong)afx->crc, (ulong)mycrc);
|
||||||
rc = invalid_crc();
|
rc = invalid_crc();
|
||||||
}
|
}
|
||||||
@ -801,7 +801,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
|
|||||||
if( rc == -1 )
|
if( rc == -1 )
|
||||||
rc = 0;
|
rc = 0;
|
||||||
else if( rc == 2 ) {
|
else if( rc == 2 ) {
|
||||||
log_error(_("premature eof (in Trailer)\n"));
|
log_error(_("premature eof (in trailer)\n"));
|
||||||
rc = G10ERR_INVALID_ARMOR;
|
rc = G10ERR_INVALID_ARMOR;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1277,7 +1277,7 @@ unarmor_pump (UnarmorPump x, int c)
|
|||||||
{
|
{
|
||||||
int c2;
|
int c2;
|
||||||
if( (c = asctobin[(c2=c)]) == 255 ) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1314,7 +1314,7 @@ unarmor_pump (UnarmorPump x, int c)
|
|||||||
if( (c = asctobin[c]) == 255 ) {
|
if( (c = asctobin[c]) == 255 ) {
|
||||||
rval = -1; /* ready */
|
rval = -1; /* ready */
|
||||||
if( x->crc != x->mycrc ) {
|
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);
|
(ulong)x->crc, (ulong)x->mycrc);
|
||||||
if ( invalid_crc() )
|
if ( invalid_crc() )
|
||||||
rval = -3;
|
rval = -3;
|
||||||
|
@ -362,7 +362,7 @@ check_card_serialno (APP app, const char *serialno)
|
|||||||
else
|
else
|
||||||
card_close ();
|
card_close ();
|
||||||
tty_printf (_("Please remove the current card and "
|
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);
|
" %.*s\n"), 32, serialno);
|
||||||
|
|
||||||
sprintf (buf, "1 %.32s", serialno);
|
sprintf (buf, "1 %.32s", serialno);
|
||||||
|
@ -191,7 +191,7 @@ encode_simple( const char *filename, int mode, int use_seskey )
|
|||||||
if( mode ) {
|
if( mode ) {
|
||||||
s2k = m_alloc_clear( sizeof *s2k );
|
s2k = m_alloc_clear( sizeof *s2k );
|
||||||
s2k->mode = RFC1991? 0:opt.s2k_mode;
|
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,
|
cfx.dek = passphrase_to_dek( NULL, 0,
|
||||||
default_cipher_algo(), s2k, 2,
|
default_cipher_algo(), s2k, 2,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
@ -380,7 +380,7 @@ setup_symkey(STRING2KEY **symkey_s2k,DEK **symkey_dek)
|
|||||||
{
|
{
|
||||||
*symkey_s2k=m_alloc_clear(sizeof(STRING2KEY));
|
*symkey_s2k=m_alloc_clear(sizeof(STRING2KEY));
|
||||||
(*symkey_s2k)->mode = opt.s2k_mode;
|
(*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_dek=passphrase_to_dek(NULL,0,opt.s2k_cipher_algo,
|
||||||
*symkey_s2k,2,NULL,NULL);
|
*symkey_s2k,2,NULL,NULL);
|
||||||
|
@ -1465,9 +1465,6 @@ parse_list_options(char *str)
|
|||||||
{NULL,0,NULL}
|
{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(parse_options(str,&opt.list_options,lopts,1))
|
||||||
{
|
{
|
||||||
if(opt.list_options&LIST_SHOW_SIG_SUBPACKETS)
|
if(opt.list_options&LIST_SHOW_SIG_SUBPACKETS)
|
||||||
@ -1587,7 +1584,6 @@ main( int argc, char **argv )
|
|||||||
opt.cert_digest_algo = 0;
|
opt.cert_digest_algo = 0;
|
||||||
opt.compress_algo = -1; /* defaults to DEFAULT_COMPRESS_ALGO */
|
opt.compress_algo = -1; /* defaults to DEFAULT_COMPRESS_ALGO */
|
||||||
opt.s2k_mode = 3; /* iterated+salted */
|
opt.s2k_mode = 3; /* iterated+salted */
|
||||||
opt.s2k_digest_algo = DIGEST_ALGO_SHA1;
|
|
||||||
#ifdef USE_CAST5
|
#ifdef USE_CAST5
|
||||||
opt.s2k_cipher_algo = CIPHER_ALGO_CAST5;
|
opt.s2k_cipher_algo = CIPHER_ALGO_CAST5;
|
||||||
#else
|
#else
|
||||||
@ -2613,6 +2609,8 @@ main( int argc, char **argv )
|
|||||||
opt.ask_cert_expire = 0;
|
opt.ask_cert_expire = 0;
|
||||||
m_free(def_digest_string);
|
m_free(def_digest_string);
|
||||||
def_digest_string = m_strdup("md5");
|
def_digest_string = m_strdup("md5");
|
||||||
|
m_free(s2k_digest_string);
|
||||||
|
s2k_digest_string = m_strdup("md5");
|
||||||
opt.compress_algo = COMPRESS_ALGO_ZIP;
|
opt.compress_algo = COMPRESS_ALGO_ZIP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3784,8 +3782,7 @@ add_notation_data( const char *string, int which )
|
|||||||
|
|
||||||
if(!saw_at && !opt.expert)
|
if(!saw_at && !opt.expert)
|
||||||
{
|
{
|
||||||
log_error(
|
log_error(_("a user notation name must contain the '@' character\n"));
|
||||||
_("a user notation name must contain the '@' character\n"));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ get_primary_uid ( KBNODE keyblock, size_t *uidlen )
|
|||||||
}
|
}
|
||||||
/* fixme: returning translatable constants instead of a user ID is
|
/* fixme: returning translatable constants instead of a user ID is
|
||||||
* not good because they are probably not utf-8 encoded. */
|
* not good because they are probably not utf-8 encoded. */
|
||||||
s = _("[User id not found]");
|
s = _("[User ID not found]");
|
||||||
*uidlen = strlen (s);
|
*uidlen = strlen (s);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -2688,7 +2688,7 @@ get_user_id( u32 *keyid, size_t *rn )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while( ++pass < 2 && !get_pubkey( NULL, keyid ) );
|
} while( ++pass < 2 && !get_pubkey( NULL, keyid ) );
|
||||||
p = m_strdup( _("[User id not found]") );
|
p = m_strdup( _("[User ID not found]") );
|
||||||
*rn = strlen(p);
|
*rn = strlen(p);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
10
g10/import.c
10
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,
|
char *user=utf8_to_native(node->pkt->pkt.user_id->name,
|
||||||
node->pkt->pkt.user_id->len,0);
|
node->pkt->pkt.user_id->len,0);
|
||||||
node->flag |= 1;
|
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);
|
keystr_from_pk(pk),user);
|
||||||
m_free(user);
|
m_free(user);
|
||||||
}
|
}
|
||||||
@ -1297,9 +1297,9 @@ chk_self_sigs( const char *fname, KBNODE keyblock,
|
|||||||
strlen(unode->pkt->pkt.user_id->name),0);
|
strlen(unode->pkt->pkt.user_id->name),0);
|
||||||
log_info( rc == G10ERR_PUBKEY_ALGO ?
|
log_info( rc == G10ERR_PUBKEY_ALGO ?
|
||||||
_("key %s: unsupported public key "
|
_("key %s: unsupported public key "
|
||||||
"algorithm on user id \"%s\"\n"):
|
"algorithm on user ID \"%s\"\n"):
|
||||||
_("key %s: invalid self-signature "
|
_("key %s: invalid self-signature "
|
||||||
"on user id \"%s\"\n"),
|
"on user ID \"%s\"\n"),
|
||||||
keystr(keyid),p);
|
keystr(keyid),p);
|
||||||
m_free(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,
|
char *p=utf8_to_native(node->pkt->pkt.user_id->name,
|
||||||
node->pkt->pkt.user_id->len,0);
|
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);
|
keystr(keyid),p);
|
||||||
m_free(p);
|
m_free(p);
|
||||||
}
|
}
|
||||||
@ -1485,7 +1485,7 @@ delete_inv_parts( const char *fname, KBNODE keyblock,
|
|||||||
* seems that this makes sense */
|
* seems that this makes sense */
|
||||||
if(opt.verbose)
|
if(opt.verbose)
|
||||||
log_info( _("key %s: non exportable signature"
|
log_info( _("key %s: non exportable signature"
|
||||||
" (class %02x) - skipped\n"),
|
" (class 0x%02X) - skipped\n"),
|
||||||
keystr(keyid), node->pkt->pkt.signature->sig_class );
|
keystr(keyid), node->pkt->pkt.signature->sig_class );
|
||||||
delete_kbnode( node );
|
delete_kbnode( node );
|
||||||
}
|
}
|
||||||
|
@ -1106,7 +1106,7 @@ change_passphrase( KBNODE keyblock )
|
|||||||
set_next_passphrase( NULL );
|
set_next_passphrase( NULL );
|
||||||
for(;;) {
|
for(;;) {
|
||||||
s2k->mode = opt.s2k_mode;
|
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,
|
dek = passphrase_to_dek( NULL, 0, opt.s2k_cipher_algo,
|
||||||
s2k, 2, errtext, NULL);
|
s2k, 2, errtext, NULL);
|
||||||
if( !dek ) {
|
if( !dek ) {
|
||||||
|
10
g10/keygen.c
10
g10/keygen.c
@ -1506,8 +1506,8 @@ ask_user_id( int mode )
|
|||||||
|
|
||||||
if( !mode )
|
if( !mode )
|
||||||
tty_printf( _("\n"
|
tty_printf( _("\n"
|
||||||
"You need a User-ID to identify your key; the software constructs the user id\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"
|
"from the Real Name, Comment and Email Address in this form:\n"
|
||||||
" \"Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>\"\n\n") );
|
" \"Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>\"\n\n") );
|
||||||
uid = aname = acomment = amail = NULL;
|
uid = aname = acomment = amail = NULL;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
@ -1676,7 +1676,7 @@ do_ask_passphrase( STRING2KEY **ret_s2k )
|
|||||||
s2k = m_alloc_secure( sizeof *s2k );
|
s2k = m_alloc_secure( sizeof *s2k );
|
||||||
for(;;) {
|
for(;;) {
|
||||||
s2k->mode = opt.s2k_mode;
|
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,
|
dek = passphrase_to_dek( NULL, 0, opt.s2k_cipher_algo, s2k,2,
|
||||||
errtext, NULL);
|
errtext, NULL);
|
||||||
if( !dek ) {
|
if( !dek ) {
|
||||||
@ -2012,7 +2012,7 @@ proc_parameter_file( struct para_data_s *para, const char *fname,
|
|||||||
|
|
||||||
s2k = m_alloc_secure( sizeof *s2k );
|
s2k = m_alloc_secure( sizeof *s2k );
|
||||||
s2k->mode = opt.s2k_mode;
|
s2k->mode = opt.s2k_mode;
|
||||||
s2k->hash_algo = opt.s2k_digest_algo;
|
s2k->hash_algo = S2K_DIGEST_ALGO;
|
||||||
set_next_passphrase( r->u.value );
|
set_next_passphrase( r->u.value );
|
||||||
dek = passphrase_to_dek( NULL, 0, opt.s2k_cipher_algo, s2k, 2,
|
dek = passphrase_to_dek( NULL, 0, opt.s2k_cipher_algo, s2k, 2,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
@ -2912,7 +2912,7 @@ generate_subkeypair( KBNODE pub_keyblock, KBNODE sec_keyblock )
|
|||||||
if( passphrase ) {
|
if( passphrase ) {
|
||||||
s2k = m_alloc_secure( sizeof *s2k );
|
s2k = m_alloc_secure( sizeof *s2k );
|
||||||
s2k->mode = opt.s2k_mode;
|
s2k->mode = opt.s2k_mode;
|
||||||
s2k->hash_algo = opt.s2k_digest_algo;
|
s2k->hash_algo = S2K_DIGEST_ALGO;
|
||||||
set_next_passphrase( passphrase );
|
set_next_passphrase( passphrase );
|
||||||
dek = passphrase_to_dek( NULL, 0, opt.s2k_cipher_algo, s2k, 2,
|
dek = passphrase_to_dek( NULL, 0, opt.s2k_cipher_algo, s2k, 2,
|
||||||
NULL, NULL );
|
NULL, NULL );
|
||||||
|
13
g10/main.h
13
g10/main.h
@ -28,10 +28,15 @@
|
|||||||
|
|
||||||
/* It could be argued that the default cipher should be 3DES rather
|
/* It could be argued that the default cipher should be 3DES rather
|
||||||
than CAST5, and the default compression should be 0
|
than CAST5, and the default compression should be 0
|
||||||
(i.e. uncompressed) rather than 1 (zip). */
|
(i.e. uncompressed) rather than 1 (zip). However, the real world
|
||||||
#define DEFAULT_CIPHER_ALGO CIPHER_ALGO_CAST5
|
issues of speed and size come into play here. */
|
||||||
#define DEFAULT_DIGEST_ALGO DIGEST_ALGO_SHA1
|
|
||||||
#define DEFAULT_COMPRESS_ALGO COMPRESS_ALGO_ZIP
|
#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
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -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 */
|
* Note: This must match the code in encode.c with opt.rfc1991 set */
|
||||||
s2k = &help_s2k;
|
s2k = &help_s2k;
|
||||||
s2k->mode = 0;
|
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
|
/* If we do not have a passphrase available in NEXT_PW and status
|
||||||
|
@ -1133,7 +1133,7 @@ sign_symencrypt_file (const char *fname, STRLIST locusr)
|
|||||||
/* prepare key */
|
/* prepare key */
|
||||||
s2k = m_alloc_clear( sizeof *s2k );
|
s2k = m_alloc_clear( sizeof *s2k );
|
||||||
s2k->mode = RFC1991? 0:opt.s2k_mode;
|
s2k->mode = RFC1991? 0:opt.s2k_mode;
|
||||||
s2k->hash_algo = opt.s2k_digest_algo;
|
s2k->hash_algo = S2K_DIGEST_ALGO;
|
||||||
|
|
||||||
algo = default_cipher_algo();
|
algo = default_cipher_algo();
|
||||||
if (!opt.quiet || !opt.batch)
|
if (!opt.quiet || !opt.batch)
|
||||||
|
Loading…
Reference in New Issue
Block a user