PR: 1904
Submitted by: David Woodhouse <dwmw2@infradead.org> Pass passphrase minimum length down to UI.
This commit is contained in:
parent
ac495542a6
commit
08df41277a
@ -523,6 +523,7 @@ __owur int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
|
|||||||
__owur int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
|
__owur int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
|
||||||
|
|
||||||
int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify);
|
int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify);
|
||||||
|
int EVP_read_pw_string_min(char *buf,int minlen,int maxlen,const char *prompt,int verify);
|
||||||
void EVP_set_pw_prompt(const char *prompt);
|
void EVP_set_pw_prompt(const char *prompt);
|
||||||
char * EVP_get_pw_prompt(void);
|
char * EVP_get_pw_prompt(void);
|
||||||
|
|
||||||
|
@ -89,6 +89,11 @@ char *EVP_get_pw_prompt(void)
|
|||||||
* in the DES library -- if someone ever wants to disable DES,
|
* in the DES library -- if someone ever wants to disable DES,
|
||||||
* this function will fail */
|
* this function will fail */
|
||||||
int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify)
|
int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify)
|
||||||
|
{
|
||||||
|
return EVP_read_pw_string_min(buf, 0, len, prompt, verify);
|
||||||
|
}
|
||||||
|
|
||||||
|
int EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt, int verify)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char buff[BUFSIZ];
|
char buff[BUFSIZ];
|
||||||
@ -97,10 +102,10 @@ int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify)
|
|||||||
if ((prompt == NULL) && (prompt_string[0] != '\0'))
|
if ((prompt == NULL) && (prompt_string[0] != '\0'))
|
||||||
prompt=prompt_string;
|
prompt=prompt_string;
|
||||||
ui = UI_new();
|
ui = UI_new();
|
||||||
UI_add_input_string(ui,prompt,0,buf,0,(len>=BUFSIZ)?BUFSIZ-1:len);
|
UI_add_input_string(ui,prompt,0,buf,min,(len>=BUFSIZ)?BUFSIZ-1:len);
|
||||||
if (verify)
|
if (verify)
|
||||||
UI_add_verify_string(ui,prompt,0,
|
UI_add_verify_string(ui,prompt,0,
|
||||||
buff,0,(len>=BUFSIZ)?BUFSIZ-1:len,buf);
|
buff,min,(len>=BUFSIZ)?BUFSIZ-1:len,buf);
|
||||||
ret = UI_process(ui);
|
ret = UI_process(ui);
|
||||||
UI_free(ui);
|
UI_free(ui);
|
||||||
OPENSSL_cleanse(buff,BUFSIZ);
|
OPENSSL_cleanse(buff,BUFSIZ);
|
||||||
|
@ -105,7 +105,7 @@ int PEM_def_callback(char *buf, int num, int w, void *key)
|
|||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
i=EVP_read_pw_string(buf,num,prompt,w);
|
i=EVP_read_pw_string_min(buf,MIN_LENGTH,num,prompt,w);
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
PEMerr(PEM_F_PEM_DEF_CALLBACK,PEM_R_PROBLEMS_GETTING_PASSWORD);
|
PEMerr(PEM_F_PEM_DEF_CALLBACK,PEM_R_PROBLEMS_GETTING_PASSWORD);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user