diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/libcrypto/man/UI_new.3 | 529 |
1 files changed, 0 insertions, 529 deletions
diff --git a/src/lib/libcrypto/man/UI_new.3 b/src/lib/libcrypto/man/UI_new.3 deleted file mode 100644 index e55477f31e..0000000000 --- a/src/lib/libcrypto/man/UI_new.3 +++ /dev/null | |||
@@ -1,529 +0,0 @@ | |||
1 | .\" $OpenBSD: UI_new.3,v 1.13 2025/03/09 15:25:14 tb Exp $ | ||
2 | .\" full merge up to: OpenSSL 78b19e90 Jan 11 00:12:01 2017 +0100 | ||
3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | ||
4 | .\" | ||
5 | .\" This file was written by Richard Levitte <levitte@openssl.org>. | ||
6 | .\" Copyright (c) 2001, 2016, 2017 The OpenSSL Project. All rights reserved. | ||
7 | .\" | ||
8 | .\" Redistribution and use in source and binary forms, with or without | ||
9 | .\" modification, are permitted provided that the following conditions | ||
10 | .\" are met: | ||
11 | .\" | ||
12 | .\" 1. Redistributions of source code must retain the above copyright | ||
13 | .\" notice, this list of conditions and the following disclaimer. | ||
14 | .\" | ||
15 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
16 | .\" notice, this list of conditions and the following disclaimer in | ||
17 | .\" the documentation and/or other materials provided with the | ||
18 | .\" distribution. | ||
19 | .\" | ||
20 | .\" 3. All advertising materials mentioning features or use of this | ||
21 | .\" software must display the following acknowledgment: | ||
22 | .\" "This product includes software developed by the OpenSSL Project | ||
23 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
24 | .\" | ||
25 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
26 | .\" endorse or promote products derived from this software without | ||
27 | .\" prior written permission. For written permission, please contact | ||
28 | .\" openssl-core@openssl.org. | ||
29 | .\" | ||
30 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
31 | .\" nor may "OpenSSL" appear in their names without prior written | ||
32 | .\" permission of the OpenSSL Project. | ||
33 | .\" | ||
34 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
35 | .\" acknowledgment: | ||
36 | .\" "This product includes software developed by the OpenSSL Project | ||
37 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
38 | .\" | ||
39 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
40 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
41 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
42 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
43 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
44 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
45 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
46 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
47 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
48 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
51 | .\" | ||
52 | .Dd $Mdocdate: March 9 2025 $ | ||
53 | .Dt UI_NEW 3 | ||
54 | .Os | ||
55 | .Sh NAME | ||
56 | .Nm UI_new , | ||
57 | .Nm UI_new_method , | ||
58 | .Nm UI_free , | ||
59 | .Nm UI_add_input_string , | ||
60 | .Nm UI_dup_input_string , | ||
61 | .Nm UI_add_verify_string , | ||
62 | .Nm UI_dup_verify_string , | ||
63 | .Nm UI_add_input_boolean , | ||
64 | .Nm UI_dup_input_boolean , | ||
65 | .Nm UI_add_info_string , | ||
66 | .Nm UI_dup_info_string , | ||
67 | .Nm UI_add_error_string , | ||
68 | .Nm UI_dup_error_string , | ||
69 | .Nm UI_construct_prompt , | ||
70 | .Nm UI_add_user_data , | ||
71 | .Nm UI_get0_user_data , | ||
72 | .Nm UI_get0_result , | ||
73 | .Nm UI_process , | ||
74 | .Nm UI_ctrl , | ||
75 | .Nm UI_set_default_method , | ||
76 | .Nm UI_get_default_method , | ||
77 | .Nm UI_get_method , | ||
78 | .Nm UI_set_method , | ||
79 | .Nm UI_OpenSSL , | ||
80 | .Nm UI_null | ||
81 | .Nd New User Interface | ||
82 | .Sh SYNOPSIS | ||
83 | .In openssl/ui.h | ||
84 | .Ft UI * | ||
85 | .Fn UI_new void | ||
86 | .Ft UI * | ||
87 | .Fo UI_new_method | ||
88 | .Fa "const UI_METHOD *method" | ||
89 | .Fc | ||
90 | .Ft void | ||
91 | .Fo UI_free | ||
92 | .Fa "UI *ui" | ||
93 | .Fc | ||
94 | .Ft int | ||
95 | .Fo UI_add_input_string | ||
96 | .Fa "UI *ui" | ||
97 | .Fa "const char *prompt" | ||
98 | .Fa "int flags" | ||
99 | .Fa "char *result_buf" | ||
100 | .Fa "int minsize" | ||
101 | .Fa "int maxsize" | ||
102 | .Fc | ||
103 | .Ft int | ||
104 | .Fo UI_dup_input_string | ||
105 | .Fa "UI *ui" | ||
106 | .Fa "const char *prompt" | ||
107 | .Fa "int flags" | ||
108 | .Fa "char *result_buf" | ||
109 | .Fa "int minsize" | ||
110 | .Fa "int maxsize" | ||
111 | .Fc | ||
112 | .Ft int | ||
113 | .Fo UI_add_verify_string | ||
114 | .Fa "UI *ui" | ||
115 | .Fa "const char *prompt" | ||
116 | .Fa "int flags" | ||
117 | .Fa "char *result_buf" | ||
118 | .Fa "int minsize" | ||
119 | .Fa "int maxsize" | ||
120 | .Fa "const char *test_buf" | ||
121 | .Fc | ||
122 | .Ft int | ||
123 | .Fo UI_dup_verify_string | ||
124 | .Fa "UI *ui" | ||
125 | .Fa "const char *prompt" | ||
126 | .Fa "int flags" | ||
127 | .Fa "char *result_buf" | ||
128 | .Fa "int minsize" | ||
129 | .Fa "int maxsize" | ||
130 | .Fa "const char *test_buf" | ||
131 | .Fc | ||
132 | .Ft int | ||
133 | .Fo UI_add_input_boolean | ||
134 | .Fa "UI *ui" | ||
135 | .Fa "const char *prompt" | ||
136 | .Fa "const char *action_desc" | ||
137 | .Fa "const char *ok_chars" | ||
138 | .Fa "const char *cancel_chars" | ||
139 | .Fa "int flags" | ||
140 | .Fa "char *result_buf" | ||
141 | .Fc | ||
142 | .Ft int | ||
143 | .Fo UI_dup_input_boolean | ||
144 | .Fa "UI *ui" | ||
145 | .Fa "const char *prompt" | ||
146 | .Fa "const char *action_desc" | ||
147 | .Fa "const char *ok_chars" | ||
148 | .Fa "const char *cancel_chars" | ||
149 | .Fa "int flags" | ||
150 | .Fa "char *result_buf" | ||
151 | .Fc | ||
152 | .Ft int | ||
153 | .Fo UI_add_info_string | ||
154 | .Fa "UI *ui" | ||
155 | .Fa "const char *text" | ||
156 | .Fc | ||
157 | .Ft int | ||
158 | .Fo UI_dup_info_string | ||
159 | .Fa "UI *ui" | ||
160 | .Fa "const char *text" | ||
161 | .Fc | ||
162 | .Ft int | ||
163 | .Fo UI_add_error_string | ||
164 | .Fa "UI *ui" | ||
165 | .Fa "const char *text" | ||
166 | .Fc | ||
167 | .Ft int | ||
168 | .Fo UI_dup_error_string | ||
169 | .Fa "UI *ui" | ||
170 | .Fa "const char *text" | ||
171 | .Fc | ||
172 | .Fd /* These are the possible flags. They can be OR'ed together. */ | ||
173 | .Fd #define UI_INPUT_FLAG_ECHO 0x01 | ||
174 | .Fd #define UI_INPUT_FLAG_DEFAULT_PWD 0x02 | ||
175 | .Ft char * | ||
176 | .Fo UI_construct_prompt | ||
177 | .Fa "UI *ui_method" | ||
178 | .Fa "const char *object_desc" | ||
179 | .Fa "const char *object_name" | ||
180 | .Fc | ||
181 | .Ft void * | ||
182 | .Fo UI_add_user_data | ||
183 | .Fa "UI *ui" | ||
184 | .Fa "void *user_data" | ||
185 | .Fc | ||
186 | .Ft void * | ||
187 | .Fo UI_get0_user_data | ||
188 | .Fa "UI *ui" | ||
189 | .Fc | ||
190 | .Ft const char * | ||
191 | .Fo UI_get0_result | ||
192 | .Fa "UI *ui" | ||
193 | .Fa "int i" | ||
194 | .Fc | ||
195 | .Ft int | ||
196 | .Fo UI_process | ||
197 | .Fa "UI *ui" | ||
198 | .Fc | ||
199 | .Ft int | ||
200 | .Fo UI_ctrl | ||
201 | .Fa "UI *ui" | ||
202 | .Fa "int cmd" | ||
203 | .Fa "long i" | ||
204 | .Fa "void *p" | ||
205 | .Fa "void (*f)()" | ||
206 | .Fc | ||
207 | .Fd #define UI_CTRL_PRINT_ERRORS 1 | ||
208 | .Fd #define UI_CTRL_IS_REDOABLE 2 | ||
209 | .Ft void | ||
210 | .Fo UI_set_default_method | ||
211 | .Fa "const UI_METHOD *meth" | ||
212 | .Fc | ||
213 | .Ft const UI_METHOD * | ||
214 | .Fo UI_get_default_method | ||
215 | .Fa void | ||
216 | .Fc | ||
217 | .Ft const UI_METHOD * | ||
218 | .Fo UI_get_method | ||
219 | .Fa "UI *ui" | ||
220 | .Fc | ||
221 | .Ft const UI_METHOD * | ||
222 | .Fo UI_set_method | ||
223 | .Fa "UI *ui" | ||
224 | .Fa "const UI_METHOD *meth" | ||
225 | .Fc | ||
226 | .Ft const UI_METHOD * | ||
227 | .Fo UI_OpenSSL | ||
228 | .Fa void | ||
229 | .Fc | ||
230 | .Ft const UI_METHOD * | ||
231 | .Fo UI_null | ||
232 | .Fa void | ||
233 | .Fc | ||
234 | .Sh DESCRIPTION | ||
235 | UI stands for User Interface, and is a general purpose set of routines | ||
236 | to prompt the user for text-based information. | ||
237 | Through user-written methods (see | ||
238 | .Xr UI_create_method 3 ) , | ||
239 | prompting can be done in any way imaginable, be it plain text prompting, | ||
240 | through dialog boxes or from a cell phone. | ||
241 | .Pp | ||
242 | All the functions work through a context of the type | ||
243 | .Vt UI . | ||
244 | This context contains all the information needed to prompt correctly | ||
245 | as well as a reference to a | ||
246 | .Vt UI_METHOD , | ||
247 | which is an ordered vector of functions that carry out the actual | ||
248 | prompting. | ||
249 | .Pp | ||
250 | The first thing to do is to create a | ||
251 | .Vt UI | ||
252 | with | ||
253 | .Fn UI_new | ||
254 | or | ||
255 | .Fn UI_new_method , | ||
256 | then add information to it with the | ||
257 | .Fn UI_add_* | ||
258 | or | ||
259 | .Fn UI_dup_* | ||
260 | functions. | ||
261 | Also, user-defined random data can be passed down to the underlying | ||
262 | method through calls to | ||
263 | .Fn UI_add_user_data . | ||
264 | The default UI method doesn't care about these data, but other methods | ||
265 | might. | ||
266 | Finally, use | ||
267 | .Fn UI_process | ||
268 | to actually perform the prompting and | ||
269 | .Fn UI_get0_result | ||
270 | to find the result to the prompt. | ||
271 | .Pp | ||
272 | A | ||
273 | .Vt UI | ||
274 | can contain more than one prompt, which are performed in the given | ||
275 | sequence. | ||
276 | Each prompt gets an index number which is returned by the | ||
277 | .Fn UI_add_* | ||
278 | and | ||
279 | .Fn UI_dup_* | ||
280 | functions, and has to be used to get the corresponding result with | ||
281 | .Fn UI_get0_result . | ||
282 | .Pp | ||
283 | The functions are as follows: | ||
284 | .Pp | ||
285 | .Fn UI_new | ||
286 | creates a new | ||
287 | .Vt UI | ||
288 | using the default UI method. | ||
289 | When done with this UI, it should be freed using | ||
290 | .Fn UI_free . | ||
291 | .Pp | ||
292 | .Fn UI_new_method | ||
293 | creates a new | ||
294 | .Vt UI | ||
295 | using the given UI method. | ||
296 | When done with this UI, it should be freed using | ||
297 | .Fn UI_free . | ||
298 | .Pp | ||
299 | .Fn UI_OpenSSL | ||
300 | returns the built-in UI method (note: not necessarily the default one, | ||
301 | since the default can be changed. | ||
302 | See further on). | ||
303 | This method is the most machine/OS dependent part of OpenSSL and | ||
304 | normally generates the most problems when porting. | ||
305 | .Pp | ||
306 | .Fn UI_null | ||
307 | returns a UI method that does nothing. | ||
308 | Its use is to avoid getting internal defaults for passed | ||
309 | .Vt UI_METHOD | ||
310 | pointers. | ||
311 | .Pp | ||
312 | .Fn UI_free | ||
313 | removes | ||
314 | .Fa ui | ||
315 | from memory, along with all other pieces of memory that are connected | ||
316 | to it, like duplicated input strings, results and others. | ||
317 | If | ||
318 | .Fa ui | ||
319 | is a | ||
320 | .Dv NULL | ||
321 | pointer, no action occurs. | ||
322 | .Pp | ||
323 | .Fn UI_add_input_string | ||
324 | and | ||
325 | .Fn UI_add_verify_string | ||
326 | add a prompt to | ||
327 | .Fa ui , | ||
328 | as well as flags and a result buffer and the desired minimum and | ||
329 | maximum sizes of the result, not counting the final NUL character. | ||
330 | The given information is used to prompt for information, for example | ||
331 | a password, and to verify a password (i.e. having the user enter | ||
332 | it twice and check that the same string was entered twice). | ||
333 | .Fn UI_add_verify_string | ||
334 | takes an extra argument that should be a pointer to the result buffer | ||
335 | of the input string that it's supposed to verify, or verification will | ||
336 | fail. | ||
337 | .Pp | ||
338 | .Fn UI_add_input_boolean | ||
339 | adds a prompt to | ||
340 | .Fa ui | ||
341 | that's supposed to be answered in a boolean way, with a single | ||
342 | character for yes and a different character for no. | ||
343 | A set of characters that can be used to cancel the prompt is given as | ||
344 | well. | ||
345 | The prompt itself is really divided in two, one part being the | ||
346 | descriptive text (given through the | ||
347 | .Fa prompt | ||
348 | argument) and one describing the possible answers (given through the | ||
349 | .Fa action_desc | ||
350 | argument). | ||
351 | .Pp | ||
352 | .Fn UI_add_info_string | ||
353 | and | ||
354 | .Fn UI_add_error_string | ||
355 | add strings that are shown at the same time as the prompt for extra | ||
356 | information or to show an error string. | ||
357 | The difference between the two is only conceptual. | ||
358 | With the builtin method, there's no technical difference between them. | ||
359 | Other methods may make a difference between them, however. | ||
360 | .Pp | ||
361 | The flags currently supported are | ||
362 | .Dv UI_INPUT_FLAG_ECHO , | ||
363 | which is relevant for | ||
364 | .Fn UI_add_input_string | ||
365 | and will have the users response be echoed (when prompting for a | ||
366 | password, this flag should obviously not be used), and | ||
367 | .Dv UI_INPUT_FLAG_DEFAULT_PWD , | ||
368 | which means that a default password of some sort will be used | ||
369 | (completely depending on the application and the UI method). | ||
370 | .Pp | ||
371 | .Fn UI_dup_input_string , | ||
372 | .Fn UI_dup_verify_string , | ||
373 | .Fn UI_dup_input_boolean , | ||
374 | .Fn UI_dup_info_string , | ||
375 | and | ||
376 | .Fn UI_dup_error_string | ||
377 | are basically the same as their | ||
378 | .Fn UI_add_* | ||
379 | counterparts, except that they make their own copies of all strings. | ||
380 | .Pp | ||
381 | .Fn UI_construct_prompt | ||
382 | is a helper function that can be used to create a prompt from two pieces | ||
383 | of information: a description and a name. | ||
384 | The default constructor (if there is none provided by the method used) | ||
385 | creates a string "Enter | ||
386 | .Em description | ||
387 | for | ||
388 | .Em name Ns :". | ||
389 | With the description "pass phrase" and the file name "foo.key", that | ||
390 | becomes "Enter pass phrase for foo.key:". Other methods may create | ||
391 | whatever string and may include encodings that will be processed by the | ||
392 | other method functions. | ||
393 | .Pp | ||
394 | .Fn UI_add_user_data | ||
395 | adds a user data pointer for the method to use at any time. | ||
396 | The builtin UI method doesn't care about this info. | ||
397 | Note that several calls to this function doesn't add data - | ||
398 | the previous blob is replaced with the one given as argument. | ||
399 | .Pp | ||
400 | .Fn UI_get0_user_data | ||
401 | retrieves the data that has last been given to the | ||
402 | .Fa ui | ||
403 | with | ||
404 | .Fn UI_add_user_data . | ||
405 | .Pp | ||
406 | .Fn UI_get0_result | ||
407 | returns a pointer to the result buffer associated with the information | ||
408 | indexed by | ||
409 | .Fa i . | ||
410 | .Pp | ||
411 | .Fn UI_process | ||
412 | goes through the information given so far, does all the printing and | ||
413 | prompting and returns the final status, which is -2 on out-of-band | ||
414 | events (Interrupt, Cancel, ...), -1 on error, or 0 on success. | ||
415 | .Pp | ||
416 | .Fn UI_ctrl | ||
417 | adds extra control for the application author. | ||
418 | For now, it understands two commands: | ||
419 | .Dv UI_CTRL_PRINT_ERRORS , | ||
420 | which makes | ||
421 | .Fn UI_process | ||
422 | print the OpenSSL error stack as part of processing the | ||
423 | .Fa ui , | ||
424 | and | ||
425 | .Dv UI_CTRL_IS_REDOABLE , | ||
426 | which returns a flag saying if the used | ||
427 | .Fa ui | ||
428 | can be used again or not. | ||
429 | .Pp | ||
430 | .Fn UI_set_default_method | ||
431 | changes the default UI method to the one given. | ||
432 | This function is not thread-safe and should not be called at the | ||
433 | same time as other OpenSSL functions. | ||
434 | .Pp | ||
435 | .Fn UI_get_default_method | ||
436 | returns a pointer to the current default UI method. | ||
437 | .Pp | ||
438 | .Fn UI_get_method | ||
439 | returns the UI method associated with a given | ||
440 | .Fa ui . | ||
441 | .Pp | ||
442 | .Fn UI_set_method | ||
443 | changes the UI method associated with a given | ||
444 | .Fa ui . | ||
445 | .Sh RETURN VALUES | ||
446 | .Fn UI_new | ||
447 | and | ||
448 | .Fn UI_new_method | ||
449 | return a valid | ||
450 | .Vt UI | ||
451 | structure or | ||
452 | .Dv NULL | ||
453 | if an error occurred. | ||
454 | .Pp | ||
455 | .Fn UI_add_input_string , | ||
456 | .Fn UI_dup_input_string , | ||
457 | .Fn UI_add_verify_string , | ||
458 | .Fn UI_dup_verify_string , | ||
459 | .Fn UI_add_input_boolean , | ||
460 | .Fn UI_dup_input_boolean , | ||
461 | .Fn UI_add_info_string , | ||
462 | .Fn UI_dup_info_string , | ||
463 | .Fn UI_add_error_string , | ||
464 | and | ||
465 | .Fn UI_dup_error_string | ||
466 | return a positive number on success or a number | ||
467 | less than or equal to zero otherwise. | ||
468 | .Pp | ||
469 | .Fn UI_construct_prompt | ||
470 | and | ||
471 | .Fn UI_get0_result | ||
472 | return a string or | ||
473 | .Dv NULL | ||
474 | if an error occurred. | ||
475 | .Pp | ||
476 | .Fn UI_add_user_data | ||
477 | and | ||
478 | .Fn UI_get0_user_data | ||
479 | return a pointer to the user data that was contained in | ||
480 | .Fa ui | ||
481 | before the call. | ||
482 | In particular, | ||
483 | .Dv NULL | ||
484 | is a valid return value. | ||
485 | .Pp | ||
486 | .Fn UI_process | ||
487 | returns 0 on success or a negative value on error. | ||
488 | .Pp | ||
489 | .Fn UI_ctrl | ||
490 | returns a mask on success or \-1 on error. | ||
491 | .Pp | ||
492 | .Fn UI_get_default_method , | ||
493 | .Fn UI_OpenSSL | ||
494 | and | ||
495 | .Fn UI_null | ||
496 | always return a pointer to a valid | ||
497 | .Vt UI_METHOD | ||
498 | structure. | ||
499 | .Pp | ||
500 | .Fn UI_get_method | ||
501 | and | ||
502 | .Fn UI_set_method | ||
503 | return a pointer to the | ||
504 | .Vt UI_METHOD | ||
505 | structure that is installed in | ||
506 | .Fa ui | ||
507 | after the call. | ||
508 | The OpenSSL documentation says that they can fail and return | ||
509 | .Dv NULL , | ||
510 | but currently, this can only happen when and after | ||
511 | .Fn UI_set_method | ||
512 | is called with an explicit | ||
513 | .Dv NULL | ||
514 | argument. | ||
515 | .Sh SEE ALSO | ||
516 | .Xr crypto 3 , | ||
517 | .Xr UI_create_method 3 , | ||
518 | .Xr UI_get_string_type 3 | ||
519 | .Sh HISTORY | ||
520 | These functions first appeared in OpenSSL 0.9.7 | ||
521 | and have been available since | ||
522 | .Ox 3.2 . | ||
523 | .Pp | ||
524 | .Fn UI_null | ||
525 | first appeared in OpenSSL 1.1.1 and has been available since | ||
526 | .Ox 7.3 . | ||
527 | .Sh AUTHORS | ||
528 | .An Richard Levitte Aq Mt richard@levitte.org | ||
529 | for the OpenSSL project. | ||