licentivo-launch 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +35 -0
  4. data/ext/launch_native/extconf.rb +28 -0
  5. data/lib/licentivo_launch/vendor/licentivo.rb +262 -0
  6. data/lib/licentivo_launch.rb +352 -0
  7. data/vendor/LICENSE +21 -0
  8. data/vendor/NOTICE +17 -0
  9. data/vendor/VERSION +1 -0
  10. data/vendor/c/app.c +33 -0
  11. data/vendor/c/demo.c +77 -0
  12. data/vendor/c/feature_tasks.h +72 -0
  13. data/vendor/c/licentivo.c +382 -0
  14. data/vendor/c/licentivo.h +67 -0
  15. data/vendor/c/quickstart.c +51 -0
  16. data/vendor/c/test_vectors.c +4 -0
  17. data/vendor/c/vendor/Monocypher-LICENCE.md +173 -0
  18. data/vendor/c/vendor/cJSON-LICENSE +20 -0
  19. data/vendor/c/vendor/cJSON.c +3191 -0
  20. data/vendor/c/vendor/cJSON.h +306 -0
  21. data/vendor/c/vendor/monocypher-ed25519.c +500 -0
  22. data/vendor/c/vendor/monocypher-ed25519.h +140 -0
  23. data/vendor/c/vendor/monocypher.c +2956 -0
  24. data/vendor/c/vendor/monocypher.h +321 -0
  25. data/vendor/curl/COPYING.txt +22 -0
  26. data/vendor/curl/bin/libcurl-x64.dll +0 -0
  27. data/vendor/curl/include/brotli/decode.h +409 -0
  28. data/vendor/curl/include/brotli/encode.h +505 -0
  29. data/vendor/curl/include/brotli/port.h +302 -0
  30. data/vendor/curl/include/brotli/shared_dictionary.h +100 -0
  31. data/vendor/curl/include/brotli/types.h +83 -0
  32. data/vendor/curl/include/curl/curl.h +3374 -0
  33. data/vendor/curl/include/curl/curlver.h +77 -0
  34. data/vendor/curl/include/curl/easy.h +123 -0
  35. data/vendor/curl/include/curl/header.h +74 -0
  36. data/vendor/curl/include/curl/mprintf.h +85 -0
  37. data/vendor/curl/include/curl/multi.h +561 -0
  38. data/vendor/curl/include/curl/options.h +70 -0
  39. data/vendor/curl/include/curl/stdcheaders.h +35 -0
  40. data/vendor/curl/include/curl/system.h +399 -0
  41. data/vendor/curl/include/curl/typecheck-gcc.h +964 -0
  42. data/vendor/curl/include/curl/urlapi.h +156 -0
  43. data/vendor/curl/include/curl/websockets.h +98 -0
  44. data/vendor/curl/include/libpsl.h +207 -0
  45. data/vendor/curl/include/libssh2.h +1516 -0
  46. data/vendor/curl/include/libssh2_publickey.h +128 -0
  47. data/vendor/curl/include/libssh2_sftp.h +382 -0
  48. data/vendor/curl/include/nghttp2/nghttp2.h +6878 -0
  49. data/vendor/curl/include/nghttp2/nghttp2ver.h +42 -0
  50. data/vendor/curl/include/nghttp3/nghttp3.h +3704 -0
  51. data/vendor/curl/include/nghttp3/version.h +46 -0
  52. data/vendor/curl/include/ngtcp2/ngtcp2.h +7485 -0
  53. data/vendor/curl/include/ngtcp2/ngtcp2_crypto.h +1071 -0
  54. data/vendor/curl/include/ngtcp2/ngtcp2_crypto_quictls.h +147 -0
  55. data/vendor/curl/include/ngtcp2/version.h +51 -0
  56. data/vendor/curl/include/openssl/aes.h +120 -0
  57. data/vendor/curl/include/openssl/asn1.h +1121 -0
  58. data/vendor/curl/include/openssl/asn1t.h +996 -0
  59. data/vendor/curl/include/openssl/bio.h +716 -0
  60. data/vendor/curl/include/openssl/blowfish.h +106 -0
  61. data/vendor/curl/include/openssl/bn.h +480 -0
  62. data/vendor/curl/include/openssl/buffer.h +102 -0
  63. data/vendor/curl/include/openssl/camellia.h +121 -0
  64. data/vendor/curl/include/openssl/cast.h +99 -0
  65. data/vendor/curl/include/openssl/chacha.h +54 -0
  66. data/vendor/curl/include/openssl/cmac.h +81 -0
  67. data/vendor/curl/include/openssl/cms.h +541 -0
  68. data/vendor/curl/include/openssl/comp.h +7 -0
  69. data/vendor/curl/include/openssl/conf.h +189 -0
  70. data/vendor/curl/include/openssl/crypto.h +458 -0
  71. data/vendor/curl/include/openssl/ct.h +567 -0
  72. data/vendor/curl/include/openssl/curve25519.h +104 -0
  73. data/vendor/curl/include/openssl/des.h +215 -0
  74. data/vendor/curl/include/openssl/dh.h +245 -0
  75. data/vendor/curl/include/openssl/dsa.h +263 -0
  76. data/vendor/curl/include/openssl/dtls1.h +107 -0
  77. data/vendor/curl/include/openssl/ec.h +675 -0
  78. data/vendor/curl/include/openssl/ecdh.h +6 -0
  79. data/vendor/curl/include/openssl/ecdsa.h +6 -0
  80. data/vendor/curl/include/openssl/engine.h +215 -0
  81. data/vendor/curl/include/openssl/err.h +325 -0
  82. data/vendor/curl/include/openssl/evp.h +1288 -0
  83. data/vendor/curl/include/openssl/hkdf.h +65 -0
  84. data/vendor/curl/include/openssl/hmac.h +101 -0
  85. data/vendor/curl/include/openssl/idea.h +99 -0
  86. data/vendor/curl/include/openssl/kdf.h +137 -0
  87. data/vendor/curl/include/openssl/lhash.h +179 -0
  88. data/vendor/curl/include/openssl/md4.h +105 -0
  89. data/vendor/curl/include/openssl/md5.h +99 -0
  90. data/vendor/curl/include/openssl/mlkem.h +236 -0
  91. data/vendor/curl/include/openssl/modes.h +118 -0
  92. data/vendor/curl/include/openssl/obj_mac.h +4646 -0
  93. data/vendor/curl/include/openssl/objects.h +137 -0
  94. data/vendor/curl/include/openssl/ocsp.h +484 -0
  95. data/vendor/curl/include/openssl/opensslconf.h +16 -0
  96. data/vendor/curl/include/openssl/opensslfeatures.h +153 -0
  97. data/vendor/curl/include/openssl/opensslv.h +18 -0
  98. data/vendor/curl/include/openssl/ossl_typ.h +196 -0
  99. data/vendor/curl/include/openssl/pem.h +542 -0
  100. data/vendor/curl/include/openssl/pkcs12.h +284 -0
  101. data/vendor/curl/include/openssl/pkcs7.h +523 -0
  102. data/vendor/curl/include/openssl/poly1305.h +45 -0
  103. data/vendor/curl/include/openssl/posix_time.h +54 -0
  104. data/vendor/curl/include/openssl/rand.h +118 -0
  105. data/vendor/curl/include/openssl/rc2.h +101 -0
  106. data/vendor/curl/include/openssl/rc4.h +88 -0
  107. data/vendor/curl/include/openssl/ripemd.h +107 -0
  108. data/vendor/curl/include/openssl/rsa.h +603 -0
  109. data/vendor/curl/include/openssl/safestack.h +1739 -0
  110. data/vendor/curl/include/openssl/sha.h +190 -0
  111. data/vendor/curl/include/openssl/sm3.h +49 -0
  112. data/vendor/curl/include/openssl/sm4.h +47 -0
  113. data/vendor/curl/include/openssl/srtp.h +148 -0
  114. data/vendor/curl/include/openssl/ssl.h +2336 -0
  115. data/vendor/curl/include/openssl/ssl3.h +441 -0
  116. data/vendor/curl/include/openssl/stack.h +99 -0
  117. data/vendor/curl/include/openssl/tls1.h +764 -0
  118. data/vendor/curl/include/openssl/ts.h +660 -0
  119. data/vendor/curl/include/openssl/txt_db.h +112 -0
  120. data/vendor/curl/include/openssl/ui.h +397 -0
  121. data/vendor/curl/include/openssl/x509.h +1037 -0
  122. data/vendor/curl/include/openssl/x509_vfy.h +464 -0
  123. data/vendor/curl/include/openssl/x509v3.h +1039 -0
  124. data/vendor/curl/include/zconf.h +206 -0
  125. data/vendor/curl/include/zdict.h +481 -0
  126. data/vendor/curl/include/zlib.h +1859 -0
  127. data/vendor/curl/include/zlib_name_mangling.h +8 -0
  128. data/vendor/curl/include/zstd.h +3198 -0
  129. data/vendor/curl/include/zstd_errors.h +107 -0
  130. data/vendor/curl/lib/libcurl.dll.a +0 -0
  131. data/vendor/curl/licenses/brotli/LICENSE.txt +19 -0
  132. data/vendor/curl/licenses/certdata/LICENSE.url +2 -0
  133. data/vendor/curl/licenses/libpsl/COPYING.txt +20 -0
  134. data/vendor/curl/licenses/libressl/COPYING.txt +133 -0
  135. data/vendor/curl/licenses/libssh2/COPYING.txt +43 -0
  136. data/vendor/curl/licenses/nghttp2/COPYING.txt +23 -0
  137. data/vendor/curl/licenses/nghttp3/COPYING.txt +22 -0
  138. data/vendor/curl/licenses/ngtcp2/COPYING.txt +22 -0
  139. data/vendor/curl/licenses/psl/LICENSE.txt +373 -0
  140. data/vendor/curl/licenses/trurl/COPYING.txt +22 -0
  141. data/vendor/curl/licenses/zlibng/LICENSE.md +19 -0
  142. data/vendor/curl/licenses/zstd/LICENSE.txt +30 -0
  143. metadata +205 -0
