Replace explicit_bzero with ssh_burn

Signed-off-by: abdallah elhdad <abdallahselhdad@gmail.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
abdallah elhdad
2025-11-21 18:33:22 +02:00
committed by Jakub Jelen
parent 0ef79018b3
commit 64f72ed55f
26 changed files with 106 additions and 99 deletions

View File

@@ -88,7 +88,7 @@ static int ssh_gets(const char *prompt, char *buf, size_t len, int verify)
fprintf(stdout, "\nVerifying, please re-enter. %s", prompt);
fflush(stdout);
if (!fgets(key_string, (int)len, stdin)) {
explicit_bzero(key_string, len);
ssh_burn(key_string, len);
SAFE_FREE(key_string);
clearerr(stdin);
continue;
@@ -99,17 +99,17 @@ static int ssh_gets(const char *prompt, char *buf, size_t len, int verify)
fprintf(stdout, "\n");
if (strcmp(buf, key_string)) {
printf("\n\07\07Mismatch - try again\n");
explicit_bzero(key_string, len);
ssh_burn(key_string, len);
SAFE_FREE(key_string);
fflush(stdout);
continue;
}
explicit_bzero(key_string, len);
ssh_burn(key_string, len);
SAFE_FREE(key_string);
}
ok = 1;
}
explicit_bzero(tmp, len);
ssh_burn(tmp, len);
free(tmp);
return ok;
@@ -152,7 +152,7 @@ int ssh_getpass(const char *prompt,
SetConsoleMode(h, mode);
if (!ok) {
explicit_bzero(buf, len);
ssh_burn(buf, len);
return -1;
}
@@ -282,7 +282,7 @@ int ssh_getpass(const char *prompt,
}
if (!ok) {
explicit_bzero(buf, len);
ssh_burn(buf, len);
return -1;
}