summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2014-02-05 05:54:59 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2014-02-05 05:54:59 +0000
commite5a3b81181b1dd3361b66bc2d289548a5e085159 (patch)
tree56a6c0c6e023b30e3a5e7e78ed3656f3ba18c1fd
parent4d1f2e7776b68c8292dcb2d6e0c7ea13bbb196dd (diff)
tiny style adjustments
-rw-r--r--sys/dev/rnd.c14
1 files 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;
}