From b03cfb739ae124714cb1b839bde443a8c3d4d4b8 Mon Sep 17 00:00:00 2001 From: schwarze Date: Wed, 14 Dec 2022 20:27:28 +0000 Subject: [PATCH] In asn1.h rev. 1.71 and 1.72, jsing@ and tb@ provided ASN1_buf_print(3). Document it. --- lib/libcrypto/man/ASN1_bn_print.3 | 5 ++- lib/libcrypto/man/ASN1_buf_print.3 | 70 ++++++++++++++++++++++++++++++ lib/libcrypto/man/BIO_new.3 | 5 ++- lib/libcrypto/man/Makefile | 3 +- 4 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 lib/libcrypto/man/ASN1_buf_print.3 diff --git a/lib/libcrypto/man/ASN1_bn_print.3 b/lib/libcrypto/man/ASN1_bn_print.3 index 75944917de1..45e5721196a 100644 --- a/lib/libcrypto/man/ASN1_bn_print.3 +++ b/lib/libcrypto/man/ASN1_bn_print.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ASN1_bn_print.3,v 1.1 2021/12/08 21:52:29 schwarze Exp $ +.\" $OpenBSD: ASN1_bn_print.3,v 1.2 2022/12/14 20:27:28 schwarze Exp $ .\" .\" Copyright (c) 2021 Ingo Schwarze .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: December 8 2021 $ +.Dd $Mdocdate: December 14 2022 $ .Dt ASN1_BN_PRINT 3 .Os .Sh NAME @@ -105,6 +105,7 @@ is a pointer. It returns 0 if printing fails. .Sh SEE ALSO +.Xr ASN1_buf_print 3 , .Xr BIO_new 3 , .Xr BIO_write 3 , .Xr BN_is_negative 3 , diff --git a/lib/libcrypto/man/ASN1_buf_print.3 b/lib/libcrypto/man/ASN1_buf_print.3 new file mode 100644 index 00000000000..12ee84adac5 --- /dev/null +++ b/lib/libcrypto/man/ASN1_buf_print.3 @@ -0,0 +1,70 @@ +.\" $OpenBSD: ASN1_buf_print.3,v 1.1 2022/12/14 20:27:28 schwarze Exp $ +.\" +.\" Copyright (c) 2022 Ingo Schwarze +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: December 14 2022 $ +.Dt ASN1_BUF_PRINT 3 +.Os +.Sh NAME +.Nm ASN1_buf_print +.Nd pretty-print a byte array +.Sh SYNOPSIS +.In openssl/asn1.h +.Ft int +.Fo ASN1_buf_print +.Fa "BIO *bio_out" +.Fa "const unsigned char *buf" +.Fa "size_t buflen" +.Fa "int indent" +.Fc +.Sh DESCRIPTION +.Fn ASN1_buf_print +prints a hexadecimal representation of the first +.Fa buflen +bytes from +.Fa buf +to +.Fa bio_out . +Despite its name and the header file, +this function has nothing to do with ASN.1. +.Pp +Each byte from +.Fa buf +is represented by two lower-case hexadecimal digits. +Fifteen pairs of digits are printed per output line, +or at most fifteen on the last output line. +Every output line including the last one ends with a newline character. +Every pair except the last is followed by a colon +.Pq Sq \&: . +If +.Fa indent +is greater than zero, +every output line is indented by +.Fa indent +space characters, but not by more than 64 characters. +.Sh RETURN VALUES +.Fn ASN1_buf_print +returns 1 if successful or 0 if printing fails. +.Sh SEE ALSO +.Xr ASN1_bn_print 3 , +.Xr ASN1_item_print 3 , +.Xr ASN1_STRING_print_ex 3 , +.Xr ASN1_TIME_print 3 , +.Xr BIO_new 3 , +.Xr BIO_write 3 +.Sh HISTORY +.Fn ASN1_buf_print +first appeared in OpenSSL 1.1.0 and has been available since +.Ox 7.3 . diff --git a/lib/libcrypto/man/BIO_new.3 b/lib/libcrypto/man/BIO_new.3 index 17f5a708e8e..53dee2c60aa 100644 --- a/lib/libcrypto/man/BIO_new.3 +++ b/lib/libcrypto/man/BIO_new.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: BIO_new.3,v 1.22 2021/11/27 16:18:03 schwarze Exp $ +.\" $OpenBSD: BIO_new.3,v 1.23 2022/12/14 20:27:28 schwarze Exp $ .\" full merge up to: .\" OpenSSL man3/BIO_new.pod fb46be03 Feb 26 11:51:31 2016 +0000 .\" OpenSSL man7/bio.pod 631c37be Dec 12 16:56:50 2017 +0100 @@ -52,7 +52,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: November 27 2021 $ +.Dd $Mdocdate: December 14 2022 $ .Dt BIO_NEW 3 .Os .Sh NAME @@ -228,6 +228,7 @@ Create a memory BIO: .Pp .Dl BIO *mem = BIO_new(BIO_s_mem()); .Sh SEE ALSO +.Xr ASN1_buf_print 3 , .Xr BIO_ctrl 3 , .Xr BIO_dump 3 , .Xr BIO_f_asn1 3 , diff --git a/lib/libcrypto/man/Makefile b/lib/libcrypto/man/Makefile index 88f1a05f7e2..12e4212215d 100644 --- a/lib/libcrypto/man/Makefile +++ b/lib/libcrypto/man/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.238 2022/11/21 22:04:04 schwarze Exp $ +# $OpenBSD: Makefile,v 1.239 2022/12/14 20:27:28 schwarze Exp $ .include @@ -19,6 +19,7 @@ MAN= \ ASN1_TYPE_get.3 \ ASN1_UNIVERSALSTRING_to_string.3 \ ASN1_bn_print.3 \ + ASN1_buf_print.3 \ ASN1_generate_nconf.3 \ ASN1_get_object.3 \ ASN1_item_d2i.3 \ -- 2.20.1