UI_STRING(3ossl)
π NAME π
okay bestie, gather round, this is the UI_STRING page for the 3ossl manual, and it's literally all about User interface string parsing β¨
The whole squad of functions and types living here:
UI_STRINGUI_string_typesUI_get_string_typeUI_get_input_flagsUI_get0_output_stringUI_get0_action_stringUI_get0_result_stringUI_get_result_string_lengthUI_get0_test_stringUI_get_result_minsizeUI_get_result_maxsizeUI_set_resultUI_set_result_ex
π SYNOPSIS π
#include <openssl/ui.h>
typedef struct ui_string_st UI_STRING;
enum UI_string_types {
UIT_NONE = 0,
UIT_PROMPT, /* Prompt for a string */
UIT_VERIFY, /* Prompt for a string and verify */
UIT_BOOLEAN, /* Prompt for a yes/no response */
UIT_INFO, /* Send info to the user */
UIT_ERROR /* Send an error message to the user */
};
enum UI_string_types UI_get_string_type(UI_STRING *uis);
int UI_get_input_flags(UI_STRING *uis);
const char *UI_get0_output_string(UI_STRING *uis);
const char *UI_get0_action_string(UI_STRING *uis);
const char *UI_get0_result_string(UI_STRING *uis);
int UI_get_result_string_length(UI_STRING *uis);
const char *UI_get0_test_string(UI_STRING *uis);
int UI_get_result_minsize(UI_STRING *uis);
int UI_get_result_maxsize(UI_STRING *uis);
int UI_set_result(UI *ui, UI_STRING *uis, const char *result);
int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len);
πΈ DESCRIPTION πΈ
So here's the tea, bestie π
β a UI_STRING gets created internally and gets added to a UI whenever one of these cuties gets called:
UI_add_input_string()UI_dup_input_string()UI_add_verify_string()UI_dup_verify_string()UI_add_input_boolean()UI_dup_input_boolean()UI_add_info_string()UI_dup_info_string()UI_add_error_string()UI_dup_error_string()
If you're a UI_METHOD user, you genuinely don't need to know anything more. Like, go live your life π¦. But if you're a UI_METHOD creator, you're gonna want to fetch text out of these UI_STRING objects and add results back into some of them. That's your main character moment, ngl π
UI_get_string_type() β grabs the type of the given UI_STRING. Simple, iconic.
UI_get_input_flags() β grabs the flags hanging out with that UI_STRING.
UI_get0_output_string() β grabs the actual string you're gonna output (prompt, info, error, whatever the vibe is).
UI_get0_action_string() β grabs the action description tied to a UIT_BOOLEAN type UI_STRING. For every other UI_STRING type? NULL, babes. Check UI_add_input_boolean(3) for the lore.
UI_get0_result_string() and UI_get_result_string_length() β these two retrieve the result of a prompt and its length. Only useful for UIT_PROMPT and UIT_VERIFY type strings, fr fr. For all other UI_STRING types, UI_get0_result_string() returns NULL and UI_get_result_string_length() returns -1. π
UI_get0_test_string() β grabs the string you compare the prompt result against. Only useful for UIT_VERIFY type strings. For all other UI_STRING types, NULL is returned.
UI_get_result_minsize() and UI_get_result_maxsize() β grab the minimum and maximum required size of the result. Only useful for UIT_PROMPT and UIT_VERIFY type strings. For all other UI_STRING types, -1 is returned.
UI_set_result_ex() β sets the result value of a prompt and its length. Here's how it goes down:
- For
UIT_PROMPTandUIT_VERIFYtype UI strings, this sets the result retrievable withUI_get0_result_string()by copying the contents ofresultβ if its length fits the minimum and maximum size requirements. If it doesn't fit? No copy for you π«. - For
UIT_BOOLEANtype UI strings, this sets the first character of the result retrievable withUI_get0_result_string()to the firstok_chargiven withUI_add_input_boolean()orUI_dup_input_boolean()if the result matched any of them, or the first of thecancel_charsif the result matched any of them. Otherwise it's set to the NUL char"\0".
Need more onok_charsandcancel_chars? Go readUI_add_input_boolean(3), bestie π«Ά
UI_set_result() β does the exact same thing as UI_set_result_ex(), except it calculates its length internally. It expects the string to be terminated with a NUL byte, which means it's only useful with normal C strings. That's it, that's the whole thing β¨
π RETURN VALUES π
UI_get_string_type()β returns the UI string type.UI_get_input_flags()β returns the UI string flags.UI_get0_output_string()β returns the UI string output string.UI_get0_action_string()β returns the UI string action description string forUIT_BOOLEANtype UI strings,NULLfor any other type.UI_get0_result_string()β returns the UI string result buffer forUIT_PROMPTandUIT_VERIFYtype UI strings,NULLfor any other type.UI_get_result_string_length()β returns the UI string result buffer's content length forUIT_PROMPTandUIT_VERIFYtype UI strings,-1for any other type.UI_get0_test_string()β returns the UI string action description string forUIT_VERIFYtype UI strings,NULLfor any other type.UI_get_result_minsize()β returns the minimum allowed result size for the UI string forUIT_PROMPTandUIT_VERIFYtype strings,-1for any other type.UI_get_result_maxsize()β returns the minimum allowed result size for the UI string forUIT_PROMPTandUIT_VERIFYtype strings,-1for any other type.
not me reading that twice β yep, UI_get_result_maxsize() really does say minimum allowed result size in the docs, I'm just the messenger, don't shoot me π
UI_set_result()β returns0on success, or when the UI string is of any type other thanUIT_PROMPT,UIT_VERIFYorUIT_BOOLEAN. Returns-1on error. π
π¦ SEE ALSO π¦
π COPYRIGHT π
Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's a wrap, bestie π«Ά this was UI_STRING(3ossl) from 3.5.9, dated 2026-09-29 β go forth and parse those UI strings, you absolute icon πβ¨πΈ
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms