new MKSH_A4PB cppflag: force use of arc4random_pushb(3) during seeding
just the way sysctl KERN_ARND currently is used on OpenBSD/MirBSD (for manual packager overrides only, no mirtoconf check; e.g. for Cygwin)
This commit is contained in:
12
var.c
12
var.c
@@ -26,7 +26,7 @@
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.108 2010/07/17 22:09:40 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.109 2010/07/18 17:29:50 tg Exp $");
|
||||
|
||||
/*
|
||||
* Variables
|
||||
@@ -1050,6 +1050,16 @@ change_random(const void *vp, size_t n)
|
||||
/* we ignore failures and take in k anyway */
|
||||
h = oaathash_update(h, k, sizeof(k));
|
||||
kshstate_v.lcg_state_ = oaathash_finalise(h);
|
||||
#elif defined(MKSH_A4PB)
|
||||
/* forced by the user to use arc4random_pushb(3) • Cygwin? */
|
||||
{
|
||||
uint32_t prv;
|
||||
|
||||
prv = arc4random_pushb(&kshstate_v.lcg_state_,
|
||||
sizeof(kshstate_v.lcg_state_));
|
||||
h = oaathash_update(h, &prv, sizeof(prv));
|
||||
}
|
||||
kshstate_v.lcg_state_ = oaathash_finalise(h);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user