Index: trunk/src/sh_entropy.c
===================================================================
--- trunk/src/sh_entropy.c	(revision 146)
+++ trunk/src/sh_entropy.c	(revision 147)
@@ -295,5 +295,5 @@
       if (0 == sh_unix_device_readable(fd2)) 
 	{
-	  m_count = sl_read_timeout_fd(fd2, &nbuf, nbytes, 
+	  m_count = sl_read_timeout_fd(fd2, nbuf, nbytes, 
 				       timeout_val, SL_FALSE);
 	  if (m_count < 0)
@@ -387,4 +387,5 @@
       SH_MUTEX_UNLOCK_UNSAFE(mutex_skey);
       memset (keybuf, '\0', KEY_BYT);
+      memset (kbuf,   '\0', sizeof(kbuf));
       
       SL_RETURN(0, _("sh_entropy"));
@@ -960,8 +961,32 @@
 #endif
 
-
-
-
-
-
-
+#ifdef SH_CUTEST
+#include "CuTest.h"
+
+void Test_entropy (CuTest *tc)
+{
+  char                 bufx[9 * sizeof(UINT32) + 1];
+  char                 bufy[9 * sizeof(UINT32) + 1];
+  int                  status;
+
+  memset(skey->poolv, '\0', KEY_BYT);
+
+  status = sh_entropy (24, bufx);
+  CuAssertTrue(tc, 0 == status);
+
+  memset(skey->poolv, '\0', KEY_BYT);
+
+  status = sh_entropy (24, bufy);
+  CuAssertTrue(tc, 0 == status);
+
+  CuAssertTrue(tc, 0 != memcmp(bufx, bufy, 24));
+}
+#endif
+
+
+
+
+
+
+
+
