From: tb Date: Fri, 21 Apr 2023 13:08:16 +0000 (+0000) Subject: s2i_ASN1_INTEGER: make error conditions more explicit, a few more tweaks X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2fefeda35e640d4ab69d1a443167e80ec81d90c9;p=openbsd s2i_ASN1_INTEGER: make error conditions more explicit, a few more tweaks --- 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 .\" @@ -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.