From 1085073b2b4e1e5fdfac7b06368632e1ec8cd662 Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 23 Nov 2021 09:53:45 +0000 Subject: [PATCH] In DH_set0_pqg() also set dh->length if q is set to match what OpenSSL do. ok inoguchi jsing --- lib/libcrypto/dh/dh_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libcrypto/dh/dh_lib.c b/lib/libcrypto/dh/dh_lib.c index 446bc65aa28..a66ed1f5bf0 100644 --- a/lib/libcrypto/dh/dh_lib.c +++ b/lib/libcrypto/dh/dh_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh_lib.c,v 1.32 2018/05/02 15:48:38 tb Exp $ */ +/* $OpenBSD: dh_lib.c,v 1.33 2021/11/23 09:53:45 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -273,6 +273,7 @@ DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g) if (q != NULL) { BN_free(dh->q); dh->q = q; + dh->length = BN_num_bits(dh->q); } if (g != NULL) { BN_free(dh->g); -- 2.20.1