* yarrow.c: Delete old macintosh support.
authorKen Raeburn <raeburn@mit.edu>
Thu, 28 Apr 2005 21:37:18 +0000 (21:37 +0000)
committerKen Raeburn <raeburn@mit.edu>
Thu, 28 Apr 2005 21:37:18 +0000 (21:37 +0000)
(yarrow_input_maybe_locking): Do the optional locking, and verify that the
mutex is locked, before doing anything else.
(yarrow_reseed_locked): Verify that the global mutex is locked before doing
anything else.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17204 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/crypto/yarrow/ChangeLog
src/lib/crypto/yarrow/yarrow.c

index cf08dc9ed91ec0430ead3d43089e6c69257ba8d1..6e9d02804cf1dc0588ab570feee251938087c7e0 100644 (file)
@@ -1,3 +1,11 @@
+2005-04-28  Ken Raeburn  <raeburn@mit.edu>
+
+       * yarrow.c: Delete old macintosh support.
+       (yarrow_input_maybe_locking): Do the optional locking, and verify
+       that the mutex is locked, before doing anything else.
+       (yarrow_reseed_locked): Verify that the global mutex is locked
+       before doing anything else.
+
 2005-01-13  Ken Raeburn  <raeburn@mit.edu>
 
        * yarrow.c (yarrow_reseed_locked): Renamed from
index 29c10f79e0fe2bc8899c828f2b8e908f722b9eec..b52057daa0a30875ed86b4f657abed221bf38c60 100644 (file)
 #include "port-sockets.h"
 #else
 #   include <unistd.h>
-#   if defined(macintosh)
-#       include <Memory.h>
-#   else
-#       include <netinet/in.h>
-#   endif
+#   include <netinet/in.h>
 #endif
 #if !defined(YARROW_NO_MATHLIB)
 #include <math.h>
@@ -262,23 +258,24 @@ int yarrow_input_maybe_locking( Yarrow_CTX* y, unsigned source_id,
     Source* source;
     size_t new_entropy;
     size_t estimate;
+  
+    if (do_lock) {
+           TRY( LOCK() );
+           locked = 1;
+    }
+    k5_assert_locked(&krb5int_yarrow_lock);
 
     if (!y) { THROW( YARROW_BAD_ARG ); }
 
     if (source_id >= y->num_sources) { THROW( YARROW_BAD_SOURCE ); }
   
     source = &y->source[source_id];
-  
+
     if(source->pool != YARROW_FAST_POOL && source->pool != YARROW_SLOW_POOL)
     {
        THROW( YARROW_BAD_SOURCE );
     }
 
-    if (do_lock) {
-           TRY( LOCK() );
-           locked = 1;
-    }
-
     /* hash in the sample */
 
     HASH_Update(&y->pool[source->pool], (const void*)sample, size);
@@ -672,8 +669,8 @@ static int Yarrow_Save_State( Yarrow_CTX *y )
 static int yarrow_reseed_locked(Yarrow_CTX* y, int pool)
 {
     EXCEP_DECL;
-    HASH_CTX* fast_pool = &y->pool[YARROW_FAST_POOL];
-    HASH_CTX* slow_pool = &y->pool[YARROW_SLOW_POOL];
+    HASH_CTX* fast_pool;
+    HASH_CTX* slow_pool;
     byte digest[HASH_DIGEST_SIZE];
     HASH_CTX hash;
     byte v_0[HASH_DIGEST_SIZE];
@@ -681,7 +678,10 @@ static int yarrow_reseed_locked(Yarrow_CTX* y, int pool)
     krb5_ui_4 big_endian_int32;
     COUNTER i;
 
+    k5_assert_locked(&krb5int_yarrow_lock);
     if (!y) { THROW( YARROW_BAD_ARG ); }
+    fast_pool = &y->pool[YARROW_FAST_POOL];
+    slow_pool = &y->pool[YARROW_SLOW_POOL];
     if( pool != YARROW_FAST_POOL && pool != YARROW_SLOW_POOL )
     {
        THROW( YARROW_BAD_ARG );