gnutls_dh_get_prime_bits() returns wrong values

Nikos Mavrogiannopoulos nmav at gnutls.org
Sun May 31 09:04:10 CEST 2009


Peter Hendrickson wrote:
> When I run gnutls_dh_get_prime_bits() it returns a value 8 bits larger
> than the actual length of the prime.  For example, if I load a
> Diffie-Hellman parameter with 4096 bits, I am told after the
> negotiation that the prime was 4104 bits long.
> 
> It looks like it's getting something from dh->prime.size and
> multiplying it by 8 and that prime.size is one larger than is correct.
> 
> In the debugger I watched gnutls_dh_params_import_pkcs3() load the
> parameters and it looks like one-larger prime.size is getting set in
> the process of ASN.1 parsing and MPI construction.  Probably that's
> correct and dh_get_prime_bits() should be doing a little more work to
> report the right value.  For one thing, if it's reporting the number
> of bits, it can't multiply an integer by 8 and always be correct.

Indeed you are right and thank you for the bug report. The number is
being rounded on byte level. I have noted it down as bug.

regards,
Nikos





More information about the Gnutls-devel mailing list