From 3c92292236bda43e76e564cf300af62949b26436 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sat, 30 Aug 2014 16:49:49 -0700 Subject: [PATCH] Bug 1061021, Part 5: Remove InitInputFromSECItem, r=keeler --HG-- extra : rebase_source : 353ad008af15700266226b6f3f535385cb182d09 --- .../gtest/pkixocsp_VerifyEncodedOCSPResponse.cpp | 13 +++++++------ security/pkix/test/lib/pkixtestutil.cpp | 9 --------- security/pkix/test/lib/pkixtestutil.h | 2 -- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/security/pkix/test/gtest/pkixocsp_VerifyEncodedOCSPResponse.cpp b/security/pkix/test/gtest/pkixocsp_VerifyEncodedOCSPResponse.cpp index 53d263d1728f..fb775bb3bfad 100644 --- a/security/pkix/test/gtest/pkixocsp_VerifyEncodedOCSPResponse.cpp +++ b/security/pkix/test/gtest/pkixocsp_VerifyEncodedOCSPResponse.cpp @@ -111,11 +111,12 @@ public: if (GenerateKeyPair(rootPublicKey, rootPrivateKey) != Success) { return false; } - rootSPKI = SECKEY_EncodeDERSubjectPublicKeyInfo(rootPublicKey.get()); - if (!rootSPKI) { + ScopedSECItem rootSPKIItem( + SECKEY_EncodeDERSubjectPublicKeyInfo(rootPublicKey.get())); + if (!rootSPKIItem) { return false; } - + rootSPKI.assign(rootSPKIItem->data, rootSPKIItem->len); return true; } @@ -152,7 +153,7 @@ public: } Input rootSPKIDER; - if (InitInputFromSECItem(rootSPKI.get(), rootSPKIDER) != Success) { + if (rootSPKIDER.Init(rootSPKI.data(), rootSPKI.length()) != Success) { abort(); } endEntityCertID = new (std::nothrow) CertID(rootNameDERInput, rootSPKIDER, @@ -163,7 +164,7 @@ public: } static ScopedSECKEYPrivateKey rootPrivateKey; - static ScopedSECItem rootSPKI; + static ByteString rootSPKI; static long rootIssuedCount; OCSPTestTrustDomain trustDomain; @@ -175,7 +176,7 @@ public: /*static*/ ScopedSECKEYPrivateKey pkixocsp_VerifyEncodedResponse::rootPrivateKey; -/*static*/ ScopedSECItem pkixocsp_VerifyEncodedResponse::rootSPKI; +/*static*/ ByteString pkixocsp_VerifyEncodedResponse::rootSPKI; /*static*/ long pkixocsp_VerifyEncodedResponse::rootIssuedCount = 0; /////////////////////////////////////////////////////////////////////////////// diff --git a/security/pkix/test/lib/pkixtestutil.cpp b/security/pkix/test/lib/pkixtestutil.cpp index da1ec443068d..76004f1d4895 100644 --- a/security/pkix/test/lib/pkixtestutil.cpp +++ b/security/pkix/test/lib/pkixtestutil.cpp @@ -149,15 +149,6 @@ TLV(uint8_t tag, const ByteString& value) return result; } -Result -InitInputFromSECItem(const SECItem* secItem, /*out*/ Input& input) -{ - if (!secItem) { - return Result::FATAL_ERROR_INVALID_ARGS; - } - return input.Init(secItem->data, secItem->len); -} - class Output { public: diff --git a/security/pkix/test/lib/pkixtestutil.h b/security/pkix/test/lib/pkixtestutil.h index 20c821019b19..1b336c99c219 100644 --- a/security/pkix/test/lib/pkixtestutil.h +++ b/security/pkix/test/lib/pkixtestutil.h @@ -113,8 +113,6 @@ ByteString CNToDERName(const char* cn); Result TamperOnce(/*in/out*/ ByteString& item, const ByteString& from, const ByteString& to); -Result InitInputFromSECItem(const SECItem* secItem, /*out*/ Input& input); - /////////////////////////////////////////////////////////////////////////////// // Encode Certificates