Browse Source

unify files further

OPENBSD_5_9
deraadt 9 years ago
parent
commit
31a603a934
20 changed files with 122 additions and 122 deletions
  1. +4
    -4
      src/lib/libcrypto/arc4random/arc4random_freebsd.h
  2. +4
    -4
      src/lib/libcrypto/arc4random/arc4random_netbsd.h
  3. +4
    -4
      src/lib/libcrypto/arc4random/arc4random_osx.h
  4. +8
    -8
      src/lib/libcrypto/arc4random/getentropy_aix.c
  5. +8
    -8
      src/lib/libcrypto/arc4random/getentropy_hpux.c
  6. +10
    -10
      src/lib/libcrypto/arc4random/getentropy_linux.c
  7. +4
    -4
      src/lib/libcrypto/arc4random/getentropy_netbsd.c
  8. +8
    -8
      src/lib/libcrypto/arc4random/getentropy_osx.c
  9. +9
    -9
      src/lib/libcrypto/arc4random/getentropy_solaris.c
  10. +2
    -2
      src/lib/libcrypto/arc4random/getentropy_win.c
  11. +4
    -4
      src/lib/libcrypto/crypto/arc4random_freebsd.h
  12. +4
    -4
      src/lib/libcrypto/crypto/arc4random_netbsd.h
  13. +4
    -4
      src/lib/libcrypto/crypto/arc4random_osx.h
  14. +8
    -8
      src/lib/libcrypto/crypto/getentropy_aix.c
  15. +8
    -8
      src/lib/libcrypto/crypto/getentropy_hpux.c
  16. +10
    -10
      src/lib/libcrypto/crypto/getentropy_linux.c
  17. +4
    -4
      src/lib/libcrypto/crypto/getentropy_netbsd.c
  18. +8
    -8
      src/lib/libcrypto/crypto/getentropy_osx.c
  19. +9
    -9
      src/lib/libcrypto/crypto/getentropy_solaris.c
  20. +2
    -2
      src/lib/libcrypto/crypto/getentropy_win.c

