summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ui/ui_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ui/ui_util.c')
-rw-r--r--src/lib/libcrypto/ui/ui_util.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/lib/libcrypto/ui/ui_util.c b/src/lib/libcrypto/ui/ui_util.c
index 5d9760bb7b..af50451403 100644
--- a/src/lib/libcrypto/ui/ui_util.c
+++ b/src/lib/libcrypto/ui/ui_util.c
@@ -7,7 +7,7 @@
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 11 *
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in 13 * notice, this list of conditions and the following disclaimer in
@@ -56,18 +56,20 @@
56#include <string.h> 56#include <string.h>
57#include "ui_locl.h" 57#include "ui_locl.h"
58 58
59int UI_UTIL_read_pw_string(char *buf,int length,const char *prompt,int verify) 59int
60 { 60UI_UTIL_read_pw_string(char *buf, int length, const char *prompt, int verify)
61{
61 char buff[BUFSIZ]; 62 char buff[BUFSIZ];
62 int ret; 63 int ret;
63 64
64 ret=UI_UTIL_read_pw(buf,buff,(length>BUFSIZ)?BUFSIZ:length,prompt,verify); 65 ret = UI_UTIL_read_pw(buf, buff, (length > BUFSIZ) ? BUFSIZ : length, prompt, verify);
65 OPENSSL_cleanse(buff,BUFSIZ); 66 OPENSSL_cleanse(buff, BUFSIZ);
66 return(ret); 67 return (ret);
67 } 68}
68 69
69int UI_UTIL_read_pw(char *buf,char *buff,int size,const char *prompt,int verify) 70int
70 { 71UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt, int verify)
72{
71 int ok = 0; 73 int ok = 0;
72 UI *ui; 74 UI *ui;
73 75
@@ -75,17 +77,16 @@ int UI_UTIL_read_pw(char *buf,char *buff,int size,const char *prompt,int verify)
75 return -1; 77 return -1;
76 78
77 ui = UI_new(); 79 ui = UI_new();
78 if (ui) 80 if (ui) {
79 { 81 ok = UI_add_input_string(ui, prompt, 0, buf, 0, size - 1);
80 ok = UI_add_input_string(ui,prompt,0,buf,0,size-1);
81 if (ok >= 0 && verify) 82 if (ok >= 0 && verify)
82 ok = UI_add_verify_string(ui,prompt,0,buff,0,size-1, 83 ok = UI_add_verify_string(ui, prompt, 0, buff, 0, size - 1,
83 buf); 84 buf);
84 if (ok >= 0) 85 if (ok >= 0)
85 ok=UI_process(ui); 86 ok = UI_process(ui);
86 UI_free(ui); 87 UI_free(ui);
87 } 88 }
88 if (ok > 0) 89 if (ok > 0)
89 ok = 0; 90 ok = 0;
90 return(ok); 91 return (ok);
91 } 92}