From: Guilhem Moulin Date: Mon, 5 Sep 2016 01:50:28 +0000 (-0700) Subject: Fix pgpring reporting of DSA and Elgamal key lengths. (closes #3867) X-Git-Tag: neomutt-20160910~12^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bd8b385ac485d15dfc7fe600ea30bbad01f3610a;p=neomutt Fix pgpring reporting of DSA and Elgamal key lengths. (closes #3867) 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. --- diff --git a/pgppubring.c b/pgppubring.c index 8da3bbb88..b045518f2 100644 --- a/pgppubring.c +++ b/pgppubring.c @@ -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)