summaryrefslogtreecommitdiff
path: root/lib/libssl/man
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2018-08-27 15:42:40 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2018-08-27 15:42:40 +0000
commit85e325d013739ee133761c95a1209fc808d9dad2 (patch)
tree7cb306721912e219a15518a4ce22c12463231aa7 /lib/libssl/man
parentf15f7cfc720afc12db0a45aaceddbf50dc3dc44d (diff)
Fix formatting and grammatical issues with the description of how to use
i2d_SSL_SESSION. Also rework the example code so that it is clearer and uses more appropriate names. Input from and ok schwarze@, tb@
Diffstat (limited to 'lib/libssl/man')
-rw-r--r--lib/libssl/man/d2i_SSL_SESSION.336
1 files changed, 17 insertions, 19 deletions
diff --git a/lib/libssl/man/d2i_SSL_SESSION.3 b/lib/libssl/man/d2i_SSL_SESSION.3
index 64f84e60522..9c5c2285fa6 100644
--- a/lib/libssl/man/d2i_SSL_SESSION.3
+++ b/lib/libssl/man/d2i_SSL_SESSION.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: d2i_SSL_SESSION.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $
+.\" $OpenBSD: d2i_SSL_SESSION.3,v 1.6 2018/08/27 15:42:39 jsing Exp $
.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\"
.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
@@ -48,7 +48,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: March 27 2018 $
+.Dd $Mdocdate: August 27 2018 $
.Dt D2I_SSL_SESSION 3
.Os
.Sh NAME
@@ -131,31 +131,29 @@ the memory location pointed to by
.Fa pp
must be large enough to hold the binary representation of the session.
There is no known limit on the size of the created ASN1 representation,
-so the necessary amount of space should be obtained by first calling
+so call
.Fn i2d_SSL_SESSION
-with
-.Fa pp Ns
-= Ns
-.Dv NULL ,
-and obtain the size needed, then allocate the memory and call
+first with
+.Fa pp Ns = Ns Dv NULL
+to obtain the encoded size, before allocating the required amount of memory and
+calling
.Fn i2d_SSL_SESSION
again.
Note that this will advance the value contained in
.Fa *pp
so it is necessary to save a copy of the original allocation.
For example:
-.Bd -literal
-int i, j;
+.Bd -literal -offset indent
+char *p, *pp;
+int elen, len;
-char *p, *temp;
-
- i = i2d_SSL_SESSION(sess, NULL);
- p = temp = malloc(i);
- if (temp != NULL) {
- j = i2d_SSL_SESSION(sess, &temp);
- assert(i == j);
- assert(p + i == temp);
- }
+elen = i2d_SSL_SESSION(sess, NULL);
+p = pp = malloc(elen);
+if (p != NULL) {
+ len = i2d_SSL_SESSION(sess, &pp);
+ assert(elen == len);
+ assert(p + len == pp);
+}
.Ed
.Sh RETURN VALUES
.Fn d2i_SSL_SESSION