*** empty log message ***

This commit is contained in:
Werner Koch 2004-03-29 13:56:57 +00:00
parent fcbd25c5ad
commit 42ac422ba0
9 changed files with 99 additions and 34 deletions

View File

@ -1,3 +1,9 @@
2004-03-29 Werner Koch <wk@gnupg.org>
* elgamal.c (verify): s/exp/exponent/ to shutup a compiler
warning.
* dsa.c (verify): Ditto.
2003-11-29 David Shaw <dshaw@jabberwocky.com> 2003-11-29 David Shaw <dshaw@jabberwocky.com>
* elgamal.c (gen_k): New arg SMALL_K. * elgamal.c (gen_k): New arg SMALL_K.

View File

@ -320,7 +320,7 @@ verify(MPI r, MPI s, MPI hash, DSA_public_key *pkey )
int rc; int rc;
MPI w, u1, u2, v; MPI w, u1, u2, v;
MPI base[3]; MPI base[3];
MPI exp[3]; MPI exponent[3];
if( !(mpi_cmp_ui( r, 0 ) > 0 && mpi_cmp( r, pkey->q ) < 0) ) if( !(mpi_cmp_ui( r, 0 ) > 0 && mpi_cmp( r, pkey->q ) < 0) )
@ -343,10 +343,10 @@ verify(MPI r, MPI s, MPI hash, DSA_public_key *pkey )
mpi_mulm( u2, r, w, pkey->q ); mpi_mulm( u2, r, w, pkey->q );
/* v = g^u1 * y^u2 mod p mod q */ /* v = g^u1 * y^u2 mod p mod q */
base[0] = pkey->g; exp[0] = u1; base[0] = pkey->g; exponent[0] = u1;
base[1] = pkey->y; exp[1] = u2; base[1] = pkey->y; exponent[1] = u2;
base[2] = NULL; exp[2] = NULL; base[2] = NULL; exponent[2] = NULL;
mpi_mulpowm( v, base, exp, pkey->p ); mpi_mulpowm( v, base, exponent, pkey->p );
mpi_fdiv_r( v, v, pkey->q ); mpi_fdiv_r( v, v, pkey->q );
rc = !mpi_cmp( v, r ); rc = !mpi_cmp( v, r );

View File

@ -458,7 +458,7 @@ verify(MPI a, MPI b, MPI input, ELG_public_key *pkey )
MPI t1; MPI t1;
MPI t2; MPI t2;
MPI base[4]; MPI base[4];
MPI exp[4]; MPI exponent[4];
if( !(mpi_cmp_ui( a, 0 ) > 0 && mpi_cmp( a, pkey->p ) < 0) ) if( !(mpi_cmp_ui( a, 0 ) > 0 && mpi_cmp( a, pkey->p ) < 0) )
return 0; /* assertion 0 < a < p failed */ return 0; /* assertion 0 < a < p failed */
@ -478,10 +478,10 @@ verify(MPI a, MPI b, MPI input, ELG_public_key *pkey )
rc = !mpi_cmp( t1, t2 ); rc = !mpi_cmp( t1, t2 );
#elif 0 #elif 0
/* t1 = (y^a mod p) * (a^b mod p) mod p */ /* t1 = (y^a mod p) * (a^b mod p) mod p */
base[0] = pkey->y; exp[0] = a; base[0] = pkey->y; exponent[0] = a;
base[1] = a; exp[1] = b; base[1] = a; exponent[1] = b;
base[2] = NULL; exp[2] = NULL; base[2] = NULL; exponent[2] = NULL;
mpi_mulpowm( t1, base, exp, pkey->p ); mpi_mulpowm( t1, base, exponent, pkey->p );
/* t2 = g ^ input mod p */ /* t2 = g ^ input mod p */
mpi_powm( t2, pkey->g, input, pkey->p ); mpi_powm( t2, pkey->g, input, pkey->p );
@ -490,11 +490,11 @@ verify(MPI a, MPI b, MPI input, ELG_public_key *pkey )
#else #else
/* t1 = g ^ - input * y ^ a * a ^ b mod p */ /* t1 = g ^ - input * y ^ a * a ^ b mod p */
mpi_invm(t2, pkey->g, pkey->p ); mpi_invm(t2, pkey->g, pkey->p );
base[0] = t2 ; exp[0] = input; base[0] = t2 ; exponent[0] = input;
base[1] = pkey->y; exp[1] = a; base[1] = pkey->y; exponent[1] = a;
base[2] = a; exp[2] = b; base[2] = a; exponent[2] = b;
base[3] = NULL; exp[3] = NULL; base[3] = NULL; exponent[3] = NULL;
mpi_mulpowm( t1, base, exp, pkey->p ); mpi_mulpowm( t1, base, exponent, pkey->p );
rc = !mpi_cmp_ui( t1, 1 ); rc = !mpi_cmp_ui( t1, 1 );
#endif #endif

View File