@@ -0,0 +1,112 @@
1
+ /* $OpenBSD: txt_db.h,v 1.9 2014/07/10 22:45:58 jsing Exp $ */
2
+ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3
+ * All rights reserved.
4
+ *
5
+ * This package is an SSL implementation written
6
+ * by Eric Young (eay@cryptsoft.com).
7
+ * The implementation was written so as to conform with Netscapes SSL.
8
+ *
9
+ * This library is free for commercial and non-commercial use as long as
10
+ * the following conditions are aheared to. The following conditions
11
+ * apply to all code found in this distribution, be it the RC4, RSA,
12
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13
+ * included with this distribution is covered by the same copyright terms
14
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15
+ *
16
+ * Copyright remains Eric Young's, and as such any Copyright notices in
17
+ * the code are not to be removed.
18
+ * If this package is used in a product, Eric Young should be given attribution
19
+ * as the author of the parts of the library used.
20
+ * This can be in the form of a textual message at program startup or
21
+ * in documentation (online or textual) provided with the package.
22
+ *
23
+ * Redistribution and use in source and binary forms, with or without
24
+ * modification, are permitted provided that the following conditions
25
+ * are met:
26
+ * 1. Redistributions of source code must retain the copyright
27
+ * notice, this list of conditions and the following disclaimer.
28
+ * 2. Redistributions in binary form must reproduce the above copyright
29
+ * notice, this list of conditions and the following disclaimer in the
30
+ * documentation and/or other materials provided with the distribution.
31
+ * 3. All advertising materials mentioning features or use of this software
32
+ * must display the following acknowledgement:
33
+ * "This product includes cryptographic software written by
34
+ * Eric Young (eay@cryptsoft.com)"
35
+ * The word 'cryptographic' can be left out if the rouines from the library
36
+ * being used are not cryptographic related :-).
37
+ * 4. If you include any Windows specific code (or a derivative thereof) from
38
+ * the apps directory (application code) you must include an acknowledgement:
39
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40
+ *
41
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51
+ * SUCH DAMAGE.
52
+ *
53
+ * The licence and distribution terms for any publically available version or
54
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
55
+ * copied and put under another distribution licence
56
+ * [including the GNU Public Licence.]
57
+ */
58
+
59
+ #ifndef HEADER_TXT_DB_H
60
+ #define HEADER_TXT_DB_H
61
+
62
+ #include <openssl/opensslconf.h>
63
+
64
+ #ifndef OPENSSL_NO_BIO
65
+ #include <openssl/bio.h>
66
+ #endif
67
+ #include <openssl/stack.h>
68
+ #include <openssl/lhash.h>
69
+
70
+ #define DB_ERROR_OK 0
71
+ #define DB_ERROR_MALLOC 1
72
+ #define DB_ERROR_INDEX_CLASH 2
73
+ #define DB_ERROR_INDEX_OUT_OF_RANGE 3
74
+ #define DB_ERROR_NO_INDEX 4
75
+ #define DB_ERROR_INSERT_INDEX_CLASH 5
76
+
77
+ #ifdef __cplusplus
78
+ extern "C" {
79
+ #endif
80
+
81
+ typedef OPENSSL_STRING *OPENSSL_PSTRING;
82
+ DECLARE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)
83
+
84
+ typedef struct txt_db_st {
85
+ int num_fields;
86
+ STACK_OF(OPENSSL_PSTRING) *data;
87
+ LHASH_OF(OPENSSL_STRING) **index;
88
+ int (**qual)(OPENSSL_STRING *);
89
+ long error;
90
+ long arg1;
91
+ long arg2;
92
+ OPENSSL_STRING *arg_row;
93
+ } TXT_DB;
94
+
95
+ #ifndef OPENSSL_NO_BIO
96
+ TXT_DB *TXT_DB_read(BIO *in, int num);
97
+ long TXT_DB_write(BIO *out, TXT_DB *db);
98
+ #else
99
+ TXT_DB *TXT_DB_read(char *in, int num);
100
+ long TXT_DB_write(char *out, TXT_DB *db);
101
+ #endif
102
+ int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(OPENSSL_STRING *),
103
+ LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp);
104
+ void TXT_DB_free(TXT_DB *db);
105
+ OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, OPENSSL_STRING *value);
106
+ int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value);
107
+
108
+ #ifdef __cplusplus
109
+ }
110
+ #endif
111
+
112
+ #endif
@@ -0,0 +1,397 @@
1
+ /* $OpenBSD: ui.h,v 1.20 2025/03/09 15:25:53 tb Exp $ */
2
+ /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3
+ * project 2001.
4
+ */
5
+ /* ====================================================================
6
+ * Copyright (c) 2001 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
+ *
53
+ * This product includes cryptographic software written by Eric Young
54
+ * (eay@cryptsoft.com). This product includes software written by Tim
55
+ * Hudson (tjh@cryptsoft.com).
56
+ *
57
+ */
58
+
59
+ #ifndef HEADER_UI_H
60
+ #define HEADER_UI_H
61
+
62
+ #include <openssl/opensslconf.h>
63
+
64
+ #include <openssl/crypto.h>
65
+ #include <openssl/safestack.h>
66
+ #include <openssl/ossl_typ.h>
67
+
68
+ #ifdef __cplusplus
69
+ extern "C" {
70
+ #endif
71
+
72
+ /* Declared already in ossl_typ.h */
73
+ /* typedef struct ui_st UI; */
74
+ /* typedef struct ui_method_st UI_METHOD; */
75
+
76
+
77
+ /*
78
+ * All the following functions return -1 or NULL on error and in some cases
79
+ * (UI_process()) -2 if interrupted or in some other way cancelled.
80
+ * When everything is fine, they return 0, a positive value or a non-NULL
81
+ * pointer, all depending on their purpose.
82
+ */
83
+
84
+ /* Creators and destructor. */
85
+ UI *UI_new(void);
86
+ UI *UI_new_method(const UI_METHOD *method);
87
+ void UI_free(UI *ui);
88
+
89
+ /*
90
+ * The following functions are used to add strings to be printed and prompt
91
+ * strings to prompt for data. The names are UI_{add,dup}_<function>_string
92
+ * and UI_{add,dup}_input_boolean.
93
+ *
94
+ * UI_{add,dup}_<function>_string have the following meanings:
95
+ * add add a text or prompt string. The pointers given to these
96
+ * functions are used verbatim, no copying is done.
97
+ * dup make a copy of the text or prompt string, then add the copy
98
+ * to the collection of strings in the user interface.
99
+ * <function>
100
+ * The function is a name for the functionality that the given
101
+ * string shall be used for. It can be one of:
102
+ * input use the string as data prompt.
103
+ * verify use the string as verification prompt. This
104
+ * is used to verify a previous input.
105
+ * info use the string for informational output.
106
+ * error use the string for error output.
107
+ * Honestly, there's currently no difference between info and error for the
108
+ * moment.
109
+ *
110
+ * UI_{add,dup}_input_boolean have the same semantics for "add" and "dup",
111
+ * and are typically used when one wants to prompt for a yes/no response.
112
+ *
113
+ * All of the functions in this group take a UI and a prompt string.
114
+ * The string input and verify addition functions also take a flag argument,
115
+ * a buffer for the result to end up in, a minimum input size and a maximum
116
+ * input size (the result buffer MUST be large enough to be able to contain
117
+ * the maximum number of characters). Additionally, the verify addition
118
+ * functions takes another buffer to compare the result against.
119
+ * The boolean input functions take an action description string (which should
120
+ * be safe to ignore if the expected user action is obvious, for example with
121
+ * a dialog box with an OK button and a Cancel button), a string of acceptable
122
+ * characters to mean OK and to mean Cancel. The two last strings are checked
123
+ * to make sure they don't have common characters. Additionally, the same
124
+ * flag argument as for the string input is taken, as well as a result buffer.
125
+ * The result buffer is required to be at least one byte long. Depending on
126
+ * the answer, the first character from the OK or the Cancel character strings
127
+ * will be stored in the first byte of the result buffer. No NUL will be
128
+ * added, so the result is *not* a string.
129
+ *
130
+ * On success, the functions all return an index of the added information.
131
+ * That index is useful when retrieving results with UI_get0_result().
132
+ */
133
+ int UI_add_input_string(UI *ui, const char *prompt, int flags,
134
+ char *result_buf, int minsize, int maxsize);
135
+ int UI_dup_input_string(UI *ui, const char *prompt, int flags,
136
+ char *result_buf, int minsize, int maxsize);
137
+ int UI_add_verify_string(UI *ui, const char *prompt, int flags,
138
+ char *result_buf, int minsize, int maxsize, const char *test_buf);
139
+ int UI_dup_verify_string(UI *ui, const char *prompt, int flags,
140
+ char *result_buf, int minsize, int maxsize, const char *test_buf);
141
+ int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc,
142
+ const char *ok_chars, const char *cancel_chars,
143
+ int flags, char *result_buf);
144
+ int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,
145
+ const char *ok_chars, const char *cancel_chars,
146
+ int flags, char *result_buf);
147
+ int UI_add_info_string(UI *ui, const char *text);
148
+ int UI_dup_info_string(UI *ui, const char *text);
149
+ int UI_add_error_string(UI *ui, const char *text);
150
+ int UI_dup_error_string(UI *ui, const char *text);
151
+
152
+ /* These are the possible flags. They can be or'ed together. */
153
+ /* Use to have echoing of input */
154
+ #define UI_INPUT_FLAG_ECHO 0x01
155
+ /*
156
+ * Use a default password. Where that password is found is completely
157
+ * up to the application, it might for example be in the user data set
158
+ * with UI_add_user_data(). It is not recommended to have more than
159
+ * one input in each UI being marked with this flag, or the application
160
+ * might get confused.
161
+ */
162
+ #define UI_INPUT_FLAG_DEFAULT_PWD 0x02
163
+
164
+ /*
165
+ * Users of these routines may want to define flags of their own. The core
166
+ * UI won't look at those, but will pass them on to the method routines. They
167
+ * must use higher bits so they don't get confused with the UI bits above.
168
+ * UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use. A good
169
+ * example of use is this:
170
+ *
171
+ * #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE)
172
+ */
173
+ #define UI_INPUT_FLAG_USER_BASE 16
174
+
175
+
176
+ /*
177
+ * The following function helps construct a prompt. object_desc is a
178
+ * textual short description of the object, for example "pass phrase",
179
+ * and object_name is the name of the object (might be a card name or
180
+ * a file name.
181
+ * The returned string shall always be allocated on the heap with
182
+ * malloc(), and need to be free'd with free().
183
+ *
184
+ * If the ui_method doesn't contain a pointer to a user-defined prompt
185
+ * constructor, a default string is built, looking like this:
186
+ *
187
+ * "Enter {object_desc} for {object_name}:"
188
+ *
189
+ * So, if object_desc has the value "pass phrase" and object_name has
190
+ * the value "foo.key", the resulting string is:
191
+ *
192
+ * "Enter pass phrase for foo.key:"
193
+ */
194
+ char *UI_construct_prompt(UI *ui_method, const char *object_desc,
195
+ const char *object_name);
196
+
197
+
198
+ /*
199
+ * The following function is used to store a pointer to user-specific data.
200
+ * Any previous such pointer will be returned and replaced.
201
+ *
202
+ * For callback purposes, this function makes a lot more sense than using
203
+ * ex_data, since the latter requires that different parts of OpenSSL or
204
+ * applications share the same ex_data index.
205
+ *
206
+ * Note that the UI_OpenSSL() method completely ignores the user data.
207
+ * Other methods may not, however.
208
+ */
209
+ void *UI_add_user_data(UI *ui, void *user_data);
210
+ /* We need a user data retrieving function as well. */
211
+ void *UI_get0_user_data(UI *ui);
212
+
213
+ /* Return the result associated with a prompt given with the index i. */
214
+ const char *UI_get0_result(UI *ui, int i);
215
+
216
+ /* When all strings have been added, process the whole thing. */
217
+ int UI_process(UI *ui);
218
+
219
+ /*
220
+ * Give a user interface parametrised control commands. This can be used to
221
+ * send down an integer, a data pointer or a function pointer, as well as
222
+ * be used to get information from a UI.
223
+ */
224
+ int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void));
225
+
226
+ /* The commands */
227
+ /*
228
+ * Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the
229
+ * OpenSSL error stack before printing any info or added error messages and
230
+ * before any prompting.
231
+ */
232
+ #define UI_CTRL_PRINT_ERRORS 1
233
+ /*
234
+ * Check if a UI_process() is possible to do again with the same instance of
235
+ * a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0
236
+ * if not.
237
+ */
238
+ #define UI_CTRL_IS_REDOABLE 2
239
+
240
+
241
+ /* Some methods may use extra data */
242
+ #define UI_set_app_data(s,arg) UI_set_ex_data(s,0,arg)
243
+ #define UI_get_app_data(s) UI_get_ex_data(s,0)
244
+ int UI_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
245
+ CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
246
+ int UI_set_ex_data(UI *r, int idx, void *arg);
247
+ void *UI_get_ex_data(UI *r, int idx);
248
+
249
+ /* Use specific methods instead of the built-in one */
250
+ void UI_set_default_method(const UI_METHOD *meth);
251
+ const UI_METHOD *UI_get_default_method(void);
252
+ const UI_METHOD *UI_get_method(UI *ui);
253
+ const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth);
254
+
255
+ /* The method with all the built-in thingies */
256
+ const UI_METHOD *UI_OpenSSL(void);
257
+
258
+ const UI_METHOD *UI_null(void);
259
+
260
+ /*
261
+ * ---------- For method writers ----------
262
+ * A method contains a number of functions that implement the low level
263
+ * of the User Interface. The functions are:
264
+ *
265
+ * an opener This function starts a session, maybe by opening
266
+ * a channel to a tty, or by opening a window.
267
+ * a writer This function is called to write a given string,
268
+ * maybe to the tty, maybe as a field label in a
269
+ * window.
270
+ * a flusher This function is called to flush everything that
271
+ * has been output so far. It can be used to actually
272
+ * display a dialog box after it has been built.
273
+ * a reader This function is called to read a given prompt,
274
+ * maybe from the tty, maybe from a field in a
275
+ * window. Note that it's called with all string
276
+ * structures, not only the prompt ones, so it must
277
+ * check such things itself.
278
+ * a closer This function closes the session, maybe by closing
279
+ * the channel to the tty, or closing the window.
280
+ *
281
+ * All these functions are expected to return:
282
+ *
283
+ * 0 on error.
284
+ * 1 on success.
285
+ * -1 on out-of-band events, for example if some prompting has
286
+ * been canceled (by pressing Ctrl-C, for example). This is
287
+ * only checked when returned by the flusher or the reader.
288
+ *
289
+ * The way this is used, the opener is first called, then the writer for all
290
+ * strings, then the flusher, then the reader for all strings and finally the
291
+ * closer. Note that if you want to prompt from a terminal or other command
292
+ * line interface, the best is to have the reader also write the prompts
293
+ * instead of having the writer do it. If you want to prompt from a dialog
294
+ * box, the writer can be used to build up the contents of the box, and the
295
+ * flusher to actually display the box and run the event loop until all data
296
+ * has been given, after which the reader only grabs the given data and puts
297
+ * them back into the UI strings.
298
+ *
299
+ * All method functions take a UI as argument. Additionally, the writer and
300
+ * the reader take a UI_STRING.
301
+ */
302
+
303
+ /*
304
+ * The UI_STRING type is the data structure that contains all the needed info
305
+ * about a string or a prompt, including test data for a verification prompt.
306
+ */
307
+ typedef struct ui_string_st UI_STRING;
308
+ DECLARE_STACK_OF(UI_STRING)
309
+
310
+ /*
311
+ * The different types of strings that are currently supported.
312
+ * This is only needed by method authors.
313
+ */
314
+ enum UI_string_types {
315
+ UIT_NONE = 0,
316
+ UIT_PROMPT, /* Prompt for a string */
317
+ UIT_VERIFY, /* Prompt for a string and verify */
318
+ UIT_BOOLEAN, /* Prompt for a yes/no response */
319
+ UIT_INFO, /* Send info to the user */
320
+ UIT_ERROR /* Send an error message to the user */
321
+ };
322
+
323
+ /* Create and manipulate methods */
324
+ UI_METHOD *UI_create_method(const char *name);
325
+ void UI_destroy_method(UI_METHOD *ui_method);
326
+ int UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui));
327
+ int UI_method_set_writer(UI_METHOD *method,
328
+ int (*writer)(UI *ui, UI_STRING *uis));
329
+ int UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui));
330
+ int UI_method_set_reader(UI_METHOD *method,
331
+ int (*reader)(UI *ui, UI_STRING *uis));
332
+ int UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui));
333
+ int UI_method_set_prompt_constructor(UI_METHOD *method,
334
+ char *(*prompt_constructor)(UI *ui, const char *object_desc,
335
+ const char *object_name));
336
+ int (*UI_method_get_opener(const UI_METHOD *method))(UI *);
337
+ int (*UI_method_get_writer(const UI_METHOD *method))(UI *, UI_STRING *);
338
+ int (*UI_method_get_flusher(const UI_METHOD *method))(UI *);
339
+ int (*UI_method_get_reader(const UI_METHOD *method))(UI *, UI_STRING *);
340
+ int (*UI_method_get_closer(const UI_METHOD *method))(UI *);
341
+ char *(*UI_method_get_prompt_constructor(const UI_METHOD *method))(UI *,
342
+ const char *, const char *);
343
+
344
+ /*
345
+ * The following functions are helpers for method writers to access relevant
346
+ * data from a UI_STRING.
347
+ */
348
+ /* Return type of the UI_STRING */
349
+ enum UI_string_types UI_get_string_type(UI_STRING *uis);
350
+ /* Return input flags of the UI_STRING */
351
+ int UI_get_input_flags(UI_STRING *uis);
352
+ /* Return the actual string to output (the prompt, info or error) */
353
+ const char *UI_get0_output_string(UI_STRING *uis);
354
+ /* Return the optional action string to output (boolean prompt instruction) */
355
+ const char *UI_get0_action_string(UI_STRING *uis);
356
+ /* Return the result of a prompt */
357
+ const char *UI_get0_result_string(UI_STRING *uis);
358
+ /* Return the string to test the result against. Only useful with verifies. */
359
+ const char *UI_get0_test_string(UI_STRING *uis);
360
+ /* Return the required minimum size of the result */
361
+ int UI_get_result_minsize(UI_STRING *uis);
362
+ /* Return the required maximum size of the result */
363
+ int UI_get_result_maxsize(UI_STRING *uis);
364
+ /* Set the result of a UI_STRING. */
365
+ int UI_set_result(UI *ui, UI_STRING *uis, const char *result);
366
+
367
+ void ERR_load_UI_strings(void);
368
+
369
+ /* Error codes for the UI functions. */
370
+
371
+ /* Function codes. */
372
+ #define UI_F_GENERAL_ALLOCATE_BOOLEAN 108
373
+ #define UI_F_GENERAL_ALLOCATE_PROMPT 109
374
+ #define UI_F_GENERAL_ALLOCATE_STRING 100
375
+ #define UI_F_UI_CTRL 111
376
+ #define UI_F_UI_DUP_ERROR_STRING 101
377
+ #define UI_F_UI_DUP_INFO_STRING 102
378
+ #define UI_F_UI_DUP_INPUT_BOOLEAN 110
379
+ #define UI_F_UI_DUP_INPUT_STRING 103
380
+ #define UI_F_UI_DUP_VERIFY_STRING 106
381
+ #define UI_F_UI_GET0_RESULT 107
382
+ #define UI_F_UI_NEW_METHOD 104
383
+ #define UI_F_UI_SET_RESULT 105
384
+
385
+ /* Reason codes. */
386
+ #define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104
387
+ #define UI_R_INDEX_TOO_LARGE 102
388
+ #define UI_R_INDEX_TOO_SMALL 103
389
+ #define UI_R_NO_RESULT_BUFFER 105
390
+ #define UI_R_RESULT_TOO_LARGE 100
391
+ #define UI_R_RESULT_TOO_SMALL 101
392
+ #define UI_R_UNKNOWN_CONTROL_COMMAND 106
393
+
394
+ #ifdef __cplusplus
395
+ }
396
+ #endif
397
+ #endif