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:
38
libwvdrmengine/oemcrypto/mock/src/oemcrypto_nonce_table.h
Normal file
38
libwvdrmengine/oemcrypto/mock/src/oemcrypto_nonce_table.h
Normal 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_
|
||||
Reference in New Issue
Block a user