+ 4
- 4
src/lib/libcrypto/arc4random/arc4random_freebsd.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: arc4random_freebsd.h,v 1.2 2015/01/15 06:57:18 deraadt Exp $ */
/* $OpenBSD: arc4random_freebsd.h,v 1.3 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 1996, David Mazieres <dm@uun.org> * Copyright (c) 1996, David Mazieres <dm@uun.org>
@ -73,14 +73,14 @@ _rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
{ {
if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE, if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
return -1;
return (-1);
if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE, if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
munmap(*rsp, sizeof(**rsp)); munmap(*rsp, sizeof(**rsp));
return -1;
return (-1);
} }
_ARC4_ATFORK(_rs_forkhandler); _ARC4_ATFORK(_rs_forkhandler);
return 0;
return (0);
} }

+ 4
- 4
src/lib/libcrypto/arc4random/arc4random_netbsd.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: arc4random_netbsd.h,v 1.1 2015/01/19 20:21:40 bcook Exp $ */
/* $OpenBSD: arc4random_netbsd.h,v 1.2 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 1996, David Mazieres <dm@uun.org> * Copyright (c) 1996, David Mazieres <dm@uun.org>
@ -73,14 +73,14 @@ _rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
{ {
if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE, if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
return -1;
return (-1);
if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE, if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
munmap(*rsp, sizeof(**rsp)); munmap(*rsp, sizeof(**rsp));
return -1;
return (-1);
} }
_ARC4_ATFORK(_rs_forkhandler); _ARC4_ATFORK(_rs_forkhandler);
return 0;
return (0);
} }

+ 4
- 4
src/lib/libcrypto/arc4random/arc4random_osx.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: arc4random_osx.h,v 1.9 2015/01/15 06:57:18 deraadt Exp $ */
/* $OpenBSD: arc4random_osx.h,v 1.10 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 1996, David Mazieres <dm@uun.org> * Copyright (c) 1996, David Mazieres <dm@uun.org>
@ -67,14 +67,14 @@ _rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
{ {
if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE, if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
return -1;
return (-1);
if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE, if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
munmap(*rsp, sizeof(**rsp)); munmap(*rsp, sizeof(**rsp));
return -1;
return (-1);
} }
_ARC4_ATFORK(_rs_forkhandler); _ARC4_ATFORK(_rs_forkhandler);
return 0;
return (0);
} }

+ 8
- 8
src/lib/libcrypto/arc4random/getentropy_aix.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_aix.c,v 1.3 2015/08/25 17:26:43 deraadt Exp $ */
/* $OpenBSD: getentropy_aix.c,v 1.4 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 2015 Michael Felt <aixtools@gmail.com> * Copyright (c) 2015 Michael Felt <aixtools@gmail.com>
@ -72,7 +72,7 @@ getentropy(void *buf, size_t len)
if (len > 256) { if (len > 256) {
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
/* /*
@ -130,8 +130,8 @@ gotdata(char *buf, size_t len)
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
any_set |= buf[i]; any_set |= buf[i];
if (any_set == 0) if (any_set == 0)
return -1;
return 0;
return (-1);
return (0);
} }
static int static int
@ -181,11 +181,11 @@ start:
close(fd); close(fd);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
nodevrandom: nodevrandom:
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
static const int cl[] = { static const int cl[] = {
@ -418,8 +418,8 @@ getentropy_fallback(void *buf, size_t len)
explicit_bzero(results, sizeof results); explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
errno = EIO; errno = EIO;
return -1;
return (-1);
} }

+ 8
- 8
src/lib/libcrypto/arc4random/getentropy_hpux.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_hpux.c,v 1.3 2015/08/25 17:26:43 deraadt Exp $ */
/* $OpenBSD: getentropy_hpux.c,v 1.4 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@ -76,7 +76,7 @@ getentropy(void *buf, size_t len)
if (len > 256) { if (len > 256) {
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
/* /*
@ -134,8 +134,8 @@ gotdata(char *buf, size_t len)
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
any_set |= buf[i]; any_set |= buf[i];
if (any_set == 0) if (any_set == 0)
return -1;
return 0;
return (-1);
return (0);
} }
static int static int
@ -185,11 +185,11 @@ start:
close(fd); close(fd);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
nodevrandom: nodevrandom:
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
static const int cl[] = { static const int cl[] = {
@ -412,8 +412,8 @@ getentropy_fallback(void *buf, size_t len)
explicit_bzero(results, sizeof results); explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
errno = EIO; errno = EIO;
return -1;
return (-1);
} }

+ 10
- 10
src/lib/libcrypto/arc4random/getentropy_linux.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_linux.c,v 1.40 2015/08/25 17:26:43 deraadt Exp $ */
/* $OpenBSD: getentropy_linux.c,v 1.41 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@ -91,7 +91,7 @@ getentropy(void *buf, size_t len)
if (len > 256) { if (len > 256) {
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
#ifdef SYS_getrandom #ifdef SYS_getrandom
@ -186,8 +186,8 @@ gotdata(char *buf, size_t len)
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
any_set |= buf[i]; any_set |= buf[i];
if (any_set == 0) if (any_set == 0)
return -1;
return 0;
return (-1);
return (0);
} }
#ifdef SYS_getrandom #ifdef SYS_getrandom
@ -260,11 +260,11 @@ start:
close(fd); close(fd);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
nodevrandom: nodevrandom:
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
#ifdef SYS__sysctl #ifdef SYS__sysctl
@ -295,7 +295,7 @@ getentropy_sysctl(void *buf, size_t len)
} }
sysctlfailed: sysctlfailed:
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
#endif /* SYS__sysctl */ #endif /* SYS__sysctl */
@ -330,7 +330,7 @@ getentropy_phdr(struct dl_phdr_info *info, size_t size, void *data)
SHA512_CTX *ctx = data; SHA512_CTX *ctx = data;
SHA512_Update(ctx, &info->dlpi_addr, sizeof (info->dlpi_addr)); SHA512_Update(ctx, &info->dlpi_addr, sizeof (info->dlpi_addr));
return 0;
return (0);
} }
static int static int
@ -540,8 +540,8 @@ getentropy_fallback(void *buf, size_t len)
explicit_bzero(results, sizeof results); explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
errno = EIO; errno = EIO;
return -1;
return (-1);
} }

