Snapshot; Do some running repairs on entropy harvesting. More needs to follow.
This commit is contained in:
parent
e007bbae78
commit
8a3bb03c25
@ -1147,7 +1147,7 @@ swi_sched(void *cookie, int flags)
|
||||
entropy.event = (uintptr_t)ih;
|
||||
entropy.td = curthread;
|
||||
random_harvest(&entropy, sizeof(entropy), 1, 0,
|
||||
RANDOM_INTERRUPT);
|
||||
RANDOM_SWI);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -638,9 +638,8 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m)
|
||||
m->m_flags |= M_PROMISC;
|
||||
}
|
||||
|
||||
/* First chunk of an mbuf contains good entropy */
|
||||
if (harvest.ethernet)
|
||||
random_harvest(m, 16, 3, 0, RANDOM_NET);
|
||||
random_harvest(&(m->m_data), 12, 3, 0, RANDOM_NET_ETHER);
|
||||
|
||||
ether_demux(ifp, m);
|
||||
CURVNET_RESTORE();
|
||||
|
@ -922,9 +922,8 @@ tunwrite(struct cdev *dev, struct uio *uio, int flag)
|
||||
m_freem(m);
|
||||
return (EAFNOSUPPORT);
|
||||
}
|
||||
/* First chunk of an mbuf contains good junk */
|
||||
if (harvest.point_to_point)
|
||||
random_harvest(m, 16, 3, 0, RANDOM_NET);
|
||||
random_harvest(&(m->m_data), 12, 3, 0, RANDOM_NET_TUN);
|
||||
ifp->if_ibytes += m->m_pkthdr.len;
|
||||
ifp->if_ipackets++;
|
||||
CURVNET_SET(ifp->if_vnet);
|
||||
|
@ -774,9 +774,8 @@ ng_iface_rcvdata(hook_p hook, item_p item)
|
||||
m_freem(m);
|
||||
return (EAFNOSUPPORT);
|
||||
}
|
||||
/* First chunk of an mbuf contains good junk */
|
||||
if (harvest.point_to_point)
|
||||
random_harvest(m, 16, 3, 0, RANDOM_NET);
|
||||
random_harvest(&(m->m_data), 12, 3, 0, RANDOM_NET_NG);
|
||||
M_SETFIB(m, ifp->if_fib);
|
||||
netisr_dispatch(isr, m);
|
||||
return (0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2000 Mark R. V. Murray
|
||||
* Copyright (c) 2000-2013 Mark R. V. Murray
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -42,8 +42,11 @@ enum esource {
|
||||
RANDOM_WRITE = 0,
|
||||
RANDOM_KEYBOARD,
|
||||
RANDOM_MOUSE,
|
||||
RANDOM_NET,
|
||||
RANDOM_NET_TUN,
|
||||
RANDOM_NET_ETHER,
|
||||
RANDOM_NET_NG,
|
||||
RANDOM_INTERRUPT,
|
||||
RANDOM_SWI,
|
||||
RANDOM_PURE,
|
||||
ENTROPYSOURCE
|
||||
};
|
||||
@ -57,6 +60,7 @@ struct harvest_select {
|
||||
int point_to_point;
|
||||
int interrupt;
|
||||
int swi;
|
||||
int namei;
|
||||
};
|
||||
|
||||
extern struct harvest_select harvest;
|
||||
|
Loading…
Reference in New Issue
Block a user