summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/crypto/os/rnd_confoun.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/lib/crypto/os/rnd_confoun.c b/src/lib/crypto/os/rnd_confoun.c
new file mode 100644
index 000000000..09140f588
--- /dev/null
+++ b/src/lib/crypto/os/rnd_confoun.c
@@ -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;
+}