aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/random/random_rng.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2015-10-12 11:04:55 +0200
committerTobias Brunner <tobias@strongswan.org>2015-10-29 16:17:17 +0100
commit35dbf8af7a9048f3384af181613c352b718f8d8e (patch)
tree30e0d3c51f4c6e61d3aa8975b60b9265c6107e7f /src/libstrongswan/plugins/random/random_rng.c
parent37a22a166b6f76d8acf4051b8480d592e851072b (diff)
downloadstrongswan-35dbf8af7a9048f3384af181613c352b718f8d8e.tar.bz2
strongswan-35dbf8af7a9048f3384af181613c352b718f8d8e.tar.xz
random: Properly handle errors when reading from /dev/[u]random
If -1 was returned on the first call to read() `done` got SIZE_MAX and the function returned TRUE even though no actual random data had been allocated. Fixes #1156.
Diffstat (limited to 'src/libstrongswan/plugins/random/random_rng.c')
-rw-r--r--src/libstrongswan/plugins/random/random_rng.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libstrongswan/plugins/random/random_rng.c b/src/libstrongswan/plugins/random/random_rng.c
index 36d5446b8..177b3c2e5 100644
--- a/src/libstrongswan/plugins/random/random_rng.c
+++ b/src/libstrongswan/plugins/random/random_rng.c
@@ -56,6 +56,7 @@ METHOD(rng_t, get_bytes, bool,
DBG1(DBG_LIB, "reading from random FD %d failed: %s, retrying...",
this->fd, strerror(errno));
sleep(1);
+ continue;
}
done += got;
}