Enable OEMCrypto Unit Tests

This is a merge from the widevine repository of
http://go/wvgerrit/13923 Switch openssl to use the EVP interface for aes-ctr-128
http://go/wvgerrit/13979 Add Test Certificate to OEMCrypto Mock
http://go/wvgerrit/13978 Add Test Keybox to Level 3 OEMCrypto
http://go/wvgerrit/13873 Enable OEMCrypto Unit Tests

This CL adds a main program to oemcrypto_test.cpp, which filters out
tests that are not supported on the specified platform. It also adds
LoadTestKeybox to the mock. This allows oemcrypto unit tests to be run
on devices that have production keybox.  It also allows the same set
of unit tests to work on Android and on non-Android platforms.

b/18962381 Use test certificate (partial fix)
b/19867990 Separate cast receiver tests

Change-Id: If89c31530103ed85aa37d7379bd5b4dc2a927f38
This commit is contained in:
Fred Gylys-Colwell
2015-04-07 15:21:58 -07:00
parent 229fb48f83
commit 6d5be4fddf
21 changed files with 2059 additions and 1383 deletions

View File

@@ -76,12 +76,12 @@ class SessionContext {
SessionContext() {}
public:
explicit SessionContext(CryptoEngine* ce, SessionId sid)
explicit SessionContext(CryptoEngine* ce, SessionId sid, RSA* rsa_key)
: valid_(true),
ce_(ce),
id_(sid),
current_content_key_(NULL),
rsa_key_(NULL),
rsa_key_(rsa_key),
allowed_schemes_(kSign_RSASSA_PSS),
usage_entry_(NULL) {}
~SessionContext();
@@ -225,7 +225,11 @@ class CryptoEngine {
void Terminate();
KeyboxError ValidateKeybox();
WvKeybox& keybox() { return keybox_; }
WvKeybox& keybox() { return use_test_keybox_ ? test_keybox_ : keybox_; }
WvKeybox& real_keybox() { return keybox_; }
void UseTestKeybox() { use_test_keybox_ = true; }
RSA* rsa_key() { return rsa_key_; }
bool LoadTestRSAKey();
SessionId CreateSession();
@@ -252,6 +256,7 @@ class CryptoEngine {
bool local_display();
bool closed_platform();
bool supports_storage();
bool supports_keybox();
bool is_anti_rollback_hw_present();
const char* security_level();
@@ -259,8 +264,11 @@ class CryptoEngine {
SessionContext* current_session_;
ActiveSessions sessions_;
WvKeybox keybox_;
WvTestKeybox test_keybox_;
wvcdm::Lock session_table_lock_;
UsageTable* usage_table_;
bool use_test_keybox_;
RSA* rsa_key_; // If no keybox, this is baked in certificate.
CORE_DISALLOW_COPY_AND_ASSIGN(CryptoEngine);
};