make sure we have IV that is random enough. memory allocator on
some of platforms give us almost constant number (oops). Obtained from: KAME
This commit is contained in:
parent
3f4ab6537f
commit
222e221abc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=65153
@ -2664,6 +2664,7 @@ key_setsaval(sav, m, mhp)
|
||||
const struct esp_algorithm *algo;
|
||||
#endif
|
||||
int error = 0;
|
||||
struct timeval tv;
|
||||
|
||||
/* sanity check */
|
||||
if (m == NULL || mhp == NULL || mhp->msg == NULL)
|
||||
@ -2812,7 +2813,14 @@ key_setsaval(sav, m, mhp)
|
||||
error = ENOBUFS;
|
||||
goto fail;
|
||||
}
|
||||
/* initialize ? */
|
||||
|
||||
/* initialize */
|
||||
{
|
||||
int i;
|
||||
u_int8_t *p = (u_int8_t *)sav->iv;
|
||||
for (i = 0; i < sav->ivlen; i++)
|
||||
p[i] = key_random() & 0xff;
|
||||
}
|
||||
break;
|
||||
#else
|
||||
break;
|
||||
@ -2834,9 +2842,6 @@ key_setsaval(sav, m, mhp)
|
||||
sav->tick = 0;
|
||||
|
||||
/* make lifetime for CURRENT */
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
KMALLOC(sav->lft_c, struct sadb_lifetime *,
|
||||
sizeof(struct sadb_lifetime));
|
||||
if (sav->lft_c == NULL) {
|
||||
@ -2856,7 +2861,6 @@ key_setsaval(sav, m, mhp)
|
||||
sav->lft_c->sadb_lifetime_bytes = 0;
|
||||
sav->lft_c->sadb_lifetime_addtime = tv.tv_sec;
|
||||
sav->lft_c->sadb_lifetime_usetime = 0;
|
||||
}
|
||||
|
||||
/* lifetimes for HARD and SOFT */
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user