From: Mark Wooding Date: Wed, 13 Sep 2017 09:04:46 +0000 (+0100) Subject: proxy/tripe-mitm.c: Abolish use of RC4. X-Git-Tag: 1.5.0~41^2~42 X-Git-Url: https://git.distorted.org.uk/~mdw/tripe/commitdiff_plain/9f90c1f6d21867ca0e1a2b42a9514299221cbe1d proxy/tripe-mitm.c: Abolish use of RC4. --- 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));