Author: adrian
Date: Fri Nov  1 20:53:49 2013
New Revision: 257525
URL: http://svnweb.freebsd.org/changeset/base/257525

Log:
  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.

Modified:
  head/sys/dev/random/harvest.c
  head/sys/net/bpf.c
  head/sys/net/if_ethersubr.c
  head/sys/net/if_tun.c
  head/sys/sys/random.h

Modified: head/sys/dev/random/harvest.c
==============================================================================
--- head/sys/dev/random/harvest.c       Fri Nov  1 20:33:30 2013        
(r257524)
+++ head/sys/dev/random/harvest.c       Fri Nov  1 20:53:49 2013        
(r257525)
@@ -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);

Modified: head/sys/net/bpf.c
==============================================================================
--- head/sys/net/bpf.c  Fri Nov  1 20:33:30 2013        (r257524)
+++ head/sys/net/bpf.c  Fri Nov  1 20:53:49 2013        (r257525)
@@ -577,7 +577,7 @@ bpf_movein(struct uio *uio, int linktype
                                goto bad;
                        }
                }
-               bcopy(m->m_data, sockp->sa_data, hlen);
+               bcopy(mtod(m, const void *), sockp->sa_data, hlen);
        }
        *hdrlen = hlen;
 

Modified: head/sys/net/if_ethersubr.c
==============================================================================
--- head/sys/net/if_ethersubr.c Fri Nov  1 20:33:30 2013        (r257524)
+++ head/sys/net/if_ethersubr.c Fri Nov  1 20:53:49 2013        (r257525)
@@ -642,7 +642,7 @@ ether_input_internal(struct ifnet *ifp, 
        }
 
        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();

Modified: head/sys/net/if_tun.c
==============================================================================
--- head/sys/net/if_tun.c       Fri Nov  1 20:33:30 2013        (r257524)
+++ head/sys/net/if_tun.c       Fri Nov  1 20:53:49 2013        (r257525)
@@ -919,7 +919,7 @@ tunwrite(struct cdev *dev, struct uio *u
                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);

Modified: head/sys/sys/random.h
==============================================================================
--- head/sys/sys/random.h       Fri Nov  1 20:33:30 2013        (r257524)
+++ head/sys/sys/random.h       Fri Nov  1 20:53:49 2013        (r257525)
@@ -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
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to