head 1.2; access; symbols; locks; strict; comment @# @; 1.2 date 2022.09.11.19.33.05; author schmonz; state dead; branches; next 1.1; commitid U2Ki3xiyPWB5RtTD; 1.1 date 2022.08.30.17.55.31; author schmonz; state Exp; branches; next ; commitid TzVUibcj0mpxHVRD; desc @@ 1.2 log @Update to 20220901. From the changelog: - fixed randombytes(), uses getentropy() and /dev/urandom where getentropy() does not exist @ text @$NetBSD: patch-randombytes.c-01getentropy,v 1.1 2022/08/30 17:55:31 schmonz Exp $ Apply upstream commit 0cb7bb4 to fall back to /dev/urandom on systems where getentropy() is not present. --- randombytes.c-01getentropy.orig 2022-08-30 17:47:01.000000000 +0000 +++ randombytes.c-01getentropy @@@@ -0,0 +1,30 @@@@ +/* +version 20220222 +*/ + +#include +#ifdef __APPLE__ +#include +#endif +#include "randombytes.h" + +void randombytes(void *xv, long long xlen) { + + long long i; + unsigned char *x = (unsigned char *) xv; + + while (xlen > 0) { + if (xlen < 256) + i = xlen; + else + i = 256; + + if (getentropy(x, i) == -1) { + sleep(1); + continue; + } + x += i; + xlen -= i; + } + __asm__ __volatile__("" : : "r"(xv) : "memory"); +} @ 1.1 log @Apply upstream commit 0cb7bb4 to fall back to /dev/urandom on systems where getentropy() is not present. Bump PKGREVISION. @ text @d1 1 a1 1 $NetBSD$ @