Snapshot; Do some running repairs on entropy harvesting. More needs to follow.

This commit is contained in:
Mark Murray 2013-08-26 18:35:21 +00:00
parent f8530155da
commit c495c93567
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/random_number_generator/; revision=254928
5 changed files with 10 additions and 9 deletions

View File

@ -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);
}
/*

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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;