Fix SRM Version in mock
Merge from Widevine repo of http://go/wvgerrit/26522 The modifiable OEMCrypto mock did not use the correct initial SRM version as specified in the options file. This CL fixes that. b/37713658 Change-Id: I5ab5f5549dd7815edd4a3d69b804440faedeb657
This commit is contained in:
@@ -346,14 +346,18 @@ class AndroidModifiableCryptoEngine : public CryptoEngine {
|
|||||||
|
|
||||||
OEMCryptoResult current_srm_version(uint16_t *version) {
|
OEMCryptoResult current_srm_version(uint16_t *version) {
|
||||||
if (srm_loaded_) {
|
if (srm_loaded_) {
|
||||||
|
LOGV("SRM loaded. version used is %d.", srm_version_);
|
||||||
*version = srm_version_;
|
*version = srm_version_;
|
||||||
return OEMCrypto_SUCCESS;
|
return OEMCrypto_SUCCESS;
|
||||||
}
|
}
|
||||||
int value = GetOption("srm_initial_version", -1);
|
int value = GetOption("srm_initial_version", -1);
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
*version = srm_version_;
|
LOGV("SRM version from get option: %d.", value);
|
||||||
|
srm_version_ = value;
|
||||||
|
*version = value;
|
||||||
return OEMCrypto_SUCCESS;
|
return OEMCrypto_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
|
LOGI("SRM initial version is %d -- reporting not implemented.", value);
|
||||||
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -410,17 +410,18 @@ OEMCryptoResult SessionContext::LoadKeys(
|
|||||||
uint32_t minimum_version =
|
uint32_t minimum_version =
|
||||||
htonl(*reinterpret_cast<const uint32_t*>(srm_requirement + 8));
|
htonl(*reinterpret_cast<const uint32_t*>(srm_requirement + 8));
|
||||||
uint16_t current_version = 0;
|
uint16_t current_version = 0;
|
||||||
if (OEMCrypto_SUCCESS == ce_->current_srm_version(¤t_version) &&
|
if (OEMCrypto_SUCCESS != ce_->current_srm_version(¤t_version)) {
|
||||||
current_version >= minimum_version) {
|
LOGW("[LoadKeys: SRM Version not available.");
|
||||||
srm_requirements_status_ = ValidSRMVersion;
|
|
||||||
if (ce_->srm_blacklisted_device_attached()) {
|
|
||||||
LOGW("[LoadKeys: SRM blacklisted device attached]");
|
|
||||||
srm_requirements_status_ = InvalidSRMVersion;
|
srm_requirements_status_ = InvalidSRMVersion;
|
||||||
}
|
} else if (current_version < minimum_version) {
|
||||||
} else {
|
LOGW("[LoadKeys: SRM Version is too small %d, required: %d",
|
||||||
LOGW("[LoadKeys: SRM Version too small %d, required: %d",
|
|
||||||
current_version, minimum_version);
|
current_version, minimum_version);
|
||||||
srm_requirements_status_ = InvalidSRMVersion;
|
srm_requirements_status_ = InvalidSRMVersion;
|
||||||
|
} else if (ce_->srm_blacklisted_device_attached()) {
|
||||||
|
LOGW("[LoadKeys: SRM blacklisted device attached]");
|
||||||
|
srm_requirements_status_ = InvalidSRMVersion;
|
||||||
|
} else {
|
||||||
|
srm_requirements_status_ = ValidSRMVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user