From a1d102d4f276940fd881c0be4e07df3ff28ee720 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Tue, 23 Dec 2014 14:51:52 -0800 Subject: [PATCH] Bug 1115761, Part 3: Rename NSS-based crypto functions, r=jcj --HG-- extra : rebase_source : b11b172fac76c7845d2a97cabf1bad9e04a50367 --- security/apps/AppTrustDomain.cpp | 10 +++++----- security/certverifier/NSSCertDBTrustDomain.cpp | 10 +++++----- security/pkix/include/pkix/pkixnss.h | 16 ++++++++-------- security/pkix/lib/pkixnss.cpp | 12 ++++++------ security/pkix/test/lib/pkixtestnss.cpp | 8 ++++---- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/security/apps/AppTrustDomain.cpp b/security/apps/AppTrustDomain.cpp index 43b6c21812e..f9f01d7cd16 100644 --- a/security/apps/AppTrustDomain.cpp +++ b/security/apps/AppTrustDomain.cpp @@ -217,15 +217,15 @@ Result AppTrustDomain::VerifySignedData(const SignedDataWithSignature& signedData, Input subjectPublicKeyInfo) { - return ::mozilla::pkix::VerifySignedData(signedData, subjectPublicKeyInfo, - mMinimumNonECCBits, mPinArg); + return ::mozilla::pkix::VerifySignedDataNSS(signedData, subjectPublicKeyInfo, + mMinimumNonECCBits, mPinArg); } Result AppTrustDomain::DigestBuf(Input item, /*out*/ uint8_t* digestBuf, size_t digestBufLen) { - return ::mozilla::pkix::DigestBuf(item, digestBuf, digestBufLen); + return ::mozilla::pkix::DigestBufNSS(item, digestBuf, digestBufLen); } Result @@ -252,8 +252,8 @@ AppTrustDomain::IsChainValid(const DERArray& certChain, Time time) Result AppTrustDomain::CheckPublicKey(Input subjectPublicKeyInfo) { - return ::mozilla::pkix::CheckPublicKey(subjectPublicKeyInfo, - mMinimumNonECCBits); + return ::mozilla::pkix::CheckPublicKeyNSS(subjectPublicKeyInfo, + mMinimumNonECCBits); } } } // namespace mozilla::psm diff --git a/security/certverifier/NSSCertDBTrustDomain.cpp b/security/certverifier/NSSCertDBTrustDomain.cpp index bf14425a6a6..7ef733492e9 100644 --- a/security/certverifier/NSSCertDBTrustDomain.cpp +++ b/security/certverifier/NSSCertDBTrustDomain.cpp @@ -258,15 +258,15 @@ Result NSSCertDBTrustDomain::VerifySignedData(const SignedDataWithSignature& signedData, Input subjectPublicKeyInfo) { - return ::mozilla::pkix::VerifySignedData(signedData, subjectPublicKeyInfo, - mMinimumNonECCBits, mPinArg); + return ::mozilla::pkix::VerifySignedDataNSS(signedData, subjectPublicKeyInfo, + mMinimumNonECCBits, mPinArg); } Result NSSCertDBTrustDomain::DigestBuf(Input item, /*out*/ uint8_t* digestBuf, size_t digestBufLen) { - return ::mozilla::pkix::DigestBuf(item, digestBuf, digestBufLen); + return ::mozilla::pkix::DigestBufNSS(item, digestBuf, digestBufLen); } @@ -700,8 +700,8 @@ NSSCertDBTrustDomain::IsChainValid(const DERArray& certArray, Time time) Result NSSCertDBTrustDomain::CheckPublicKey(Input subjectPublicKeyInfo) { - return ::mozilla::pkix::CheckPublicKey(subjectPublicKeyInfo, - mMinimumNonECCBits); + return ::mozilla::pkix::CheckPublicKeyNSS(subjectPublicKeyInfo, + mMinimumNonECCBits); } namespace { diff --git a/security/pkix/include/pkix/pkixnss.h b/security/pkix/include/pkix/pkixnss.h index c6d8e1a350a..a26d47fe695 100644 --- a/security/pkix/include/pkix/pkixnss.h +++ b/security/pkix/include/pkix/pkixnss.h @@ -32,10 +32,10 @@ namespace mozilla { namespace pkix { // Verify the given signed data using the given public key. -Result VerifySignedData(const SignedDataWithSignature& sd, - Input subjectPublicKeyInfo, - unsigned int minimumNonECCBits, - void* pkcs11PinArg); +Result VerifySignedDataNSS(const SignedDataWithSignature& sd, + Input subjectPublicKeyInfo, + unsigned int minimumNonECCBits, + void* pkcs11PinArg); // Computes the SHA-1 hash of the data in the current item. // @@ -48,13 +48,13 @@ Result VerifySignedData(const SignedDataWithSignature& sd, // TODO: Taking the output buffer as (uint8_t*, size_t) is counter to our // other, extensive, memory safety efforts in mozilla::pkix, and we should find // a way to provide a more-obviously-safe interface. -Result DigestBuf(Input item, /*out*/ uint8_t* digestBuf, - size_t digestBufLen); +Result DigestBufNSS(Input item, /*out*/ uint8_t* digestBuf, + size_t digestBufLen); // Checks, for RSA keys and DSA keys, that the modulus is at least the given // number of bits. -Result CheckPublicKey(Input subjectPublicKeyInfo, - unsigned int minimumNonECCBits); +Result CheckPublicKeyNSS(Input subjectPublicKeyInfo, + unsigned int minimumNonECCBits); Result MapPRErrorCodeToResult(PRErrorCode errorCode); PRErrorCode MapResultToPRErrorCode(Result result); diff --git a/security/pkix/lib/pkixnss.cpp b/security/pkix/lib/pkixnss.cpp index 6db6defcf00..9ee2122a843 100644 --- a/security/pkix/lib/pkixnss.cpp +++ b/security/pkix/lib/pkixnss.cpp @@ -39,7 +39,7 @@ namespace mozilla { namespace pkix { typedef ScopedPtr ScopedSECKeyPublicKey; -Result +static Result CheckPublicKeySize(Input subjectPublicKeyInfo, unsigned int minimumNonECCBits, /*out*/ ScopedSECKeyPublicKey& publicKey) { @@ -79,16 +79,16 @@ CheckPublicKeySize(Input subjectPublicKeyInfo, unsigned int minimumNonECCBits, } Result -CheckPublicKey(Input subjectPublicKeyInfo, unsigned int minimumNonECCBits) +CheckPublicKeyNSS(Input subjectPublicKeyInfo, unsigned int minimumNonECCBits) { ScopedSECKeyPublicKey unused; return CheckPublicKeySize(subjectPublicKeyInfo, minimumNonECCBits, unused); } Result -VerifySignedData(const SignedDataWithSignature& sd, - Input subjectPublicKeyInfo, unsigned int minimumNonECCBits, - void* pkcs11PinArg) +VerifySignedDataNSS(const SignedDataWithSignature& sd, + Input subjectPublicKeyInfo, unsigned int minimumNonECCBits, + void* pkcs11PinArg) { SECOidTag pubKeyAlg; SECOidTag digestAlg; @@ -159,7 +159,7 @@ VerifySignedData(const SignedDataWithSignature& sd, } Result -DigestBuf(Input item, /*out*/ uint8_t* digestBuf, size_t digestBufLen) +DigestBufNSS(Input item, /*out*/ uint8_t* digestBuf, size_t digestBufLen) { static_assert(TrustDomain::DIGEST_LENGTH == SHA1_LENGTH, "TrustDomain::DIGEST_LENGTH must be 20 (SHA-1 digest length)"); diff --git a/security/pkix/test/lib/pkixtestnss.cpp b/security/pkix/test/lib/pkixtestnss.cpp index def30122952..45a85d77fee 100644 --- a/security/pkix/test/lib/pkixtestnss.cpp +++ b/security/pkix/test/lib/pkixtestnss.cpp @@ -307,7 +307,7 @@ Result TestCheckPublicKey(Input subjectPublicKeyInfo) { InitNSSIfNeeded(); - return CheckPublicKey(subjectPublicKeyInfo, MINIMUM_TEST_KEY_BITS); + return CheckPublicKeyNSS(subjectPublicKeyInfo, MINIMUM_TEST_KEY_BITS); } Result @@ -315,15 +315,15 @@ TestVerifySignedData(const SignedDataWithSignature& signedData, Input subjectPublicKeyInfo) { InitNSSIfNeeded(); - return VerifySignedData(signedData, subjectPublicKeyInfo, - MINIMUM_TEST_KEY_BITS, nullptr); + return VerifySignedDataNSS(signedData, subjectPublicKeyInfo, + MINIMUM_TEST_KEY_BITS, nullptr); } Result TestDigestBuf(Input item, /*out*/ uint8_t* digestBuf, size_t digestBufLen) { InitNSSIfNeeded(); - return DigestBuf(item, digestBuf, digestBufLen); + return DigestBufNSS(item, digestBuf, digestBufLen); } } } } // namespace mozilla::pkix::test