Loading...
bsd/dev/random/randomdev.c xnu-792.2.4 xnu-792.10.96
--- xnu/xnu-792.2.4/bsd/dev/random/randomdev.c
+++ xnu/xnu-792.10.96/bsd/dev/random/randomdev.c
@@ -238,8 +238,8 @@
         
         /* put it in Yarrow */
         if (prngInput(gPrngRef, (BYTE*) rdBuffer,
-			sizeof (rdBuffer), SYSTEM_SOURCE,
-        	sizeof (rdBuffer) * 8) != 0) {
+			bytesToInput, SYSTEM_SOURCE,
+        	bytesToInput * 8) != 0) {
             retCode = EIO;
             goto error_exit;
         }
@@ -279,7 +279,7 @@
         int bytesToRead = min(uio_resid(uio), sizeof (wrBuffer));
         
         /* get the data from Yarrow */
-        if (prngOutput(gPrngRef, (BYTE *) wrBuffer, sizeof (wrBuffer)) != 0) {
+        if (prngOutput(gPrngRef, (BYTE *) wrBuffer, bytesToRead) != 0) {
             printf ("Couldn't read data from Yarrow.\n");
             
             /* something's really weird */