-.\" $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>
.\"
.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
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
.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 .
.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.