Use hex for FDPT hash

Merge from Widevine repo of http://go/wvgerrit/75123
Merge from Widevine repo of http://go/wvgerrit/75114

This changes the encoding for the hash to be hex instead of base64.

Also, the bad frame number is initialized to 0 to make it easier to
debug. And the FDPT test app now uses the correct byte order.

Bug: 129100318
Test: unit tests, FDPT test app.
Change-Id: I296bab990125a4e18bec92f3316e8289a3b25a6b
This commit is contained in:
Fred Gylys-Colwell
2019-03-22 11:42:21 -07:00
parent a5bc8be7a0
commit d641797e05
3 changed files with 4 additions and 4 deletions

View File

@@ -1810,7 +1810,7 @@ CdmResponseType CdmEngine::ParseDecryptHashString(
return INVALID_DECRYPT_HASH_FORMAT; return INVALID_DECRYPT_HASH_FORMAT;
} }
std::vector<uint8_t> hash_vec = wvcdm::Base64Decode(tokens[2]); std::vector<uint8_t> hash_vec = wvcdm::a2b_hex(tokens[2]);
if (hash_vec.empty()) { if (hash_vec.empty()) {
LOGE("CdmEngine::ParseDecryptHashString: malformed hash: %s", LOGE("CdmEngine::ParseDecryptHashString: malformed hash: %s",
hash_string.c_str()); hash_string.c_str());

View File

@@ -1951,7 +1951,7 @@ CdmResponseType CryptoSession::GetDecryptHashError(std::string* error_string) {
} }
error_string->clear(); error_string->clear();
uint32_t failed_frame_number; uint32_t failed_frame_number = 0;
OEMCryptoResult sts; OEMCryptoResult sts;
WithOecSessionLock("GetDecryptHashError", [&] { WithOecSessionLock("GetDecryptHashError", [&] {
sts = OEMCrypto_GetHashErrorCode(oec_session_id_, &failed_frame_number); sts = OEMCrypto_GetHashErrorCode(oec_session_id_, &failed_frame_number);

View File

@@ -405,10 +405,10 @@ TEST_F(WvCdmEngineTest, ParseDecryptHashStringTest) {
const std::string test_frame_number_string = const std::string test_frame_number_string =
std::to_string(test_frame_number); std::to_string(test_frame_number);
const std::string test_invalid_hash = "an invalid hash"; const std::string test_invalid_hash = "an invalid hash";
std::vector<uint8_t> binary_hash{ 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38 }; std::vector<uint8_t> binary_hash{ 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0xFF };
const std::string test_valid_decoded_hash(binary_hash.begin(), const std::string test_valid_decoded_hash(binary_hash.begin(),
binary_hash.end()); binary_hash.end());
const std::string test_valid_hash = Base64Encode(binary_hash); const std::string test_valid_hash = b2a_hex(binary_hash);
const std::string test_invalid_hash_string = "sample hash string"; const std::string test_invalid_hash_string = "sample hash string";
const std::string test_valid_hash_string = test_session_id + kComma + const std::string test_valid_hash_string = test_session_id + kComma +
test_frame_number_string + kComma + test_valid_hash; test_frame_number_string + kComma + test_valid_hash;