--- /dev/null
+/* $OpenBSD: ui.h,v 1.1 2022/11/12 13:16:10 beck Exp $ */
+/*
+ * Copyright (c) 2022 Bob Beck <beck@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _LIBCRYPTO_UI_H
+#define _LIBCRYPTO_UI_H
+
+#include_next <openssl/ui.h>
+#include "crypto_namespace.h"
+
+LCRYPTO_USED(UI_new);
+LCRYPTO_USED(UI_new_method);
+LCRYPTO_USED(UI_free);
+LCRYPTO_USED(UI_add_input_string);
+LCRYPTO_USED(UI_dup_input_string);
+LCRYPTO_USED(UI_add_verify_string);
+LCRYPTO_USED(UI_dup_verify_string);
+LCRYPTO_USED(UI_add_input_boolean);
+LCRYPTO_USED(UI_dup_input_boolean);
+LCRYPTO_USED(UI_add_info_string);
+LCRYPTO_USED(UI_dup_info_string);
+LCRYPTO_USED(UI_add_error_string);
+LCRYPTO_USED(UI_dup_error_string);
+LCRYPTO_USED(UI_construct_prompt);
+LCRYPTO_USED(UI_add_user_data);
+LCRYPTO_USED(UI_get0_user_data);
+LCRYPTO_USED(UI_get0_result);
+LCRYPTO_USED(UI_process);
+LCRYPTO_USED(UI_ctrl);
+LCRYPTO_USED(UI_get_ex_new_index);
+LCRYPTO_USED(UI_set_ex_data);
+LCRYPTO_USED(UI_get_ex_data);
+LCRYPTO_USED(UI_set_default_method);
+LCRYPTO_USED(UI_get_default_method);
+LCRYPTO_USED(UI_get_method);
+LCRYPTO_USED(UI_set_method);
+LCRYPTO_USED(UI_OpenSSL);
+LCRYPTO_USED(UI_create_method);
+LCRYPTO_USED(UI_destroy_method);
+LCRYPTO_USED(UI_method_set_opener);
+LCRYPTO_USED(UI_method_set_writer);
+LCRYPTO_USED(UI_method_set_flusher);
+LCRYPTO_USED(UI_method_set_reader);
+LCRYPTO_USED(UI_method_set_closer);
+LCRYPTO_USED(UI_method_set_prompt_constructor);
+LCRYPTO_USED(UI_method_get_opener);
+LCRYPTO_USED(UI_method_get_writer);
+LCRYPTO_USED(UI_method_get_flusher);
+LCRYPTO_USED(UI_method_get_reader);
+LCRYPTO_USED(UI_method_get_closer);
+LCRYPTO_USED(UI_get_string_type);
+LCRYPTO_USED(UI_get_input_flags);
+LCRYPTO_USED(UI_get0_output_string);
+LCRYPTO_USED(UI_get0_action_string);
+LCRYPTO_USED(UI_get0_result_string);
+LCRYPTO_USED(UI_get0_test_string);
+LCRYPTO_USED(UI_get_result_minsize);
+LCRYPTO_USED(UI_get_result_maxsize);
+LCRYPTO_USED(UI_set_result);
+LCRYPTO_USED(UI_UTIL_read_pw_string);
+LCRYPTO_USED(UI_UTIL_read_pw);
+LCRYPTO_USED(ERR_load_UI_strings);
+LCRYPTO_USED(UI_method_get_prompt_constructor);
+
+#endif /* _LIBCRYPTO_UI_H */
-/* $OpenBSD: ui_lib.c,v 1.44 2020/09/25 11:25:31 tb Exp $ */
+/* $OpenBSD: ui_lib.c,v 1.45 2022/11/12 13:16:10 beck Exp $ */
/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
* project 2001.
*/
{
return (UI_new_method(NULL));
}
+LCRYPTO_ALIAS(UI_new)
UI *
UI_new_method(const UI_METHOD *method)
return ret;
}
+LCRYPTO_ALIAS(UI_new_method)
static void
free_string(UI_STRING *uis)
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_UI, ui, &ui->ex_data);
free(ui);
}
+LCRYPTO_ALIAS(UI_free)
static int
allocate_string_stack(UI *ui)
return general_allocate_string(ui, prompt, 0, UIT_PROMPT, flags,
result_buf, minsize, maxsize, NULL);
}
+LCRYPTO_ALIAS(UI_add_input_string)
/* Same as UI_add_input_string(), excepts it takes a copy of the prompt. */
int
return general_allocate_string(ui, prompt, 1, UIT_PROMPT, flags,
result_buf, minsize, maxsize, NULL);
}
+LCRYPTO_ALIAS(UI_dup_input_string)
int
UI_add_verify_string(UI *ui, const char *prompt, int flags, char *result_buf,
return general_allocate_string(ui, prompt, 0, UIT_VERIFY, flags,
result_buf, minsize, maxsize, test_buf);
}
+LCRYPTO_ALIAS(UI_add_verify_string)
int
UI_dup_verify_string(UI *ui, const char *prompt, int flags,
return general_allocate_string(ui, prompt, 1, UIT_VERIFY, flags,
result_buf, minsize, maxsize, test_buf);
}
+LCRYPTO_ALIAS(UI_dup_verify_string)
int
UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc,
return general_allocate_boolean(ui, prompt, action_desc, ok_chars,
cancel_chars, 0, UIT_BOOLEAN, flags, result_buf);
}
+LCRYPTO_ALIAS(UI_add_input_boolean)
int
UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,
return general_allocate_boolean(ui, prompt, action_desc, ok_chars,
cancel_chars, 1, UIT_BOOLEAN, flags, result_buf);
}
+LCRYPTO_ALIAS(UI_dup_input_boolean)
int
UI_add_info_string(UI *ui, const char *text)
return general_allocate_string(ui, text, 0, UIT_INFO, 0, NULL, 0, 0,
NULL);
}
+LCRYPTO_ALIAS(UI_add_info_string)
int
UI_dup_info_string(UI *ui, const char *text)
return general_allocate_string(ui, text, 1, UIT_INFO, 0, NULL, 0, 0,
NULL);
}
+LCRYPTO_ALIAS(UI_dup_info_string)
int
UI_add_error_string(UI *ui, const char *text)
return general_allocate_string(ui, text, 0, UIT_ERROR, 0, NULL, 0, 0,
NULL);
}
+LCRYPTO_ALIAS(UI_add_error_string)
int
UI_dup_error_string(UI *ui, const char *text)
return general_allocate_string(ui, text, 1, UIT_ERROR, 0, NULL, 0, 0,
NULL);
}
+LCRYPTO_ALIAS(UI_dup_error_string)
char *
UI_construct_prompt(UI *ui, const char *object_desc, const char *object_name)
return prompt;
}
+LCRYPTO_ALIAS(UI_construct_prompt)
void *
UI_add_user_data(UI *ui, void *user_data)
ui->user_data = user_data;
return old_data;
}
+LCRYPTO_ALIAS(UI_add_user_data)
void *
UI_get0_user_data(UI *ui)
{
return ui->user_data;
}
+LCRYPTO_ALIAS(UI_get0_user_data)
const char *
UI_get0_result(UI *ui, int i)
}
return UI_get0_result_string(sk_UI_STRING_value(ui->strings, i));
}
+LCRYPTO_ALIAS(UI_get0_result)
static int
print_error(const char *str, size_t len, void *arg)
return -1;
return ok;
}
+LCRYPTO_ALIAS(UI_process)
int
UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f) (void))
UIerror(UI_R_UNKNOWN_CONTROL_COMMAND);
return -1;
}
+LCRYPTO_ALIAS(UI_ctrl)
int
UI_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_UI, argl, argp,
new_func, dup_func, free_func);
}
+LCRYPTO_ALIAS(UI_get_ex_new_index)
int
UI_set_ex_data(UI *r, int idx, void *arg)
{
return (CRYPTO_set_ex_data(&r->ex_data, idx, arg));
}
+LCRYPTO_ALIAS(UI_set_ex_data)
void *
UI_get_ex_data(UI *r, int idx)
{
return (CRYPTO_get_ex_data(&r->ex_data, idx));
}
+LCRYPTO_ALIAS(UI_get_ex_data)
void
UI_set_default_method(const UI_METHOD *meth)
{
default_UI_meth = meth;
}
+LCRYPTO_ALIAS(UI_set_default_method)
const UI_METHOD *
UI_get_default_method(void)
}
return default_UI_meth;
}
+LCRYPTO_ALIAS(UI_get_default_method)
const UI_METHOD *
UI_get_method(UI *ui)
{
return ui->meth;
}
+LCRYPTO_ALIAS(UI_get_method)
const UI_METHOD *
UI_set_method(UI *ui, const UI_METHOD *meth)
ui->meth = meth;
return ui->meth;
}
+LCRYPTO_ALIAS(UI_set_method)
UI_METHOD *
return ui_method;
}
+LCRYPTO_ALIAS(UI_create_method)
/*
* BIG FSCKING WARNING!!!! If you use this on a statically allocated method
ui_method->name = NULL;
free(ui_method);
}
+LCRYPTO_ALIAS(UI_destroy_method)
int
UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui))
}
return -1;
}
+LCRYPTO_ALIAS(UI_method_set_opener)
int
UI_method_set_writer(UI_METHOD *method, int (*writer)(UI *ui, UI_STRING *uis))
}
return -1;
}
+LCRYPTO_ALIAS(UI_method_set_writer)
int
UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui))
}
return -1;
}
+LCRYPTO_ALIAS(UI_method_set_flusher)
int
UI_method_set_reader(UI_METHOD *method, int (*reader)(UI *ui, UI_STRING *uis))
}
return -1;
}
+LCRYPTO_ALIAS(UI_method_set_reader)
int
UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui))
}
return -1;
}
+LCRYPTO_ALIAS(UI_method_set_closer)
int
UI_method_set_prompt_constructor(UI_METHOD *method,
}
return -1;
}
+LCRYPTO_ALIAS(UI_method_set_prompt_constructor)
int
(*UI_method_get_opener(const UI_METHOD * method))(UI *)
return method->ui_open_session;
return NULL;
}
+LCRYPTO_ALIAS(UI_method_get_opener)
int
(*UI_method_get_writer(const UI_METHOD *method))(UI *, UI_STRING *)
return method->ui_write_string;
return NULL;
}
+LCRYPTO_ALIAS(UI_method_get_writer)
int
(*UI_method_get_flusher(const UI_METHOD *method)) (UI *)
return method->ui_flush;
return NULL;
}
+LCRYPTO_ALIAS(UI_method_get_flusher)
int
(*UI_method_get_reader(const UI_METHOD *method))(UI *, UI_STRING *)
return method->ui_read_string;
return NULL;
}
+LCRYPTO_ALIAS(UI_method_get_reader)
int
(*UI_method_get_closer(const UI_METHOD *method))(UI *)
return method->ui_close_session;
return NULL;
}
+LCRYPTO_ALIAS(UI_method_get_closer)
char *
(*UI_method_get_prompt_constructor(const UI_METHOD *method))(UI *, const char *,
return method->ui_construct_prompt;
return NULL;
}
+LCRYPTO_ALIAS(UI_method_get_prompt_constructor)
enum UI_string_types
UI_get_string_type(UI_STRING *uis)
return UIT_NONE;
return uis->type;
}
+LCRYPTO_ALIAS(UI_get_string_type)
int
UI_get_input_flags(UI_STRING *uis)
return 0;
return uis->input_flags;
}
+LCRYPTO_ALIAS(UI_get_input_flags)
const char *
UI_get0_output_string(UI_STRING *uis)
return NULL;
return uis->out_string;
}
+LCRYPTO_ALIAS(UI_get0_output_string)
const char *
UI_get0_action_string(UI_STRING *uis)
return NULL;
}
}
+LCRYPTO_ALIAS(UI_get0_action_string)
const char *
UI_get0_result_string(UI_STRING *uis)
return NULL;
}
}
+LCRYPTO_ALIAS(UI_get0_result_string)
const char *
UI_get0_test_string(UI_STRING *uis)
return NULL;
}
}
+LCRYPTO_ALIAS(UI_get0_test_string)
int
UI_get_result_minsize(UI_STRING *uis)
return -1;
}
}
+LCRYPTO_ALIAS(UI_get_result_minsize)
int
UI_get_result_maxsize(UI_STRING *uis)
return -1;
}
}
+LCRYPTO_ALIAS(UI_get_result_maxsize)
int
UI_set_result(UI *ui, UI_STRING *uis, const char *result)
}
return 0;
}
+LCRYPTO_ALIAS(UI_set_result)