Re: FW: seeking info on source of DH key requirements

Viktor Dukhovni <[email protected]> Thu, 18 Sep 2025 01:20:37 +1000
Newsgroups gmane.comp.encryption.openssl.user
Message-ID <[email protected]>
On Wed, Sep 17, 2025 at 02:34:07PM +0000, Wall, Stephen wrote:

> Can anyone tell me what the source (RFC, NIST, FIPS, whatever) of this
> test in diffie-hellman key generation (dh_key.c) is?
> 
>         /* Is it an approved safe prime ?*/
>         if (DH_get_nid(dh) != NID_undef) {
>             int max_strength =
>                     ossl_ifc_ffc_compute_security_bits(BN_num_bits(dh->params.p));
> 
>             if (dh->params.q == NULL
>                 || dh->length > BN_num_bits(dh->params.q))
>                 goto err;
> 
> https://github.com/openssl/openssl/blob/d88c43a64408616572941e5d0b127194d80f562f/crypto/dh/dh_key.c#L318

For any DH group with an explicit 'q' parameter, the private key is an
element of [1, q-1], so its bit count (dh->length) is at most the bit
count of `q`.

This report is rather skimpy.  Which specific group is this (pleaes
report the group name.  And make an effort to find out where dh->length
was set to its unexpectedly larger value.

What protocol is this?  TLS, SSH, something else?

-- 
    Viktor.

-- 
You received this message because you are subscribed to the Google Groups "openssl-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openssl-users+unsubscribe-MCmKBN63+Bmbup2nOX2J7Q@public.gmane.org
To view this discussion visit https://groups.google.com/a/openssl.org/d/msgid/openssl-users/aMrRxf-TiAthTj5n%40chardros.imrryr.org.