aboutsummaryrefslogtreecommitdiffstats
path: root/g10/mainproc.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1997-11-24 11:04:11 +0000
committerWerner Koch <[email protected]>1997-11-24 11:04:11 +0000
commita51cca90b6c8d3628d9b97a08f9370b3e249a9b6 (patch)
tree093b652e684cef1623777be8ea2b96876f9ee1e7 /g10/mainproc.c
parentcompress stuff implemented (diff)
downloadgnupg-a51cca90b6c8d3628d9b97a08f9370b3e249a9b6.tar.gz
gnupg-a51cca90b6c8d3628d9b97a08f9370b3e249a9b6.zip
IDEA removed, signing works
Diffstat (limited to 'g10/mainproc.c')
-rw-r--r--g10/mainproc.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/g10/mainproc.c b/g10/mainproc.c
index 0055200b4..45cb8fbbd 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -29,7 +29,7 @@
#include "util.h"
#include "cipher.h"
#include "keydb.h"
-
+#include "filter.h"
static int opt_list=1; /* and list the data packets to stdout */
@@ -48,7 +48,9 @@ proc_packets( IOBUF a )
int lvl0, lvl1;
int last_was_pubkey_enc = 0;
u32 keyid[2];
+ md_filter_context_t mfx;
+ memset( &mfx, 0, sizeof mfx );
lvl0 = opt.check_sigs? 1:0; /* stdout or /dev/null */
lvl1 = opt.check_sigs? 1:3; /* stdout or error */
pkt = m_alloc( sizeof *pkt );
@@ -135,7 +137,14 @@ proc_packets( IOBUF a )
sig = pkt->pkt.signature;
ustr = get_user_id_string(sig->keyid);
result = -1;
- if( sig->sig_class != 0x10 )
+ if( sig->sig_class == 0x00 ) {
+ if( mfx.rmd160 )
+ result = 0;
+ else
+ printstr(lvl1,"sig?: %s: no plaintext for signature\n",
+ ustr);
+ }
+ else if( sig->sig_class != 0x10 )
printstr(lvl1,"sig?: %s: unknown signature class %02x\n",
ustr, sig->sig_class);
else if( !pkt->pkc_parent || !pkt->user_parent )
@@ -145,20 +154,25 @@ proc_packets( IOBUF a )
if( result )
;
- else if( !opt.check_sigs ) {
+ else if( !opt.check_sigs && sig->sig_class != 0x00 ) {
result = -1;
printstr(lvl0, "sig: from %s\n", ustr );
}
else if(sig->pubkey_algo == PUBKEY_ALGO_RSA ) {
md_handle.algo = sig->d.rsa.digest_algo;
if( sig->d.rsa.digest_algo == DIGEST_ALGO_RMD160 ) {
- md_handle.u.rmd = rmd160_copy(pkt->pkc_parent->mfx.rmd160);
- rmd160_write(md_handle.u.rmd, pkt->user_parent->name,
- pkt->user_parent->len);
+ if( sig->sig_class == 0x00 )
+ md_handle.u.rmd = rmd160_copy( mfx.rmd160 );
+ else {
+ md_handle.u.rmd = rmd160_copy(pkt->pkc_parent->mfx.rmd160);
+ rmd160_write(md_handle.u.rmd, pkt->user_parent->name,
+ pkt->user_parent->len);
+ }
result = signature_check( sig, md_handle );
rmd160_close(md_handle.u.rmd);
}
- else if( sig->d.rsa.digest_algo == DIGEST_ALGO_MD5 ) {
+ else if( sig->d.rsa.digest_algo == DIGEST_ALGO_MD5
+ && sig->sig_class != 0x00 ) {
md_handle.u.md5 = md5_copy(pkt->pkc_parent->mfx.md5);
md5_write(md_handle.u.md5, pkt->user_parent->name,
pkt->user_parent->len);
@@ -173,6 +187,8 @@ proc_packets( IOBUF a )
if( result == -1 )
;
+ else if( !result && sig->sig_class == 0x00 )
+ printstr(1, "sig: good signature from %s\n", ustr );
else if( !result )
printstr(lvl0, "sig: good signature from %s\n", ustr );
else
@@ -235,7 +251,9 @@ proc_packets( IOBUF a )
else if( pkt->pkttype == PKT_PLAINTEXT ) {
PKT_plaintext *pt = pkt->pkt.plaintext;
printf("txt: plain text data name='%.*s'\n", pt->namelen, pt->name);
- result = handle_plaintext( pt );
+ free_md_filter_context( &mfx );
+ mfx.rmd160 = rmd160_open(0);
+ result = handle_plaintext( pt, &mfx );
if( !result )
fputs( " okay",stdout);
else
@@ -269,6 +287,7 @@ proc_packets( IOBUF a )
m_free(dek);
free_packet( pkt );
m_free( pkt );
+ free_md_filter_context( &mfx );
return 0;
}