Convert the random entropy harvesting code to use a const void * pointer

rather than just void *.

Then, as part of this, convert a couple of mbuf m->m_data accesses
to mtod(m, const void *).

Reviewed by:	markm
Approved by:	security-officer (delphij)
Sponsored by:	Netflix, Inc.
This commit is contained in:
Adrian Chadd 2013-11-01 20:53:49 +00:00
parent 760eb697b4
commit a09968c479
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=257525
5 changed files with 5 additions and 5 deletions

View File

@ -86,7 +86,7 @@ randomdev_deinit_harvester(void)
* read which can be quite expensive.
*/
void
random_harvest(void *entropy, u_int count, u_int bits, enum esource origin)
random_harvest(const void *entropy, u_int count, u_int bits, enum esource origin)
{
if (reap_func)
(*reap_func)(get_cyclecount(), entropy, count, bits, origin);

View File

@ -577,7 +577,7 @@ bpf_movein(struct uio *uio, int linktype, struct ifnet *ifp, struct mbuf **mp,
goto bad;
}
}
bcopy(m->m_data, sockp->sa_data, hlen);
bcopy(mtod(m, const void *), sockp->sa_data, hlen);
}
*hdrlen = hlen;

View File

@ -642,7 +642,7 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m)
}
if (harvest.ethernet)
random_harvest(&(m->m_data), 12, 2, RANDOM_NET_ETHER);
random_harvest(mtod(m, const void *), 12, 2, RANDOM_NET_ETHER);
ether_demux(ifp, m);
CURVNET_RESTORE();

View File

@ -919,7 +919,7 @@ tunwrite(struct cdev *dev, struct uio *uio, int flag)
return (EAFNOSUPPORT);
}
if (harvest.point_to_point)
random_harvest(&(m->m_data), 12, 2, RANDOM_NET_TUN);
random_harvest(mtod(m, const void *), 12, 2, RANDOM_NET_TUN);
ifp->if_ibytes += m->m_pkthdr.len;
ifp->if_ipackets++;
CURVNET_SET(ifp->if_vnet);

View File

@ -58,7 +58,7 @@ enum esource {
RANDOM_PURE_RNDTEST,
ENTROPYSOURCE
};
void random_harvest(void *, u_int, u_int, enum esource);
void random_harvest(const void *, u_int, u_int, enum esource);
/* Allow the sysadmin to select the broad category of
* entropy types to harvest