]> git.ipfire.org Git - thirdparty/openssl.git/commit
DH private key size was one bit too large
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Sat, 21 Jun 2025 10:53:56 +0000 (12:53 +0200)
committerTomas Mraz <tomas@openssl.org>
Wed, 13 Aug 2025 09:24:52 +0000 (11:24 +0200)
commitf3b0e8a51806103e7eef82ec79df4df3c68fcb26
treecf57dde0ce78d1faa1e96993f34a9ad6e5cc03c7
parent229bc34313018559c8cb8c67ac30273785fa4d65
DH private key size was one bit too large

In the case when no q parameter was given,
the function generate_key in dh_key.c did create
one bit too much, so the priv_key value was exceeding
the DH group size q = (p-1)/2.
When the length is used in this case the limit is also
one bit too high, but for backward compatibility this
limit was left as is, instead we have to silently reduce
the value by one.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27870)

(cherry picked from commit d6510d99ae4a8a23f54fdfb1473af6a920da8345)
crypto/dh/dh_key.c