const char* DEV_URANDOM = "/dev/urandom";
#endif // KM_WIN32
+bool Kumu::libdcp_test = false;
const ui32_t RNG_KEY_SIZE = 512UL;
const ui32_t RNG_KEY_SIZE_BITS = 256UL;
AES_KEY m_Context;
byte_t m_ctr_buf[RNG_BLOCK_SIZE];
Mutex m_Lock;
+ unsigned int m_libdcp_test_rng_state;
h__RNG()
{
} // end AutoMutex context
set_key(rng_key);
+
+ m_libdcp_test_rng_state = 1;
}
//
AES_encrypt(m_ctr_buf, tmp, &m_Context);
memcpy(buf + gen_count, tmp, len - gen_count);
}
+
+ if (libdcp_test)
+ {
+ for (unsigned int i = 0; i < len; ++i)
+ buf[i] = rand_r(&m_libdcp_test_rng_state);
+ }
}
};
// key_len must be <= 64 (larger values will be truncated)
void Gen_FIPS_186_Value(const byte_t* key_in, ui32_t key_len, byte_t* buf, ui32_t buf_len);
+ extern bool libdcp_test;
} // namespace Kumu
#!/bin/sh
-LD_LIBRARY_PATH=build/src
+LD_LIBRARY_PATH=build/src:build/asdcplib/src
build/test/tests
-diff -ur build/test/foo test/ref/DCP
+#diff -ur build/test/foo test/ref/DCP
\ No newline at end of file
using namespace std;
-bool libdcp::libdcp_test = false;
-
/** Create a UUID.
* @return UUID.
*/
{
char buffer[64];
Kumu::UUID id;
-
- if (libdcp_test) {
- static int N = 0;
- byte_t t[16];
- for (int i = 0; i < 16; ++i) {
- t[i] = N;
- }
- ++N;
-
- id = Kumu::UUID (t);
- } else {
- Kumu::GenRandomValue (id);
- }
-
+ Kumu::GenRandomValue (id);
id.EncodeHex (buffer, 64);
return string (buffer);
}
extern std::string make_uuid ();
extern std::string make_digest (std::string);
-extern bool libdcp_test;
}
*/
#include <boost/filesystem.hpp>
+#include "KM_prng.h"
#include "dcp.h"
#include "util.h"
#include "tags.h"
BOOST_AUTO_TEST_CASE (dcp_test)
{
- libdcp::libdcp_test = true;
-
+ Kumu::libdcp_test = true;
+
libdcp::Tags* t = libdcp::Tags::instance ();
t->issuer = "OpenDCP 0.0.25";
t->creator = "OpenDCP 0.0.25";