]> granicus.if.org Git - mutt/commitdiff
Fix pgpring reporting of DSA and Elgamal key lengths. (closes #3867)
authorGuilhem Moulin <guilhem@guilhem.org>
Mon, 5 Sep 2016 01:50:28 +0000 (18:50 -0700)
committerGuilhem Moulin <guilhem@guilhem.org>
Mon, 5 Sep 2016 01:50:28 +0000 (18:50 -0700)
Patch provided by Guilhem Moulin from an original idea of Fabrizio
Tarizzo.

The key length is always the length of the first MPI for RSA, DSA, and
Elgamal.

pgppubring.c

index 8da3bbb88d54f481f5c05cdde4a6b675586a1db2..b045518f28ea98d6554ad0955064c8fe6b433e34 100644 (file)
@@ -341,19 +341,15 @@ static pgp_key_t pgp_parse_pgp3_key (unsigned char *buff, size_t l)
   p->algorithm = pgp_pkalgbytype (alg);
   p->flags |= pgp_get_abilities (alg);
 
-  if (alg == 17)
-    skip_bignum (buff, l, j, &j, 3);
-  else if (alg == 16 || alg == 20)
-    skip_bignum (buff, l, j, &j, 2);
-
   len = (buff[j] << 8) + buff[j + 1];
   p->keylen = len;
 
-
   if (alg >= 1 && alg <= 3)
     skip_bignum (buff, l, j, &j, 2);
-  else if (alg == 17 || alg == 16 || alg == 20)
-    skip_bignum (buff, l, j, &j, 1);
+  else if (alg == 16 || alg == 20)
+    skip_bignum (buff, l, j, &j, 3);
+  else if (alg == 17)
+    skip_bignum (buff, l, j, &j, 4);
 
   pgp_make_pgp3_fingerprint (buff, j, digest);
   if (dump_fingerprints)