int idx, write_flags;
tfc_yesno catch_all_errors, ignore_seek_errors, password, overwrite_source, do_fsync, do_pad;
tfc_yesno do_preserve_time, do_stats_in_gibs, do_statline_dynamic = YES, do_less_stats;
-tfc_yesno no_repeat, do_full_hexdump = YES, verbose, statline_was_shown;
+tfc_yesno no_repeat, do_full_hexdump = YES, verbose, statline_was_shown, show_secrets;
char *srcfname = TFC_STDIN_NAME, *dstfname = TFC_STDOUT_NAME, *do_mac_file, *counter_file, *sksum_hashlist_file;
char *saltf, *genkeyf, *mackeyf, *tweakf;
char *pw_prompt, *mac_pw_prompt;
return 0;
}
+static inline int isctrlchr(int c)
+{
+ if (c == 9) return 0;
+ if (c >= 0 && c <= 31) return 1;
+ if (c == 127) return 1;
+ return 0;
+}
+
+static int getps_plain_filter(struct getpasswd_state *getps, char chr, size_t pos)
+{
+ int x;
+
+ x = getps_filter(getps, chr, pos);
+ if (x != 1) return x;
+
+ if (pos < getps->pwlen && !isctrlchr(chr))
+ write(getps->efd, &chr, sizeof(char));
+ return 1;
+}
+
+static int getps_plain_hex_filter(struct getpasswd_state *getps, char chr, size_t pos)
+{
+ int x;
+
+ x = getps_hex_filter(getps, chr, pos);
+ if (x != 1) return x;
+
+ if (pos < getps->pwlen && !isctrlchr(chr))
+ write(getps->efd, &chr, sizeof(char));
+ return 1;
+}
+
int main(int argc, char **argv)
{
int c;
do_full_hexdump = NO;
else if (!strcmp(s, "fullkey"))
do_full_key = YES;
+ else if (!strcmp(s, "showsecrets"))
+ show_secrets = YES;
else if (!strncmp(s, "iobs", 4) && *(s+4) == '=') {
s += 5;
blksize = (size_t)tfc_humanfsize(s, &stoi);
getps.passwd = pwdask;
getps.pwlen = sizeof(pwdask)-1;
getps.echo = mac_pw_prompt ? mac_pw_prompt : "Enter MAC password: ";
- getps.charfilter = getps_filter;
- getps.maskchar = 'x';
+ getps.charfilter = (show_secrets == YES) ? getps_plain_filter : getps_filter;
+ getps.maskchar = (show_secrets == YES) ? 0 : 'x';
getps.flags = GETP_WAITFILL;
n = xgetpasswd(&getps);
if (n == NOSIZE) xerror(NO, NO, YES, "getting MAC password");
getps.passwd = (char *)pblk;
getps.pwlen = n;
getps.echo = pw_prompt ? pw_prompt : "Enter rawkey (str): ";
- getps.charfilter = getps_filter;
- getps.maskchar = 'x';
+ getps.charfilter = (show_secrets == YES) ? getps_plain_filter : getps_filter;
+ getps.maskchar = (show_secrets == YES) ? 0 : 'x';
getps.flags = GETP_WAITFILL;
n = xgetpasswd(&getps);
if (n == NOSIZE) xerror(NO, NO, YES, "getting string rawkey");
getps.passwd = pwdask;
getps.pwlen = (TF_FROM_BITS(TFC_KEY_BITS)*2);
getps.echo = pw_prompt ? pw_prompt : "Enter rawkey (hex): ";
- getps.charfilter = getps_hex_filter;
- getps.maskchar = 'x';
+ getps.charfilter = (show_secrets == YES) ? getps_plain_hex_filter : getps_hex_filter;
+ getps.maskchar = (show_secrets == YES) ? 0 : 'x';
getps.flags = GETP_WAITFILL;
n = xgetpasswd(&getps);
if (n == NOSIZE) xerror(NO, NO, YES, "getting hex rawkey");
getps.passwd = pwdask;
getps.pwlen = sizeof(pwdask)-1;
getps.echo = pw_prompt ? pw_prompt : "Enter password: ";
- getps.charfilter = getps_filter;
- getps.maskchar = 'x';
+ getps.charfilter = (show_secrets == YES) ? getps_plain_filter : getps_filter;
+ getps.maskchar = (show_secrets == YES) ? 0 : 'x';
getps.flags = GETP_WAITFILL;
n = xgetpasswd(&getps);
if (n == NOSIZE) xerror(NO, NO, YES, "getting password");
extern int idx, write_flags;
extern tfc_yesno catch_all_errors, ignore_seek_errors, password, overwrite_source, do_fsync, do_pad;
extern tfc_yesno do_preserve_time, do_stats_in_gibs, do_statline_dynamic, do_less_stats;
-extern tfc_yesno no_repeat, do_full_hexdump, verbose, statline_was_shown;
+extern tfc_yesno no_repeat, do_full_hexdump, verbose, statline_was_shown, show_secrets;
extern char *srcfname, *dstfname, *do_mac_file, *counter_file, *sksum_hashlist_file;
extern char *saltf, *genkeyf, *mackeyf, *tweakf;
extern char *pw_prompt, *mac_pw_prompt;