summaryrefslogtreecommitdiffstats
path: root/crypto/evp/evp_key.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/evp/evp_key.c')
-rw-r--r--crypto/evp/evp_key.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/crypto/evp/evp_key.c b/crypto/evp/evp_key.c
index 26cdcdf195..91738a273f 100644
--- a/crypto/evp/evp_key.c
+++ b/crypto/evp/evp_key.c
@@ -61,6 +61,7 @@
#include <openssl/x509.h>
#include <openssl/objects.h>
#include <openssl/evp.h>
+#include <openssl/ui.h>
/* should be init to zeros. */
static char prompt_string[80];
@@ -86,13 +87,21 @@ char *EVP_get_pw_prompt(void)
* this function will fail */
int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify)
{
-#ifndef OPENSSL_NO_DES
+ int ret;
+ char buff[BUFSIZ];
+ UI *ui;
+
if ((prompt == NULL) && (prompt_string[0] != '\0'))
prompt=prompt_string;
- return(des_read_pw_string(buf,len,prompt,verify));
-#else
- return -1;
-#endif
+ ui = UI_new();
+ UI_add_input_string(ui,prompt,0,buf,0,(len>=BUFSIZ)?BUFSIZ-1:len);
+ if (verify)
+ UI_add_verify_string(ui,prompt,0,
+ buff,0,(len>=BUFSIZ)?BUFSIZ-1:len,buf);
+ ret = UI_process(ui);
+ UI_free(ui);
+ memset(buff,0,BUFSIZ);
+ return ret;
}
int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,