From 57addcd0b71c631a06928fd0b33117f9d0c597fa Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 20 Feb 2018 18:01:42 +0000 Subject: [PATCH] Provide DH_set_length() ok jsing --- lib/libcrypto/Symbols.list | 1 + lib/libcrypto/dh/dh.h | 3 ++- lib/libcrypto/dh/dh_lib.c | 11 ++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list index d13279d3fc0..885d5fb111d 100644 --- a/lib/libcrypto/Symbols.list +++ b/lib/libcrypto/Symbols.list @@ -776,6 +776,7 @@ DH_set0_pqg DH_set_default_method DH_set_ex_data DH_set_flags +DH_set_length DH_set_method DH_size DH_test_flags diff --git a/lib/libcrypto/dh/dh.h b/lib/libcrypto/dh/dh.h index 8e31d7542e7..a5e686b21ae 100644 --- a/lib/libcrypto/dh/dh.h +++ b/lib/libcrypto/dh/dh.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dh.h,v 1.23 2018/02/20 17:59:31 tb Exp $ */ +/* $OpenBSD: dh.h,v 1.24 2018/02/20 18:01:42 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -197,6 +197,7 @@ int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key); 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); +int DH_set_length(DH *dh, long length); /* Deprecated version */ #ifndef OPENSSL_NO_DEPRECATED diff --git a/lib/libcrypto/dh/dh_lib.c b/lib/libcrypto/dh/dh_lib.c index ade6ace4871..856d32c1b60 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.27 2018/02/20 17:59:31 tb Exp $ */ +/* $OpenBSD: dh_lib.c,v 1.28 2018/02/20 18:01:42 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#include #include #include @@ -324,3 +325,11 @@ DH_set_flags(DH *dh, int flags) { dh->flags |= flags; } + +int +DH_set_length(DH *dh, long length) +{ + if (length < 0 || length > INT_MAX) + dh->length = length; + return 1; +} -- 2.20.1