+2004-06-02 Ken Raeburn <raeburn@mit.edu>
+
+ * prng.c (init_once): Variable deleted.
+ (krb5_c_random_add_entropy): Do the initialization once, using
+ the yarrow_lock mutex instead of k5_once to protect it.
+
2004-05-24 Ezra Peisach <epeisach@mit.edu>
* t_nfold.c (fold_kerberos): Change nbytes argument to unsigned.
/*
- * Copyright (C) 2001, 2002 by the Massachusetts Institute of Technology.
+ * Copyright (C) 2001, 2002, 2004 by the Massachusetts Institute of Technology.
* All rights reserved.
*
*
#include "yarrow.h"
static Yarrow_CTX y_ctx;
-static k5_once_t init_once = K5_ONCE_INIT;
static int inited, init_error;
static k5_mutex_t yarrow_lock = K5_MUTEX_PARTIAL_INITIALIZER;
yerr = krb5int_crypto_init();
if (yerr)
return yerr;
- /* Run the Yarrow init code, if not done already. */
- yerr = k5_once(&init_once, do_yarrow_init);
- if (yerr)
- return yerr;
- /* Return an error if the Yarrow initialization failed. */
- if (init_error)
- return KRB5_CRYPTO_INTERNAL;
/* Now, finally, feed in the data. */
yerr = k5_mutex_lock(&yarrow_lock);
if (yerr)
return yerr;
+ if (!inited)
+ do_yarrow_init();
+ if (init_error) {
+ k5_mutex_unlock(&yarrow_lock);
+ return KRB5_CRYPTO_INTERNAL;
+ }
yerr = krb5int_yarrow_input (&y_ctx, randsource,
data->data, data->length,
entropy_estimate (randsource, data->length));