Add a mutex for the shared static storage used by Yarrow
authorKen Raeburn <raeburn@mit.edu>
Sat, 1 May 2004 00:00:02 +0000 (00:00 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 1 May 2004 00:00:02 +0000 (00:00 +0000)
commit5e0b254fc61c328d1ae2729b0cc7392165790f3c
treef890511bae7b75e9c124b785ef2c142912b5de36
parenta4f8e8baa568d752f3a4efc94827f10bd14bfc95
Add a mutex for the shared static storage used by Yarrow

* crypto_libinit.c (initialized): Variable deleted.
(cryptoint_initialize_library, cryptoint_cleanup_library): Use new macros for
automatic shared library init/fini functions.
(prng_cleanup): Declaration deleted.
(krb5int_prng_init, krb5int_prng_cleanup): Declare.
(cryptoint_initialize_library): Call krb5int_prng_init.
(krb5int_crypto_init): New function, checks that cryptoint_initialize_library
was called successfully.
(cryptoint_cleanup_library): Call krb5int_prng_cleanup only if the initializer
ran.
* crypto_libinit.h: Deleted.
* prng.c: Include k5-thread.h.
(init_once, init_error, yarrow_lock): New variables.
(krb5int_prng_init): New function; finish initializing the mutex lock.
(do_yarrow_init): New function.
(krb5_c_random_add_entropy): Call it once only.  Lock the mutex before
processing the input.
(krb5_c_random_make_octets): Lock the mutex before extracting random bytes.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16290 dc483132-0cff-0310-8789-dd5450dbe970
src/lib/crypto/ChangeLog
src/lib/crypto/crypto_libinit.c
src/lib/crypto/crypto_libinit.h [deleted file]
src/lib/crypto/prng.c