libhcrypto: UI_UTIL_FLAG_VERIFY_SILENT

This commit is contained in:
Luke Howard
2018-12-30 21:24:59 +11:00
committed by Nico Williams
parent 7e0ff63b38
commit 014f16883c
9 changed files with 25 additions and 10 deletions

View File

@@ -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);