UI_STRING(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ¦‹ UI_STRING(3ossl) β€” OpenSSL's lil' user-interface string object ✨

okay so this is the UI_STRING(3ossl) page from the OpenSSL manual, and bestie, it's literally all about the string objects that carry prompts, info and errors back and forth between OpenSSL and a human πŸ’… no cap, it's more fun than it sounds.


🌸 NAME 🌸

UI_STRING, UI_string_types, UI_get_string_type, UI_get_input_flags, UI_get0_output_string, UI_get0_action_string, UI_get0_result_string, UI_get_result_string_length, UI_get0_test_string, UI_get_result_minsize, UI_get_result_maxsize, UI_set_result, UI_set_result_ex β€” user interface string parsing πŸŽ€


✨ 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 a UI_STRING gets created internally and added to a UI whenever one of these girlies 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() or UI_dup_error_string(). that's the whole origin story, slay 🌈

if you're a UI_METHOD user, honestly? you don't need to know anything more, you're done here, go touch grass 🫢

but if you're a UI_METHOD creator, then it's absolutely your moment to shine, because you're gonna want to fetch text from these UI_STRING objects and add results back into some of them. main character energy fr fr πŸ‘‘

πŸŽ€ the getters, one by one πŸŽ€

  • UI_get_string_type() β€” gets you the type of the given UI_STRING. iconic little vibe check πŸ’…
  • UI_get_input_flags() β€” gets you the flags associated with the given UI_STRING 🚩
  • UI_get0_output_string() β€” gets you the actual string to output (prompt, info, error, ...). the real one, the one you show the human ✨
  • UI_get0_action_string() β€” gets you the action description associated with a UIT_BOOLEAN type UI_STRING. for all other UI_STRING types, NULL is returned. see UI_add_input_boolean(3) πŸ¦‹
  • UI_get0_result_string() and UI_get_result_string_length() β€” get you the result of a prompt and its length. this is only useful for UIT_PROMPT and UIT_VERIFY type strings. for all other UI_STRING types, UI_get0_result_string() returns NULL and UI_get_result_string_length() returns -1 😭
  • UI_get0_test_string() β€” gets you the string to compare the prompt result with. this is 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() β€” get you the minimum and maximum required size of the result. this is only useful for UIT_PROMPT and UIT_VERIFY type strings. for all other UI_STRING types, -1 is returned πŸ“

πŸ’œ the setters πŸ’œ

UI_set_result_ex() sets the result value of a prompt and its length. here's the tea per type:

  • for UIT_PROMPT and UIT_VERIFY type UI strings, it sets the result retrievable with UI_get0_result_string() by copying the contents of result if its length fits the minimum and maximum size requirements βœ…
  • for UIT_BOOLEAN type UI strings, it sets the first character of the result retrievable with UI_get0_result_string() to the first ok_char given with UI_add_input_boolean() or UI_dup_input_boolean() if the result matched any of them, or the first of the cancel_chars if the result matched any of them, otherwise it's set to the NUL char "\0". see UI_add_input_boolean(3) for more info on ok_chars and cancel_chars 🧚

UI_set_result() does the same thing as UI_set_result_ex(), but it calculates its length internally. it expects the string to be terminated with a NUL byte, and is therefore only useful with normal C strings. classic πŸ’€


πŸ”₯ 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 for UIT_BOOLEAN type UI strings, NULL for any other type πŸ™…
  • UI_get0_result_string() returns the UI string result buffer for UIT_PROMPT and UIT_VERIFY type UI strings, NULL for any other type πŸ“¦
  • UI_get_result_string_length() returns the UI string result buffer's content length for UIT_PROMPT and UIT_VERIFY type UI strings, -1 for any other type πŸ“
  • UI_get0_test_string() returns the UI string action description string for UIT_VERIFY type UI strings, NULL for any other type πŸ§ͺ
  • UI_get_result_minsize() returns the minimum allowed result size for the UI string for UIT_PROMPT and UIT_VERIFY type strings, -1 for any other type πŸ”½
  • UI_get_result_maxsize() returns the minimum allowed result size for the UI string for UIT_PROMPT and UIT_VERIFY type strings, -1 for any other type πŸ”Ό
ngl the page literally says "minimum" for UI_get_result_maxsize() too β€” we're just reporting what it says, don't come for us πŸ™ˆ
  • UI_set_result() returns 0 on success or when the UI string is of any type other than UIT_PROMPT, UIT_VERIFY or UIT_BOOLEAN, -1 on error πŸ’€

🌈 SEE ALSO 🌈

UI(3) β€” go read that one next bestie, it's giving prequel 🫢


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>.


k that's the whole page, and yes you ate that πŸ’… mwah πŸ’– β€” this was UI_STRING(3ossl) from OpenSSL 3.5.0, dated 2026-09-25, signing off βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from