summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/9/port/random.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/src/9/port/random.c b/sys/src/9/port/random.c
index c6dd838f4..b27e5720d 100644
--- a/sys/src/9/port/random.c
+++ b/sys/src/9/port/random.c
@@ -96,9 +96,10 @@ randomread(void *p, ulong n)
if(hwrandbuf != nil)
(*hwrandbuf)(p, n);
- /* copy chacha state and increment iv */
+ /* copy chacha state, rekey and increment iv */
qlock(rs);
c = *rs;
+ chacha_encrypt((uchar*)&rs->input[4], 32, &c);
if(++rs->input[13] == 0)
if(++rs->input[14] == 0)
++rs->input[15];