mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Still making gpg2 work.
At least the keyids are now correctly computed again.
This commit is contained in:
parent
fbe4ac37f6
commit
b61df862a7
@ -1,3 +1,7 @@
|
||||
2006-05-24 Werner Koch <wk@g10code.com>
|
||||
|
||||
* configure.ac: New option --disable-optimization taked from 1.4.3.
|
||||
|
||||
2006-05-23 Werner Koch <wk@g10code.com>
|
||||
|
||||
* configure.ac (ZLIBS): New for zlib link commands. Add bzip2
|
||||
|
14
configure.ac
14
configure.ac
@ -1080,6 +1080,20 @@ if test "$GCC" = yes; then
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# This is handy for debugging so the compiler doesn't rearrange
|
||||
# things and eliminate variables.
|
||||
#
|
||||
AC_ARG_ENABLE(optimization,
|
||||
AC_HELP_STRING([--disable-optimization],
|
||||
[disable compiler optimization]),
|
||||
[if test $enableval = no ; then
|
||||
CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]]//'`
|
||||
fi])
|
||||
|
||||
|
||||
|
||||
|
||||
AC_SUBST(NETLIBS)
|
||||
AC_SUBST(W32LIBS)
|
||||
|
||||
|
@ -1,3 +1,14 @@
|
||||
2006-05-24 Werner Koch <wk@g10code.com>
|
||||
|
||||
* keyid.c (hash_public_key): Do not double hash the length bytes,
|
||||
they are already included by mpi_print.
|
||||
|
||||
* misc.c (openpgp_pk_test_algo2): Get test call right.
|
||||
|
||||
* misc.c (string_to_cipher_algo, string_to_digest_algo): New.
|
||||
* keygen.c (keygen_set_std_prefs): use them here.
|
||||
* gpg.c (main): and here.
|
||||
|
||||
2006-05-23 Werner Koch <wk@g10code.com>
|
||||
|
||||
* card-util.c (generate_card_keys): Removed temporary kludge for
|
||||
|
12
g10/gpg.c
12
g10/gpg.c
@ -2515,7 +2515,7 @@ main (int argc, char **argv )
|
||||
case oNoUtf8Strings: utf8_strings = 0; break;
|
||||
case oDisableCipherAlgo:
|
||||
{
|
||||
int algo = gcry_cipher_map_name (pargs.r.ret_str);
|
||||
int algo = string_to_cipher_algo (pargs.r.ret_str);
|
||||
gcry_cipher_ctl (NULL, GCRYCTL_DISABLE_ALGO, &algo, sizeof algo);
|
||||
}
|
||||
break;
|
||||
@ -2859,7 +2859,7 @@ main (int argc, char **argv )
|
||||
|
||||
|
||||
if( def_cipher_string ) {
|
||||
opt.def_cipher_algo = gcry_cipher_map_name (def_cipher_string);
|
||||
opt.def_cipher_algo = string_to_cipher_algo (def_cipher_string);
|
||||
if(opt.def_cipher_algo==0 &&
|
||||
(ascii_strcasecmp(def_cipher_string,"idea")==0
|
||||
|| ascii_strcasecmp(def_cipher_string,"s1")==0))
|
||||
@ -2869,7 +2869,7 @@ main (int argc, char **argv )
|
||||
log_error(_("selected cipher algorithm is invalid\n"));
|
||||
}
|
||||
if( def_digest_string ) {
|
||||
opt.def_digest_algo = gcry_md_map_name (def_digest_string);
|
||||
opt.def_digest_algo = string_to_digest_algo (def_digest_string);
|
||||
xfree(def_digest_string); def_digest_string = NULL;
|
||||
if ( openpgp_md_test_algo (opt.def_digest_algo) )
|
||||
log_error(_("selected digest algorithm is invalid\n"));
|
||||
@ -2881,19 +2881,19 @@ main (int argc, char **argv )
|
||||
log_error(_("selected compression algorithm is invalid\n"));
|
||||
}
|
||||
if( cert_digest_string ) {
|
||||
opt.cert_digest_algo = gcry_md_map_name (cert_digest_string);
|
||||
opt.cert_digest_algo = string_to_digest_algo (cert_digest_string);
|
||||
xfree(cert_digest_string); cert_digest_string = NULL;
|
||||
if (openpgp_md_test_algo(opt.cert_digest_algo))
|
||||
log_error(_("selected certification digest algorithm is invalid\n"));
|
||||
}
|
||||
if( s2k_cipher_string ) {
|
||||
opt.s2k_cipher_algo = gcry_cipher_map_name (s2k_cipher_string);
|
||||
opt.s2k_cipher_algo = string_to_cipher_algo (s2k_cipher_string);
|
||||
xfree(s2k_cipher_string); s2k_cipher_string = NULL;
|
||||
if (openpgp_cipher_test_algo (opt.s2k_cipher_algo))
|
||||
log_error(_("selected cipher algorithm is invalid\n"));
|
||||
}
|
||||
if( s2k_digest_string ) {
|
||||
opt.s2k_digest_algo = gcry_md_map_name (s2k_digest_string);
|
||||
opt.s2k_digest_algo = string_to_digest_algo (s2k_digest_string);
|
||||
xfree(s2k_digest_string); s2k_digest_string = NULL;
|
||||
if (openpgp_md_test_algo(opt.s2k_digest_algo))
|
||||
log_error(_("selected digest algorithm is invalid\n"));
|
||||
|
@ -371,7 +371,6 @@ int agent_scd_getattr (const char *name, struct agent_card_info_s *info) {return
|
||||
#endif /* ENABLE_CARD_SUPPORT */
|
||||
|
||||
/* Stubs to void linking to ../cipher/cipher.c */
|
||||
int string_to_cipher_algo( const char *string ) { return 0; }
|
||||
const char *cipher_algo_to_string( int algo ) { return "?";}
|
||||
void disable_cipher_algo( int algo ) {}
|
||||
int check_cipher_algo( int algo ) { return -1;}
|
||||
|
@ -370,12 +370,12 @@ keygen_set_std_prefs (const char *string,int personal)
|
||||
|
||||
while((tok=strsep(&prefstring," ,")))
|
||||
{
|
||||
if((val=gcry_cipher_map_name (tok)))
|
||||
if((val=string_to_cipher_algo (tok)))
|
||||
{
|
||||
if(set_one_pref(val,1,tok,sym,&nsym))
|
||||
rc=-1;
|
||||
}
|
||||
else if((val=gcry_md_map_name (tok)))
|
||||
else if((val=string_to_digest_algo (tok)))
|
||||
{
|
||||
if(set_one_pref(val,2,tok,hash,&nhash))
|
||||
rc=-1;
|
||||
|
@ -56,7 +56,6 @@ void
|
||||
hash_public_key( gcry_md_hd_t md, PKT_public_key *pk )
|
||||
{
|
||||
unsigned int n = 6;
|
||||
unsigned int nb[PUBKEY_MAX_NPKEY];
|
||||
unsigned int nn[PUBKEY_MAX_NPKEY];
|
||||
byte *pp[PUBKEY_MAX_NPKEY];
|
||||
int i;
|
||||
@ -77,7 +76,6 @@ hash_public_key( gcry_md_hd_t md, PKT_public_key *pk )
|
||||
else
|
||||
for(i=0; i < npkey; i++ )
|
||||
{
|
||||
nb[i] = gcry_mpi_get_nbits (pk->pkey[i]);
|
||||
if (gcry_mpi_print (GCRYMPI_FMT_PGP, NULL, 0, &nbytes, pk->pkey[i]))
|
||||
BUG ();
|
||||
pp[i] = xmalloc (nbytes);
|
||||
@ -85,7 +83,7 @@ hash_public_key( gcry_md_hd_t md, PKT_public_key *pk )
|
||||
&nbytes, pk->pkey[i]))
|
||||
BUG ();
|
||||
nn[i] = nbytes;
|
||||
n += 2 + nn[i];
|
||||
n += nn[i];
|
||||
}
|
||||
|
||||
gcry_md_putc ( md, 0x99 ); /* ctb */
|
||||
@ -119,8 +117,6 @@ hash_public_key( gcry_md_hd_t md, PKT_public_key *pk )
|
||||
else
|
||||
for(i=0; i < npkey; i++ )
|
||||
{
|
||||
gcry_md_putc ( md, nb[i]>>8);
|
||||
gcry_md_putc ( md, nb[i] );
|
||||
gcry_md_write ( md, pp[i], nn[i] );
|
||||
xfree(pp[i]);
|
||||
}
|
||||
|
@ -106,6 +106,9 @@ void deprecated_warning(const char *configname,unsigned int configlineno,
|
||||
const char *option,const char *repl1,const char *repl2);
|
||||
void deprecated_command (const char *name);
|
||||
|
||||
int string_to_cipher_algo (const char *string);
|
||||
int string_to_digest_algo (const char *string);
|
||||
|
||||
const char *compress_algo_to_string(int algo);
|
||||
int string_to_compress_algo(const char *string);
|
||||
int check_compress_algo(int algo);
|
||||
|
54
g10/misc.c
54
g10/misc.c
@ -429,7 +429,6 @@ int
|
||||
openpgp_pk_test_algo2( int algo, unsigned int use )
|
||||
{
|
||||
int use_buf = use;
|
||||
size_t sizeof_use_buf = sizeof (use_buf);
|
||||
|
||||
if (algo == GCRY_PK_ELG_E)
|
||||
algo = GCRY_PK_ELG;
|
||||
@ -437,8 +436,7 @@ openpgp_pk_test_algo2( int algo, unsigned int use )
|
||||
if (algo < 0 || algo > 110)
|
||||
return gpg_error (GPG_ERR_PUBKEY_ALGO);
|
||||
|
||||
return gcry_pk_algo_info (algo, GCRYCTL_TEST_ALGO,
|
||||
&use_buf, &sizeof_use_buf);
|
||||
return gcry_pk_algo_info (algo, GCRYCTL_TEST_ALGO, NULL, &use_buf);
|
||||
}
|
||||
|
||||
int
|
||||
@ -739,6 +737,54 @@ deprecated_command (const char *name)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Wrapper around gcry_cipher_map_name to provide a fallback using the
|
||||
* "Sn" syntax as used by the preference strings.
|
||||
*/
|
||||
int
|
||||
string_to_cipher_algo (const char *string)
|
||||
{
|
||||
int val;
|
||||
|
||||
val = gcry_cipher_map_name (string);
|
||||
if (!val && string && (string[0]=='S' || string[0]=='s'))
|
||||
{
|
||||
char *endptr;
|
||||
|
||||
string++;
|
||||
val = strtol (string, &endptr, 10);
|
||||
if (!*string || *endptr || openpgp_cipher_test_algo (val))
|
||||
val = 0;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wrapper around gcry_md_map_name to provide a fallback using the
|
||||
* "Hn" syntax as used by the preference strings.
|
||||
*/
|
||||
int
|
||||
string_to_digest_algo (const char *string)
|
||||
{
|
||||
int val;
|
||||
|
||||
val = gcry_md_map_name (string);
|
||||
if (!val && string && (string[0]=='H' || string[0]=='h'))
|
||||
{
|
||||
char *endptr;
|
||||
|
||||
string++;
|
||||
val = strtol (string, &endptr, 10);
|
||||
if (!*string || *endptr || openpgp_md_test_algo (val))
|
||||
val = 0;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char *
|
||||
compress_algo_to_string(int algo)
|
||||
{
|
||||
@ -771,7 +817,7 @@ compress_algo_to_string(int algo)
|
||||
int
|
||||
string_to_compress_algo(const char *string)
|
||||
{
|
||||
/* NOTE TO TRANSLATOR: See doc/TRANSLATE about this string. */
|
||||
/* TRANSLATORS: See doc/TRANSLATE about this string. */
|
||||
if(match_multistr(_("uncompressed|none"),string))
|
||||
return 0;
|
||||
else if(ascii_strcasecmp(string,"uncompressed")==0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user