diff options
author | 2013-09-11 15:00:18 +0000 | |
---|---|---|
committer | 2013-09-11 15:00:18 +0000 | |
commit | 05d863314c58237be48095f5225b5545704b0ecd (patch) | |
tree | 17f19175fabc2fa2ee0477572588f65c8e9b611e /lib/libsqlite3 | |
parent | According to ITU X.690 (ASN.1 definition document), "octet strings" (diff) | |
download | wireguard-openbsd-05d863314c58237be48095f5225b5545704b0ecd.tar.xz wireguard-openbsd-05d863314c58237be48095f5225b5545704b0ecd.zip |
switch to using arc4random, as prompted by deraadt@.
also, OMIT_BUILTIN_TEST, since we're just a production library (duh)
bump shlib_version accordingly
okay reyk@, thanks for looking at this!
Diffstat (limited to 'lib/libsqlite3')
-rw-r--r-- | lib/libsqlite3/Makefile | 6 | ||||
-rw-r--r-- | lib/libsqlite3/shlib_version | 4 | ||||
-rw-r--r-- | lib/libsqlite3/src/os_unix.c | 4 | ||||
-rw-r--r-- | lib/libsqlite3/src/random.c | 6 |
4 files changed, 16 insertions, 4 deletions
diff --git a/lib/libsqlite3/Makefile b/lib/libsqlite3/Makefile index 7eb96e84c7c..d7009341eb2 100644 --- a/lib/libsqlite3/Makefile +++ b/lib/libsqlite3/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.10 2013/06/09 14:48:53 landry Exp $ +# $OpenBSD: Makefile,v 1.11 2013/09/11 15:00:18 espie Exp $ .include <bsd.own.mk> @@ -40,13 +40,15 @@ SRCS += pthread_stub.c FEATURE_FLAGS = -DSQLITE_ENABLE_COLUMN_METADATA \ -DSQLITE_ENABLE_RTREE \ -DSQLITE_ENABLE_UNLOCK_NOTIFY \ - -DSQLITE_ENABLE_FTS3 + -DSQLITE_ENABLE_FTS3 \ + -DSQLITE_OMIT_BUILTIN_TEST CPPFLAGS += $(FEATURE_FLAGS) -DSQLITE_THREADSAFE=1 \ -DHAVE_STDINT_H=1 -DHAVE_INTTYPES_H=1 \ -DHAVE_GMTIME_R=1 \ -DHAVE_LOCALTIME_R=1 \ -DHAVE_USLEEP=1 \ + -DHAVE_ARC4RANDOM_BUF=1 \ -DHAVE_STRERROR_R=1 \ -DSQLITE_TEMP_STORE=1 \ -DSQLITE_SOUNDEX=1 \ diff --git a/lib/libsqlite3/shlib_version b/lib/libsqlite3/shlib_version index cd2b605f972..15c8cf82d2d 100644 --- a/lib/libsqlite3/shlib_version +++ b/lib/libsqlite3/shlib_version @@ -1,3 +1,3 @@ -# $OpenBSD: shlib_version,v 1.8 2013/08/13 05:52:16 guenther Exp $ -major=24 +# $OpenBSD: shlib_version,v 1.9 2013/09/11 15:00:18 espie Exp $ +major=25 minor=0 diff --git a/lib/libsqlite3/src/os_unix.c b/lib/libsqlite3/src/os_unix.c index abc23a452e7..6707ec142ac 100644 --- a/lib/libsqlite3/src/os_unix.c +++ b/lib/libsqlite3/src/os_unix.c @@ -5995,6 +5995,9 @@ static int unixRandomness(sqlite3_vfs *NotUsed, int nBuf, char *zBuf){ */ memset(zBuf, 0, nBuf); #if !defined(SQLITE_TEST) +# if HAVE_ARC4RANDOM_BUF + arc4random_buf(zBuf, nBuf); +# else { int pid, fd, got; fd = robust_open("/dev/urandom", O_RDONLY, 0); @@ -6011,6 +6014,7 @@ static int unixRandomness(sqlite3_vfs *NotUsed, int nBuf, char *zBuf){ robust_close(0, fd, __LINE__); } } +# endif #endif return nBuf; } diff --git a/lib/libsqlite3/src/random.c b/lib/libsqlite3/src/random.c index 234ebdf658f..d371e446672 100644 --- a/lib/libsqlite3/src/random.c +++ b/lib/libsqlite3/src/random.c @@ -17,7 +17,12 @@ */ #include "sqliteInt.h" +#if HAVE_ARC4RANDOM_BUF && defined(SQLITE_OMIT_BUILTIN_TEST) +void sqlite3_randomness(int N, void *pBuf){ + arc4random_buf(pBuf, N); +} +#else /* All threads share a single random number generator. ** This structure is the current state of the generator. */ @@ -143,3 +148,4 @@ void sqlite3PrngResetState(void){ GLOBAL(struct sqlite3PrngType, sqlite3Prng).isInit = 0; } #endif /* SQLITE_OMIT_BUILTIN_TEST */ +#endif |