Bug 1515342 - Ignore spki decode failures on negative (expect_fail) tests. r=jcj
authorKevin Jacobs <kjacobs@mozilla.com>
Fri, 21 Jun 2019 19:33:55 +0000
changeset 15176 ebc93d6daeaa9001d31fd18b5199779da99ae9aa
parent 15175 efd44c8a6c6330fd5752f57d8d8b627aa3b36b43
child 15189 6ef49fe67d6227a1d290da5537ec0dade379a15a
push id3409
push userjjones@mozilla.com
push dateFri, 21 Jun 2019 19:34:16 +0000
reviewersjcj
bugs1515342
Bug 1515342 - Ignore spki decode failures on negative (expect_fail) tests. r=jcj Differential Revision: https://phabricator.services.mozilla.com/D35565
gtests/pk11_gtest/pk11_curve25519_unittest.cc
--- a/gtests/pk11_gtest/pk11_curve25519_unittest.cc
+++ b/gtests/pk11_gtest/pk11_curve25519_unittest.cc
@@ -35,16 +35,19 @@ class Pkcs11Curve25519Test
     ScopedSECKEYPrivateKey privKey(key);
     ASSERT_TRUE(privKey);
 
     SECItem spkiItem = {siBuffer, toUcharPtr(spki),
                         static_cast<unsigned int>(spki_len)};
 
     ScopedCERTSubjectPublicKeyInfo certSpki(
         SECKEY_DecodeDERSubjectPublicKeyInfo(&spkiItem));
+    if (!expect_success && !certSpki) {
+      return;
+    }
     ASSERT_TRUE(certSpki);
 
     ScopedSECKEYPublicKey pubKey(SECKEY_ExtractPublicKey(certSpki.get()));
     ASSERT_TRUE(pubKey);
 
     ScopedPK11SymKey symKey(PK11_PubDeriveWithKDF(
         privKey.get(), pubKey.get(), false, nullptr, nullptr, CKM_ECDH1_DERIVE,
         CKM_SHA512_HMAC, CKA_DERIVE, 0, CKD_NULL, nullptr, nullptr));