From 7c7e45068cf11a725567dcbdd67fa322b6f93b74 Mon Sep 17 00:00:00 2001 From: tb Date: Wed, 5 Jan 2022 20:36:29 +0000 Subject: [PATCH] Prepare to provide DH_get_length() Will be needed by openssl(1) dhparam. ok inoguchi jsing --- lib/libcrypto/dh/dh.h | 5 ++++- lib/libcrypto/dh/dh_lib.c | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/dh/dh.h b/lib/libcrypto/dh/dh.h index 8e57c191c42..83ad67bebfb 100644 --- a/lib/libcrypto/dh/dh.h +++ b/lib/libcrypto/dh/dh.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dh.h,v 1.27 2022/01/05 20:30:16 tb Exp $ */ +/* $OpenBSD: dh.h,v 1.28 2022/01/05 20:36:29 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -209,6 +209,9 @@ const BIGNUM *DH_get0_pub_key(const DH *dh); void DH_clear_flags(DH *dh, int flags); int DH_test_flags(const DH *dh, int flags); void DH_set_flags(DH *dh, int flags); +#if defined(LIBRESSL_OPAQUE_DH) || defined(LIBRESSL_CRYPTO_INTERNAL) +long DH_get_length(const DH *dh); +#endif int DH_set_length(DH *dh, long length); /* Deprecated version */ diff --git a/lib/libcrypto/dh/dh_lib.c b/lib/libcrypto/dh/dh_lib.c index 58f01b6e6af..d331e7cd084 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.34 2022/01/05 20:30:16 tb Exp $ */ +/* $OpenBSD: dh_lib.c,v 1.35 2022/01/05 20:36:29 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -355,6 +355,12 @@ DH_set_flags(DH *dh, int flags) dh->flags |= flags; } +long +DH_get_length(const DH *dh) +{ + return dh->length; +} + int DH_set_length(DH *dh, long length) { -- 2.20.1