@ -1,3 +1,8 @@
2004-03-29 Werner Koch <wk@gnupg.org>
* g10.c: New command --gpgconf-list.
(gpgconf_list): New.
2004-03-27 David Shaw <dshaw@jabberwocky.com> 2004-03-27 David Shaw <dshaw@jabberwocky.com>
* keyedit.c (keyedit_menu): Request a trustdb update when adding a * keyedit.c (keyedit_menu): Request a trustdb update when adding a

View File

@ -91,6 +91,7 @@ enum cmd_and_opt_values
aNRSignKey, aNRSignKey,
aNRLSignKey, aNRLSignKey,
aListConfig, aListConfig,
aGPGConfList,
aListPackets, aListPackets,
aEditKey, aEditKey,
aDeleteKeys, aDeleteKeys,
@ -361,6 +362,7 @@ static ARGPARSE_OPTS opts[] = {
{ aImport, "import", 256, N_("import/merge keys")}, { aImport, "import", 256, N_("import/merge keys")},
{ aFastImport, "fast-import", 256, "@"}, { aFastImport, "fast-import", 256, "@"},
{ aListConfig, "list-config", 256, "@"}, { aListConfig, "list-config", 256, "@"},
{ aGPGConfList, "gpgconf-list", 256, "@" },
{ aListPackets,"list-packets",256,N_("list only the sequence of packets")}, { aListPackets,"list-packets",256,N_("list only the sequence of packets")},
{ aExportOwnerTrust, { aExportOwnerTrust,
"export-ownertrust", 256, N_("export the ownertrust values")}, "export-ownertrust", 256, N_("export the ownertrust values")},
@ -1220,6 +1222,27 @@ list_config(char *items)
} }
/* List options and default values in the GPG Conf format. This is a
new tool distributed with gnupg 1.9.x but we also want some limited
support in older gpg versions. The output is the name of the
configuration file and a list of options available for editing by
gpgconf. */
static void
gpgconf_list (const char *configfile)
{
/* The following definitions are taken from gnupg/tools/gpgconf-comp.c. */
#define GC_OPT_FLAG_NONE 0UL
#define GC_OPT_FLAG_DEFAULT (1UL << 4)
printf ("gpgconf-gpg.conf:%lu:\"%s\n",
GC_OPT_FLAG_DEFAULT,configfile?configfile:"/dev/null");
printf ("verbose:%lu:\n", GC_OPT_FLAG_NONE);
printf ("quiet:%lu:\n", GC_OPT_FLAG_NONE);
printf ("keyserver:%lu:\n", GC_OPT_FLAG_NONE);
}
/* Collapses argc/argv into a single string that must be freed */ /* Collapses argc/argv into a single string that must be freed */
static char * static char *
collapse_args(int argc,char *argv[]) collapse_args(int argc,char *argv[])
@ -1263,6 +1286,7 @@ main( int argc, char **argv )
int detached_sig = 0; int detached_sig = 0;
FILE *configfp = NULL; FILE *configfp = NULL;
char *configname = NULL; char *configname = NULL;
char *save_configname = NULL;
unsigned configlineno; unsigned configlineno;
int parse_debug = 0; int parse_debug = 0;
int default_config = 1; int default_config = 1;
@ -1463,16 +1487,20 @@ main( int argc, char **argv )
{ {
switch( pargs.r_opt ) switch( pargs.r_opt )
{ {
case aCheckKeys: set_cmd( &cmd, aCheckKeys); break; case aCheckKeys:
case aListConfig: set_cmd( &cmd, aListConfig); break; case aListConfig:
case aListPackets: set_cmd( &cmd, aListPackets); break; case aGPGConfList:
case aImport: set_cmd( &cmd, aImport); break; case aListPackets:
case aFastImport: set_cmd( &cmd, aFastImport); break; case aImport:
case aSendKeys: set_cmd( &cmd, aSendKeys); break; case aFastImport:
case aRecvKeys: set_cmd( &cmd, aRecvKeys); break; case aSendKeys:
case aSearchKeys: set_cmd( &cmd, aSearchKeys); break; case aRecvKeys:
case aRefreshKeys: set_cmd( &cmd, aRefreshKeys); break; case aSearchKeys:
case aExport: set_cmd( &cmd, aExport); break; case aRefreshKeys:
case aExport:
set_cmd (&cmd, pargs.r_opt);
break;
case aExportAll: case aExportAll:
opt.export_options|=EXPORT_INCLUDE_NON_RFC; opt.export_options|=EXPORT_INCLUDE_NON_RFC;
set_cmd(&cmd,aExport); set_cmd(&cmd,aExport);
@ -1946,15 +1974,31 @@ main( int argc, char **argv )
} }
} }
if( configfp ) { if( configfp ) {
fclose( configfp ); fclose( configfp );
configfp = NULL; configfp = NULL;
m_free(configname); configname = NULL; /* Remember the first config file name. */
if (!save_configname)
save_configname = configname;
else
m_free(configname);
configname = NULL;
goto next_pass; goto next_pass;
} }
m_free( configname ); configname = NULL; m_free( configname ); configname = NULL;
if( log_get_errorcount(0) ) if( log_get_errorcount(0) )
g10_exit(2); g10_exit(2);
/* The command --gpgconf-list is pretty simple and may be called
directly after the option parsing. */
if (cmd == aGPGConfList)
{
gpgconf_list (save_configname);
g10_exit (0);
}
m_free (save_configname);
if( nogreeting ) if( nogreeting )
greeting = 0; greeting = 0;

