diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-04-09 13:05:00 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-04-16 15:17:56 +0300 |
commit | bdb5b62df6e2e1e05127aa75e28a171223ea38ec (patch) | |
tree | 0308809e8cca2bf71b1299ecb709bad9f589fcc8 | |
parent | f316cb4a2a2524241fedfdd431aca7fd83b3ab48 (diff) | |
download | rpm-bdb5b62df6e2e1e05127aa75e28a171223ea38ec.tar.gz |
Fix PGP v4 fingerprint calculation (rhbz#493777)
- patch from openSUSE / Michael Schroeder
(cherry picked from commit 7a8aecbc8651cab2bd945db8ffd749f9a165bdf1)
-rw-r--r-- | rpmio/rpmpgp.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c index d0f8e81e3..47cc764de 100644 --- a/rpmio/rpmpgp.c +++ b/rpmio/rpmpgp.c @@ -1097,6 +1097,7 @@ int pgpPubkeyFingerprint(const uint8_t * pkt, size_t pktlen, pgpKeyID_t keyid) case 4: { pgpPktKeyV4 v = (pgpPktKeyV4) (h); uint8_t * d = NULL; + uint8_t in[3]; size_t dlen; int i; @@ -1113,7 +1114,12 @@ int pgpPubkeyFingerprint(const uint8_t * pkt, size_t pktlen, pgpKeyID_t keyid) } ctx = rpmDigestInit(PGPHASHALGO_SHA1, RPMDIGEST_NONE); - (void) rpmDigestUpdate(ctx, pkt, (se-pkt)); + i = se - h; + in[0] = 0x99; + in[1] = i >> 8; + in[2] = i; + (void) rpmDigestUpdate(ctx, in, 3); + (void) rpmDigestUpdate(ctx, h, i); (void) rpmDigestFinal(ctx, (void **)&d, &dlen, 0); if (d) { |