OEMCrypto v16.1 Documentation and Headers

This commit contains the updated v16.1 documentation dated Nov 12th,
as well has the headers and update ODK library.

Unit tests and reference code is partially implemented, but not yet
complete.
This commit is contained in:
Fred Gylys-Colwell
2019-11-15 15:45:18 -08:00
parent 4de11d11e8
commit 2f232e2939
50 changed files with 6364 additions and 2780 deletions

40
util/test/test_clock.cpp Normal file
View File

@@ -0,0 +1,40 @@
// Copyright 2013 Google Inc. All Rights Reserved.
//
// Clock - A fake clock just for running tests.
#include "clock.h"
#include <chrono>
#include "test_sleep.h"
namespace wvcdm {
namespace {
// A fake clock that only advances when TestSleep::Sleep is called.
class FakeClock : public wvcdm::TestSleep::CallBack {
public:
FakeClock() {
auto now = std::chrono::steady_clock().now();
now_ = now.time_since_epoch() / std::chrono::milliseconds(1);
TestSleep::set_callback(this);
}
~FakeClock() { TestSleep::set_callback(nullptr); }
void ElapseTime(int64_t milliseconds) { now_ += milliseconds; }
int64_t now() const { return now_; }
private:
int64_t now_;
};
FakeClock* g_fake_clock = nullptr;
} // namespace
// On devices running a fake OEMCrypto, we can use a fake sleep and fake time.
int64_t Clock::GetCurrentTime() {
if (g_fake_clock == nullptr) g_fake_clock = new FakeClock();
return g_fake_clock->now() / 1000;
}
} // namespace wvcdm