diff options
author | jsing <> | 2018-08-27 15:42:39 +0000 |
---|---|---|
committer | jsing <> | 2018-08-27 15:42:39 +0000 |
commit | efb4b7d294563bb79e9a64739754b78928308802 (patch) | |
tree | a97408710115a9034fea0ec1c9b9df7996f094f9 /src | |
parent | ca38cb83a45306d2c43cf255009ccdddf2edf4b9 (diff) | |
download | openbsd-efb4b7d294563bb79e9a64739754b78928308802.tar.gz openbsd-efb4b7d294563bb79e9a64739754b78928308802.tar.bz2 openbsd-efb4b7d294563bb79e9a64739754b78928308802.zip |
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 'src')
-rw-r--r-- | src/lib/libssl/man/d2i_SSL_SESSION.3 | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/lib/libssl/man/d2i_SSL_SESSION.3 b/src/lib/libssl/man/d2i_SSL_SESSION.3 index 64f84e6052..9c5c2285fa 100644 --- a/src/lib/libssl/man/d2i_SSL_SESSION.3 +++ b/src/lib/libssl/man/d2i_SSL_SESSION.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: d2i_SSL_SESSION.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_SSL_SESSION.3,v 1.6 2018/08/27 15:42:39 jsing Exp $ |
2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
3 | .\" | 3 | .\" |
4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. | 4 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>. |
@@ -48,7 +48,7 @@ | |||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
50 | .\" | 50 | .\" |
51 | .Dd $Mdocdate: March 27 2018 $ | 51 | .Dd $Mdocdate: August 27 2018 $ |
52 | .Dt D2I_SSL_SESSION 3 | 52 | .Dt D2I_SSL_SESSION 3 |
53 | .Os | 53 | .Os |
54 | .Sh NAME | 54 | .Sh NAME |
@@ -131,31 +131,29 @@ the memory location pointed to by | |||
131 | .Fa pp | 131 | .Fa pp |
132 | must be large enough to hold the binary representation of the session. | 132 | must be large enough to hold the binary representation of the session. |
133 | There is no known limit on the size of the created ASN1 representation, | 133 | There is no known limit on the size of the created ASN1 representation, |
134 | so the necessary amount of space should be obtained by first calling | 134 | so call |
135 | .Fn i2d_SSL_SESSION | 135 | .Fn i2d_SSL_SESSION |
136 | with | 136 | first with |
137 | .Fa pp Ns | 137 | .Fa pp Ns = Ns Dv NULL |
138 | = Ns | 138 | to obtain the encoded size, before allocating the required amount of memory and |
139 | .Dv NULL , | 139 | calling |
140 | and obtain the size needed, then allocate the memory and call | ||
141 | .Fn i2d_SSL_SESSION | 140 | .Fn i2d_SSL_SESSION |
142 | again. | 141 | again. |
143 | Note that this will advance the value contained in | 142 | Note that this will advance the value contained in |
144 | .Fa *pp | 143 | .Fa *pp |
145 | so it is necessary to save a copy of the original allocation. | 144 | so it is necessary to save a copy of the original allocation. |
146 | For example: | 145 | For example: |
147 | .Bd -literal | 146 | .Bd -literal -offset indent |
148 | int i, j; | 147 | char *p, *pp; |
148 | int elen, len; | ||
149 | 149 | ||
150 | char *p, *temp; | 150 | elen = i2d_SSL_SESSION(sess, NULL); |
151 | 151 | p = pp = malloc(elen); | |
152 | i = i2d_SSL_SESSION(sess, NULL); | 152 | if (p != NULL) { |
153 | p = temp = malloc(i); | 153 | len = i2d_SSL_SESSION(sess, &pp); |
154 | if (temp != NULL) { | 154 | assert(elen == len); |
155 | j = i2d_SSL_SESSION(sess, &temp); | 155 | assert(p + len == pp); |
156 | assert(i == j); | 156 | } |
157 | assert(p + i == temp); | ||
158 | } | ||
159 | .Ed | 157 | .Ed |
160 | .Sh RETURN VALUES | 158 | .Sh RETURN VALUES |
161 | .Fn d2i_SSL_SESSION | 159 | .Fn d2i_SSL_SESSION |