summaryrefslogtreecommitdiffstats
path: root/g10/keyid.c
diff options
context:
space:
mode:
authorDavid Shaw <dshaw@jabberwocky.com>2003-12-10 02:59:45 +0100
committerDavid Shaw <dshaw@jabberwocky.com>2003-12-10 02:59:45 +0100
commit888a6c2980cc1811545b870e81159b9e16b86f7a (patch)
treebcef2f85f32d4f9e9e18cd3a3b30bec53e6561f3 /g10/keyid.c
parent* keyid.c (keyid_from_sk, keyid_from_pk, fingerprint_from_pk, (diff)
downloadgnupg2-888a6c2980cc1811545b870e81159b9e16b86f7a.tar.xz
gnupg2-888a6c2980cc1811545b870e81159b9e16b86f7a.zip
* keyid.c (do_fingerprint_md): Remove the rules to hash the old v3 Elgamal
keys. They are no longer needed.
Diffstat (limited to 'g10/keyid.c')
-rw-r--r--g10/keyid.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/g10/keyid.c b/g10/keyid.c
index 76f7a782a..8641f7d94 100644
--- a/g10/keyid.c
+++ b/g10/keyid.c
@@ -51,15 +51,15 @@ static MD_HANDLE
do_fingerprint_md( PKT_public_key *pk )
{
MD_HANDLE md;
- unsigned n;
+ unsigned n=6;
unsigned nb[PUBKEY_MAX_NPKEY];
unsigned nn[PUBKEY_MAX_NPKEY];
byte *pp[PUBKEY_MAX_NPKEY];
int i;
int npkey = pubkey_get_npkey( pk->pubkey_algo );
- md = md_open( pk->version < 4 ? DIGEST_ALGO_RMD160 : DIGEST_ALGO_SHA1, 0);
- n = pk->version < 4 ? 8 : 6;
+ md = md_open( DIGEST_ALGO_SHA1, 0);
+
if(npkey==0 && pk->pkey[0] && mpi_is_opaque(pk->pkey[0]))
{
pp[0]=mpi_get_opaque(pk->pkey[0],&nn[0]);
@@ -74,29 +74,16 @@ do_fingerprint_md( PKT_public_key *pk )
}
md_putc( md, 0x99 ); /* ctb */
+ /* What does it mean if n is greater than than 0xFFFF ? */
md_putc( md, n >> 8 ); /* 2 byte length header */
md_putc( md, n );
- if( pk->version < 4 )
- md_putc( md, 3 );
- else
- md_putc( md, 4 );
+ md_putc( md, 4 );
- { u32 a = pk->timestamp;
- md_putc( md, a >> 24 );
- md_putc( md, a >> 16 );
- md_putc( md, a >> 8 );
- md_putc( md, a );
- }
- if( pk->version < 4 ) {
- u16 a;
+ md_putc( md, pk->timestamp >> 24 );
+ md_putc( md, pk->timestamp >> 16 );
+ md_putc( md, pk->timestamp >> 8 );
+ md_putc( md, pk->timestamp );
- if( pk->expiredate )
- a = (u16)((pk->expiredate - pk->timestamp) / 86400L);
- else
- a = 0;
- md_putc( md, a >> 8 );
- md_putc( md, a );
- }
md_putc( md, pk->pubkey_algo );
if(npkey==0 && pk->pkey[0] && mpi_is_opaque(pk->pkey[0]))
@@ -109,6 +96,7 @@ do_fingerprint_md( PKT_public_key *pk )
md_write( md, pp[i], nn[i] );
m_free(pp[i]);
}
+
md_final( md );
return md;