From e5a3b81181b1dd3361b66bc2d289548a5e085159 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Wed, 5 Feb 2014 05:54:59 +0000 Subject: tiny style adjustments --- sys/dev/rnd.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c index 820e29572e3..4fdfe64ce09 100644 --- a/sys/dev/rnd.c +++ b/sys/dev/rnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rnd.c,v 1.154 2014/01/22 03:24:42 jsing Exp $ */ +/* $OpenBSD: rnd.c,v 1.155 2014/02/05 05:54:58 tedu Exp $ */ /* * Copyright (c) 2011 Theo de Raadt. @@ -805,7 +805,7 @@ randomclose(dev_t dev, int flag, int mode, struct proc *p) int randomread(dev_t dev, struct uio *uio, int ioflag) { - u_char lbuf[KEYSZ+IVSZ]; + u_char lbuf[KEYSZ+IVSZ]; chacha_ctx lctx; size_t total = uio->uio_resid; u_char *buf; @@ -828,12 +828,12 @@ randomread(dev_t dev, struct uio *uio, int ioflag) if (myctx) { #ifndef KEYSTREAM_ONLY - bzero(buf, n); + memset(buf, 0, n); #endif chacha_encrypt_bytes(&lctx, buf, buf, n); } else arc4random_buf(buf, n); - ret = uiomove((caddr_t)buf, n, uio); + ret = uiomove(buf, n, uio); if (ret == 0 && uio->uio_resid > 0) yield(); } @@ -855,16 +855,16 @@ randomwrite(dev_t dev, struct uio *uio, int flags) buf = malloc(POOLBYTES, M_TEMP, M_WAITOK); - while (!ret && uio->uio_resid > 0) { + while (ret == 0 && uio->uio_resid > 0) { int n = min(POOLBYTES, uio->uio_resid); ret = uiomove(buf, n, uio); - if (ret) + if (ret != 0) break; while (n % sizeof(u_int32_t)) ((u_int8_t *)buf)[n++] = 0; add_entropy_words(buf, n / 4); - if (ret == 0 && uio->uio_resid > 0) + if (uio->uio_resid > 0) yield(); newdata = 1; } -- cgit v1.2.3