rpm/rpm-4.6.0-rsa-v4.patch
Panu Matilainen 513005792c - handle NULL as EVR to rpmdsSingle() (#487881, #485616)
- permit UTF-8 as first char of dependency names (#455119)
- handle RSA V4 signatures (#436812)
- add alpha arch ISA-bits
2009-03-12 06:00:21 +00:00

35 lines
1.2 KiB
Diff

commit fbb16d025ecdae96f9301e47c2dab8b3e37bb5a8
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Wed Mar 4 13:08:30 2009 +0200
Handle V4 signature trailer for RSA too (ticket #34)
(cherry picked from commit d50db40ceed7083467f7b548da7b2fbe96aaec61)
diff --git a/lib/signature.c b/lib/signature.c
index 67f70ab..2416e53 100644
--- a/lib/signature.c
+++ b/lib/signature.c
@@ -1199,17 +1199,16 @@ verifyRSASignature(rpmKeyring keyring, rpmtd sigtd, pgpDig dig, char ** msg,
if (sigp->hash != NULL)
xx = rpmDigestUpdate(ctx, sigp->hash, sigp->hashlen);
-#ifdef NOTYET /* XXX not for binary/text signatures as in packages. */
- if (!(sigp->sigtype == PGPSIGTYPE_BINARY || sigp->sigtype == PGP_SIGTYPE_TEXT)) {
- size_t nb = dig->nbytes + sigp->hashlen;
+ if (sigp->version == 4) {
+ /* V4 trailer is six octets long (rfc4880) */
uint8_t trailer[6];
+ uint32_t nb = sigp->hashlen;
nb = htonl(nb);
- trailer[0] = 0x4;
+ trailer[0] = sigp->version;
trailer[1] = 0xff;
- memcpy(trailer+2, &nb, sizeof(nb));
+ memcpy(trailer+2, &nb, 4);
xx = rpmDigestUpdate(ctx, trailer, sizeof(trailer));
}
-#endif
xx = rpmDigestFinal(ctx, (void **)&dig->md5, &dig->md5len, 0);