Add a DecryptCENC call after SelectKey for entitled sessions

Merge from Widevine repo of http://go/wvgerrit/154874

We do not require an error to come from SelectKey immediately, it can
come from a following call to DecryptCENC. This adds a function
Session::TestDecryptCENC to be called instead of SelectKey for the tests
that use entitled sessions.

Bug: 232225906
Test: tested with http://go/ag/20420224

Change-Id: If5695a5034cce371b6eb6bcf1b6467d84456c21d
This commit is contained in:
Vicky Min
2022-11-08 13:56:10 -08:00
committed by Fred Gylys-Colwell
parent e88bcf51c8
commit 579b9144b5
3 changed files with 82 additions and 50 deletions

View File

@@ -561,6 +561,12 @@ class Session {
void TestDecryptCTR(bool select_key_first = true,
OEMCryptoResult expected_result = OEMCrypto_SUCCESS,
size_t key_index = 0);
// Encrypt some data and pass to OEMCrypto_DecryptCENC to verify decryption
// for entitled sessions.
void TestDecryptEntitled(OEMCryptoResult expected_result = OEMCrypto_SUCCESS,
OEMCrypto_SESSION session = 0,
const uint8_t* content_key_id = nullptr,
size_t content_key_id_length = 0);
// Verify that an attempt to select an expired key either succeeds, or gives
// an actionable error code.
void TestSelectExpired(size_t key_index);