[gnutls-devel] Bug: gnutls_dh_get_group prepends a zero byte to prime
Thomas Klute
thomas2.klute at uni-dortmund.de
Fri May 22 16:11:18 CEST 2015
Am 22.05.2015 um 09:05 schrieb Nikos Mavrogiannopoulos:
> On Fri, May 22, 2015 at 12:17 AM, Thomas Klute
> <thomas2.klute at uni-dortmund.de> wrote:
>> Hello,
>> I believe I have found a bug in gnutls_dh_get_group: It returns the
>> prime with an extra zero byte at the beginning.
>
> Indeed, I see that the number is written as a non-negative integer
> there, so it will have a leading zero if the number would have been
> interpreted as negative. The intention was to assist applications who
> may import that value in an mpz_t value. Would it make sense to
> document the fact that there may be a leading zero in that case,
> rather than eliminating? That behavior has been for quite some time
> and I believe any users of this function would already use or work
> around it.
That makes sense, thank you. Knowing about the (possible) offset makes
it easy enough to work around where necessary. :-)
Kind regards,
Thomas
More information about the Gnutls-devel
mailing list