summaryrefslogtreecommitdiffstats
path: root/crypto/des/read2pwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/des/read2pwd.c')
-rw-r--r--crypto/des/read2pwd.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/crypto/des/read2pwd.c b/crypto/des/read2pwd.c
index a8ceaf088a..e7d8c12724 100644
--- a/crypto/des/read2pwd.c
+++ b/crypto/des/read2pwd.c
@@ -57,14 +57,21 @@
*/
#include "des_locl.h"
+#include <openssl/ui.h>
int des_read_password(des_cblock *key, const char *prompt, int verify)
{
int ok;
char buf[BUFSIZ],buff[BUFSIZ];
+ UI *ui;
- if ((ok=des_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0)
+ ui = UI_new();
+ UI_add_input_string(ui,prompt,0,buf,0,BUFSIZ-1);
+ if (verify)
+ UI_add_verify_string(ui,prompt,0,buff,0,BUFSIZ-1,buf);
+ if ((ok=UI_process(ui)) == 0)
des_string_to_key(buf,key);
+ UI_free(ui);
memset(buf,0,BUFSIZ);
memset(buff,0,BUFSIZ);
return(ok);
@@ -75,9 +82,15 @@ int des_read_2passwords(des_cblock *key1, des_cblock *key2, const char *prompt,
{
int ok;
char buf[BUFSIZ],buff[BUFSIZ];
+ UI *ui;
- if ((ok=des_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0)
+ ui = UI_new();
+ UI_add_input_string(ui,prompt,0,buf,0,BUFSIZ-1);
+ if (verify)
+ UI_add_verify_string(ui,prompt,0,buff,0,BUFSIZ-1,buf);
+ if ((ok=UI_process(ui)) == 0)
des_string_to_2keys(buf,key1,key2);
+ UI_free(ui);
memset(buf,0,BUFSIZ);
memset(buff,0,BUFSIZ);
return(ok);