summaryrefslogtreecommitdiffstats
path: root/lib/libsqlite3/src/os_unix.c
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2013-09-11 15:00:18 +0000
committerespie <espie@openbsd.org>2013-09-11 15:00:18 +0000
commit05d863314c58237be48095f5225b5545704b0ecd (patch)
tree17f19175fabc2fa2ee0477572588f65c8e9b611e /lib/libsqlite3/src/os_unix.c
parentAccording to ITU X.690 (ASN.1 definition document), "octet strings" (diff)
downloadwireguard-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/src/os_unix.c')
-rw-r--r--lib/libsqlite3/src/os_unix.c4
1 files changed, 4 insertions, 0 deletions
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;
}