1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-08 12:44:23 +01:00

* build-packet.c (write_fake_data, do_secret_key), seckey-cert.c

(do_check): Use an unsigned length for mpi_get_opaque.

* options.h: It's impolite to assign -1 to an unsigned
opt.force_ownertrust.
This commit is contained in:
David Shaw 2003-12-17 23:04:53 +00:00
parent e49672d5a3
commit 7847eae02c
4 changed files with 17 additions and 11 deletions

View File

@ -1,5 +1,11 @@
2003-12-17 David Shaw <dshaw@localhost.localdomain>
* build-packet.c (write_fake_data, do_secret_key), seckey-cert.c
(do_check): Use an unsigned length for mpi_get_opaque.
* options.h: It's impolite to assign -1 to an unsigned
opt.force_ownertrust.
* sig-check.c (cmp_help, do_check), sign.c (do_sign): Remove old
unused code.

View File

@ -182,7 +182,7 @@ static void
write_fake_data( IOBUF out, MPI a )
{
if( a ) {
int i;
unsigned int i;
void *p;
p = mpi_get_opaque( a, &i );
@ -353,15 +353,17 @@ do_secret_key( IOBUF out, int ctb, PKT_secret_key *sk )
else if( sk->is_protected && sk->version >= 4 ) {
/* The secret key is protected - write it out as it is */
byte *p;
unsigned int ndata;
assert( mpi_is_opaque( sk->skey[npkey] ) );
p = mpi_get_opaque( sk->skey[npkey], &i );
iobuf_write(a, p, i );
p = mpi_get_opaque( sk->skey[npkey], &ndata );
iobuf_write(a, p, ndata );
}
else if( sk->is_protected ) {
/* The secret key is protected te old v4 way. */
for( ; i < nskey; i++ ) {
byte *p;
int ndata;
unsigned int ndata;
assert (mpi_is_opaque (sk->skey[i]));
p = mpi_get_opaque (sk->skey[i], &ndata);

View File

@ -97,7 +97,7 @@ struct {
{
TM_CLASSIC=0, TM_PGP=1, TM_EXTERNAL=2, TM_ALWAYS, TM_AUTO
} trust_model;
unsigned int force_ownertrust;
int force_ownertrust;
enum
{
CO_GNUPG=0, CO_RFC2440, CO_RFC1991, CO_PGP2, CO_PGP6, CO_PGP7, CO_PGP8

View File

@ -86,7 +86,7 @@ do_check( PKT_secret_key *sk, const char *tryagain_text, int mode,
cipher_setiv( cipher_hd, sk->protect.iv, sk->protect.ivlen );
csum = 0;
if( sk->version >= 4 ) {
int ndata;
unsigned int ndata;
byte *p, *data;
u16 csumc = 0;
@ -140,7 +140,7 @@ do_check( PKT_secret_key *sk, const char *tryagain_text, int mode,
}
}
}
/* must check it here otherwise the mpi_read_xx would fail
because the length may have an arbitrary value */
if( sk->csum == csum ) {
@ -159,8 +159,7 @@ do_check( PKT_secret_key *sk, const char *tryagain_text, int mode,
for(i=pubkey_get_npkey(sk->pubkey_algo);
i < pubkey_get_nskey(sk->pubkey_algo); i++ ) {
byte *p;
int ndata;
unsigned int dummy;
unsigned int ndata;
assert (mpi_is_opaque (sk->skey[i]));
p = mpi_get_opaque (sk->skey[i], &ndata);
@ -173,8 +172,7 @@ do_check( PKT_secret_key *sk, const char *tryagain_text, int mode,
cipher_decrypt (cipher_hd, buffer+2, p+2, ndata-2);
csum += checksum (buffer, ndata);
mpi_free (sk->skey[i]);
dummy = ndata;
sk->skey[i] = mpi_read_from_buffer (buffer, &dummy, 1);
sk->skey[i] = mpi_read_from_buffer (buffer, &ndata, 1);
assert (sk->skey[i]);
m_free (buffer);
/* csum += checksum_mpi (sk->skey[i]); */