summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/crypto/getentropy_linux.c
diff options
context:
space:
mode:
authorderaadt <>2015-09-11 11:52:55 +0000
committerderaadt <>2015-09-11 11:52:55 +0000
commit52f5d74dfdc68d06be5b27e3df8b2fbb6387acf6 (patch)
tree3eca2f8474bd414322105d51e0a8bdb7f2035269 /src/lib/libcrypto/crypto/getentropy_linux.c
parent368b501095ffe62862d468562cfaf9d1012ca99c (diff)
downloadopenbsd-52f5d74dfdc68d06be5b27e3df8b2fbb6387acf6.tar.gz
openbsd-52f5d74dfdc68d06be5b27e3df8b2fbb6387acf6.tar.bz2
openbsd-52f5d74dfdc68d06be5b27e3df8b2fbb6387acf6.zip
unify files further
Diffstat (limited to 'src/lib/libcrypto/crypto/getentropy_linux.c')
-rw-r--r--src/lib/libcrypto/crypto/getentropy_linux.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/libcrypto/crypto/getentropy_linux.c b/src/lib/libcrypto/crypto/getentropy_linux.c
index fb218feefa..2a0a6875e4 100644
--- a/src/lib/libcrypto/crypto/getentropy_linux.c
+++ b/src/lib/libcrypto/crypto/getentropy_linux.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getentropy_linux.c,v 1.40 2015/08/25 17:26:43 deraadt Exp $ */ 1/* $OpenBSD: getentropy_linux.c,v 1.41 2015/09/11 11:52:55 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>
@@ -91,7 +91,7 @@ getentropy(void *buf, size_t len)
91 91
92 if (len > 256) { 92 if (len > 256) {
93 errno = EIO; 93 errno = EIO;
94 return -1; 94 return (-1);
95 } 95 }
96 96
97#ifdef SYS_getrandom 97#ifdef SYS_getrandom
@@ -186,8 +186,8 @@ gotdata(char *buf, size_t len)
186 for (i = 0; i < len; ++i) 186 for (i = 0; i < len; ++i)
187 any_set |= buf[i]; 187 any_set |= buf[i];
188 if (any_set == 0) 188 if (any_set == 0)
189 return -1; 189 return (-1);
190 return 0; 190 return (0);
191} 191}
192 192
193#ifdef SYS_getrandom 193#ifdef SYS_getrandom
@@ -260,11 +260,11 @@ start:
260 close(fd); 260 close(fd);
261 if (gotdata(buf, len) == 0) { 261 if (gotdata(buf, len) == 0) {
262 errno = save_errno; 262 errno = save_errno;
263 return 0; /* satisfied */ 263 return (0); /* satisfied */
264 } 264 }
265nodevrandom: 265nodevrandom:
266 errno = EIO; 266 errno = EIO;
267 return -1; 267 return (-1);
268} 268}
269 269
270#ifdef SYS__sysctl 270#ifdef SYS__sysctl
@@ -295,7 +295,7 @@ getentropy_sysctl(void *buf, size_t len)
295 } 295 }
296sysctlfailed: 296sysctlfailed:
297 errno = EIO; 297 errno = EIO;
298 return -1; 298 return (-1);
299} 299}
300#endif /* SYS__sysctl */ 300#endif /* SYS__sysctl */
301 301
@@ -330,7 +330,7 @@ getentropy_phdr(struct dl_phdr_info *info, size_t size, void *data)
330 SHA512_CTX *ctx = data; 330 SHA512_CTX *ctx = data;
331 331
332 SHA512_Update(ctx, &info->dlpi_addr, sizeof (info->dlpi_addr)); 332 SHA512_Update(ctx, &info->dlpi_addr, sizeof (info->dlpi_addr));
333 return 0; 333 return (0);
334} 334}
335 335
336static int 336static int
@@ -540,8 +540,8 @@ getentropy_fallback(void *buf, size_t len)
540 explicit_bzero(results, sizeof results); 540 explicit_bzero(results, sizeof results);
541 if (gotdata(buf, len) == 0) { 541 if (gotdata(buf, len) == 0) {
542 errno = save_errno; 542 errno = save_errno;
543 return 0; /* satisfied */ 543 return (0); /* satisfied */
544 } 544 }
545 errno = EIO; 545 errno = EIO;
546 return -1; 546 return (-1);
547} 547}