aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/random/randomdev.c
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2016-04-25 21:14:32 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2016-04-25 21:14:32 +0000
commit7b250b1ec9da6b80d73784911c59c64d688789ad (patch)
tree1fc6430078595e4fd65e3bd353a84fb7186f1082 /sys/dev/random/randomdev.c
parent820a9567edf962c8821fb3ec25be36f7b9de7316 (diff)
Notes
Diffstat (limited to 'sys/dev/random/randomdev.c')
-rw-r--r--sys/dev/random/randomdev.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c
index 978a5644ca354..7edfca8ad6075 100644
--- a/sys/dev/random/randomdev.c
+++ b/sys/dev/random/randomdev.c
@@ -68,9 +68,6 @@ static u_int READ_RANDOM(void *, u_int);
#define READ_RANDOM read_random
#endif
-/* Return the largest number >= x that is a multiple of m */
-#define CEIL_TO_MULTIPLE(x, m) ((((x) + (m) - 1)/(m))*(m))
-
static d_read_t randomdev_read;
static d_write_t randomdev_write;
static d_poll_t randomdev_poll;
@@ -164,7 +161,7 @@ READ_RANDOM_UIO(struct uio *uio, bool nonblock)
* which is what the underlying generator is expecting.
* See the random_buf size requirements in the Yarrow/Fortuna code.
*/
- read_len = CEIL_TO_MULTIPLE(read_len, RANDOM_BLOCKSIZE);
+ read_len = roundup(read_len, RANDOM_BLOCKSIZE);
/* Work in chunks page-sized or less */
read_len = MIN(read_len, PAGE_SIZE);
p_random_alg_context->ra_read(random_buf, read_len);
@@ -204,7 +201,7 @@ READ_RANDOM(void *random_buf, u_int len)
* Round up the read length to a crypto block size multiple,
* which is what the underlying generator is expecting.
*/
- read_len = CEIL_TO_MULTIPLE(len, RANDOM_BLOCKSIZE);
+ read_len = roundup(len, RANDOM_BLOCKSIZE);
p_random_alg_context->ra_read(local_buf, read_len);
memcpy(random_buf, local_buf, len);
}