-/* $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.
*
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
-/* $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.
*
* [including the GNU Public Licence.]
*/
+#include <limits.h>
#include <stdio.h>
#include <openssl/opensslconf.h>
{
dh->flags |= flags;
}
+
+int
+DH_set_length(DH *dh, long length)
+{
+ if (length < 0 || length > INT_MAX)
+ dh->length = length;
+ return 1;
+}