summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ui
diff options
context:
space:
mode:
authortb <>2026-05-19 09:23:36 +0000
committertb <>2026-05-19 09:23:36 +0000
commit28f5d130562bcde7a46ba82124fa2d823c9c48a3 (patch)
tree40574c9426ec3b197d444adafc0ec15e40d60f13 /src/lib/libcrypto/ui
parent1bd3db3b28b123d1adeffcb69b8d4020de53bb57 (diff)
downloadopenbsd-28f5d130562bcde7a46ba82124fa2d823c9c48a3.tar.gz
openbsd-28f5d130562bcde7a46ba82124fa2d823c9c48a3.tar.bz2
openbsd-28f5d130562bcde7a46ba82124fa2d823c9c48a3.zip
libcrypto/ui: mechanically rename the union _ into u
While mainstream OS use compilers that understand anonymous unions, which would be cleaner here, some special snowflakes rely on LibreSSL in their stacks and they sometimes use very old and special compilers. There is no need to impose a burden on them. There is far more impactful and important cleanup that could be done in the ui pit. This obviates jsg's upcoming removal of a windows-ce workaround. discussed with jsing
Diffstat (limited to 'src/lib/libcrypto/ui')
-rw-r--r--src/lib/libcrypto/ui/ui_lib.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c
index e7587beea1..3cfb3d371a 100644
--- a/src/lib/libcrypto/ui/ui_lib.c
+++ b/src/lib/libcrypto/ui/ui_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ui_lib.c,v 1.53 2026/05/19 09:17:44 tb Exp $ */ 1/* $OpenBSD: ui_lib.c,v 1.54 2026/05/19 09:23:36 tb Exp $ */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -95,7 +95,7 @@ struct ui_string_st {
95 const char *ok_chars; /* Input */ 95 const char *ok_chars; /* Input */
96 const char *cancel_chars; /* Input */ 96 const char *cancel_chars; /* Input */
97 } boolean_data; 97 } boolean_data;
98 } _; 98 } u;
99 99
100#define OUT_STRING_FREEABLE 0x01 100#define OUT_STRING_FREEABLE 0x01
101 int flags; /* flags for internal use */ 101 int flags; /* flags for internal use */
@@ -134,9 +134,9 @@ free_string(UI_STRING *uis)
134 free((char *) uis->out_string); 134 free((char *) uis->out_string);
135 switch (uis->type) { 135 switch (uis->type) {
136 case UIT_BOOLEAN: 136 case UIT_BOOLEAN:
137 free((char *)uis->_.boolean_data.action_desc); 137 free((char *)uis->u.boolean_data.action_desc);
138 free((char *)uis->_.boolean_data.ok_chars); 138 free((char *)uis->u.boolean_data.ok_chars);
139 free((char *)uis->_.boolean_data.cancel_chars); 139 free((char *)uis->u.boolean_data.cancel_chars);
140 break; 140 break;
141 default: 141 default:
142 break; 142 break;
@@ -219,9 +219,9 @@ general_allocate_string(UI *ui, const char *prompt, int dup_prompt,
219 if ((s = general_allocate_prompt(prompt, dup_prompt, type, input_flags, 219 if ((s = general_allocate_prompt(prompt, dup_prompt, type, input_flags,
220 result_buf)) == NULL) 220 result_buf)) == NULL)
221 goto err; 221 goto err;
222 s->_.string_data.result_minsize = minsize; 222 s->u.string_data.result_minsize = minsize;
223 s->_.string_data.result_maxsize = maxsize; 223 s->u.string_data.result_maxsize = maxsize;
224 s->_.string_data.test_buf = test_buf; 224 s->u.string_data.test_buf = test_buf;
225 225
226 if (allocate_string_stack(ui) < 0) 226 if (allocate_string_stack(ui) < 0)
227 goto err; 227 goto err;
@@ -258,25 +258,25 @@ general_allocate_boolean(UI *ui, const char *prompt, const char *action_desc,
258 258
259 if (dup_strings) { 259 if (dup_strings) {
260 if (action_desc != NULL) { 260 if (action_desc != NULL) {
261 if ((s->_.boolean_data.action_desc = 261 if ((s->u.boolean_data.action_desc =
262 strdup(action_desc)) == NULL) { 262 strdup(action_desc)) == NULL) {
263 UIerror(ERR_R_MALLOC_FAILURE); 263 UIerror(ERR_R_MALLOC_FAILURE);
264 goto err; 264 goto err;
265 } 265 }
266 } 266 }
267 if ((s->_.boolean_data.ok_chars = strdup(ok_chars)) == NULL) { 267 if ((s->u.boolean_data.ok_chars = strdup(ok_chars)) == NULL) {
268 UIerror(ERR_R_MALLOC_FAILURE); 268 UIerror(ERR_R_MALLOC_FAILURE);
269 goto err; 269 goto err;
270 } 270 }
271 if ((s->_.boolean_data.cancel_chars = strdup(cancel_chars)) == 271 if ((s->u.boolean_data.cancel_chars = strdup(cancel_chars)) ==
272 NULL) { 272 NULL) {
273 UIerror(ERR_R_MALLOC_FAILURE); 273 UIerror(ERR_R_MALLOC_FAILURE);
274 goto err; 274 goto err;
275 } 275 }
276 } else { 276 } else {
277 s->_.boolean_data.action_desc = action_desc; 277 s->u.boolean_data.action_desc = action_desc;
278 s->_.boolean_data.ok_chars = ok_chars; 278 s->u.boolean_data.ok_chars = ok_chars;
279 s->_.boolean_data.cancel_chars = cancel_chars; 279 s->u.boolean_data.cancel_chars = cancel_chars;
280 } 280 }
281 281
282 if (allocate_string_stack(ui) < 0) 282 if (allocate_string_stack(ui) < 0)
@@ -805,7 +805,7 @@ UI_get0_action_string(UI_STRING *uis)
805 switch (uis->type) { 805 switch (uis->type) {
806 case UIT_PROMPT: 806 case UIT_PROMPT:
807 case UIT_BOOLEAN: 807 case UIT_BOOLEAN:
808 return uis->_.boolean_data.action_desc; 808 return uis->u.boolean_data.action_desc;
809 default: 809 default:
810 return NULL; 810 return NULL;
811 } 811 }
@@ -836,7 +836,7 @@ UI_get0_test_string(UI_STRING *uis)
836 836
837 switch (uis->type) { 837 switch (uis->type) {
838 case UIT_VERIFY: 838 case UIT_VERIFY:
839 return uis->_.string_data.test_buf; 839 return uis->u.string_data.test_buf;
840 default: 840 default:
841 return NULL; 841 return NULL;
842 } 842 }
@@ -852,7 +852,7 @@ UI_get_result_minsize(UI_STRING *uis)
852 switch (uis->type) { 852 switch (uis->type) {
853 case UIT_PROMPT: 853 case UIT_PROMPT:
854 case UIT_VERIFY: 854 case UIT_VERIFY:
855 return uis->_.string_data.result_minsize; 855 return uis->u.string_data.result_minsize;
856 default: 856 default:
857 return -1; 857 return -1;
858 } 858 }
@@ -868,7 +868,7 @@ UI_get_result_maxsize(UI_STRING *uis)
868 switch (uis->type) { 868 switch (uis->type) {
869 case UIT_PROMPT: 869 case UIT_PROMPT:
870 case UIT_VERIFY: 870 case UIT_VERIFY:
871 return uis->_.string_data.result_maxsize; 871 return uis->u.string_data.result_maxsize;
872 default: 872 default:
873 return -1; 873 return -1;
874 } 874 }
@@ -889,22 +889,22 @@ UI_set_result(UI *ui, UI_STRING *uis, const char *result)
889 switch (uis->type) { 889 switch (uis->type) {
890 case UIT_PROMPT: 890 case UIT_PROMPT:
891 case UIT_VERIFY: 891 case UIT_VERIFY:
892 if (l < uis->_.string_data.result_minsize) { 892 if (l < uis->u.string_data.result_minsize) {
893 ui->flags |= UI_FLAG_REDOABLE; 893 ui->flags |= UI_FLAG_REDOABLE;
894 UIerror(UI_R_RESULT_TOO_SMALL); 894 UIerror(UI_R_RESULT_TOO_SMALL);
895 ERR_asprintf_error_data 895 ERR_asprintf_error_data
896 ("You must type in %d to %d characters", 896 ("You must type in %d to %d characters",
897 uis->_.string_data.result_minsize, 897 uis->u.string_data.result_minsize,
898 uis->_.string_data.result_maxsize); 898 uis->u.string_data.result_maxsize);
899 return -1; 899 return -1;
900 } 900 }
901 if (l > uis->_.string_data.result_maxsize) { 901 if (l > uis->u.string_data.result_maxsize) {
902 ui->flags |= UI_FLAG_REDOABLE; 902 ui->flags |= UI_FLAG_REDOABLE;
903 UIerror(UI_R_RESULT_TOO_LARGE); 903 UIerror(UI_R_RESULT_TOO_LARGE);
904 ERR_asprintf_error_data 904 ERR_asprintf_error_data
905 ("You must type in %d to %d characters", 905 ("You must type in %d to %d characters",
906 uis->_.string_data.result_minsize, 906 uis->u.string_data.result_minsize,
907 uis->_.string_data.result_maxsize); 907 uis->u.string_data.result_maxsize);
908 return -1; 908 return -1;
909 } 909 }
910 if (!uis->result_buf) { 910 if (!uis->result_buf) {
@@ -912,7 +912,7 @@ UI_set_result(UI *ui, UI_STRING *uis, const char *result)
912 return -1; 912 return -1;
913 } 913 }
914 strlcpy(uis->result_buf, result, 914 strlcpy(uis->result_buf, result,
915 uis->_.string_data.result_maxsize + 1); 915 uis->u.string_data.result_maxsize + 1);
916 break; 916 break;
917 case UIT_BOOLEAN: 917 case UIT_BOOLEAN:
918 if (!uis->result_buf) { 918 if (!uis->result_buf) {
@@ -921,14 +921,14 @@ UI_set_result(UI *ui, UI_STRING *uis, const char *result)
921 } 921 }
922 uis->result_buf[0] = '\0'; 922 uis->result_buf[0] = '\0';
923 for (p = result; *p; p++) { 923 for (p = result; *p; p++) {
924 if (strchr(uis->_.boolean_data.ok_chars, *p)) { 924 if (strchr(uis->u.boolean_data.ok_chars, *p)) {
925 uis->result_buf[0] = 925 uis->result_buf[0] =
926 uis->_.boolean_data.ok_chars[0]; 926 uis->u.boolean_data.ok_chars[0];
927 break; 927 break;
928 } 928 }
929 if (strchr(uis->_.boolean_data.cancel_chars, *p)) { 929 if (strchr(uis->u.boolean_data.cancel_chars, *p)) {
930 uis->result_buf[0] = 930 uis->result_buf[0] =
931 uis->_.boolean_data.cancel_chars[0]; 931 uis->u.boolean_data.cancel_chars[0];
932 break; 932 break;
933 } 933 }
934 } 934 }