-.\" $OpenBSD: DH_size.3,v 1.5 2018/02/17 16:59:48 schwarze Exp $
-.\" OpenSSL 4d524e10 Feb 24 11:55:57 2000 +0000
+.\" $OpenBSD: DH_size.3,v 1.6 2018/02/24 15:18:47 schwarze Exp $
+.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\"
-.\" This file was written by Ulf Moeller <ulf@openssl.org>.
-.\" Copyright (c) 2000 The OpenSSL Project. All rights reserved.
+.\" This file was written by Ulf Moeller <ulf@openssl.org>
+.\" and Kurt Roeckx <kurt@roeckx.be>.
+.\" Copyright (c) 2000, 2015 The OpenSSL Project. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: February 17 2018 $
+.Dd $Mdocdate: February 24 2018 $
.Dt DH_SIZE 3
.Os
.Sh NAME
-.Nm DH_size
+.Nm DH_size ,
+.Nm DH_bits
.Nd get Diffie-Hellman prime size
.Sh SYNOPSIS
.In openssl/dh.h
.Ft int
.Fo DH_size
-.Fa "DH *dh"
+.Fa "const DH *dh"
+.Fc
+.Ft int
+.Fo DH_size
+.Fa "const DH *dh"
.Fc
.Sh DESCRIPTION
-This function returns the Diffie-Hellman size in bytes.
+.Fn DH_size
+returns the Diffie-Hellman prime size in bytes.
It can be used to determine how much memory must be allocated for the
shared secret computed by
.Xr DH_compute_key 3 .
.Pp
+.Fn DH_bits
+returns the number of significant bits in the key.
+.Pp
.Fa dh
and
.Fa dh->p
must not be
.Dv NULL .
-.Sh RETURN VALUES
-The size in bytes.
.Sh SEE ALSO
.Xr BN_num_bytes 3 ,
.Xr DH_generate_key 3 ,
.Sh HISTORY
.Fn DH_size
is available in all versions of SSLeay and OpenSSL.
+.Pp
+.Fn DH_bits
+first appeared in OpenSSL 1.1.0.