diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2017-06-16 20:16:05 +1000 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2017-06-17 23:04:00 +1000 |
commit | a85b5759f34c0c4110a479a8b5fa606f15ed9b23 (patch) | |
tree | 518cb8346249a42fd2aa8a78c09c3631e14db6aa /external/unbound/compat | |
parent | Merge pull request #2059 (diff) | |
download | monero-a85b5759f34c0c4110a479a8b5fa606f15ed9b23.tar.xz |
Upgrade unbound library
These files were pulled from the 1.6.3 release tarball.
This new version builds against OpenSSL version 1.1 which will be
the default in the new Debian Stable which is due to be released
RealSoonNow (tm).
Diffstat (limited to 'external/unbound/compat')
-rw-r--r-- | external/unbound/compat/arc4_lock.c | 2 | ||||
-rw-r--r-- | external/unbound/compat/arc4random.c | 3 | ||||
-rw-r--r-- | external/unbound/compat/ctime_r.c | 2 | ||||
-rw-r--r-- | external/unbound/compat/explicit_bzero.c | 4 | ||||
-rw-r--r-- | external/unbound/compat/getentropy_linux.c | 9 | ||||
-rw-r--r-- | external/unbound/compat/strsep.c | 65 |
6 files changed, 80 insertions, 5 deletions
diff --git a/external/unbound/compat/arc4_lock.c b/external/unbound/compat/arc4_lock.c index faa743d15..0c45ad01b 100644 --- a/external/unbound/compat/arc4_lock.c +++ b/external/unbound/compat/arc4_lock.c @@ -48,7 +48,7 @@ void _ARC4_UNLOCK(void) } #else /* !THREADS_DISABLED */ -static lock_quick_t arc4lock; +static lock_quick_type arc4lock; static int arc4lockinit = 0; void _ARC4_LOCK(void) diff --git a/external/unbound/compat/arc4random.c b/external/unbound/compat/arc4random.c index 2c859f184..a09665c5d 100644 --- a/external/unbound/compat/arc4random.c +++ b/external/unbound/compat/arc4random.c @@ -48,6 +48,9 @@ #else /* !__GNUC__ */ #define inline #endif /* !__GNUC__ */ +#ifndef MAP_ANON +#define MAP_ANON MAP_ANONYMOUS +#endif #define KEYSZ 32 #define IVSZ 8 diff --git a/external/unbound/compat/ctime_r.c b/external/unbound/compat/ctime_r.c index 2594dc17e..87c2609a8 100644 --- a/external/unbound/compat/ctime_r.c +++ b/external/unbound/compat/ctime_r.c @@ -6,7 +6,7 @@ #include "util/locks.h" /** the lock for ctime buffer */ -static lock_basic_t ctime_lock; +static lock_basic_type ctime_lock; /** has it been inited */ static int ctime_r_init = 0; diff --git a/external/unbound/compat/explicit_bzero.c b/external/unbound/compat/explicit_bzero.c index a3ba2798a..5f1c427c2 100644 --- a/external/unbound/compat/explicit_bzero.c +++ b/external/unbound/compat/explicit_bzero.c @@ -6,7 +6,11 @@ #include "config.h" #include <string.h> +#ifdef HAVE_ATTR_WEAK __attribute__((weak)) void +#else +void +#endif __explicit_bzero_hook(void *ATTR_UNUSED(buf), size_t ATTR_UNUSED(len)) { } diff --git a/external/unbound/compat/getentropy_linux.c b/external/unbound/compat/getentropy_linux.c index b8d4a2bd0..cae18e03b 100644 --- a/external/unbound/compat/getentropy_linux.c +++ b/external/unbound/compat/getentropy_linux.c @@ -66,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)) @@ -100,7 +103,7 @@ int getentropy(void *buf, size_t len); extern int main(int, char *argv[]); #endif static int gotdata(char *buf, size_t len); -#ifdef SYS_getrandom +#if defined(SYS_getrandom) && defined(__NR_getrandom) static int getentropy_getrandom(void *buf, size_t len); #endif static int getentropy_urandom(void *buf, size_t len); @@ -119,7 +122,7 @@ getentropy(void *buf, size_t len) return -1; } -#ifdef SYS_getrandom +#if defined(SYS_getrandom) && defined(__NR_getrandom) /* * Try descriptor-less getrandom() */ @@ -215,7 +218,7 @@ gotdata(char *buf, size_t len) return 0; } -#ifdef SYS_getrandom +#if defined(SYS_getrandom) && defined(__NR_getrandom) static int getentropy_getrandom(void *buf, size_t len) { diff --git a/external/unbound/compat/strsep.c b/external/unbound/compat/strsep.c new file mode 100644 index 000000000..4e3f05c52 --- /dev/null +++ b/external/unbound/compat/strsep.c @@ -0,0 +1,65 @@ +/** + * strsep implementation for compatibility. + * + * LICENSE + * Copyright (c) 2016, NLnet Labs + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of NLnetLabs nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + **/ + +#include "config.h" + +/** see if character is in the delimiter array */ +static int +in_delim(char c, const char* delim) +{ + const char* p; + if(!delim) + return 0; + for(p=delim; *p; p++) { + if(*p == c) + return 1; + } + return 0; +} + +char *strsep(char **stringp, const char *delim) +{ + char* s; + char* orig; + if(stringp == NULL || *stringp == NULL) + return NULL; + orig = *stringp; + s = *stringp; + while(*s && !in_delim(*s, delim)) + s++; + if(*s) { + *s = 0; + *stringp = s+1; + } else { + *stringp = NULL; + } + return orig; +} |