on obsd/mbsd, entropy is cheap enough for us to do this (codepath in
kernel checked for both) for additional seeding ($RANDOM is still from the LCG only)
This commit is contained in:
parent
31b288561f
commit
a6c81ea978
4
check.t
4
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.379 2010/07/04 17:45:11 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.380 2010/07/11 11:17:29 tg Exp $
|
||||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
||||||
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
||||||
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||||
@ -25,7 +25,7 @@
|
|||||||
# http://www.research.att.com/~gsf/public/ifs.sh
|
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R39 2010/07/04
|
@(#)MIRBSD KSH R39 2010/07/11
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
stdin:
|
stdin:
|
||||||
|
10
mksh.1
10
mksh.1
@ -1,4 +1,4 @@
|
|||||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.227 2010/07/04 17:33:56 tg Exp $
|
.\" $MirOS: src/bin/mksh/mksh.1,v 1.228 2010/07/11 11:17:31 tg Exp $
|
||||||
.\" $OpenBSD: ksh.1,v 1.134 2010/05/10 21:04:54 jmc Exp $
|
.\" $OpenBSD: ksh.1,v 1.134 2010/05/10 21:04:54 jmc Exp $
|
||||||
.\"-
|
.\"-
|
||||||
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||||
@ -71,7 +71,7 @@
|
|||||||
.\" with -mandoc, it might implement .Mx itself, but we want to
|
.\" with -mandoc, it might implement .Mx itself, but we want to
|
||||||
.\" use our own definition. And .Dd must come *first*, always.
|
.\" use our own definition. And .Dd must come *first*, always.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: July 4 2010 $
|
.Dd $Mdocdate: July 11 2010 $
|
||||||
.\"
|
.\"
|
||||||
.\" Check which macro package we use
|
.\" Check which macro package we use
|
||||||
.\"
|
.\"
|
||||||
@ -1920,10 +1920,10 @@ May be unset or
|
|||||||
.Dv NULL
|
.Dv NULL
|
||||||
if the shell doesn't know where it is.
|
if the shell doesn't know where it is.
|
||||||
.It Ev RANDOM
|
.It Ev RANDOM
|
||||||
Every time
|
Each time
|
||||||
.Ev RANDOM
|
.Ev RANDOM
|
||||||
is referenced, it is assigned a 15-bit pseudo-random number, i.e. between
|
is referenced, it is assigned a number between 0 and 32767 from
|
||||||
0 and 32767, first, which is taken from a Linear Congruential PRNG.
|
a Linear Congruential PRNG first.
|
||||||
.It Ev REPLY
|
.It Ev REPLY
|
||||||
Default parameter for the
|
Default parameter for the
|
||||||
.Ic read
|
.Ic read
|
||||||
|
4
sh.h
4
sh.h
@ -150,9 +150,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.395 2010/07/04 17:45:16 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.396 2010/07/11 11:17:32 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R39 2010/07/04"
|
#define MKSH_VERSION "R39 2010/07/11"
|
||||||
|
|
||||||
#ifndef MKSH_INCLUDES_ONLY
|
#ifndef MKSH_INCLUDES_ONLY
|
||||||
|
|
||||||
|
24
var.c
24
var.c
@ -22,7 +22,11 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.106 2010/07/04 17:45:17 tg Exp $");
|
#if defined(__OpenBSD__)
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.107 2010/07/11 11:17:33 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Variables
|
* Variables
|
||||||
@ -1022,6 +1026,11 @@ void
|
|||||||
change_random(const void *vp, size_t n)
|
change_random(const void *vp, size_t n)
|
||||||
{
|
{
|
||||||
register uint32_t h = 0x100;
|
register uint32_t h = 0x100;
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
int mib[2];
|
||||||
|
uint8_t k[3];
|
||||||
|
size_t klen;
|
||||||
|
#endif
|
||||||
|
|
||||||
kshstate_v.cr_dp = vp;
|
kshstate_v.cr_dp = vp;
|
||||||
kshstate_v.cr_dsz = n;
|
kshstate_v.cr_dsz = n;
|
||||||
@ -1029,6 +1038,19 @@ change_random(const void *vp, size_t n)
|
|||||||
h = oaathash_update(oaathash_update(h, (void *)&kshstate_v,
|
h = oaathash_update(oaathash_update(h, (void *)&kshstate_v,
|
||||||
sizeof(kshstate_v)), vp, n);
|
sizeof(kshstate_v)), vp, n);
|
||||||
kshstate_v.lcg_state_ = oaathash_finalise(h);
|
kshstate_v.lcg_state_ = oaathash_finalise(h);
|
||||||
|
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
/* OpenBSD, MirBSD: proper kernel entropy comes at zero cost */
|
||||||
|
|
||||||
|
mib[0] = CTL_KERN;
|
||||||
|
mib[1] = KERN_ARND;
|
||||||
|
klen = sizeof(k);
|
||||||
|
sysctl(mib, 2, k, &klen, &kshstate_v.lcg_state_,
|
||||||
|
sizeof(kshstate_v.lcg_state_));
|
||||||
|
/* we ignore failures and take in k anyway */
|
||||||
|
h = oaathash_update(h, k, sizeof(k));
|
||||||
|
kshstate_v.lcg_state_ = oaathash_finalise(h);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user