Require 20 keys per session and 10 sessions

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

OMECrypto v12 requires at least 20 keys per session and at least 10
sessions.  This CL updates the unit tests to verify this, and updates
level 3 and mock code to conform.

This CL also updates the level 3 oemcrypto to support 16 sessions and
320 keys total.

b/30140448 Minimum 20 keys per OEMCrypto_Session

Change-Id: Idd38d8f2cdfd6acde6fa7622b5912372bee9e488
This commit is contained in:
Fred Gylys-Colwell
2016-11-28 21:36:03 -08:00
parent 97c2c74556
commit f0cee3ad20
3 changed files with 80 additions and 51 deletions

View File

@@ -36,7 +36,7 @@ void PrintTo(const PatternTestVariant& param, ostream* os);
namespace wvoec {
const size_t kNumKeys = 4;
const size_t kMaxNumKeys = 20;
namespace {
#if defined(TEST_SPEED_MULTIPLIER) // Can slow test time limits when
@@ -83,7 +83,7 @@ typedef struct {
// This structure will be signed to simulate a message from the server.
struct MessageData {
MessageKeyData keys[kNumKeys];
MessageKeyData keys[kMaxNumKeys];
uint8_t mac_key_iv[wvcdm::KEY_IV_SIZE];
uint8_t mac_keys[2 * wvcdm::MAC_KEY_SIZE];
uint8_t pst[kTestKeyIdMaxLength];
@@ -154,7 +154,8 @@ class Session {
const vector<uint8_t>& in_buffer, const uint8_t *key,
const uint8_t* starting_iv, vector<uint8_t>* out_buffer);
void TestDecryptCTR(bool select_key_first = true,
OEMCryptoResult expected_result = OEMCrypto_SUCCESS);
OEMCryptoResult expected_result = OEMCrypto_SUCCESS,
int key_index = 0);
void MakeRSACertificate(
struct RSAPrivateKeyMessage* encrypted, std::vector<uint8_t>* signature,
uint32_t allowed_schemes, const vector<uint8_t>& rsa_key);
@@ -186,6 +187,9 @@ class Session {
OEMCrypto_KeyObject* key_array() { return key_array_; }
std::vector<uint8_t>& signature() { return signature_; }
void set_num_keys(int num_keys) { num_keys_ = num_keys; }
int num_keys() const { return num_keys_; }
private:
bool open_;
bool forced_session_id_;
@@ -198,8 +202,9 @@ class Session {
vector<uint8_t> pst_report_buffer_;
MessageData license_;
MessageData encrypted_license_;
OEMCrypto_KeyObject key_array_[kNumKeys];
OEMCrypto_KeyObject key_array_[kMaxNumKeys];
std::vector<uint8_t> signature_;
int num_keys_;
};
} // namespace wvoec