* http://man.openbsd.org/getentropy.2
*/
+#include "config.h"
+/*
#define _POSIX_C_SOURCE 199309L
#define _GNU_SOURCE 1
+*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <unistd.h>
#include <time.h>
+#ifndef HAVE_NETTLE
#include <openssl/sha.h>
+#else
+#include <nettle/sha.h>
+#define SHA512_CTX struct sha512_ctx
+#define SHA512_Init(x) sha512_init(x)
+#define SHA512_Update(x, b, s) sha512_update(x, s, b)
+#define SHA512_Final(r, c) sha512_digest(c, SHA512_DIGEST_SIZE, r)
+#endif
#include <linux/types.h>
#include <linux/random.h>
#include <sys/auxv.h>
#endif
#include <sys/vfs.h>
+#ifndef MAP_ANON
+#define MAP_ANON MAP_ANONYMOUS
+#endif
#define REPEAT 5
#define min(a, b) (((a) < (b)) ? (a) : (b))
* http://man.openbsd.org/getentropy.2
*/
+#include "config.h"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <stdlib.h>
+#ifdef HAVE_STDINT_H
#include <stdint.h>
+#endif
#include <stdio.h>
#include <link.h>
#include <termios.h>
#include <errno.h>
#include <unistd.h>
#include <time.h>
+#ifdef HAVE_SYS_SHA2_H
#include <sys/sha2.h>
#define SHA512_Init SHA512Init
#define SHA512_Update SHA512Update
#define SHA512_Final SHA512Final
+#else
+#include "openssl/sha.h"
+#endif
#include <sys/vfs.h>
#include <sys/statfs.h>
OpenBSD, no changes but makes the file, comments, identical.
- Upgrade compat/getentropy_solaris.c to version 1.13 from OpenBSD.
- Upgrade compat/getentropy_osx.c to version 1.12 from OpenBSD.
+ - Changes to compat/getentropy files for,
+ no link to openssl if using nettle, and hence config.h for
+ HAVE_NETTLE variable.
+ compat definition of MAP_ANON, for older systems.
+ ifdef stdint.h inclusion for older systems.
+ ifdef sha2.h inclusion for older systems.
19 November 2019: Wouter
- Fix CVE-2019-18934, shell execution in ipsecmod.