]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Changes to compat/getentropy files for,
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Wed, 20 Nov 2019 12:28:49 +0000 (13:28 +0100)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Wed, 20 Nov 2019 12:28:49 +0000 (13:28 +0100)
  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.

compat/getentropy_linux.c
compat/getentropy_solaris.c
doc/Changelog

index 6b220be311549332be2777e4bc362353611969e2..d9a5277a6d2b3235db7a0ffd8eb8632ace5138a4 100644 (file)
  * 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>
@@ -55,6 +66,9 @@
 #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))
index b80c84de9e5d562b24abcb16a72264cf2b542ffc..0a03046d468144c55fbd99b36ba4081e8b8bf758 100644 (file)
@@ -20,6 +20,7 @@
  * http://man.openbsd.org/getentropy.2
  */
 
+#include "config.h"
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/ioctl.h>
@@ -32,7 +33,9 @@
 #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>
index 0df61acbb59a466999c145dc3f5bbdac3af5b418..02ad18bbee8a11be1b6875e1bb28cfa80fdc9220 100644 (file)
          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.