]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/magic.c
New CHAP implementation, rewritten from scratch to avoid the code
[ppp.git] / pppd / magic.c
index 2e0426c5c6af9839469c7568206541a6977a1138..2fb23ff4adf48b68e6da309eb90373cd6bcc1d0f 100644 (file)
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: magic.c,v 1.10 2002/12/04 23:03:32 paulus Exp $"
+#define RCSID  "$Id: magic.c,v 1.11 2003/06/11 23:56:26 paulus Exp $"
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/time.h>
@@ -82,6 +83,18 @@ magic()
     return (u_int32_t) mrand48();
 }
 
+/*
+ * random_bytes - Fill a buffer with random bytes.
+ */
+void
+random_bytes(unsigned char *buf, int len)
+{
+       int i;
+
+       for (i = 0; i < len; ++i)
+               buf[i] = mrand48() >> 24;
+}
+
 #ifdef NO_DRAND48
 /*
  * Substitute procedures for those systems which don't have