summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschwarze <>2016-12-26 15:36:18 +0000
committerschwarze <>2016-12-26 15:36:18 +0000
commit14b2889eb360f84951861c14bd3a80c2fd701017 (patch)
treed8cb91dbe8cc4d0779f9d2a1578adf03a9ceb1e8 /src
parent184bac77338d562f8106b14d90eeebe2a0d55850 (diff)
downloadopenbsd-14b2889eb360f84951861c14bd3a80c2fd701017.tar.gz
openbsd-14b2889eb360f84951861c14bd3a80c2fd701017.tar.bz2
openbsd-14b2889eb360f84951861c14bd3a80c2fd701017.zip
describe what happens for val_out == NULL and for der_out == NULL
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/ASN1_item_d2i.329
1 files changed, 26 insertions, 3 deletions
diff --git a/src/lib/libcrypto/man/ASN1_item_d2i.3 b/src/lib/libcrypto/man/ASN1_item_d2i.3
index 52707f017a..b20580dba1 100644
--- a/src/lib/libcrypto/man/ASN1_item_d2i.3
+++ b/src/lib/libcrypto/man/ASN1_item_d2i.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_item_d2i.3,v 1.1 2016/12/24 21:42:29 schwarze Exp $ 1.\" $OpenBSD: ASN1_item_d2i.3,v 1.2 2016/12/26 15:36:18 schwarze Exp $
2.\" OpenSSL doc/man3/d2i_X509.pod b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL doc/man3/d2i_X509.pod b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: December 24 2016 $ 68.Dd $Mdocdate: December 26 2016 $
69.Dt ASN1_ITEM_D2I 3 69.Dt ASN1_ITEM_D2I 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -151,6 +151,8 @@ If successful,
151is advanced to the byte following the parsed data. 151is advanced to the byte following the parsed data.
152.Pp 152.Pp
153If decoding succeeds and 153If decoding succeeds and
154.Fa val_out
155or
154.Pf * Fa val_out 156.Pf * Fa val_out
155is 157is
156.Dv NULL , 158.Dv NULL ,
@@ -189,13 +191,18 @@ respectively.
189encodes the object pointed to by 191encodes the object pointed to by
190.Fa val_in 192.Fa val_in
191into DER format. 193into DER format.
194.Pp
192If 195If
193.Fa der_out 196.Pf * Fa der_out
194is not 197is not
195.Dv NULL , 198.Dv NULL ,
196it writes the DER-encoded data to the buffer at 199it writes the DER-encoded data to the buffer at
197.Pf * Fa der_out 200.Pf * Fa der_out
198and increments it to point after the data just written. 201and increments it to point after the data just written.
202In this case, it is the responsibility of the user to make sure
203that the buffer pointed to by
204.Pf * Fa der_out
205is long enough, such that no buffer owerflow can occur.
199.Pp 206.Pp
200If 207If
201.Pf * Fa der_out 208.Pf * Fa der_out
@@ -205,6 +212,22 @@ memory is allocated for a buffer, and
205.Pf * Fa der_out 212.Pf * Fa der_out
206is not incremented, but points to the start of the data just written. 213is not incremented, but points to the start of the data just written.
207.Pp 214.Pp
215If
216.Fa der_out
217is
218.Dv NULL ,
219the encoded bytes are not written anywhere but discarded.
220For
221.Fa val_in
222objects of variable encoding size, this is sometimes used to first
223find the number of bytes that will be written.
224Then, a sufficient amount of memory is allocated before calling
225.Fn ASN1_item_i2d
226again.
227This explicit double-call technique is often not needed because the
228auto-allocation technique described in the previous paragraph can
229be used.
230.Pp
208.Fn ASN1_item_i2d_bio 231.Fn ASN1_item_i2d_bio
209and 232and
210.Fn ASN1_item_i2d_fp 233.Fn ASN1_item_i2d_fp