From 5d59ae970232332300c3000304bffba78ec1d017 Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 20 Feb 2018 17:38:15 +0000 Subject: [PATCH] Provide DH_{clear,set,test}_flags(). ok jsing --- lib/libcrypto/Symbols.list | 3 +++ lib/libcrypto/dh/dh.h | 5 ++++- lib/libcrypto/dh/dh_lib.c | 20 +++++++++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list index 2252220278c..5a5df4702b8 100644 --- a/lib/libcrypto/Symbols.list +++ b/lib/libcrypto/Symbols.list @@ -755,6 +755,7 @@ DES_xcbc_encrypt DH_OpenSSL DH_check DH_check_pub_key +DH_clear_flags DH_compute_key DH_free DH_generate_key @@ -771,8 +772,10 @@ DH_set0_key DH_set0_pqg DH_set_default_method DH_set_ex_data +DH_set_flags DH_set_method DH_size +DH_test_flags DH_up_ref DHparams_dup DHparams_it diff --git a/lib/libcrypto/dh/dh.h b/lib/libcrypto/dh/dh.h index f1c51850eb5..39e8d093e56 100644 --- a/lib/libcrypto/dh/dh.h +++ b/lib/libcrypto/dh/dh.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dh.h,v 1.21 2018/02/18 14:58:12 tb Exp $ */ +/* $OpenBSD: dh.h,v 1.22 2018/02/20 17:38:15 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -193,6 +193,9 @@ void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g); void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key); 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); /* Deprecated version */ #ifndef OPENSSL_NO_DEPRECATED diff --git a/lib/libcrypto/dh/dh_lib.c b/lib/libcrypto/dh/dh_lib.c index bb2ca426a0c..e5e8b9146b9 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.25 2018/02/18 14:58:12 tb Exp $ */ +/* $OpenBSD: dh_lib.c,v 1.26 2018/02/20 17:38:15 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -300,3 +300,21 @@ DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key) return 1; } + +void +DH_clear_flags(DH *dh, int flags) +{ + dh->flags &= ~flags; +} + +int +DH_test_flags(const DH *dh, int flags) +{ + return dh->flags & flags; +} + +void +DH_set_flags(DH *dh, int flags) +{ + dh->flags |= flags; +} -- 2.20.1