replace uses of OAAT hash in all its variants by NZAT (mksh internal) or NZAAT (all others)
This commit is contained in:
20
var.c
20
var.c
@@ -26,7 +26,7 @@
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.128 2011/07/05 20:12:20 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.129 2011/07/06 22:22:02 tg Exp $");
|
||||
|
||||
/*-
|
||||
* Variables
|
||||
@@ -1496,9 +1496,9 @@ hash(const void *s)
|
||||
{
|
||||
register uint32_t h;
|
||||
|
||||
oaat1_init_impl(h);
|
||||
oaat1_addstr_impl(h, s);
|
||||
oaat1_fini_impl(h);
|
||||
NZATInit(h);
|
||||
NZATUpdateString(h, s);
|
||||
NZATFinish(h);
|
||||
return (h);
|
||||
}
|
||||
|
||||
@@ -1507,9 +1507,9 @@ rndset(long v)
|
||||
{
|
||||
register uint32_t h;
|
||||
|
||||
oaat1_init_impl(h);
|
||||
oaat1_addmem_impl(h, &lcg_state, sizeof(lcg_state));
|
||||
oaat1_addmem_impl(h, &v, sizeof(v));
|
||||
NZATInit(h);
|
||||
NZATUpdateMem(h, &lcg_state, sizeof(lcg_state));
|
||||
NZATUpdateMem(h, &v, sizeof(v));
|
||||
|
||||
#if defined(arc4random_pushb_fast) || defined(MKSH_A4PB)
|
||||
/*
|
||||
@@ -1518,16 +1518,16 @@ rndset(long v)
|
||||
* user requested us to use the old functions
|
||||
*/
|
||||
lcg_state = h;
|
||||
oaat1_fini_impl(lcg_state);
|
||||
NZAATFinish(lcg_state);
|
||||
#if defined(arc4random_pushb_fast)
|
||||
arc4random_pushb_fast(&lcg_state, sizeof(lcg_state));
|
||||
lcg_state = arc4random();
|
||||
#else
|
||||
lcg_state = arc4random_pushb(&lcg_state, sizeof(lcg_state));
|
||||
#endif
|
||||
oaat1_addmem_impl(h, &lcg_state, sizeof(lcg_state));
|
||||
NZATUpdateMem(h, &lcg_state, sizeof(lcg_state));
|
||||
#endif
|
||||
|
||||
oaat1_fini_impl(h);
|
||||
NZAATFinish(h);
|
||||
lcg_state = h;
|
||||
}
|
||||
|
Reference in New Issue
Block a user