diff options
author | schwarze <> | 2016-12-26 15:36:18 +0000 |
---|---|---|
committer | schwarze <> | 2016-12-26 15:36:18 +0000 |
commit | 14b2889eb360f84951861c14bd3a80c2fd701017 (patch) | |
tree | d8cb91dbe8cc4d0779f9d2a1578adf03a9ceb1e8 | |
parent | 184bac77338d562f8106b14d90eeebe2a0d55850 (diff) | |
download | openbsd-14b2889eb360f84951861c14bd3a80c2fd701017.tar.gz openbsd-14b2889eb360f84951861c14bd3a80c2fd701017.tar.bz2 openbsd-14b2889eb360f84951861c14bd3a80c2fd701017.zip |
describe what happens for val_out == NULL and for der_out == NULL
-rw-r--r-- | src/lib/libcrypto/man/ASN1_item_d2i.3 | 29 |
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, | |||
151 | is advanced to the byte following the parsed data. | 151 | is advanced to the byte following the parsed data. |
152 | .Pp | 152 | .Pp |
153 | If decoding succeeds and | 153 | If decoding succeeds and |
154 | .Fa val_out | ||
155 | or | ||
154 | .Pf * Fa val_out | 156 | .Pf * Fa val_out |
155 | is | 157 | is |
156 | .Dv NULL , | 158 | .Dv NULL , |
@@ -189,13 +191,18 @@ respectively. | |||
189 | encodes the object pointed to by | 191 | encodes the object pointed to by |
190 | .Fa val_in | 192 | .Fa val_in |
191 | into DER format. | 193 | into DER format. |
194 | .Pp | ||
192 | If | 195 | If |
193 | .Fa der_out | 196 | .Pf * Fa der_out |
194 | is not | 197 | is not |
195 | .Dv NULL , | 198 | .Dv NULL , |
196 | it writes the DER-encoded data to the buffer at | 199 | it writes the DER-encoded data to the buffer at |
197 | .Pf * Fa der_out | 200 | .Pf * Fa der_out |
198 | and increments it to point after the data just written. | 201 | and increments it to point after the data just written. |
202 | In this case, it is the responsibility of the user to make sure | ||
203 | that the buffer pointed to by | ||
204 | .Pf * Fa der_out | ||
205 | is long enough, such that no buffer owerflow can occur. | ||
199 | .Pp | 206 | .Pp |
200 | If | 207 | If |
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 |
206 | is not incremented, but points to the start of the data just written. | 213 | is not incremented, but points to the start of the data just written. |
207 | .Pp | 214 | .Pp |
215 | If | ||
216 | .Fa der_out | ||
217 | is | ||
218 | .Dv NULL , | ||
219 | the encoded bytes are not written anywhere but discarded. | ||
220 | For | ||
221 | .Fa val_in | ||
222 | objects of variable encoding size, this is sometimes used to first | ||
223 | find the number of bytes that will be written. | ||
224 | Then, a sufficient amount of memory is allocated before calling | ||
225 | .Fn ASN1_item_i2d | ||
226 | again. | ||
227 | This explicit double-call technique is often not needed because the | ||
228 | auto-allocation technique described in the previous paragraph can | ||
229 | be used. | ||
230 | .Pp | ||
208 | .Fn ASN1_item_i2d_bio | 231 | .Fn ASN1_item_i2d_bio |
209 | and | 232 | and |
210 | .Fn ASN1_item_i2d_fp | 233 | .Fn ASN1_item_i2d_fp |