summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/ASN1_bn_print.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/ASN1_bn_print.3')
-rw-r--r--src/lib/libcrypto/man/ASN1_bn_print.3118
1 files changed, 118 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/ASN1_bn_print.3 b/src/lib/libcrypto/man/ASN1_bn_print.3
new file mode 100644
index 0000000000..75944917de
--- /dev/null
+++ b/src/lib/libcrypto/man/ASN1_bn_print.3
@@ -0,0 +1,118 @@
1.\" $OpenBSD: ASN1_bn_print.3,v 1.1 2021/12/08 21:52:29 schwarze Exp $
2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: December 8 2021 $
18.Dt ASN1_BN_PRINT 3
19.Os
20.Sh NAME
21.Nm ASN1_bn_print
22.Nd pretty-print a BIGNUM object
23.Sh SYNOPSIS
24.In openssl/asn1.h
25.Ft int
26.Fo ASN1_bn_print
27.Fa "BIO *bio_out"
28.Fa "const char *label"
29.Fa "const BIGNUM *bn"
30.Fa "unsigned char *buffer"
31.Fa "int indent"
32.Fc
33.Sh DESCRIPTION
34.Fn ASN1_bn_print
35prints
36.Fa bn
37to
38.Fa bio_out
39in human-readable form.
40Despite its name and the header file,
41this function has nothing to do with ASN.1.
42.Pp
43The caller is responsible for providing a
44.Fa buffer
45that is at least
46.Fn BN_num_bytes bn
47+ 1 bytes long.
48To avoid a buffer overrun, be careful to not forget the
49.Dq plus one .
50It is unspecified what the buffer may contain after the function returns.
51.Pp
52If
53.Fa indent
54is greater than zero,
55.Fa indent
56space characters are printed first, but not more than 128.
57.Pp
58The NUL-terminated
59.Fa label
60is printed next.
61.Pp
62After that, there are three cases:
63.Bl -bullet
64.It
65If
66.Fa bn
67represents the number zero,
68.Qq 0
69is printed.
70.It
71If
72.Fa bn
73can be represented by the data type
74.Vt unsigned long ,
75it is printed in decimal notation,
76followed by hexadecimal notation in parentheses,
77both optionally preceded by a minus sign.
78.It
79Otherwise, the string
80.Qq Pq Negative
81is printed if appropriate, a new output line is started,
82and the indentation is increased by four space characters.
83The bytes of the value of
84.Fa bn
85are then printed in big-endian order, each byte represented
86by a two-digit hexadecimal number,
87and each but the last byte followed by a colon.
88A new output line is started after every group of 15 bytes.
89.El
90.Pp
91Finally, a newline character is printed to end the output.
92.Pp
93If
94.Fa bn
95is a
96.Dv NULL
97pointer, all arguments are ignored and nothing is printed.
98.Sh RETURN VALUES
99.Fn ASN1_bn_print
100returns 1
101if successful or if
102.Fa bn
103is a
104.Dv NULL
105pointer.
106It returns 0 if printing fails.
107.Sh SEE ALSO
108.Xr BIO_new 3 ,
109.Xr BIO_write 3 ,
110.Xr BN_is_negative 3 ,
111.Xr BN_is_zero 3 ,
112.Xr BN_new 3 ,
113.Xr BN_num_bytes 3 ,
114.Xr BN_print 3
115.Sh HISTORY
116.Fn ASN1_bn_print
117first appeared in OpenSSL 1.0.0 and has been available since
118.Ox 4.9 .