View File

@ -1,3 +1,7 @@
2004-03-29 Werner Koch <wk@gnupg.org>
* mpi.h: s/exp/exponent/ to shutup a compiler warning.
2004-01-13 David Shaw <dshaw@jabberwocky.com> 2004-01-13 David Shaw <dshaw@jabberwocky.com>
* util.h: Add prototype for print_string2(). * util.h: Add prototype for print_string2().

View File

@ -166,7 +166,7 @@ int mpi_gcd( MPI g, MPI a, MPI b );
/*-- mpi-pow.c --*/ /*-- mpi-pow.c --*/
void mpi_pow( MPI w, MPI u, MPI v); void mpi_pow( MPI w, MPI u, MPI v);
void mpi_powm( MPI res, MPI base, MPI exp, MPI mod); void mpi_powm( MPI res, MPI base, MPI exponent, MPI mod);
/*-- mpi-mpow.c --*/ /*-- mpi-mpow.c --*/
void mpi_mulpowm( MPI res, MPI *basearray, MPI *exparray, MPI mod); void mpi_mulpowm( MPI res, MPI *basearray, MPI *exparray, MPI mod);

View File

@ -1,3 +1,8 @@
2004-03-29 Werner Koch <wk@gnupg.org>
* mpi-pow.c (mpi_powm): s/exp/exponent/ to shutup a compiler
warning.
2004-01-20 David Shaw <dshaw@jabberwocky.com> 2004-01-20 David Shaw <dshaw@jabberwocky.com>
* hppa1.1/udiv-qrnnd.S: Alignment fix from Lamont Jones for * hppa1.1/udiv-qrnnd.S: Alignment fix from Lamont Jones for

View File

@ -39,7 +39,7 @@
* RES = BASE ^ EXP mod MOD * RES = BASE ^ EXP mod MOD
*/ */
void void
mpi_powm( MPI res, MPI base, MPI exp, MPI mod) mpi_powm( MPI res, MPI base, MPI exponent, MPI mod)
{ {
mpi_ptr_t rp, ep, mp, bp; mpi_ptr_t rp, ep, mp, bp;
mpi_size_t esize, msize, bsize, rsize; mpi_size_t esize, msize, bsize, rsize;
@ -55,19 +55,19 @@ mpi_powm( MPI res, MPI base, MPI exp, MPI mod)
mpi_size_t tsize=0; /* to avoid compiler warning */ mpi_size_t tsize=0; /* to avoid compiler warning */
/* fixme: we should check that the warning is void*/ /* fixme: we should check that the warning is void*/
esize = exp->nlimbs; esize = exponent->nlimbs;
msize = mod->nlimbs; msize = mod->nlimbs;
size = 2 * msize; size = 2 * msize;
esign = exp->sign; esign = exponent->sign;
msign = mod->sign; msign = mod->sign;
esec = mpi_is_secure(exp); esec = mpi_is_secure(exponent);
msec = mpi_is_secure(mod); msec = mpi_is_secure(mod);
bsec = mpi_is_secure(base); bsec = mpi_is_secure(base);
rsec = mpi_is_secure(res); rsec = mpi_is_secure(res);
rp = res->d; rp = res->d;
ep = exp->d; ep = exponent->d;
if( !msize ) if( !msize )
msize = 1 / msize; /* provoke a signal */ msize = 1 / msize; /* provoke a signal */
@ -129,7 +129,7 @@ mpi_powm( MPI res, MPI base, MPI exp, MPI mod)
rp = res->d; rp = res->d;
} }
} }
else { /* Make BASE, EXP and MOD not overlap with RES. */ else { /* Make BASE, EXPONENT and MOD not overlap with RES. */
if( rp == bp ) { if( rp == bp ) {
/* RES and BASE are identical. Allocate temp. space for BASE. */ /* RES and BASE are identical. Allocate temp. space for BASE. */
assert( !bp_marker ); assert( !bp_marker );
@ -137,7 +137,8 @@ mpi_powm( MPI res, MPI base, MPI exp, MPI mod)
MPN_COPY(bp, rp, bsize); MPN_COPY(bp, rp, bsize);
} }
if( rp == ep ) { if( rp == ep ) {
/* RES and EXP are identical. Allocate temp. space for EXP. */ /* RES and EXPONENT are identical.
Allocate temp. space for EXPONENT. */
ep = ep_marker = mpi_alloc_limb_space( esize, esec ); ep = ep_marker = mpi_alloc_limb_space( esize, esec );
MPN_COPY(ep, rp, esize); MPN_COPY(ep, rp, esize);
} }