Allow key_session to be equal to oec_session when removing entitled key session
In some rare cases when |oec_session| was already closed, |key_session| with the same session id will not exist any longer. This is a fix to allow such case to not return an error. Test: run opk tests Bug: 343093320 Change-Id: I3218145ee8c1047a5cc756560e448b178c2c7a93
This commit is contained in:
@@ -1308,7 +1308,13 @@ class Adapter {
|
|||||||
|
|
||||||
OEMCryptoResult RemoveEntitledKeySession(OEMCrypto_SESSION key_session) {
|
OEMCryptoResult RemoveEntitledKeySession(OEMCrypto_SESSION key_session) {
|
||||||
LevelSession pair = GetSession(key_session);
|
LevelSession pair = GetSession(key_session);
|
||||||
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
|
if (!pair.fcn) {
|
||||||
|
// If the entitlement session with the same session ID was closed before
|
||||||
|
// the entitled key session, GetSession() will return an empty pair. The
|
||||||
|
// entitled key session should already be released when its corresponding
|
||||||
|
// entitlement session was closed. In this case, simply return success.
|
||||||
|
return OEMCrypto_SUCCESS;
|
||||||
|
}
|
||||||
if (pair.fcn->version < 16) return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
if (pair.fcn->version < 16) return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||||
if (pair.fcn->CreateEntitledKeySession == nullptr)
|
if (pair.fcn->CreateEntitledKeySession == nullptr)
|
||||||
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||||
|
|||||||
Reference in New Issue
Block a user