1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-04 04:52:47 -05:00

Add a TermWin method to draw a 'trust sigil'.

This is not yet used by anything, but the idea is that it'll be a
graphic in the terminal window that can't be replicated by a server
sending escape sequences, and hence can be used as a reliable
indication that the text on a particular terminal line is generated by
PuTTY itself and not passed through from the server. This will make it
possible to detect a malicious server trying to mimic local prompts to
trick you out of information that shouldn't be sent over the wire
(such as private-key passphrases).

The trust sigil I've picked is a small copy of the PuTTY icon, which
is thematically nice (it can be read as if the PuTTY icon is the name
of the speaker in a dialogue) and also convenient because we had that
graphic available already on all platforms. (Though the contortions I
had to go through to make the GTK 1 code draw it were quite annoying.)

The trust sigil has the same dimensions as a CJK double-width
character, i.e. it's 2 character cells wide by 1 high.
This commit is contained in:
Simon Tatham
2019-03-10 14:37:11 +00:00
parent e21afff605
commit 2a5d8e05e8
4 changed files with 188 additions and 1 deletions

View File

@ -1099,6 +1099,10 @@ struct TermWinVtable {
* redraw it in different colours). */
void (*draw_cursor)(TermWin *, int x, int y, wchar_t *text, int len,
unsigned long attrs, int line_attrs, truecolour tc);
/* Draw the sigil indicating that a line of text has come from
* PuTTY itself rather than the far end (defence against end-of-
* authentication spoofing) */
void (*draw_trust_sigil)(TermWin *, int x, int y);
int (*char_width)(TermWin *, int uc);
void (*free_draw_ctx)(TermWin *);
@ -1151,6 +1155,8 @@ static inline void win_draw_cursor(
TermWin *win, int x, int y, wchar_t *text, int len,
unsigned long attrs, int line_attrs, truecolour tc)
{ win->vt->draw_cursor(win, x, y, text, len, attrs, line_attrs, tc); }
static inline void win_draw_trust_sigil(TermWin *win, int x, int y)
{ win->vt->draw_trust_sigil(win, x, y); }
static inline int win_char_width(TermWin *win, int uc)
{ return win->vt->char_width(win, uc); }
static inline void win_free_draw_ctx(TermWin *win)