diff options
author | Richard Levitte <levitte@openssl.org> | 2017-07-01 12:39:51 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2017-09-08 20:06:06 +0200 |
commit | 4e049e2c3658ee2bc6e63e696a3779d2f9eed377 (patch) | |
tree | 3991cd2f4d5fb0d64b515dcc5bcc8a12443454e7 /include | |
parent | a8c5ed812d1537728807059b4182d358bb2ca7c1 (diff) |
Add UI functions to set result with explicit length and to retrieve the length
This allows completely arbitrary passphrases to be entered, including
NUL bytes.
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/3821)
Diffstat (limited to 'include')
-rw-r--r-- | include/openssl/ui.h | 3 | ||||
-rw-r--r-- | include/openssl/uierr.h | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/include/openssl/ui.h b/include/openssl/ui.h index 0f8c03f8ed..a0246745bf 100644 --- a/include/openssl/ui.h +++ b/include/openssl/ui.h @@ -175,6 +175,7 @@ void *UI_get0_user_data(UI *ui); /* 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); @@ -340,6 +341,7 @@ const char *UI_get0_output_string(UI_STRING *uis); 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. */ @@ -350,6 +352,7 @@ int UI_get_result_minsize(UI_STRING *uis); 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, diff --git a/include/openssl/uierr.h b/include/openssl/uierr.h index 3550650ca7..f7c77f2ed1 100644 --- a/include/openssl/uierr.h +++ b/include/openssl/uierr.h @@ -37,9 +37,11 @@ int ERR_load_UI_strings(void); # define UI_F_UI_DUP_USER_DATA 118 # define UI_F_UI_DUP_VERIFY_STRING 106 # define UI_F_UI_GET0_RESULT 107 +# define UI_F_UI_GET_RESULT_LENGTH 119 # define UI_F_UI_NEW_METHOD 104 # define UI_F_UI_PROCESS 113 # define UI_F_UI_SET_RESULT 105 +# define UI_F_UI_SET_RESULT_EX 120 /* * UI reason codes. |