From 9f90c1f6d21867ca0e1a2b42a9514299221cbe1d Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Wed, 13 Sep 2017 10:04:46 +0100 Subject: [PATCH] proxy/tripe-mitm.c: Abolish use of RC4. --- proxy/tripe-mitm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/proxy/tripe-mitm.c b/proxy/tripe-mitm.c index 7a2502b7..ab05a882 100644 --- a/proxy/tripe-mitm.c +++ b/proxy/tripe-mitm.c @@ -62,9 +62,9 @@ #include #include +#include #include #include -#include #include "util.h" @@ -627,7 +627,8 @@ int main(int argc, char *argv[]) const char *kfname = "keyring.pub"; int i; unsigned f = 0; - char buf[16]; + char buf[32]; + static octet zero[CHACHA_NONCESZ]; #define f_bogus 1u @@ -652,9 +653,9 @@ int main(int argc, char *argv[]) if (f & f_bogus) { usage(stderr); exit(1); } rand_noisesrc(RAND_GLOBAL, &noise_source); - rand_seed(RAND_GLOBAL, 160); + rand_seed(RAND_GLOBAL, 256); rand_get(RAND_GLOBAL, buf, sizeof(buf)); - rng = rc4_rand(buf, sizeof(buf)); + rng = chacha20_rand(buf, sizeof(buf), zero); sel_init(&sel); if (key_open(&keys, kfname, KOPEN_READ, key_moan, 0)) die(1, "couldn't open `%s': %s", kfname, strerror(errno)); -- 2.11.0