mirror of
git://git.gnupg.org/gnupg.git
synced 2025-06-17 20:27:03 +02:00
* sig-check.c (signature_check, signature_check2, check_key_signature,
check_key_signature2): Allow passing NULLs for unused parameters in the x2 form of each function to avoid the need for dummy variables. getkey.c, mainproc.c: Change all callers.
This commit is contained in:
parent
5d65681eb6
commit
9f839ac937
@ -1,3 +1,11 @@
|
|||||||
|
2003-07-21 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* sig-check.c (signature_check, signature_check2,
|
||||||
|
check_key_signature, check_key_signature2): Allow passing NULLs
|
||||||
|
for unused parameters in the x2 form of each function to avoid the
|
||||||
|
need for dummy variables. getkey.c, mainproc.c: Change all
|
||||||
|
callers.
|
||||||
|
|
||||||
2003-07-15 David Shaw <dshaw@jabberwocky.com>
|
2003-07-15 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* keygen.c (do_add_key_flags): Don't set the certify flag for
|
* keygen.c (do_add_key_flags): Don't set the certify flag for
|
||||||
|
@ -1595,8 +1595,6 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked )
|
|||||||
else if ( k->pkt->pkttype == PKT_SIGNATURE && uidnode )
|
else if ( k->pkt->pkttype == PKT_SIGNATURE && uidnode )
|
||||||
{
|
{
|
||||||
PKT_signature *sig = k->pkt->pkt.signature;
|
PKT_signature *sig = k->pkt->pkt.signature;
|
||||||
u32 dummy;
|
|
||||||
int dum2;
|
|
||||||
|
|
||||||
if(sig->keyid[0] != kid[0] || sig->keyid[1]!=kid[1])
|
if(sig->keyid[0] != kid[0] || sig->keyid[1]!=kid[1])
|
||||||
{
|
{
|
||||||
@ -1606,7 +1604,7 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked )
|
|||||||
|
|
||||||
if(get_pubkey_fast(ultimate_pk,sig->keyid)==0
|
if(get_pubkey_fast(ultimate_pk,sig->keyid)==0
|
||||||
&& check_key_signature2(keyblock,k,ultimate_pk,
|
&& check_key_signature2(keyblock,k,ultimate_pk,
|
||||||
NULL,&dummy,&dum2)==0
|
NULL,NULL,NULL)==0
|
||||||
&& get_ownertrust(ultimate_pk)==TRUST_ULTIMATE)
|
&& get_ownertrust(ultimate_pk)==TRUST_ULTIMATE)
|
||||||
{
|
{
|
||||||
free_public_key(ultimate_pk);
|
free_public_key(ultimate_pk);
|
||||||
|
@ -665,7 +665,6 @@ do_check_sig( CTX c, KBNODE node, int *is_selfsig, int *is_expkey )
|
|||||||
PKT_signature *sig;
|
PKT_signature *sig;
|
||||||
MD_HANDLE md = NULL, md2 = NULL;
|
MD_HANDLE md = NULL, md2 = NULL;
|
||||||
int algo, rc, dum2;
|
int algo, rc, dum2;
|
||||||
u32 dummy;
|
|
||||||
|
|
||||||
if(!is_expkey)
|
if(!is_expkey)
|
||||||
is_expkey=&dum2;
|
is_expkey=&dum2;
|
||||||
@ -722,9 +721,9 @@ do_check_sig( CTX c, KBNODE node, int *is_selfsig, int *is_expkey )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
return G10ERR_SIG_CLASS;
|
return G10ERR_SIG_CLASS;
|
||||||
rc = signature_check2( sig, md, &dummy, is_expkey );
|
rc = signature_check2( sig, md, NULL, is_expkey );
|
||||||
if( rc == G10ERR_BAD_SIGN && md2 )
|
if( rc == G10ERR_BAD_SIGN && md2 )
|
||||||
rc = signature_check2( sig, md2, &dummy, is_expkey );
|
rc = signature_check2( sig, md2, NULL, is_expkey );
|
||||||
md_close(md);
|
md_close(md);
|
||||||
md_close(md2);
|
md_close(md2);
|
||||||
|
|
||||||
|
@ -50,9 +50,7 @@ static int do_check( PKT_public_key *pk, PKT_signature *sig,
|
|||||||
int
|
int
|
||||||
signature_check( PKT_signature *sig, MD_HANDLE digest )
|
signature_check( PKT_signature *sig, MD_HANDLE digest )
|
||||||
{
|
{
|
||||||
u32 dummy;
|
return signature_check2( sig, digest, NULL, NULL );
|
||||||
int dum2;
|
|
||||||
return signature_check2( sig, digest, &dummy, &dum2 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -62,8 +60,6 @@ signature_check2( PKT_signature *sig, MD_HANDLE digest,
|
|||||||
PKT_public_key *pk = m_alloc_clear( sizeof *pk );
|
PKT_public_key *pk = m_alloc_clear( sizeof *pk );
|
||||||
int rc=0;
|
int rc=0;
|
||||||
|
|
||||||
*r_expiredate = 0;
|
|
||||||
|
|
||||||
/* Sanity check that the md has a context for the hash that the
|
/* Sanity check that the md has a context for the hash that the
|
||||||
sig is expecting. This can happen if a onepass sig header does
|
sig is expecting. This can happen if a onepass sig header does
|
||||||
not match the actual sig, and also if the clearsign "Hash:"
|
not match the actual sig, and also if the clearsign "Hash:"
|
||||||
@ -79,6 +75,7 @@ signature_check2( PKT_signature *sig, MD_HANDLE digest,
|
|||||||
rc=G10ERR_BAD_PUBKEY; /* you cannot have a good sig from an
|
rc=G10ERR_BAD_PUBKEY; /* you cannot have a good sig from an
|
||||||
invalid subkey */
|
invalid subkey */
|
||||||
else {
|
else {
|
||||||
|
if(r_expiredate)
|
||||||
*r_expiredate = pk->expiredate;
|
*r_expiredate = pk->expiredate;
|
||||||
rc = do_check( pk, sig, digest, r_expired );
|
rc = do_check( pk, sig, digest, r_expired );
|
||||||
}
|
}
|
||||||
@ -208,6 +205,7 @@ do_check_messages( PKT_public_key *pk, PKT_signature *sig, int *r_expired )
|
|||||||
{
|
{
|
||||||
u32 cur_time;
|
u32 cur_time;
|
||||||
|
|
||||||
|
if(r_expired)
|
||||||
*r_expired = 0;
|
*r_expired = 0;
|
||||||
if( pk->version == 4 && pk->pubkey_algo == PUBKEY_ALGO_ELGAMAL_E ) {
|
if( pk->version == 4 && pk->pubkey_algo == PUBKEY_ALGO_ELGAMAL_E ) {
|
||||||
log_info(_("key %08lX: this is a PGP generated "
|
log_info(_("key %08lX: this is a PGP generated "
|
||||||
@ -251,6 +249,7 @@ do_check_messages( PKT_public_key *pk, PKT_signature *sig, int *r_expired )
|
|||||||
sprintf(buf,"%lu",(ulong)pk->expiredate);
|
sprintf(buf,"%lu",(ulong)pk->expiredate);
|
||||||
write_status_text(STATUS_KEYEXPIRED,buf);
|
write_status_text(STATUS_KEYEXPIRED,buf);
|
||||||
write_status(STATUS_SIGEXPIRED);
|
write_status(STATUS_SIGEXPIRED);
|
||||||
|
if(r_expired)
|
||||||
*r_expired = 1;
|
*r_expired = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,9 +472,7 @@ check_revocation_keys(PKT_public_key *pk,PKT_signature *sig)
|
|||||||
int
|
int
|
||||||
check_key_signature( KBNODE root, KBNODE node, int *is_selfsig )
|
check_key_signature( KBNODE root, KBNODE node, int *is_selfsig )
|
||||||
{
|
{
|
||||||
u32 dummy;
|
return check_key_signature2(root, node, NULL, is_selfsig, NULL, NULL );
|
||||||
int dum2;
|
|
||||||
return check_key_signature2(root, node, NULL, is_selfsig, &dummy, &dum2 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If check_pk is set, then use it to check the signature in node
|
/* If check_pk is set, then use it to check the signature in node
|
||||||
@ -492,7 +489,9 @@ check_key_signature2( KBNODE root, KBNODE node, PKT_public_key *check_pk,
|
|||||||
|
|
||||||
if( is_selfsig )
|
if( is_selfsig )
|
||||||
*is_selfsig = 0;
|
*is_selfsig = 0;
|
||||||
|
if( r_expiredate )
|
||||||
*r_expiredate = 0;
|
*r_expiredate = 0;
|
||||||
|
if( r_expired )
|
||||||
*r_expired = 0;
|
*r_expired = 0;
|
||||||
assert( node->pkt->pkttype == PKT_SIGNATURE );
|
assert( node->pkt->pkttype == PKT_SIGNATURE );
|
||||||
assert( root->pkt->pkttype == PKT_PUBLIC_KEY );
|
assert( root->pkt->pkttype == PKT_PUBLIC_KEY );
|
||||||
@ -511,6 +510,7 @@ check_key_signature2( KBNODE root, KBNODE node, PKT_public_key *check_pk,
|
|||||||
if( keyid[0] == sig->keyid[0] && keyid[1] == sig->keyid[1] )
|
if( keyid[0] == sig->keyid[0] && keyid[1] == sig->keyid[1] )
|
||||||
*is_selfsig = 1;
|
*is_selfsig = 1;
|
||||||
}
|
}
|
||||||
|
/* TODO: should set r_expiredate here as well */
|
||||||
if((rc=do_check_messages(pk,sig,r_expired)))
|
if((rc=do_check_messages(pk,sig,r_expired)))
|
||||||
return rc;
|
return rc;
|
||||||
return sig->flags.valid? 0 : G10ERR_BAD_SIGN;
|
return sig->flags.valid? 0 : G10ERR_BAD_SIGN;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user