diff options
author | 2016-02-19 19:15:59 +0000 | |
---|---|---|
committer | 2016-02-19 19:15:59 +0000 | |
commit | 891494cb971924a644011cf1e2d7311a28134d8c (patch) | |
tree | a0a7291178d429be1253f0b2c85236071e3533f4 | |
parent | spacing fixes, from ray; (diff) | |
download | wireguard-openbsd-891494cb971924a644011cf1e2d7311a28134d8c.tar.xz wireguard-openbsd-891494cb971924a644011cf1e2d7311a28134d8c.zip |
Right shift by an amount larger than width of type is undefined behavior.
Pointed out by Martin Natano, slightly tweaked by me.
ok deraadt@
-rw-r--r-- | sys/dev/rnd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c index 819ce0dc730..0f6c5660407 100644 --- a/sys/dev/rnd.c +++ b/sys/dev/rnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rnd.c,v 1.178 2016/01/08 07:54:02 stefan Exp $ */ +/* $OpenBSD: rnd.c,v 1.179 2016/02/19 19:15:59 stefan Exp $ */ /* * Copyright (c) 2011 Theo de Raadt. @@ -421,7 +421,7 @@ add_entropy_words(const u_int32_t *buf, u_int n) for (; n--; buf++) { u_int32_t w = (*buf << entropy_input_rotate) | - (*buf >> (32 - entropy_input_rotate)); + (*buf >> ((32 - entropy_input_rotate) & 31)); u_int i = entropy_add_ptr = (entropy_add_ptr - 1) & POOLMASK; /* |