/*
- * Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
*
- * Licensed under the OpenSSL license (the "License"). You may not use
+ * 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
*/
-#ifndef HEADER_UI_H
-# define HEADER_UI_H
+#ifndef OPENSSL_UI_H
+# define OPENSSL_UI_H
+# pragma once
-# include <openssl/opensslconf.h>
+# include <openssl/macros.h>
+# ifndef OPENSSL_NO_DEPRECATED_3_0
+# define HEADER_UI_H
+# endif
-# ifndef OPENSSL_NO_UI
+# include <openssl/opensslconf.h>
-# if OPENSSL_API_COMPAT < 0x10100000L
-# include <openssl/crypto.h>
+# ifndef OPENSSL_NO_DEPRECATED_1_1_0
+# include <openssl/crypto.h>
+# endif
+# include <openssl/safestack.h>
+# include <openssl/pem.h>
+# include <openssl/types.h>
+# include <openssl/uierr.h>
+
+/* For compatibility reasons, the macro OPENSSL_NO_UI is currently retained */
+# ifndef OPENSSL_NO_DEPRECATED_3_0
+# ifdef OPENSSL_NO_UI_CONSOLE
+# define OPENSSL_NO_UI
# endif
-# include <openssl/safestack.h>
-# include <openssl/pem.h>
-# include <openssl/ossl_typ.h>
-# include <openssl/uierr.h>
+# endif
-#ifdef __cplusplus
+# ifdef __cplusplus
extern "C" {
-#endif
+# endif
/*
* All the following functions return -1 or NULL on error and in some cases
* each UI being marked with this flag, or the application might get
* confused.
*/
-# define UI_INPUT_FLAG_DEFAULT_PWD 0x02
+# define UI_INPUT_FLAG_DEFAULT_PWD 0x02
/*-
* The user of these routines may want to define flags of their own. The core
* #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE)
*
*/
-# define UI_INPUT_FLAG_USER_BASE 16
+# define UI_INPUT_FLAG_USER_BASE 16
/*-
* The following function helps construct a prompt. object_desc is a
/* Return the result associated with a prompt given with the index i. */
const char *UI_get0_result(UI *ui, int i);
+int UI_get_result_length(UI *ui, int i);
/* When all strings have been added, process the whole thing. */
int UI_process(UI *ui);
/*
- * Give a user interface parametrised control commands. This can be used to
+ * Give a user interface parameterised control commands. This can be used to
* send down an integer, a data pointer or a function pointer, as well as be
* used to get information from a UI.
*/
* OpenSSL error stack before printing any info or added error messages and
* before any prompting.
*/
-# define UI_CTRL_PRINT_ERRORS 1
+# define UI_CTRL_PRINT_ERRORS 1
/*
* Check if a UI_process() is possible to do again with the same instance of
* a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0
# define UI_set_app_data(s,arg) UI_set_ex_data(s,0,arg)
# define UI_get_app_data(s) UI_get_ex_data(s,0)
-#define UI_get_ex_new_index(l, p, newf, dupf, freef) \
+# define UI_get_ex_new_index(l, p, newf, dupf, freef) \
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_UI, l, p, newf, dupf, freef)
int UI_set_ex_data(UI *r, int idx, void *arg);
void *UI_get_ex_data(UI *r, int idx);
const UI_METHOD *UI_get_method(UI *ui);
const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth);
+# ifndef OPENSSL_NO_UI_CONSOLE
+
/* The method with all the built-in thingies */
UI_METHOD *UI_OpenSSL(void);
+# endif
+
/*
* NULL method. Literally does nothing, but may serve as a placeholder
* to avoid internal default.
const char *UI_get0_action_string(UI_STRING *uis);
/* Return the result of a prompt */
const char *UI_get0_result_string(UI_STRING *uis);
+int UI_get_result_string_length(UI_STRING *uis);
/*
* Return the string to test the result against. Only useful with verifies.
*/
int UI_get_result_maxsize(UI_STRING *uis);
/* Set the result of a UI_STRING. */
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);
/* A couple of popular utility functions */
int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,
int verify);
UI_METHOD *UI_UTIL_wrap_read_pem_callback(pem_password_cb *cb, int rwflag);
-int ERR_load_UI_strings(void);
-# ifdef __cplusplus
+# ifdef __cplusplus
}
-# endif
# endif
#endif