summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2018-02-20 18:01:42 +0000
committertb <>2018-02-20 18:01:42 +0000
commitaccf1b94b3627d2ed5d78c6638d3d618404a8a2d (patch)
treebdef8812546fe7d01dbcaa4d1153354a8c8e45ec
parentd30e5e15f9a3c998b56789b616020f1019eefbfb (diff)
downloadopenbsd-accf1b94b3627d2ed5d78c6638d3d618404a8a2d.tar.gz
openbsd-accf1b94b3627d2ed5d78c6638d3d618404a8a2d.tar.bz2
openbsd-accf1b94b3627d2ed5d78c6638d3d618404a8a2d.zip
Provide DH_set_length()
ok jsing
-rw-r--r--src/lib/libcrypto/Symbols.list1
-rw-r--r--src/lib/libcrypto/dh/dh.h3
-rw-r--r--src/lib/libcrypto/dh/dh_lib.c11
3 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list
index d13279d3fc..885d5fb111 100644
--- a/src/lib/libcrypto/Symbols.list
+++ b/src/lib/libcrypto/Symbols.list
@@ -776,6 +776,7 @@ DH_set0_pqg
776DH_set_default_method 776DH_set_default_method
777DH_set_ex_data 777DH_set_ex_data
778DH_set_flags 778DH_set_flags
779DH_set_length
779DH_set_method 780DH_set_method
780DH_size 781DH_size
781DH_test_flags 782DH_test_flags
diff --git a/src/lib/libcrypto/dh/dh.h b/src/lib/libcrypto/dh/dh.h
index 8e31d7542e..a5e686b21a 100644
--- a/src/lib/libcrypto/dh/dh.h
+++ b/src/lib/libcrypto/dh/dh.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh.h,v 1.23 2018/02/20 17:59:31 tb Exp $ */ 1/* $OpenBSD: dh.h,v 1.24 2018/02/20 18:01:42 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -197,6 +197,7 @@ int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
197void DH_clear_flags(DH *dh, int flags); 197void DH_clear_flags(DH *dh, int flags);
198int DH_test_flags(const DH *dh, int flags); 198int DH_test_flags(const DH *dh, int flags);
199void DH_set_flags(DH *dh, int flags); 199void DH_set_flags(DH *dh, int flags);
200int DH_set_length(DH *dh, long length);
200 201
201/* Deprecated version */ 202/* Deprecated version */
202#ifndef OPENSSL_NO_DEPRECATED 203#ifndef OPENSSL_NO_DEPRECATED
diff --git a/src/lib/libcrypto/dh/dh_lib.c b/src/lib/libcrypto/dh/dh_lib.c
index ade6ace487..856d32c1b6 100644
--- a/src/lib/libcrypto/dh/dh_lib.c
+++ b/src/lib/libcrypto/dh/dh_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_lib.c,v 1.27 2018/02/20 17:59:31 tb Exp $ */ 1/* $OpenBSD: dh_lib.c,v 1.28 2018/02/20 18:01:42 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -56,6 +56,7 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#include <limits.h>
59#include <stdio.h> 60#include <stdio.h>
60 61
61#include <openssl/opensslconf.h> 62#include <openssl/opensslconf.h>
@@ -324,3 +325,11 @@ DH_set_flags(DH *dh, int flags)
324{ 325{
325 dh->flags |= flags; 326 dh->flags |= flags;
326} 327}
328
329int
330DH_set_length(DH *dh, long length)
331{
332 if (length < 0 || length > INT_MAX)
333 dh->length = length;
334 return 1;
335}