Refactor OEMCrypto Engine

Merge from widevine repo of http://go/wvgerrit/23280

This CL moves some of the oemcrypto mock classes into their own
files.  There are no real code changes.

Change-Id: I4e4a6a01d8e75051bc0eb2a5d58361c438c7f41b
This commit is contained in:
Fred Gylys-Colwell
2017-01-27 15:21:08 -08:00
parent 650a0fdead
commit d06fa606c7
10 changed files with 1706 additions and 1585 deletions

View File

@@ -0,0 +1,38 @@
// Copyright 2013 Google Inc. All Rights Reserved.
//
// Mock implementation of OEMCrypto APIs
//
#ifndef MOCK_OEMCRYPTO_NONCE_TABLE_H_
#define MOCK_OEMCRYPTO_NONCE_TABLE_H_
#include <stdint.h>
namespace wvoec_mock {
class NonceTable {
public:
static const int kTableSize = 16;
NonceTable() {
for (int i = 0; i < kTableSize; ++i) {
state_[i] = kNTStateInvalid;
}
}
~NonceTable() {}
void AddNonce(uint32_t nonce);
bool CheckNonce(uint32_t nonce);
void Flush();
private:
enum NonceTableState {
kNTStateInvalid,
kNTStateValid,
kNTStateFlushPending
};
NonceTableState state_[kTableSize];
uint32_t age_[kTableSize];
uint32_t nonces_[kTableSize];
};
} // namespace wvoec_mock
#endif // MOCK_OEMCRYPTO_NONCE_TABLE_H_