summaryrefslogtreecommitdiffstats
path: root/g10/sig-check.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1998-02-18 14:58:46 +0100
committerWerner Koch <wk@gnupg.org>1998-02-18 14:58:46 +0100
commitb758180325b90184f7ac66267141cb5465c07a9f (patch)
tree69767c83c2ad2afd85db3cdbcb7489cc13c76123 /g10/sig-check.c
parentimport works (diff)
downloadgnupg2-b758180325b90184f7ac66267141cb5465c07a9f.tar.xz
gnupg2-b758180325b90184f7ac66267141cb5465c07a9f.zip
added revcation stuff and fixed a couple of bugs
Diffstat (limited to 'g10/sig-check.c')
-rw-r--r--g10/sig-check.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/g10/sig-check.c b/g10/sig-check.c
index 4615c46e0..360a184c8 100644
--- a/g10/sig-check.c
+++ b/g10/sig-check.c
@@ -183,7 +183,9 @@ do_check( PKT_public_cert *pkc, PKT_signature *sig, MD_HANDLE digest )
/****************
- * check the signature pointed to by NODE. This is a key signatures
+ * check the signature pointed to by NODE. This is a key signatures.
+ * If the function detects a elf signature, it uses the PKC from
+ * NODE and does not read the any public key.
*/
int
check_key_signature( KBNODE root, KBNODE node, int *is_selfsig )
@@ -198,7 +200,6 @@ check_key_signature( KBNODE root, KBNODE node, int *is_selfsig )
if( is_selfsig )
*is_selfsig = 0;
assert( node->pkt->pkttype == PKT_SIGNATURE );
- assert( (node->pkt->pkt.signature->sig_class&~3) == 0x10 );
assert( root->pkt->pkttype == PKT_PUBLIC_CERT );
pkc = root->pkt->pkt.public_cert;
@@ -213,27 +214,36 @@ check_key_signature( KBNODE root, KBNODE node, int *is_selfsig )
if( (rc=check_digest_algo(algo)) )
return rc;
- unode = find_prev_kbnode( root, node, PKT_USER_ID );
-
- if( unode ) {
- PKT_user_id *uid = unode->pkt->pkt.user_id;
-
- if( is_selfsig ) {
- u32 keyid[2];
-
- keyid_from_pkc( pkc, keyid );
- if( keyid[0] == sig->keyid[0] && keyid[1] == sig->keyid[1] )
- *is_selfsig = 1;
- }
+ if( sig->sig_class == 0x20 ) {
md = md_open( algo, 0 );
hash_public_cert( md, pkc );
- md_write( md, uid->name, uid->len );
rc = do_check( pkc, sig, md );
md_close(md);
}
else {
- log_error("no user id for key signature packet\n");
- rc = G10ERR_SIG_CLASS;
+ unode = find_prev_kbnode( root, node, PKT_USER_ID );
+
+ if( unode ) {
+ PKT_user_id *uid = unode->pkt->pkt.user_id;
+ u32 keyid[2];
+
+ keyid_from_pkc( pkc, keyid );
+ md = md_open( algo, 0 );
+ hash_public_cert( md, pkc );
+ md_write( md, uid->name, uid->len );
+ if( keyid[0] == sig->keyid[0] && keyid[1] == sig->keyid[1] ) {
+ if( is_selfsig )
+ *is_selfsig = 1;
+ rc = do_check( pkc, sig, md );
+ }
+ else
+ rc = signature_check( sig, md );
+ md_close(md);
+ }
+ else {
+ log_error("no user id for key signature packet\n");
+ rc = G10ERR_SIG_CLASS;
+ }
}
return rc;