diff options
Diffstat (limited to 'src/lib/libcrypto/man/BN_bn2bin.3')
-rw-r--r-- | src/lib/libcrypto/man/BN_bn2bin.3 | 237 |
1 files changed, 237 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/BN_bn2bin.3 b/src/lib/libcrypto/man/BN_bn2bin.3 new file mode 100644 index 0000000000..02d6b2c8b8 --- /dev/null +++ b/src/lib/libcrypto/man/BN_bn2bin.3 | |||
@@ -0,0 +1,237 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_BN2BIN 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_bn2bin , | ||
6 | .Nm BN_bin2bn , | ||
7 | .Nm BN_bn2hex , | ||
8 | .Nm BN_bn2dec , | ||
9 | .Nm BN_hex2bn , | ||
10 | .Nm BN_dec2bn , | ||
11 | .Nm BN_print , | ||
12 | .Nm BN_print_fp , | ||
13 | .Nm BN_bn2mpi , | ||
14 | .Nm BN_mpi2bn | ||
15 | .Nd format conversions | ||
16 | .Sh SYNOPSIS | ||
17 | .In openssl/bn.h | ||
18 | .Ft int | ||
19 | .Fo BN_bn2bin | ||
20 | .Fa "const BIGNUM *a" | ||
21 | .Fa "unsigned char *to" | ||
22 | .Fc | ||
23 | .Ft BIGNUM * | ||
24 | .Fo BN_bin2bn | ||
25 | .Fa "const unsigned char *s" | ||
26 | .Fa "int len" | ||
27 | .Fa "BIGNUM *ret" | ||
28 | .Fc | ||
29 | .Ft char * | ||
30 | .Fo BN_bn2hex | ||
31 | .Fa "const BIGNUM *a" | ||
32 | .Fc | ||
33 | .Ft char * | ||
34 | .Fo BN_bn2dec | ||
35 | .Fa "const BIGNUM *a" | ||
36 | .Fc | ||
37 | .Ft int | ||
38 | .Fo BN_hex2bn | ||
39 | .Fa "BIGNUM **a" | ||
40 | .Fa "const char *str" | ||
41 | .Fc | ||
42 | .Ft int | ||
43 | .Fo BN_dec2bn | ||
44 | .Fa "BIGNUM **a" | ||
45 | .Fa "const char *str" | ||
46 | .Fc | ||
47 | .Ft int | ||
48 | .Fo BN_print | ||
49 | .Fa "BIO *fp" | ||
50 | .Fa "const BIGNUM *a" | ||
51 | .Fc | ||
52 | .Ft int | ||
53 | .Fo BN_print_fp | ||
54 | .Fa "FILE *fp" | ||
55 | .Fa "const BIGNUM *a" | ||
56 | .Fc | ||
57 | .Ft int | ||
58 | .Fo BN_bn2mpi | ||
59 | .Fa "const BIGNUM *a" | ||
60 | .Fa "unsigned char *to" | ||
61 | .Fc | ||
62 | .Ft BIGNUM * | ||
63 | .Fo BN_mpi2bn | ||
64 | .Fa "unsigned char *s" | ||
65 | .Fa "int len" | ||
66 | .Fa "BIGNUM *ret" | ||
67 | .Fc | ||
68 | .Sh DESCRIPTION | ||
69 | .Fn BN_bn2bin | ||
70 | converts the absolute value of | ||
71 | .Fa a | ||
72 | into big-endian form and stores it at | ||
73 | .Fa to . | ||
74 | .Fa to | ||
75 | must point to | ||
76 | .Fn BN_num_bytes a | ||
77 | bytes of memory. | ||
78 | .Pp | ||
79 | .Fn BN_bin2bn | ||
80 | converts the positive integer in big-endian form of length | ||
81 | .Fa len | ||
82 | at | ||
83 | .Fa s | ||
84 | into a | ||
85 | .Vt BIGNUM | ||
86 | and places it in | ||
87 | .Fa ret . | ||
88 | If | ||
89 | .Fa ret | ||
90 | is | ||
91 | .Dv NULL , | ||
92 | a new | ||
93 | .Vt BIGNUM | ||
94 | is created. | ||
95 | .Pp | ||
96 | .Fn BN_bn2hex | ||
97 | and | ||
98 | .Fn BN_bn2dec | ||
99 | return printable strings containing the hexadecimal and decimal encoding of | ||
100 | .Fa a | ||
101 | respectively. | ||
102 | For negative numbers, the string is prefaced with a leading minus sign. | ||
103 | The string must be freed later using | ||
104 | .Xr free 3 . | ||
105 | .Pp | ||
106 | .Fn BN_hex2bn | ||
107 | converts the string | ||
108 | .Fa str | ||
109 | containing a hexadecimal number to a | ||
110 | .Vt BIGNUM | ||
111 | and stores it in | ||
112 | .Pf * Fa a . | ||
113 | If | ||
114 | .Pf * Fa a | ||
115 | is | ||
116 | .Dv NULL , | ||
117 | a new | ||
118 | .Vt BIGNUM | ||
119 | is created. | ||
120 | If | ||
121 | .Fa a | ||
122 | is | ||
123 | .Dv NULL , | ||
124 | it only computes the number's length in hexadecimal digits. | ||
125 | If the string starts with a minus sign, the number is negative. | ||
126 | .Fn BN_dec2bn | ||
127 | is the same using the decimal system. | ||
128 | .Pp | ||
129 | .Fn BN_print | ||
130 | and | ||
131 | .Fn BN_print_fp | ||
132 | write the hexadecimal encoding of | ||
133 | .Fa a , | ||
134 | with a leading minus sign for negative numbers, to the | ||
135 | .Vt BIO | ||
136 | or | ||
137 | .Vt FILE | ||
138 | .Fa fp . | ||
139 | .Pp | ||
140 | .Fn BN_bn2mpi | ||
141 | and | ||
142 | .Fn BN_mpi2bn | ||
143 | convert | ||
144 | .Vt BIGNUM Ns s | ||
145 | from and to a format that consists of the number's length in bytes | ||
146 | represented as a 4-byte big-endian number, and the number itself in | ||
147 | big-endian format, where the most significant bit signals a negative | ||
148 | number (the representation of numbers with the MSB set is prefixed with | ||
149 | a NUL byte). | ||
150 | .Pp | ||
151 | .Fn BN_bn2mpi | ||
152 | stores the representation of | ||
153 | .Fa a | ||
154 | at | ||
155 | .Fa to , | ||
156 | where | ||
157 | .Fa to | ||
158 | must be large enough to hold the result. | ||
159 | The size can be determined by calling | ||
160 | .Fn BN_bn2mpi a , NULL . | ||
161 | .Pp | ||
162 | .Fn BN_mpi2bn | ||
163 | converts the | ||
164 | .Fa len | ||
165 | bytes long representation at | ||
166 | .Fa s | ||
167 | to a | ||
168 | .Vt BIGNUM | ||
169 | and stores it at | ||
170 | .Fa ret , | ||
171 | or in a newly allocated | ||
172 | .Vt BIGNUM | ||
173 | if | ||
174 | .Fa ret | ||
175 | is | ||
176 | .Dv NULL . | ||
177 | .Sh RETURN VALUES | ||
178 | .Fn BN_bn2bin | ||
179 | returns the length of the big-endian number placed at | ||
180 | .Fa to . | ||
181 | .Fn BN_bin2bn | ||
182 | returns the | ||
183 | .Vt BIGNUM , | ||
184 | or | ||
185 | .Dv NULL | ||
186 | on error. | ||
187 | .Pp | ||
188 | .Fn BN_bn2hex | ||
189 | and | ||
190 | .Fn BN_bn2dec | ||
191 | return a NUL-terminated string, or | ||
192 | .Dv NULL | ||
193 | on error. | ||
194 | .Fn BN_hex2bn | ||
195 | and | ||
196 | .Fn BN_dec2bn | ||
197 | return the number's length in hexadecimal or decimal digits, and 0 on | ||
198 | error. | ||
199 | .Pp | ||
200 | .Fn BN_print_fp | ||
201 | and | ||
202 | .Fn BN_print | ||
203 | return 1 on success, 0 on write errors. | ||
204 | .Pp | ||
205 | .Fn BN_bn2mpi | ||
206 | returns the length of the representation. | ||
207 | .Fn BN_mpi2bn | ||
208 | returns the | ||
209 | .Vt BIGNUM , | ||
210 | or | ||
211 | .Dv NULL | ||
212 | on error. | ||
213 | .Pp | ||
214 | The error codes can be obtained by | ||
215 | .Xr ERR_get_error 3 . | ||
216 | .Sh SEE ALSO | ||
217 | .Xr ASN1_INTEGER_to_BN 3 , | ||
218 | .Xr bn 3 , | ||
219 | .Xr BN_num_bytes 3 , | ||
220 | .Xr BN_zero 3 , | ||
221 | .Xr ERR_get_error 3 | ||
222 | .Sh HISTORY | ||
223 | .Fn BN_bn2bin , | ||
224 | .Fn BN_bin2bn , | ||
225 | .Fn BN_print_fp , | ||
226 | and | ||
227 | .Fn BN_print | ||
228 | are available in all versions of SSLeay and OpenSSL. | ||
229 | .Pp | ||
230 | .Fn BN_bn2hex , | ||
231 | .Fn BN_bn2dec , | ||
232 | .Fn BN_hex2bn , | ||
233 | .Fn BN_dec2bn , | ||
234 | .Fn BN_bn2mpi , | ||
235 | and | ||
236 | .Fn BN_mpi2bn | ||
237 | were added in SSLeay 0.9.0. | ||