]>
Commit | Line | Data |
---|---|---|
0f113f3e | 1 | /* |
aa6bb135 | 2 | * Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved. |
a63d5eaa | 3 | * |
aa6bb135 RS |
4 | * Licensed under the OpenSSL license (the "License"). You may not use |
5 | * this file except in compliance with the License. You can obtain a copy | |
6 | * in the file LICENSE in the source distribution or at | |
7 | * https://www.openssl.org/source/license.html | |
a63d5eaa RL |
8 | */ |
9 | ||
10 | #ifndef HEADER_UI_LOCL_H | |
0f113f3e MC |
11 | # define HEADER_UI_LOCL_H |
12 | ||
13 | # include <openssl/ui.h> | |
14 | # include <openssl/crypto.h> | |
15 | ||
16 | # ifdef _ | |
17 | # undef _ | |
18 | # endif | |
19 | ||
20 | struct ui_method_st { | |
21 | char *name; | |
22 | /* | |
23 | * All the functions return 1 or non-NULL for success and 0 or NULL for | |
24 | * failure | |
25 | */ | |
26 | /* | |
27 | * Open whatever channel for this, be it the console, an X window or | |
28 | * whatever. This function should use the ex_data structure to save | |
29 | * intermediate data. | |
30 | */ | |
31 | int (*ui_open_session) (UI *ui); | |
32 | int (*ui_write_string) (UI *ui, UI_STRING *uis); | |
33 | /* | |
34 | * Flush the output. If a GUI dialog box is used, this function can be | |
35 | * used to actually display it. | |
36 | */ | |
37 | int (*ui_flush) (UI *ui); | |
38 | int (*ui_read_string) (UI *ui, UI_STRING *uis); | |
39 | int (*ui_close_session) (UI *ui); | |
40 | /* | |
41 | * Construct a prompt in a user-defined manner. object_desc is a textual | |
42 | * short description of the object, for example "pass phrase", and | |
43 | * object_name is the name of the object (might be a card name or a file | |
44 | * name. The returned string shall always be allocated on the heap with | |
45 | * OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). | |
46 | */ | |
47 | char *(*ui_construct_prompt) (UI *ui, const char *object_desc, | |
48 | const char *object_name); | |
49 | }; | |
50 | ||
51 | struct ui_string_st { | |
52 | enum UI_string_types type; /* Input */ | |
53 | const char *out_string; /* Input */ | |
54 | int input_flags; /* Flags from the user */ | |
55 | /* | |
56 | * The following parameters are completely irrelevant for UIT_INFO, and | |
57 | * can therefore be set to 0 or NULL | |
58 | */ | |
59 | char *result_buf; /* Input and Output: If not NULL, | |
60 | * user-defined with size in result_maxsize. | |
61 | * Otherwise, it may be allocated by the UI | |
62 | * routine, meaning result_minsize is going | |
63 | * to be overwritten. */ | |
64 | union { | |
65 | struct { | |
66 | int result_minsize; /* Input: minimum required size of the | |
67 | * result. */ | |
68 | int result_maxsize; /* Input: maximum permitted size of the | |
69 | * result */ | |
70 | const char *test_buf; /* Input: test string to verify against */ | |
71 | } string_data; | |
72 | struct { | |
73 | const char *action_desc; /* Input */ | |
74 | const char *ok_chars; /* Input */ | |
75 | const char *cancel_chars; /* Input */ | |
76 | } boolean_data; | |
77 | } _; | |
78 | ||
79 | # define OUT_STRING_FREEABLE 0x01 | |
80 | int flags; /* flags for internal use */ | |
81 | }; | |
82 | ||
83 | struct ui_st { | |
84 | const UI_METHOD *meth; | |
85 | STACK_OF(UI_STRING) *strings; /* We might want to prompt for more than | |
86 | * one thing at a time, and with different | |
87 | * echoing status. */ | |
88 | void *user_data; | |
89 | CRYPTO_EX_DATA ex_data; | |
90 | # define UI_FLAG_REDOABLE 0x0001 | |
91 | # define UI_FLAG_PRINT_ERRORS 0x0100 | |
92 | int flags; | |
41cfbccc AG |
93 | |
94 | CRYPTO_RWLOCK *lock; | |
0f113f3e | 95 | }; |
a63d5eaa RL |
96 | |
97 | #endif |