diff options
Diffstat (limited to 'src/lib/libcrypto/arc4random/getentropy_aix.c')
-rw-r--r-- | src/lib/libcrypto/arc4random/getentropy_aix.c | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/src/lib/libcrypto/arc4random/getentropy_aix.c b/src/lib/libcrypto/arc4random/getentropy_aix.c index ff48ae7071..bd8818f264 100644 --- a/src/lib/libcrypto/arc4random/getentropy_aix.c +++ b/src/lib/libcrypto/arc4random/getentropy_aix.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: getentropy_aix.c,v 1.5 2016/08/07 03:27:21 tb Exp $ */ | 1 | /* $OpenBSD: getentropy_aix.c,v 1.6 2018/11/20 08:04:28 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2015 Michael Felt <aixtools@gmail.com> | 4 | * Copyright (c) 2015 Michael Felt <aixtools@gmail.com> |
@@ -60,7 +60,6 @@ | |||
60 | 60 | ||
61 | int getentropy(void *buf, size_t len); | 61 | int getentropy(void *buf, size_t len); |
62 | 62 | ||
63 | static int gotdata(char *buf, size_t len); | ||
64 | static int getentropy_urandom(void *buf, size_t len, const char *path, | 63 | static int getentropy_urandom(void *buf, size_t len, const char *path, |
65 | int devfscheck); | 64 | int devfscheck); |
66 | static int getentropy_fallback(void *buf, size_t len); | 65 | static int getentropy_fallback(void *buf, size_t len); |
@@ -118,22 +117,6 @@ getentropy(void *buf, size_t len) | |||
118 | return (ret); | 117 | return (ret); |
119 | } | 118 | } |
120 | 119 | ||
121 | /* | ||
122 | * Basic sanity checking; wish we could do better. | ||
123 | */ | ||
124 | static int | ||
125 | gotdata(char *buf, size_t len) | ||
126 | { | ||
127 | char any_set = 0; | ||
128 | size_t i; | ||
129 | |||
130 | for (i = 0; i < len; ++i) | ||
131 | any_set |= buf[i]; | ||
132 | if (any_set == 0) | ||
133 | return (-1); | ||
134 | return (0); | ||
135 | } | ||
136 | |||
137 | static int | 120 | static int |
138 | getentropy_urandom(void *buf, size_t len, const char *path, int devfscheck) | 121 | getentropy_urandom(void *buf, size_t len, const char *path, int devfscheck) |
139 | { | 122 | { |
@@ -179,10 +162,8 @@ start: | |||
179 | i += ret; | 162 | i += ret; |
180 | } | 163 | } |
181 | close(fd); | 164 | close(fd); |
182 | if (gotdata(buf, len) == 0) { | 165 | errno = save_errno; |
183 | errno = save_errno; | 166 | return (0); /* satisfied */ |
184 | return (0); /* satisfied */ | ||
185 | } | ||
186 | nodevrandom: | 167 | nodevrandom: |
187 | errno = EIO; | 168 | errno = EIO; |
188 | return (-1); | 169 | return (-1); |
@@ -416,10 +397,6 @@ getentropy_fallback(void *buf, size_t len) | |||
416 | } | 397 | } |
417 | explicit_bzero(&ctx, sizeof ctx); | 398 | explicit_bzero(&ctx, sizeof ctx); |
418 | explicit_bzero(results, sizeof results); | 399 | explicit_bzero(results, sizeof results); |
419 | if (gotdata(buf, len) == 0) { | 400 | errno = save_errno; |
420 | errno = save_errno; | 401 | return (0); /* satisfied */ |
421 | return (0); /* satisfied */ | ||
422 | } | ||
423 | errno = EIO; | ||
424 | return (-1); | ||
425 | } | 402 | } |