Always Report OEMCrypto_ERROR_KEY_EXPIRED as NEED_KEY

(This is a merge of wvgerrit/25422)

OEMCrypto_ERROR_KEY_EXPIRED was not always being reported to the higher
layers as a NEED_KEY error, which could cause inconsistent error
handling.

Bug: 28294273
Test: Unit tests
Change-Id: Idf5642ea0f0ba915bc1f53025a1f14691d142aed
This commit is contained in:
John W. Bruce
2017-04-10 16:49:44 -07:00
parent 20f8368f9c
commit 7f27e5a266

View File

@@ -1631,8 +1631,9 @@ CdmResponseType CryptoSession::GenericEncrypt(const std::string& in_buffer,
if (OEMCrypto_SUCCESS != sts) {
LOGE("GenericEncrypt: OEMCrypto_Generic_Encrypt err=%d", sts);
if (OEMCrypto_ERROR_KEY_EXPIRED == sts ||
OEMCrypto_ERROR_NO_CONTENT_KEY == sts) {
if (OEMCrypto_ERROR_KEY_EXPIRED == sts) {
return NEED_KEY;
} else if (OEMCrypto_ERROR_NO_CONTENT_KEY == sts) {
return KEY_NOT_FOUND_3;
} else {
return UNKNOWN_ERROR;
@@ -1680,8 +1681,9 @@ CdmResponseType CryptoSession::GenericDecrypt(const std::string& in_buffer,
if (OEMCrypto_SUCCESS != sts) {
LOGE("GenericDecrypt: OEMCrypto_Generic_Decrypt err=%d", sts);
if (OEMCrypto_ERROR_KEY_EXPIRED == sts ||
OEMCrypto_ERROR_NO_CONTENT_KEY == sts) {
if (OEMCrypto_ERROR_KEY_EXPIRED == sts) {
return NEED_KEY;
} else if (OEMCrypto_ERROR_NO_CONTENT_KEY == sts) {
return KEY_NOT_FOUND_4;
} else {
return UNKNOWN_ERROR;
@@ -1742,8 +1744,9 @@ CdmResponseType CryptoSession::GenericSign(const std::string& message,
}
LOGE("GenericSign: OEMCrypto_Generic_Sign err=%d", sts);
if (OEMCrypto_ERROR_KEY_EXPIRED == sts ||
OEMCrypto_ERROR_NO_CONTENT_KEY == sts) {
if (OEMCrypto_ERROR_KEY_EXPIRED == sts) {
return NEED_KEY;
} else if (OEMCrypto_ERROR_NO_CONTENT_KEY == sts) {
return KEY_NOT_FOUND_5;
} else {
return UNKNOWN_ERROR;
@@ -1781,8 +1784,9 @@ CdmResponseType CryptoSession::GenericVerify(const std::string& message,
if (OEMCrypto_SUCCESS != sts) {
LOGE("GenericVerify: OEMCrypto_Generic_Verify err=%d", sts);
if (OEMCrypto_ERROR_KEY_EXPIRED == sts ||
OEMCrypto_ERROR_NO_CONTENT_KEY == sts) {
if (OEMCrypto_ERROR_KEY_EXPIRED == sts) {
return NEED_KEY;
} else if (OEMCrypto_ERROR_NO_CONTENT_KEY == sts) {
return KEY_NOT_FOUND_6;
} else {
return UNKNOWN_ERROR;