summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2023-04-21 13:08:17 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2023-04-21 13:08:17 +0000
commit3278fcd1b069d086e850315d027164ba342e07d5 (patch)
tree03ade188c813baab0746a6a20e57ef64d6b3403d /lib
parentf34ea446994f5f651c45aa79850a44f64db906a3 (diff)
s2i_ASN1_INTEGER: make error conditions more explicit, a few more tweaks
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/man/s2i_ASN1_INTEGER.328
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/libcrypto/man/s2i_ASN1_INTEGER.3 b/lib/libcrypto/man/s2i_ASN1_INTEGER.3
index dd990ff7f13..39257d4a132 100644
--- a/lib/libcrypto/man/s2i_ASN1_INTEGER.3
+++ b/lib/libcrypto/man/s2i_ASN1_INTEGER.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: s2i_ASN1_INTEGER.3,v 1.3 2023/04/21 12:28:47 tb Exp $
+.\" $OpenBSD: s2i_ASN1_INTEGER.3,v 1.4 2023/04/21 13:08:16 tb Exp $
.\"
.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
.\"
@@ -67,7 +67,7 @@ and
.Vt ASN1_OCTET_STRING
objects.
They are primarily used internally for parsing configuration files and
-displaying of X.509v3 certificate extensions.
+displaying X.509v3 certificate extensions.
With the exception of
.Fn i2s_ASN1_ENUMERATED_TABLE ,
these functions ignore the
@@ -94,14 +94,15 @@ Decimal representation is used if the number has less than 128 bits,
otherwise hexadecimal representation is used to avoid excessive conversion cost.
.Pp
.Fn s2i_ASN1_INTEGER
-converts a NUL-terminated decimal or hexadecimal string representation of
-an integer into an
+converts the NUL-terminated decimal or hexadecimal string representation of
+an integer in
+.Fa value
+into an
.Vt ASN1_INTEGER
object.
A sign prefix of
.Sq -
-indicates a negative number
-and
+indicates a negative number and the base prefixes
.Sq 0x
and
.Sq 0X
@@ -169,18 +170,24 @@ arguments have strings configured in their usr_data field:
.Fn i2s_ASN1_INTEGER ,
and
.Fn i2s_ASN1_OCTET_STRING
-return a NUL-terminated string, or NULL on error,
-usually memory allocation failure.
+return a NUL-terminated string, or NULL on memory allocation failure.
.Pp
.Fn s2i_ASN1_INTEGER
returns an
.Vt ASN1_INTEGER ,
or NULL on error.
+Error conditions are memory allocation failure or if
+.Fa value
+is not a valid decimal or hexadecimal encoding of an integer.
.Pp
.Fn s2i_ASN1_OCTET_STRING
returns an
.Vt ASN1_OCTET_STRING ,
or NULL on error.
+Error conditions are memory allocation failure or if
+.Fa value
+contains an odd number of hexadecimal digits or anything except
+colons between pairs of hexadecimal digits.
.Pp
Error codes can sometimes be obtained by
.Xr ERR_get_error 3 .
@@ -195,5 +202,6 @@ have been available since
.Ox 2.6 .
.Sh BUGS
Of these functions at least
-.Fn s2i_ASN1_OCTET_STRING
-can succeed while setting an error and fail without setting an error.
+.Fn i2s_ASN1_ENUMERATED_TABLE
+can succeed while setting an error and fail without setting an error
+on the error stack.