summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/serverloop.c
diff options
context:
space:
mode:
authordugsong <dugsong@openbsd.org>2001-02-08 23:11:42 +0000
committerdugsong <dugsong@openbsd.org>2001-02-08 23:11:42 +0000
commita4624190c8e81fddf4f68af82ffea72a83bdbcf5 (patch)
treee0ebc35ad93f9a0ad97bc98fe44233e068e8646f /usr.bin/ssh/serverloop.c
parentCapital punishment, just in case :-) (diff)
downloadwireguard-openbsd-a4624190c8e81fddf4f68af82ffea72a83bdbcf5.tar.xz
wireguard-openbsd-a4624190c8e81fddf4f68af82ffea72a83bdbcf5.zip
mitigate SSH1 traffic analysis - from Solar Designer <solar@openwall.com>, ok provos@
Diffstat (limited to 'usr.bin/ssh/serverloop.c')
-rw-r--r--usr.bin/ssh/serverloop.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/ssh/serverloop.c b/usr.bin/ssh/serverloop.c
index fddcb747809..a0bc3158318 100644
--- a/usr.bin/ssh/serverloop.c
+++ b/usr.bin/ssh/serverloop.c
@@ -35,7 +35,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: serverloop.c,v 1.46 2001/02/08 19:30:52 itojun Exp $");
+RCSID("$OpenBSD: serverloop.c,v 1.47 2001/02/08 23:11:42 dugsong Exp $");
#include "xmalloc.h"
#include "packet.h"
@@ -317,6 +317,7 @@ process_input(fd_set * readset)
void
process_output(fd_set * writeset)
{
+ struct termios tio;
int len;
/* Write buffered data to program stdin. */
@@ -336,7 +337,16 @@ process_output(fd_set * writeset)
#endif
fdin = -1;
} else {
- /* Successful write. Consume the data from the buffer. */
+ /* Successful write. */
+ if (tcgetattr(fdin, &tio) == 0 &&
+ !(tio.c_lflag & ECHO)) {
+ /* Simulate echo to reduce the impact of traffic analysis. */
+ packet_start(SSH_MSG_IGNORE);
+ memset(buffer_ptr(&stdin_buffer), 0, len);
+ packet_put_string(buffer_ptr(&stdin_buffer), len);
+ packet_send();
+ }
+ /* Consume the data from the buffer. */
buffer_consume(&stdin_buffer, len);
/* Update the count of bytes written to the program. */
stdin_bytes += len;