From 28c23454138b195f62430abc74d96fde26f07e33 Mon Sep 17 00:00:00 2001 From: Cong Lin Date: Thu, 26 Oct 2023 14:03:13 -0700 Subject: [PATCH] Fix error check in ForbidPrepAndSign test OEMCrypto_ERROR_INVALID_RSA_KEY is deprecated in v17. But v16 oemcrypto can still return it. Unit test should allow this error for now. Test: run_dynamic_oemcrypto_v16.4, run_dynamic_oemcrypto_v16.3 Bug: 307668988 Change-Id: I950b62c8b3e02ea09d4795839a3d69573ab718aa --- libwvdrmengine/oemcrypto/test/oemcrypto_cast_test.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_cast_test.cpp b/libwvdrmengine/oemcrypto/test/oemcrypto_cast_test.cpp index fb62985c..83848145 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_cast_test.cpp +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_cast_test.cpp @@ -80,7 +80,10 @@ TEST_F(OEMCryptoLoadsCertificateAlternates, ForbidPrepAndSign) { OEMCryptoResult result = OEMCrypto_PrepAndSignLicenseRequest( s.session_id(), message.data(), message.size(), &core_message_length, signature.data(), &signature_length); - ASSERT_EQ(OEMCrypto_ERROR_INVALID_KEY, result); + // TODO: remove OEMCrypto_ERROR_INVALID_RSA_KEY once OEMCrypto v16 is not + // supported anymore. This error code has been deprecated since v17. + ASSERT_TRUE(result == OEMCrypto_ERROR_INVALID_KEY || + result == OEMCrypto_ERROR_INVALID_RSA_KEY); const vector zero(signature.size(), 0); ASSERT_EQ(signature, zero); // Signature should not have been computed. }