diff options
Diffstat (limited to 'g10/sign.c')
-rw-r--r-- | g10/sign.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/g10/sign.c b/g10/sign.c index eb53794dc..3b7183677 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -594,21 +594,28 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile ) } } - if( old_style || only_md5 ) + if( old_style && only_md5 ) iobuf_writestr(out, "\n" ); else { const char *s; int any = 0; + byte hashs_seen[256]; + memset( hashs_seen, 0, sizeof hashs_seen ); iobuf_writestr(out, "Hash: " ); for( sk_rover = sk_list; sk_rover; sk_rover = sk_rover->next ) { PKT_secret_key *sk = sk_rover->sk; - s = digest_algo_to_string( hash_for(sk->pubkey_algo) ); - if( s ) { - if( any ) - iobuf_put(out, ',' ); - iobuf_writestr(out, s ); - any = 1; + int i = hash_for(sk->pubkey_algo); + + if( !hashs_seen[ i & 0xff ] ) { + s = digest_algo_to_string( i ); + if( s ) { + hashs_seen[ i & 0xff ] = 1; + if( any ) + iobuf_put(out, ',' ); + iobuf_writestr(out, s ); + any = 1; + } } } assert(any); |