*** empty log message ***
authorJohn Kohl <jtkohl@mit.edu>
Wed, 23 May 1990 10:20:53 +0000 (10:20 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Wed, 23 May 1990 10:20:53 +0000 (10:20 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@901 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/crypto/os/rnd_confoun.c [new file with mode: 0644]

diff --git a/src/lib/crypto/os/rnd_confoun.c b/src/lib/crypto/os/rnd_confoun.c
new file mode 100644 (file)
index 0000000..09140f5
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * krb5_random_confounder()
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_rnd_counfoun_c[] =
+"$Id$";
+#endif /* !lint & !SABER */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+#include <krb5/ext-proto.h>
+
+/*
+ * Generate a random confounder
+ */
+krb5_ui_4
+krb5_random_confounder PROTOTYPE((void))
+{
+    static int seeded = 0;
+    long retval;
+
+    /* XXX this needs an alternative for an X3J11 C environment,
+       to use srand() and rand() */
+    if (!seeded) {
+       srandom(time(0));
+       seeded = 1;
+    }
+    /* this only gives us 31 random buts, but so what ? */
+    retval = random();
+    return (krb5_ui_4) retval;
+}