Allow parsing RSA keys from buffers with extra space at the end.

This was allowed in releases before O MR1, and some apps depend on the
ability to do so.

Bug: 69349260
Test: vogar libcore.javax.crypto.spec.KeyFactoryTestRSA
Change-Id: Iede92e8974bf34577d80fea81a5944082d216081
(cherry picked from commit c99560e778b8913ac49b81f9fb7571cf2ad999fa)
diff --git a/common/src/jni/main/cpp/NativeCrypto.cpp b/common/src/jni/main/cpp/NativeCrypto.cpp
index 521295f..06b439b 100644
--- a/common/src/jni/main/cpp/NativeCrypto.cpp
+++ b/common/src/jni/main/cpp/NativeCrypto.cpp
@@ -1098,7 +1098,7 @@
     CBS cbs;
     CBS_init(&cbs, reinterpret_cast<const uint8_t*>(bytes.get()), bytes.size());
     bssl::UniquePtr<EVP_PKEY> pkey(EVP_parse_private_key(&cbs));
-    if (!pkey || CBS_len(&cbs) != 0) {
+    if (!pkey) {
         Errors::throwParsingException(env, "Error parsing private key");
         JNI_TRACE("bytes=%p EVP_parse_private_key => threw exception", keyJavaBytes);
         return 0;
@@ -1150,7 +1150,7 @@
     CBS cbs;
     CBS_init(&cbs, reinterpret_cast<const uint8_t*>(bytes.get()), bytes.size());
     bssl::UniquePtr<EVP_PKEY> pkey(EVP_parse_public_key(&cbs));
-    if (!pkey || CBS_len(&cbs) != 0) {
+    if (!pkey) {
         Errors::throwParsingException(env, "Error parsing public key");
         JNI_TRACE("bytes=%p EVP_parse_public_key => threw exception", keyJavaBytes);
         return 0;