libhcrypto: UI_UTIL_FLAG_VERIFY_SILENT
This commit is contained in:

committed by
Nico Williams

parent
7e0ff63b38
commit
014f16883c
@@ -194,7 +194,7 @@ UI_UTIL_read_pw_string(char *buf, int length, const char *prompt, int verify)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (verify) {
|
||||
if (verify & UI_UTIL_FLAG_VERIFY) {
|
||||
char *buf2;
|
||||
buf2 = malloc(length);
|
||||
if (buf2 == NULL)
|
||||
@@ -206,8 +206,10 @@ UI_UTIL_read_pw_string(char *buf, int length, const char *prompt, int verify)
|
||||
return ret;
|
||||
}
|
||||
if (strcmp(buf2, buf) != 0) {
|
||||
fprintf(stderr, "Verify failure\n");
|
||||
fflush(stderr);
|
||||
if (!(verify & UI_UTIL_FLAG_VERIFY_SILENT)) {
|
||||
fprintf(stderr, "Verify failure\n");
|
||||
fflush(stderr);
|
||||
}
|
||||
ret = 1;
|
||||
}
|
||||
free(buf2);
|
||||
|
@@ -39,6 +39,10 @@
|
||||
/* symbol renaming */
|
||||
#define UI_UTIL_read_pw_string hc_UI_UTIL_read_pw_string
|
||||
|
||||
/* OpenSSL API extensions */
|
||||
#define UI_UTIL_FLAG_VERIFY 0x1 /* ask to verify password */
|
||||
#define UI_UTIL_FLAG_VERIFY_SILENT 0x2 /* silence on verify failure */
|
||||
|
||||
int UI_UTIL_read_pw_string(char *, int, const char *, int); /* XXX */
|
||||
|
||||
#endif /* _HEIM_UI_H */
|
||||
|
Reference in New Issue
Block a user