gnutls_dh_get_prime_bits() returns wrong values
Peter Hendrickson
pdh at wiredyne.com
Thu May 28 20:25:31 CEST 2009
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.
Peter
More information about the Gnutls-devel
mailing list