OEMCrypto Mock should not downgrade SRM

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

With this CL, the modifiable oemcrypto mock will only update the SRM
version number if the new number is greater than or equal to the
current one.

b/37744957

Change-Id: I10721146ca0ce24b1087657e18569a434e5d53b8
This commit is contained in:
Fred Gylys-Colwell
2017-05-01 14:49:10 -07:00
parent 1e451340ba
commit fb10272f55

View File

@@ -374,6 +374,11 @@ class AndroidModifiableCryptoEngine : public CryptoEngine {
}
int new_version = GetOption("srm_load_version", -1);
if (new_version >= 0) {
if (new_version < srm_version_) {
LOGE("New SRM version is lower than existing SRM version: %d < %d",
new_version, srm_version_);
return OEMCrypto_ERROR_INVALID_CONTEXT;
}
srm_version_ = new_version;
LOGI("OEMCrypto mock told to change SRM version to %d.", srm_version_);
srm_loaded_ = true;