summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschwarze <>2021-11-20 11:49:08 +0000
committerschwarze <>2021-11-20 11:49:08 +0000
commit4b108bfbfda44e8f98286b5d9745118b1d989f59 (patch)
tree3a404c4e7498b8c59d241043b36791e6dabb9044 /src
parent945f084e2204432f02dc67409d640c082c7d12b1 (diff)
downloadopenbsd-4b108bfbfda44e8f98286b5d9745118b1d989f59.tar.gz
openbsd-4b108bfbfda44e8f98286b5d9745118b1d989f59.tar.bz2
openbsd-4b108bfbfda44e8f98286b5d9745118b1d989f59.zip
Improve the description of ASN1_OCTET_STRING_cmp(3),
ASN1_OCTET_STRING_dup(3), and ASN1_OCTET_STRING_set(3). Explicitly say that they do not provide any type safety and explain what that means.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/ASN1_STRING_length.349
1 files changed, 37 insertions, 12 deletions
diff --git a/src/lib/libcrypto/man/ASN1_STRING_length.3 b/src/lib/libcrypto/man/ASN1_STRING_length.3
index da0d7468c3..83b6ffdd2f 100644
--- a/src/lib/libcrypto/man/ASN1_STRING_length.3
+++ b/src/lib/libcrypto/man/ASN1_STRING_length.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_STRING_length.3,v 1.26 2021/11/15 16:18:36 schwarze Exp $ 1.\" $OpenBSD: ASN1_STRING_length.3,v 1.27 2021/11/20 11:49:08 schwarze Exp $
2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: November 15 2021 $ 69.Dd $Mdocdate: November 20 2021 $
70.Dt ASN1_STRING_LENGTH 3 70.Dt ASN1_STRING_LENGTH 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -160,13 +160,16 @@ These functions manipulate
160structures. 160structures.
161.Pp 161.Pp
162.Fn ASN1_STRING_cmp 162.Fn ASN1_STRING_cmp
163and 163compares the type, the length, and the content of
164.Fn ASN1_OCTET_STRING_cmp
165compare the type, the length, and the content of
166.Fa a 164.Fa a
167and 165and
168.Fa b . 166.Fa b .
169.Pp 167.Pp
168.Fn ASN1_OCTET_STRING_cmp
169does exactly the same as
170.Fn ASN1_STRING_cmp
171without providing any type safety.
172.Pp
170.Fn ASN1_STRING_data 173.Fn ASN1_STRING_data
171is similar to 174is similar to
172.Fn ASN1_STRING_get0_data 175.Fn ASN1_STRING_get0_data
@@ -177,10 +180,16 @@ Applications should use
177instead. 180instead.
178.Pp 181.Pp
179.Fn ASN1_STRING_dup 182.Fn ASN1_STRING_dup
180and 183allocates a new
184.Vt ASN1_STRING
185object and copies the type, length, data, and flags from
186.Fa a
187into it.
188.Pp
181.Fn ASN1_OCTET_STRING_dup 189.Fn ASN1_OCTET_STRING_dup
182copy 190does exactly the same as
183.Fa a . 191.Fn ASN1_STRING_dup
192without providing any type safety.
184.Pp 193.Pp
185.Fn ASN1_STRING_get0_data 194.Fn ASN1_STRING_get0_data
186returns an internal pointer to the data of 195returns an internal pointer to the data of
@@ -211,13 +220,11 @@ bytes, and sets the data attribute to
211transferring ownership, without doing any validation. 220transferring ownership, without doing any validation.
212.Pp 221.Pp
213.Fn ASN1_STRING_set 222.Fn ASN1_STRING_set
214and 223sets the length attribute of
215.Fn ASN1_OCTET_STRING_set
216set the length attribute of
217.Fa str 224.Fa str
218to 225to
219.Fa len 226.Fa len
220and copy that number of bytes from 227and copies that number of bytes from
221.Fa data 228.Fa data
222into 229into
223.Fa str , 230.Fa str ,
@@ -238,6 +245,11 @@ remains uninitialized; that is not considered an error unless
238.Fa len 245.Fa len
239is negative. 246is negative.
240.Pp 247.Pp
248.Fn ASN1_OCTET_STRING_set
249does exactly the same as
250.Fn ASN1_STRING_set
251without providing any type safety.
252.Pp
241.Fn ASN1_STRING_copy 253.Fn ASN1_STRING_copy
242copies the length and data of 254copies the length and data of
243.Fa src 255.Fa src
@@ -422,3 +434,16 @@ first appeared in OpenSSL 1.0.0 and has been available since
422.Fn ASN1_STRING_get0_data 434.Fn ASN1_STRING_get0_data
423first appeared in OpenSSL 1.1.0 and has been available since 435first appeared in OpenSSL 1.1.0 and has been available since
424.Ox 6.3 . 436.Ox 6.3 .
437.Sh BUGS
438.Fn ASN1_OCTET_STRING_cmp ,
439.Fn ASN1_OCTET_STRING_dup ,
440and
441.Fn ASN1_OCTET_STRING_set
442do not check whether their arguments are really of the type
443.Dv V_ASN1_OCTET_STRING .
444They may report success even if their arguments are of a wrong type.
445Consequently, even in case of success, the return value of
446.Fn ASN1_OCTET_STRING_dup
447is not guaranteed to be of the type
448.Dv V_ASN1_OCTET_STRING
449either.