diff options
Diffstat (limited to 'src/lib/libcrypto/arc4random/getentropy_solaris.c')
-rw-r--r-- | src/lib/libcrypto/arc4random/getentropy_solaris.c | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/src/lib/libcrypto/arc4random/getentropy_solaris.c b/src/lib/libcrypto/arc4random/getentropy_solaris.c index f0fcdcf28b..b80c84de9e 100644 --- a/src/lib/libcrypto/arc4random/getentropy_solaris.c +++ b/src/lib/libcrypto/arc4random/getentropy_solaris.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: getentropy_solaris.c,v 1.12 2016/08/07 03:27:21 tb Exp $ */ | 1 | /* $OpenBSD: getentropy_solaris.c,v 1.13 2018/11/20 08:04:28 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> | 4 | * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> |
@@ -68,7 +68,6 @@ | |||
68 | 68 | ||
69 | int getentropy(void *buf, size_t len); | 69 | int getentropy(void *buf, size_t len); |
70 | 70 | ||
71 | static int gotdata(char *buf, size_t len); | ||
72 | static int getentropy_urandom(void *buf, size_t len, const char *path, | 71 | static int getentropy_urandom(void *buf, size_t len, const char *path, |
73 | int devfscheck); | 72 | int devfscheck); |
74 | static int getentropy_fallback(void *buf, size_t len); | 73 | static int getentropy_fallback(void *buf, size_t len); |
@@ -148,22 +147,6 @@ getentropy(void *buf, size_t len) | |||
148 | return (ret); | 147 | return (ret); |
149 | } | 148 | } |
150 | 149 | ||
151 | /* | ||
152 | * Basic sanity checking; wish we could do better. | ||
153 | */ | ||
154 | static int | ||
155 | gotdata(char *buf, size_t len) | ||
156 | { | ||
157 | char any_set = 0; | ||
158 | size_t i; | ||
159 | |||
160 | for (i = 0; i < len; ++i) | ||
161 | any_set |= buf[i]; | ||
162 | if (any_set == 0) | ||
163 | return (-1); | ||
164 | return (0); | ||
165 | } | ||
166 | |||
167 | static int | 150 | static int |
168 | getentropy_urandom(void *buf, size_t len, const char *path, int devfscheck) | 151 | getentropy_urandom(void *buf, size_t len, const char *path, int devfscheck) |
169 | { | 152 | { |
@@ -210,10 +193,8 @@ start: | |||
210 | i += ret; | 193 | i += ret; |
211 | } | 194 | } |
212 | close(fd); | 195 | close(fd); |
213 | if (gotdata(buf, len) == 0) { | 196 | errno = save_errno; |
214 | errno = save_errno; | 197 | return (0); /* satisfied */ |
215 | return (0); /* satisfied */ | ||
216 | } | ||
217 | nodevrandom: | 198 | nodevrandom: |
218 | errno = EIO; | 199 | errno = EIO; |
219 | return (-1); | 200 | return (-1); |
@@ -436,10 +417,6 @@ getentropy_fallback(void *buf, size_t len) | |||
436 | } | 417 | } |
437 | explicit_bzero(&ctx, sizeof ctx); | 418 | explicit_bzero(&ctx, sizeof ctx); |
438 | explicit_bzero(results, sizeof results); | 419 | explicit_bzero(results, sizeof results); |
439 | if (gotdata(buf, len) == 0) { | 420 | errno = save_errno; |
440 | errno = save_errno; | 421 | return (0); /* satisfied */ |
441 | return (0); /* satisfied */ | ||
442 | } | ||
443 | errno = EIO; | ||
444 | return (-1); | ||
445 | } | 422 | } |