Blob Blame History Raw
commit 452f162ef51d4c6484e93c2b0bc5866c10c8b734
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 feafc5e..9ca8da5 100644
--- a/lib/signature.c
+++ b/lib/signature.c
@@ -1194,17 +1194,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);