summaryrefslogtreecommitdiff
path: root/src/lib/libssl/doc/d2i_SSL_SESSION.3
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2016-07-23 19:31:36 +0000
committercvs2svn <admin@example.com>2016-07-23 19:31:36 +0000
commit86c49b31af735796dfde37aa29473a30d36367db (patch)
treee9a354a92a348338fe2b361e2eda703cae23cfab /src/lib/libssl/doc/d2i_SSL_SESSION.3
parent19d5fe348e8926bac4521c5807aa64c45b8f7a41 (diff)
downloadopenbsd-OPENBSD_6_0_BASE.tar.gz
openbsd-OPENBSD_6_0_BASE.tar.bz2
openbsd-OPENBSD_6_0_BASE.zip
This commit was manufactured by cvs2git to create tag 'OPENBSD_6_0_BASE'.OPENBSD_6_0_BASE
Diffstat (limited to 'src/lib/libssl/doc/d2i_SSL_SESSION.3')
-rw-r--r--src/lib/libssl/doc/d2i_SSL_SESSION.3129
1 files changed, 0 insertions, 129 deletions
diff --git a/src/lib/libssl/doc/d2i_SSL_SESSION.3 b/src/lib/libssl/doc/d2i_SSL_SESSION.3
deleted file mode 100644
index ef8a36de79..0000000000
--- a/src/lib/libssl/doc/d2i_SSL_SESSION.3
+++ /dev/null
@@ -1,129 +0,0 @@
1.\"
2.\" $OpenBSD: d2i_SSL_SESSION.3,v 1.2 2014/12/02 14:11:01 jmc Exp $
3.\"
4.Dd $Mdocdate: December 2 2014 $
5.Dt D2I_SSL_SESSION 3
6.Os
7.Sh NAME
8.Nm d2i_SSL_SESSION ,
9.Nm i2d_SSL_SESSION
10.Nd convert SSL_SESSION object from/to ASN1 representation
11.Sh SYNOPSIS
12.In openssl/ssl.h
13.Ft SSL_SESSION *
14.Fn d2i_SSL_SESSION "SSL_SESSION **a" "const unsigned char **pp" "long length"
15.Ft int
16.Fn i2d_SSL_SESSION "SSL_SESSION *in" "unsigned char **pp"
17.Sh DESCRIPTION
18.Fn d2i_SSL_SESSION
19transforms the external ASN1 representation of an SSL/TLS session,
20stored as binary data at location
21.Fa pp
22with length
23.Fa length ,
24into
25an
26.Vt SSL_SESSION
27object.
28.Pp
29.Fn i2d_SSL_SESSION
30transforms the
31.Vt SSL_SESSION
32object
33.Fa in
34into the ASN1 representation and stores it into the memory location pointed to
35by
36.Fa pp .
37The length of the resulting ASN1 representation is returned.
38If
39.Fa pp
40is the
41.Dv NULL
42pointer, only the length is calculated and returned.
43.Sh NOTES
44The
45.Vt SSL_SESSION
46object is built from several
47.Xr malloc 3 Ns
48-ed parts; it can therefore not be moved, copied or stored directly.
49In order to store session data on disk or into a database,
50it must be transformed into a binary ASN1 representation.
51.Pp
52When using
53.Fn d2i_SSL_SESSION ,
54the
55.Vt SSL_SESSION
56object is automatically allocated.
57The reference count is 1, so that the session must be explicitly removed using
58.Xr SSL_SESSION_free 3 ,
59unless the
60.Vt SSL_SESSION
61object is completely taken over, when being called inside the
62.Xr get_session_cb 3
63(see
64.Xr SSL_CTX_sess_set_get_cb 3 ) .
65.Pp
66.Vt SSL_SESSION
67objects keep internal link information about the session cache list when being
68inserted into one
69.Vt SSL_CTX
70object's session cache.
71One
72.Vt SSL_SESSION
73object, regardless of its reference count, must therefore only be used with one
74.Vt SSL_CTX
75object (and the
76.Vt SSL
77objects created from this
78.Vt SSL_CTX
79object).
80.Pp
81When using
82.Fn i2d_SSL_SESSION ,
83the memory location pointed to by
84.Fa pp
85must be large enough to hold the binary representation of the session.
86There is no known limit on the size of the created ASN1 representation,
87so the necessary amount of space should be obtained by first calling
88.Fn i2d_SSL_SESSION
89with
90.Fa pp Ns
91= Ns
92.Dv NULL ,
93and obtain the size needed, then allocate the memory and call
94.Fn i2d_SSL_SESSION
95again.
96Note that this will advance the value contained in
97.Fa *pp
98so it is necessary to save a copy of the original allocation.
99For example:
100.Bd -literal
101int i, j;
102
103char *p, *temp;
104
105 i = i2d_SSL_SESSION(sess, NULL);
106 p = temp = malloc(i);
107 if (temp != NULL) {
108 j = i2d_SSL_SESSION(sess, &temp);
109 assert(i == j);
110 assert(p + i == temp);
111 }
112.Ed
113.Sh RETURN VALUES
114.Fn d2i_SSL_SESSION
115returns a pointer to the newly allocated
116.Vt SSL_SESSION
117object.
118In case of failure a
119.Dv NULL
120pointer is returned and the error message can be retrieved from the error
121stack.
122.Pp
123.Fn i2d_SSL_SESSION
124returns the size of the ASN1 representation in bytes.
125When the session is not valid, 0 is returned and no operation is performed.
126.Sh SEE ALSO
127.Xr ssl 3 ,
128.Xr SSL_CTX_sess_set_get_cb 3 ,
129.Xr SSL_SESSION_free 3