Make GetMaxNumberOfSessions and GetNumberOfOpenSessions security level aware
Merged from Widevine CDM repo: https://widevine-internal-review.googlesource.com/#/c/13662/ Change-Id: Id261ab16c4f987dbee78b3ecde4beebbf44f5371
This commit is contained in:
@@ -28,6 +28,10 @@ OEMCryptoResult OEMCrypto_GetHDCPCapability(SecurityLevel level,
|
||||
OEMCrypto_HDCP_Capability* maximum);
|
||||
bool OEMCrypto_SupportsUsageTable(SecurityLevel level);
|
||||
bool OEMCrypto_IsAntiRollbackHwPresent(SecurityLevel level);
|
||||
OEMCryptoResult OEMCrypto_GetNumberOfOpenSessions(SecurityLevel level,
|
||||
size_t* count);
|
||||
OEMCryptoResult OEMCrypto_GetMaxNumberOfSessions(SecurityLevel level,
|
||||
size_t* maximum);
|
||||
} // namespace wvcdm
|
||||
|
||||
#endif // WVCDM_CORE_OEMCRYPTO_ADAPTER_H_
|
||||
|
||||
@@ -994,7 +994,8 @@ bool CryptoSession::GetNumberOfOpenSessions(size_t* count) {
|
||||
}
|
||||
|
||||
size_t sessions_count;
|
||||
OEMCryptoResult status = OEMCrypto_GetNumberOfOpenSessions(&sessions_count);
|
||||
OEMCryptoResult status = OEMCrypto_GetNumberOfOpenSessions(
|
||||
requested_security_level_, &sessions_count);
|
||||
if (OEMCrypto_SUCCESS != status) {
|
||||
LOGW("OEMCrypto_GetNumberOfOpenSessions fails with %d", status);
|
||||
return false;
|
||||
@@ -1012,7 +1013,8 @@ bool CryptoSession::GetMaxNumberOfSessions(size_t* max) {
|
||||
}
|
||||
|
||||
size_t max_sessions;
|
||||
OEMCryptoResult status = OEMCrypto_GetMaxNumberOfSessions(&max_sessions);
|
||||
OEMCryptoResult status = OEMCrypto_GetMaxNumberOfSessions(
|
||||
requested_security_level_, &max_sessions);
|
||||
if (OEMCrypto_SUCCESS != status) {
|
||||
LOGW("OEMCrypto_GetMaxNumberOfSessions fails with %d", status);
|
||||
return false;
|
||||
|
||||
@@ -568,6 +568,24 @@ bool OEMCrypto_IsAntiRollbackHwPresent(SecurityLevel level) {
|
||||
return fcn->IsAntiRollbackHwPresent();
|
||||
}
|
||||
|
||||
OEMCryptoResult OEMCrypto_GetNumberOfOpenSessions(SecurityLevel level,
|
||||
size_t* count) {
|
||||
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
const FunctionPointers* fcn = kAdapter->get(level);
|
||||
if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION;
|
||||
if (fcn->version < 10) return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||
return fcn->GetNumberOfOpenSessions(count);
|
||||
}
|
||||
|
||||
OEMCryptoResult OEMCrypto_GetMaxNumberOfSessions(SecurityLevel level,
|
||||
size_t* maximum) {
|
||||
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
const FunctionPointers* fcn = kAdapter->get(level);
|
||||
if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION;
|
||||
if (fcn->version < 10) return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||
return fcn->GetMaxNumberOfSessions(maximum);
|
||||
}
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
extern "C" OEMCryptoResult OEMCrypto_Initialize(void) {
|
||||
@@ -795,24 +813,12 @@ extern "C" bool OEMCrypto_IsAntiRollbackHwPresent() {
|
||||
return OEMCrypto_IsAntiRollbackHwPresent(kLevelDefault);
|
||||
}
|
||||
|
||||
extern "C" OEMCryptoResult OEMCrypto_GetNumberOfOpenSessions(size_t* maximum) {
|
||||
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
const FunctionPointers* fcn = kAdapter->get(kLevelDefault);
|
||||
if (!fcn) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
if (fcn->version < 10) {
|
||||
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
return fcn->GetNumberOfOpenSessions(maximum);
|
||||
extern "C" OEMCryptoResult OEMCrypto_GetNumberOfOpenSessions(size_t* count) {
|
||||
return OEMCrypto_GetNumberOfOpenSessions(kLevelDefault, count);
|
||||
}
|
||||
|
||||
extern "C" OEMCryptoResult OEMCrypto_GetMaxNumberOfSessions(size_t *maximum) {
|
||||
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
const FunctionPointers* fcn = kAdapter->get(kLevelDefault);
|
||||
if (!fcn) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
if (fcn->version < 10) {
|
||||
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
return fcn->GetMaxNumberOfSessions(maximum);
|
||||
extern "C" OEMCryptoResult OEMCrypto_GetMaxNumberOfSessions(size_t* maximum) {
|
||||
return OEMCrypto_GetMaxNumberOfSessions(kLevelDefault, maximum);
|
||||
}
|
||||
|
||||
extern "C" OEMCryptoResult OEMCrypto_Generic_Encrypt(
|
||||
|
||||
Reference in New Issue
Block a user