summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2022-01-05 20:36:30 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2022-01-05 20:36:30 +0000
commit73545937c91d640f188995daf388493333ea48e7 (patch)
treefe0b55392c1828b5153dd978c821de08bb021c1c
parent51560d245a6f75825eddac9be621c1827ed86c9f (diff)
Prepare to provide DH_get_length()
Will be needed by openssl(1) dhparam. ok inoguchi jsing
-rw-r--r--lib/libcrypto/dh/dh.h5
-rw-r--r--lib/libcrypto/dh/dh_lib.c8
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)
{