+ 4
- 4
src/lib/libcrypto/arc4random/getentropy_netbsd.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_netbsd.c,v 1.1 2015/01/19 20:21:40 bcook Exp $ */
/* $OpenBSD: getentropy_netbsd.c,v 1.2 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 2014 Pawel Jakub Dawidek <pjd@FreeBSD.org> * Copyright (c) 2014 Pawel Jakub Dawidek <pjd@FreeBSD.org>
@ -55,10 +55,10 @@ int
getentropy(void *buf, size_t len) getentropy(void *buf, size_t len)
{ {
if (len <= 256 && if (len <= 256 &&
getentropy_sysctl(buf, len) == len) {
return 0;
getentropy_sysctl(buf, len) == len) {
return (0);
} }
errno = EIO; errno = EIO;
return -1;
return (-1);
} }

+ 8
- 8
src/lib/libcrypto/arc4random/getentropy_osx.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_osx.c,v 1.8 2014/07/21 20:19:47 guenther Exp $ */
/* $OpenBSD: getentropy_osx.c,v 1.9 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@ -88,7 +88,7 @@ getentropy(void *buf, size_t len)
if (len > 256) { if (len > 256) {
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
/* /*
@ -149,8 +149,8 @@ gotdata(char *buf, size_t len)
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
any_set |= buf[i]; any_set |= buf[i];
if (any_set == 0) if (any_set == 0)
return -1;
return 0;
return (-1);
return (0);
} }
static int static int
@ -200,11 +200,11 @@ start:
close(fd); close(fd);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
nodevrandom: nodevrandom:
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
static int tcpmib[] = { CTL_NET, AF_INET, IPPROTO_TCP, TCPCTL_STATS }; static int tcpmib[] = { CTL_NET, AF_INET, IPPROTO_TCP, TCPCTL_STATS };
@ -422,8 +422,8 @@ getentropy_fallback(void *buf, size_t len)
explicit_bzero(results, sizeof results); explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
errno = EIO; errno = EIO;
return -1;
return (-1);
} }

+ 9
- 9
src/lib/libcrypto/arc4random/getentropy_solaris.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_solaris.c,v 1.10 2015/08/25 17:26:43 deraadt Exp $ */
/* $OpenBSD: getentropy_solaris.c,v 1.11 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@ -81,7 +81,7 @@ getentropy(void *buf, size_t len)
if (len > 256) { if (len > 256) {
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
/* /*
@ -160,8 +160,8 @@ gotdata(char *buf, size_t len)
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
any_set |= buf[i]; any_set |= buf[i];
if (any_set == 0) if (any_set == 0)
return -1;
return 0;
return (-1);
return (0);
} }
static int static int
@ -212,11 +212,11 @@ start:
close(fd); close(fd);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
nodevrandom: nodevrandom:
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
static const int cl[] = { static const int cl[] = {
@ -250,7 +250,7 @@ getentropy_phdr(struct dl_phdr_info *info, size_t size, void *data)
SHA512_CTX *ctx = data; SHA512_CTX *ctx = data;
SHA512_Update(ctx, &info->dlpi_addr, sizeof (info->dlpi_addr)); SHA512_Update(ctx, &info->dlpi_addr, sizeof (info->dlpi_addr));
return 0;
return (0);
} }
static int static int
@ -438,8 +438,8 @@ getentropy_fallback(void *buf, size_t len)
explicit_bzero(results, sizeof results); explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
errno = EIO; errno = EIO;
return -1;
return (-1);
} }

+ 2
- 2
src/lib/libcrypto/arc4random/getentropy_win.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_win.c,v 1.3 2014/11/11 13:54:33 bcook Exp $ */
/* $OpenBSD: getentropy_win.c,v 1.4 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 2014, Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014, Theo de Raadt <deraadt@openbsd.org>
@ -40,7 +40,7 @@ getentropy(void *buf, size_t len)
if (len > 256) { if (len > 256) {
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL,


+ 4
- 4
src/lib/libcrypto/crypto/arc4random_freebsd.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: arc4random_freebsd.h,v 1.2 2015/01/15 06:57:18 deraadt Exp $ */
/* $OpenBSD: arc4random_freebsd.h,v 1.3 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 1996, David Mazieres <dm@uun.org> * Copyright (c) 1996, David Mazieres <dm@uun.org>
@ -73,14 +73,14 @@ _rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
{ {
if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE, if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
return -1;
return (-1);
if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE, if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
munmap(*rsp, sizeof(**rsp)); munmap(*rsp, sizeof(**rsp));
return -1;
return (-1);
} }
_ARC4_ATFORK(_rs_forkhandler); _ARC4_ATFORK(_rs_forkhandler);
return 0;
return (0);
} }

+ 4
- 4
src/lib/libcrypto/crypto/arc4random_netbsd.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: arc4random_netbsd.h,v 1.1 2015/01/19 20:21:40 bcook Exp $ */
/* $OpenBSD: arc4random_netbsd.h,v 1.2 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 1996, David Mazieres <dm@uun.org> * Copyright (c) 1996, David Mazieres <dm@uun.org>
@ -73,14 +73,14 @@ _rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
{ {
if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE, if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
return -1;
return (-1);
if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE, if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
munmap(*rsp, sizeof(**rsp)); munmap(*rsp, sizeof(**rsp));
return -1;
return (-1);
} }
_ARC4_ATFORK(_rs_forkhandler); _ARC4_ATFORK(_rs_forkhandler);
return 0;
return (0);
} }

+ 4
- 4
src/lib/libcrypto/crypto/arc4random_osx.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: arc4random_osx.h,v 1.9 2015/01/15 06:57:18 deraadt Exp $ */
/* $OpenBSD: arc4random_osx.h,v 1.10 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 1996, David Mazieres <dm@uun.org> * Copyright (c) 1996, David Mazieres <dm@uun.org>
@ -67,14 +67,14 @@ _rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
{ {
if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE, if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
return -1;
return (-1);
if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE, if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
munmap(*rsp, sizeof(**rsp)); munmap(*rsp, sizeof(**rsp));
return -1;
return (-1);
} }
_ARC4_ATFORK(_rs_forkhandler); _ARC4_ATFORK(_rs_forkhandler);
return 0;
return (0);
} }

+ 8
- 8
src/lib/libcrypto/crypto/getentropy_aix.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_aix.c,v 1.3 2015/08/25 17:26:43 deraadt Exp $ */
/* $OpenBSD: getentropy_aix.c,v 1.4 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 2015 Michael Felt <aixtools@gmail.com> * Copyright (c) 2015 Michael Felt <aixtools@gmail.com>
@ -72,7 +72,7 @@ getentropy(void *buf, size_t len)
if (len > 256) { if (len > 256) {
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
/* /*
@ -130,8 +130,8 @@ gotdata(char *buf, size_t len)
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
any_set |= buf[i]; any_set |= buf[i];
if (any_set == 0) if (any_set == 0)
return -1;
return 0;
return (-1);
return (0);
} }
static int static int
@ -181,11 +181,11 @@ start:
close(fd); close(fd);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
nodevrandom: nodevrandom:
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
static const int cl[] = { static const int cl[] = {
@ -418,8 +418,8 @@ getentropy_fallback(void *buf, size_t len)
explicit_bzero(results, sizeof results); explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
errno = EIO; errno = EIO;
return -1;
return (-1);
} }

+ 8
- 8
src/lib/libcrypto/crypto/getentropy_hpux.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_hpux.c,v 1.3 2015/08/25 17:26:43 deraadt Exp $ */
/* $OpenBSD: getentropy_hpux.c,v 1.4 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@ -76,7 +76,7 @@ getentropy(void *buf, size_t len)
if (len > 256) { if (len > 256) {
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
/* /*
@ -134,8 +134,8 @@ gotdata(char *buf, size_t len)
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
any_set |= buf[i]; any_set |= buf[i];
if (any_set == 0) if (any_set == 0)
return -1;
return 0;
return (-1);
return (0);
} }
static int static int
@ -185,11 +185,11 @@ start:
close(fd); close(fd);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
nodevrandom: nodevrandom:
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
static const int cl[] = { static const int cl[] = {
@ -412,8 +412,8 @@ getentropy_fallback(void *buf, size_t len)
explicit_bzero(results, sizeof results); explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
errno = EIO; errno = EIO;
return -1;
return (-1);
} }

+ 10
- 10
src/lib/libcrypto/crypto/getentropy_linux.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_linux.c,v 1.40 2015/08/25 17:26:43 deraadt Exp $ */
/* $OpenBSD: getentropy_linux.c,v 1.41 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@ -91,7 +91,7 @@ getentropy(void *buf, size_t len)
if (len > 256) { if (len > 256) {
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
#ifdef SYS_getrandom #ifdef SYS_getrandom
@ -186,8 +186,8 @@ gotdata(char *buf, size_t len)
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
any_set |= buf[i]; any_set |= buf[i];
if (any_set == 0) if (any_set == 0)
return -1;
return 0;
return (-1);
return (0);
} }
#ifdef SYS_getrandom #ifdef SYS_getrandom
@ -260,11 +260,11 @@ start:
close(fd); close(fd);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
nodevrandom: nodevrandom:
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
#ifdef SYS__sysctl #ifdef SYS__sysctl
@ -295,7 +295,7 @@ getentropy_sysctl(void *buf, size_t len)
} }
sysctlfailed: sysctlfailed:
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
#endif /* SYS__sysctl */ #endif /* SYS__sysctl */
@ -330,7 +330,7 @@ getentropy_phdr(struct dl_phdr_info *info, size_t size, void *data)
SHA512_CTX *ctx = data; SHA512_CTX *ctx = data;
SHA512_Update(ctx, &info->dlpi_addr, sizeof (info->dlpi_addr)); SHA512_Update(ctx, &info->dlpi_addr, sizeof (info->dlpi_addr));
return 0;
return (0);
} }
static int static int
@ -540,8 +540,8 @@ getentropy_fallback(void *buf, size_t len)
explicit_bzero(results, sizeof results); explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
errno = EIO; errno = EIO;
return -1;
return (-1);
} }

