From 59f0f7cd367ca722fae74206df22958b02e77d87 Mon Sep 17 00:00:00 2001 From: Alex Dale Date: Thu, 11 Nov 2021 19:37:13 -0800 Subject: [PATCH] Added new error code OEMCrypto_ERROR_INVALID_KEY. [ Merge of http://go/wvgerrit/138606 ] The new error code OEMCrypto_ERROR_INVALID_KEY is to replace the now deprecated error code OEMCrypto_ERROR_INVALID_RSA_KEY. This error code serves the same purpose of OEMCrypto_ERROR_INVALID_RSA_KEY, but may be appied to RSA, ECC and Twisted-Edward ECC keys. In general, this error code is to indicate that a key is poorly formatted / unparsable, used in an operation without allow permissions, or used in an operation that it cannot be association (RSA signing with an ECC key). Going forward, new OEMCrypto implementation should use OEMCrypto_ERROR_INVALID_KEY in place of OEMCrypto_ERROR_INVALID_RSA_KEY. The CDM will continue to support both error codes. Bug: 201581141 Test: Testbed unit tests Change-Id: I2cf1af33a9a1d8716eec4cc63bba52d2f4af4c1b --- libwvdrmengine/cdm/core/test/test_printers.cpp | 5 ++++- libwvdrmengine/oemcrypto/odk/include/OEMCryptoCENCCommon.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libwvdrmengine/cdm/core/test/test_printers.cpp b/libwvdrmengine/cdm/core/test/test_printers.cpp index 0b1b6b1e..8dbcbb73 100644 --- a/libwvdrmengine/cdm/core/test/test_printers.cpp +++ b/libwvdrmengine/cdm/core/test/test_printers.cpp @@ -1192,7 +1192,10 @@ void PrintTo(const enum OEMCryptoResult& value, ::std::ostream* os) { *os << "OEMCrypto_ERROR_INVALID_ENTITLED_KEY_SESSION"; break; case OEMCrypto_ERROR_NEEDS_KEYBOX_PROVISIONING: - *os << "ERROR_NEEDS_KEYBOX_PROVISIONING"; + *os << "NEEDS_KEYBOX_PROVISIONING"; + break; + case OEMCrypto_ERROR_INVALID_KEY: + *os << "INVALID_KEY"; break; // ODK Values. case ODK_ERROR_CORE_MESSAGE: diff --git a/libwvdrmengine/oemcrypto/odk/include/OEMCryptoCENCCommon.h b/libwvdrmengine/oemcrypto/odk/include/OEMCryptoCENCCommon.h index 2715ea27..7dac3aef 100644 --- a/libwvdrmengine/oemcrypto/odk/include/OEMCryptoCENCCommon.h +++ b/libwvdrmengine/oemcrypto/odk/include/OEMCryptoCENCCommon.h @@ -61,7 +61,7 @@ typedef enum OEMCryptoResult { OEMCrypto_ERROR_INVALID_NONCE = 32, OEMCrypto_ERROR_TOO_MANY_KEYS = 33, OEMCrypto_ERROR_DEVICE_NOT_RSA_PROVISIONED = 34, - OEMCrypto_ERROR_INVALID_RSA_KEY = 35, + OEMCrypto_ERROR_INVALID_RSA_KEY = 35, /* deprecated */ OEMCrypto_ERROR_KEY_EXPIRED = 36, OEMCrypto_ERROR_INSUFFICIENT_RESOURCES = 37, OEMCrypto_ERROR_INSUFFICIENT_HDCP = 38, @@ -89,6 +89,7 @@ typedef enum OEMCryptoResult { OEMCrypto_WARNING_MIXED_OUTPUT_PROTECTION = 59, OEMCrypto_ERROR_INVALID_ENTITLED_KEY_SESSION = 60, OEMCrypto_ERROR_NEEDS_KEYBOX_PROVISIONING = 61, + OEMCrypto_ERROR_INVALID_KEY = 65, /* ODK return values */ ODK_ERROR_BASE = 1000, ODK_ERROR_CORE_MESSAGE = ODK_ERROR_BASE,