From 030872a85c5049cb0bfca8a9ed5a0bb82a139acf Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sun, 31 Aug 2014 19:16:26 -0700 Subject: [PATCH] Bug 1063013, Part 3: Move dependencies on pkixnss to pkixtestnss, r=keeler --HG-- rename : security/pkix/test/lib/pkixtestutil.cpp => security/pkix/test/lib/pkixtestnss.cpp extra : rebase_source : b22bd341a5c72ba87efcf23a4e048bba8adf1544 --- security/pkix/test/gtest/pkixbuild_tests.cpp | 2 +- .../test/gtest/pkixcert_extension_tests.cpp | 6 ++---- ...kixocsp_CreateEncodedOCSPRequest_tests.cpp | 3 +-- .../pkixocsp_VerifyEncodedOCSPResponse.cpp | 7 +++---- security/pkix/test/lib/pkixtestnss.cpp | 19 +++++++++++++++++++ security/pkix/test/lib/pkixtestutil.h | 6 ++++++ 6 files changed, 32 insertions(+), 11 deletions(-) diff --git a/security/pkix/test/gtest/pkixbuild_tests.cpp b/security/pkix/test/gtest/pkixbuild_tests.cpp index bec270047e4b..86e2277ba406 100644 --- a/security/pkix/test/gtest/pkixbuild_tests.cpp +++ b/security/pkix/test/gtest/pkixbuild_tests.cpp @@ -185,7 +185,7 @@ private: virtual Result CheckPublicKey(Input subjectPublicKeyInfo) { - return ::mozilla::pkix::CheckPublicKey(subjectPublicKeyInfo); + return TestCheckPublicKey(subjectPublicKeyInfo); } // We hold references to CERTCertificates in the cert chain tail so that we diff --git a/security/pkix/test/gtest/pkixcert_extension_tests.cpp b/security/pkix/test/gtest/pkixcert_extension_tests.cpp index c346762d40b1..c1121472d89c 100644 --- a/security/pkix/test/gtest/pkixcert_extension_tests.cpp +++ b/security/pkix/test/gtest/pkixcert_extension_tests.cpp @@ -24,7 +24,6 @@ #include "nssgtest.h" #include "pkix/pkix.h" -#include "pkix/pkixnss.h" #include "pkixtestutil.h" using namespace mozilla::pkix; @@ -96,8 +95,7 @@ private: virtual Result VerifySignedData(const SignedDataWithSignature& signedData, Input subjectPublicKeyInfo) { - return ::mozilla::pkix::VerifySignedData(signedData, subjectPublicKeyInfo, - nullptr); + return TestVerifySignedData(signedData, subjectPublicKeyInfo); } virtual Result DigestBuf(Input, /*out*/ uint8_t*, size_t) @@ -108,7 +106,7 @@ private: virtual Result CheckPublicKey(Input subjectPublicKeyInfo) { - return ::mozilla::pkix::CheckPublicKey(subjectPublicKeyInfo); + return TestCheckPublicKey(subjectPublicKeyInfo); } }; diff --git a/security/pkix/test/gtest/pkixocsp_CreateEncodedOCSPRequest_tests.cpp b/security/pkix/test/gtest/pkixocsp_CreateEncodedOCSPRequest_tests.cpp index 130aea46e8f2..3317beec0bdb 100644 --- a/security/pkix/test/gtest/pkixocsp_CreateEncodedOCSPRequest_tests.cpp +++ b/security/pkix/test/gtest/pkixocsp_CreateEncodedOCSPRequest_tests.cpp @@ -23,7 +23,6 @@ */ #include "nssgtest.h" -#include "pkix/pkixnss.h" #include "pkix/pkix.h" #include "pkixder.h" #include "pkixtestutil.h" @@ -70,7 +69,7 @@ private: virtual Result DigestBuf(Input item, /*out*/ uint8_t *digestBuf, size_t digestBufLen) { - return ::mozilla::pkix::DigestBuf(item, digestBuf, digestBufLen); + return TestDigestBuf(item, digestBuf, digestBufLen); } virtual Result CheckPublicKey(Input subjectPublicKeyInfo) diff --git a/security/pkix/test/gtest/pkixocsp_VerifyEncodedOCSPResponse.cpp b/security/pkix/test/gtest/pkixocsp_VerifyEncodedOCSPResponse.cpp index e035556515d5..d23c1ef6d168 100644 --- a/security/pkix/test/gtest/pkixocsp_VerifyEncodedOCSPResponse.cpp +++ b/security/pkix/test/gtest/pkixocsp_VerifyEncodedOCSPResponse.cpp @@ -73,19 +73,18 @@ public: virtual Result VerifySignedData(const SignedDataWithSignature& signedData, Input subjectPublicKeyInfo) { - return ::mozilla::pkix::VerifySignedData(signedData, subjectPublicKeyInfo, - nullptr); + return TestVerifySignedData(signedData, subjectPublicKeyInfo); } virtual Result DigestBuf(Input item, /*out*/ uint8_t *digestBuf, size_t digestBufLen) { - return ::mozilla::pkix::DigestBuf(item, digestBuf, digestBufLen); + return TestDigestBuf(item, digestBuf, digestBufLen); } virtual Result CheckPublicKey(Input subjectPublicKeyInfo) { - return ::mozilla::pkix::CheckPublicKey(subjectPublicKeyInfo); + return TestCheckPublicKey(subjectPublicKeyInfo); } private: diff --git a/security/pkix/test/lib/pkixtestnss.cpp b/security/pkix/test/lib/pkixtestnss.cpp index 752ecac0e9da..84235089d395 100644 --- a/security/pkix/test/lib/pkixtestnss.cpp +++ b/security/pkix/test/lib/pkixtestnss.cpp @@ -181,4 +181,23 @@ SHA1(const ByteString& toHash) return ByteString(digestBuf, sizeof(digestBuf)); } +Result +TestCheckPublicKey(Input subjectPublicKeyInfo) +{ + return CheckPublicKey(subjectPublicKeyInfo); +} + +Result +TestVerifySignedData(const SignedDataWithSignature& signedData, + Input subjectPublicKeyInfo) +{ + return VerifySignedData(signedData, subjectPublicKeyInfo, nullptr); +} + +Result +TestDigestBuf(Input item, /*out*/ uint8_t* digestBuf, size_t digestBufLen) +{ + return DigestBuf(item, digestBuf, digestBufLen); +} + } } } // namespace mozilla::pkix::test diff --git a/security/pkix/test/lib/pkixtestutil.h b/security/pkix/test/lib/pkixtestutil.h index 338f6ab9b408..dbe67072d8df 100644 --- a/security/pkix/test/lib/pkixtestutil.h +++ b/security/pkix/test/lib/pkixtestutil.h @@ -130,6 +130,12 @@ typedef ScopedPtr ScopedTestKeyPair; ByteString SHA1(const ByteString& toHash); +Result TestCheckPublicKey(Input subjectPublicKeyInfo); +Result TestVerifySignedData(const SignedDataWithSignature& signedData, + Input subjectPublicKeyInfo); +Result TestDigestBuf(Input item, /*out*/ uint8_t* digestBuf, + size_t digestBufLen); + // Replace one substring in item with another of the same length, but only if // the substring was found exactly once. The "same length" restriction is // useful for avoiding invalidating lengths encoded within the item. The