+ 4
- 4
src/lib/libcrypto/crypto/getentropy_netbsd.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_netbsd.c,v 1.1 2015/01/19 20:21:40 bcook Exp $ */
/* $OpenBSD: getentropy_netbsd.c,v 1.2 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 2014 Pawel Jakub Dawidek <pjd@FreeBSD.org> * Copyright (c) 2014 Pawel Jakub Dawidek <pjd@FreeBSD.org>
@ -55,10 +55,10 @@ int
getentropy(void *buf, size_t len) getentropy(void *buf, size_t len)
{ {
if (len <= 256 && if (len <= 256 &&
getentropy_sysctl(buf, len) == len) {
return 0;
getentropy_sysctl(buf, len) == len) {
return (0);
} }
errno = EIO; errno = EIO;
return -1;
return (-1);
} }

+ 8
- 8
src/lib/libcrypto/crypto/getentropy_osx.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_osx.c,v 1.8 2014/07/21 20:19:47 guenther Exp $ */
/* $OpenBSD: getentropy_osx.c,v 1.9 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@ -88,7 +88,7 @@ getentropy(void *buf, size_t len)
if (len > 256) { if (len > 256) {
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
/* /*
@ -149,8 +149,8 @@ gotdata(char *buf, size_t len)
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
any_set |= buf[i]; any_set |= buf[i];
if (any_set == 0) if (any_set == 0)
return -1;
return 0;
return (-1);
return (0);
} }
static int static int
@ -200,11 +200,11 @@ start:
close(fd); close(fd);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
nodevrandom: nodevrandom:
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
static int tcpmib[] = { CTL_NET, AF_INET, IPPROTO_TCP, TCPCTL_STATS }; static int tcpmib[] = { CTL_NET, AF_INET, IPPROTO_TCP, TCPCTL_STATS };
@ -422,8 +422,8 @@ getentropy_fallback(void *buf, size_t len)
explicit_bzero(results, sizeof results); explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
errno = EIO; errno = EIO;
return -1;
return (-1);
} }

+ 9
- 9
src/lib/libcrypto/crypto/getentropy_solaris.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_solaris.c,v 1.10 2015/08/25 17:26:43 deraadt Exp $ */
/* $OpenBSD: getentropy_solaris.c,v 1.11 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@ -81,7 +81,7 @@ getentropy(void *buf, size_t len)
if (len > 256) { if (len > 256) {
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
/* /*
@ -160,8 +160,8 @@ gotdata(char *buf, size_t len)
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
any_set |= buf[i]; any_set |= buf[i];
if (any_set == 0) if (any_set == 0)
return -1;
return 0;
return (-1);
return (0);
} }
static int static int
@ -212,11 +212,11 @@ start:
close(fd); close(fd);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
nodevrandom: nodevrandom:
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
static const int cl[] = { static const int cl[] = {
@ -250,7 +250,7 @@ getentropy_phdr(struct dl_phdr_info *info, size_t size, void *data)
SHA512_CTX *ctx = data; SHA512_CTX *ctx = data;
SHA512_Update(ctx, &info->dlpi_addr, sizeof (info->dlpi_addr)); SHA512_Update(ctx, &info->dlpi_addr, sizeof (info->dlpi_addr));
return 0;
return (0);
} }
static int static int
@ -438,8 +438,8 @@ getentropy_fallback(void *buf, size_t len)
explicit_bzero(results, sizeof results); explicit_bzero(results, sizeof results);
if (gotdata(buf, len) == 0) { if (gotdata(buf, len) == 0) {
errno = save_errno; errno = save_errno;
return 0; /* satisfied */
return (0); /* satisfied */
} }
errno = EIO; errno = EIO;
return -1;
return (-1);
} }

+ 2
- 2
src/lib/libcrypto/crypto/getentropy_win.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_win.c,v 1.3 2014/11/11 13:54:33 bcook Exp $ */
/* $OpenBSD: getentropy_win.c,v 1.4 2015/09/11 11:52:55 deraadt Exp $ */
/* /*
* Copyright (c) 2014, Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014, Theo de Raadt <deraadt@openbsd.org>
@ -40,7 +40,7 @@ getentropy(void *buf, size_t len)
if (len > 256) { if (len > 256) {
errno = EIO; errno = EIO;
return -1;
return (-1);
} }
if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL,


Loading…
Cancel
Save