Unfinished attempt to overwrite existing; tricky because you need to delay writes...
[libdcp.git] / asdcplib / src / KM_prng.cpp
index 06b22d9182f4862c99abecf51f75a11c938335a1..463ae15752cf30d05987570737e33e6540a0d19f 100755 (executable)
@@ -1,3 +1,5 @@
+/* -*- c-basic-offset: 2; -*- */
+
 /*
 Copyright (c) 2006-2009, John Hurst
 All rights reserved.
@@ -98,7 +100,9 @@ public:
 
     set_key(rng_key);
 
-    m_libdcp_test_rng_state = 1;
+#ifdef LIBDCP_POSIX    
+    reset();
+#endif    
   }
        
   //
@@ -153,6 +157,13 @@ public:
     /* XXX */
 #endif
   }
+
+#ifdef LIBDCP_POSIX  
+  void reset ()
+  {
+    m_libdcp_test_rng_state = 1;
+  }
+#endif  
 };
 
 
@@ -206,6 +217,14 @@ Kumu::FortunaRNG::FillRandom(Kumu::ByteString& Buffer)
   return Buffer.Data();
 }
 
+#ifdef LIBDCP_POSIX
+void
+Kumu::FortunaRNG::Reset()
+{
+  s_RNG->reset();
+}
+#endif
+
 //------------------------------------------------------------------------------------------
 
 //