Skip to content

Commit 3da5a51

Browse files
jogmet8m
authored andcommitted
Match the local q DHX parameter against the peer's q
As FFC/DH peer public key validation uses the peer's q value instead of checking against the local q, we must also check that these q values match when setting the peer's public key. Fixes CVE-2026-42770 Signed-off-by: Norbert Pocs <[email protected]> Reviewed-by: Viktor Dukhovni <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Mon Jun 8 19:56:27 2026 (cherry picked from commit 29b9df160cc5f20ee3907cce0cb271b982846bce)
1 parent d531f21 commit 3da5a51

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

providers/implementations/exchange/dh_exch.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,15 @@ static int dh_init(void *vpdhctx, void *vdh, const OSSL_PARAM params[])
155155
static int dh_match_params(DH *priv, DH *peer)
156156
{
157157
int ret;
158+
int ignore_q = 1;
158159
FFC_PARAMS *dhparams_priv = ossl_dh_get0_params(priv);
159160
FFC_PARAMS *dhparams_peer = ossl_dh_get0_params(peer);
160161

162+
if (dhparams_priv != NULL && dhparams_priv->q != NULL)
163+
ignore_q = 0;
161164
ret = dhparams_priv != NULL
162165
&& dhparams_peer != NULL
163-
&& ossl_ffc_params_cmp(dhparams_priv, dhparams_peer, 1);
166+
&& ossl_ffc_params_cmp(dhparams_priv, dhparams_peer, ignore_q);
164167
if (!ret)
165168
ERR_raise(ERR_LIB_PROV, PROV_R_MISMATCHING_DOMAIN_PARAMETERS);
166169
return ret;

0 commit comments

Comments
 (0)