Source release 14.0.0
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "test_keybox.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace wvoec;
|
||||
|
||||
@@ -26,7 +24,7 @@ void SessionUtil::CreateWrappedRSAKeyFromKeybox(uint32_t allowed_schemes,
|
||||
bool force) {
|
||||
Session s;
|
||||
ASSERT_NO_FATAL_FAILURE(s.open());
|
||||
ASSERT_NO_FATAL_FAILURE(s.GenerateDerivedKeysFromKeybox());
|
||||
ASSERT_NO_FATAL_FAILURE(s.GenerateDerivedKeysFromKeybox(keybox_));
|
||||
// Provisioning request would be signed by the client and verified by the
|
||||
// server.
|
||||
ASSERT_NO_FATAL_FAILURE(s.VerifyClientSignature());
|
||||
@@ -83,14 +81,16 @@ void SessionUtil::CreateWrappedRSAKey(uint32_t allowed_schemes,
|
||||
}
|
||||
}
|
||||
|
||||
void SessionUtil::InstallKeybox(const uint8_t* keybox, bool good) {
|
||||
const size_t keybox_size = wvcdm_test_auth::kKeyboxSize;
|
||||
uint8_t wrapped[keybox_size];
|
||||
size_t length = keybox_size;
|
||||
void SessionUtil::InstallKeybox(const wvcdm_test_auth::WidevineKeybox& keybox,
|
||||
bool good) {
|
||||
uint8_t wrapped[sizeof(wvcdm_test_auth::WidevineKeybox)];
|
||||
size_t length = sizeof(wvcdm_test_auth::WidevineKeybox);
|
||||
keybox_ = keybox;
|
||||
ASSERT_EQ(
|
||||
OEMCrypto_SUCCESS,
|
||||
OEMCrypto_WrapKeybox(keybox, keybox_size, wrapped, &length, NULL, 0));
|
||||
OEMCryptoResult sts = OEMCrypto_InstallKeybox(wrapped, length);
|
||||
OEMCrypto_WrapKeybox(reinterpret_cast<const uint8_t*>(&keybox),
|
||||
sizeof(keybox), wrapped, &length, NULL, 0));
|
||||
OEMCryptoResult sts = OEMCrypto_InstallKeybox(wrapped, sizeof(keybox));
|
||||
if (good) {
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, sts);
|
||||
} else {
|
||||
@@ -101,16 +101,30 @@ void SessionUtil::InstallKeybox(const uint8_t* keybox, bool good) {
|
||||
void SessionUtil::EnsureTestKeys() {
|
||||
switch (global_features.derive_key_method) {
|
||||
case DeviceFeatures::LOAD_TEST_KEYBOX:
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_LoadTestKeybox());
|
||||
keybox_ = wvcdm_test_auth::kTestKeybox;
|
||||
/* Note: If you are upgrading from an older version, it may be easier to
|
||||
* force the following condition. This uses the same test keybox as we
|
||||
* used in older versions of this test.
|
||||
*/
|
||||
if (global_features.api_version < 14) {
|
||||
keybox_ = wvcdm_test_auth::kValidKeybox01;
|
||||
}
|
||||
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS,
|
||||
OEMCrypto_LoadTestKeybox(
|
||||
reinterpret_cast<const uint8_t*>(&keybox_),
|
||||
sizeof(keybox_)));
|
||||
break;
|
||||
case DeviceFeatures::LOAD_TEST_RSA_KEY:
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_LoadTestRSAKey());
|
||||
break;
|
||||
case DeviceFeatures::EXISTING_TEST_KEYBOX:
|
||||
// already has test keybox.
|
||||
// already has old test keybox.
|
||||
keybox_ = wvcdm_test_auth::kValidKeybox01;
|
||||
break;
|
||||
case DeviceFeatures::FORCE_TEST_KEYBOX:
|
||||
InstallKeybox(wvcdm_test_auth::kKeybox, true);
|
||||
keybox_ = wvcdm_test_auth::kTestKeybox;
|
||||
InstallKeybox(keybox_, true);
|
||||
break;
|
||||
case DeviceFeatures::TEST_PROVISION_30:
|
||||
// Can use oem certificate to install test rsa key.
|
||||
@@ -140,7 +154,7 @@ void SessionUtil::InstallTestSessionKeys(Session* s) {
|
||||
s->GenerateDerivedKeysFromSessionKey());
|
||||
} else { // Just uses keybox. Test keybox should already be installed.
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
s->GenerateDerivedKeysFromKeybox());
|
||||
s->GenerateDerivedKeysFromKeybox(keybox_));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user