Bug 1578786: Fix up some includes and namespaces in security/manager/ssl so that it may compile in non-unified mode; r=keeler

Differential Revision: https://phabricator.services.mozilla.com/D44700

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Aaron Klotz 2019-09-04 18:35:50 +00:00
Родитель f96e9cd73f
Коммит 296735628c
20 изменённых файлов: 67 добавлений и 30 удалений

Просмотреть файл

@ -8,6 +8,7 @@
#include "BRNameMatchingPolicy.h"
#include "CryptoTask.h"
#include "CSTrustDomain.h"
#include "ScopedNSSTypes.h"
#include "SharedCertVerifier.h"
#include "cryptohi.h"
@ -23,6 +24,7 @@
#include "mozpkix/pkix.h"
#include "mozpkix/pkixtypes.h"
#include "secerr.h"
#include "ssl.h"
NS_IMPL_ISUPPORTS(ContentSignatureVerifier, nsIContentSignatureVerifier)

Просмотреть файл

@ -6,8 +6,8 @@
#include "CredentialManagerSecret.h"
#include <wincred.h>
#include <windows.h>
#include <wincred.h>
#include "mozilla/Logging.h"
#include "mozilla/SyncRunnable.h"

Просмотреть файл

@ -72,13 +72,13 @@ class DataStorageSharedThread final {
nsCOMPtr<nsIThread> mThread;
};
StaticMutex sDataStorageSharedThreadMutex;
static StaticAutoPtr<DataStorageSharedThread> gDataStorageSharedThread;
mozilla::StaticMutex sDataStorageSharedThreadMutex;
static mozilla::StaticAutoPtr<DataStorageSharedThread> gDataStorageSharedThread;
static bool gDataStorageSharedThreadShutDown = false;
nsresult DataStorageSharedThread::Initialize() {
MOZ_ASSERT(XRE_IsParentProcess());
StaticMutexAutoLock lock(sDataStorageSharedThreadMutex);
mozilla::StaticMutexAutoLock lock(sDataStorageSharedThreadMutex);
// If this happens, we initialized a DataStorage after shutdown notifications
// were sent, so don't re-initialize the shared thread.
@ -101,7 +101,7 @@ nsresult DataStorageSharedThread::Initialize() {
nsresult DataStorageSharedThread::Shutdown() {
MOZ_ASSERT(XRE_IsParentProcess());
StaticMutexAutoLock lock(sDataStorageSharedThreadMutex);
mozilla::StaticMutexAutoLock lock(sDataStorageSharedThreadMutex);
if (!gDataStorageSharedThread || gDataStorageSharedThreadShutDown) {
return NS_OK;
@ -122,7 +122,7 @@ nsresult DataStorageSharedThread::Shutdown() {
nsCOMPtr<nsIThread> threadHandle = gDataStorageSharedThread->mThread;
nsresult rv;
{
StaticMutexAutoUnlock unlock(sDataStorageSharedThreadMutex);
mozilla::StaticMutexAutoUnlock unlock(sDataStorageSharedThreadMutex);
rv = threadHandle->Shutdown();
}
gDataStorageSharedThread->mThread = nullptr;
@ -133,7 +133,7 @@ nsresult DataStorageSharedThread::Shutdown() {
nsresult DataStorageSharedThread::Dispatch(nsIRunnable* event) {
MOZ_ASSERT(XRE_IsParentProcess());
StaticMutexAutoLock lock(sDataStorageSharedThreadMutex);
mozilla::StaticMutexAutoLock lock(sDataStorageSharedThreadMutex);
if (gDataStorageSharedThreadShutDown || !gDataStorageSharedThread ||
!gDataStorageSharedThread->mThread) {
return NS_ERROR_FAILURE;
@ -173,7 +173,7 @@ NS_IMPL_ISUPPORTS(DataStorageMemoryReporter, nsIMemoryReporter)
NS_IMPL_ISUPPORTS(DataStorage, nsIObserver)
StaticAutoPtr<DataStorage::DataStorages> DataStorage::sDataStorages;
mozilla::StaticAutoPtr<DataStorage::DataStorages> DataStorage::sDataStorages;
DataStorage::DataStorage(const nsString& aFilename)
: mMutex("DataStorage::mMutex"),

Просмотреть файл

@ -10,6 +10,7 @@
#include "mozilla/Logging.h"
#include "mozilla/Unused.h"
#include "mozpkix/Result.h"
#include "nsThreadUtils.h"
#ifdef XP_MACOSX
# include <Security/Security.h>
@ -18,7 +19,12 @@
# include "nsCocoaFeatures.h"
#endif // XP_MACOSX
extern LazyLogModule gPIPNSSLog;
#ifdef XP_WIN
# include <windows.h>
# include <wincrypt.h>
#endif // XP_WIN
extern mozilla::LazyLogModule gPIPNSSLog;
using namespace mozilla;

Просмотреть файл

@ -15,6 +15,7 @@
#include "nsIX509Cert.h"
#include "nsIX509CertValidity.h"
#include "nsLiteralString.h"
#include "nsNSSCertificate.h"
#include "nsProxyRelease.h"
#include "nsServiceManagerUtils.h"
#include "nsString.h"

Просмотреть файл

@ -8,7 +8,9 @@
#include "mozilla/Base64.h"
#include "mozilla/SyncRunnable.h"
#include "nsNSSComponent.h"
#include "nsPK11TokenDB.h"
#include "nsXULAppAPI.h"
/* Implementing OSKeyStore when there is no platform specific one.
* This key store instead puts the keys into the NSS DB.

Просмотреть файл

@ -30,7 +30,7 @@ class NSSKeyStore final : public AbstractOSKeyStore {
private:
nsresult InitToken();
UniquePK11SlotInfo mSlot = nullptr;
mozilla::UniquePK11SlotInfo mSlot = nullptr;
};
#endif // NSSKeyStore_h

Просмотреть файл

@ -10,10 +10,15 @@
#ifndef OSKeyStore_h
#define OSKeyStore_h
#include "nsCOMPtr.h"
#include "nsIObserver.h"
#include "nsIOSKeyStore.h"
#include "nsIThread.h"
#include "nsString.h"
#include "ScopedNSSTypes.h"
#include <memory>
#include <vector>
class AbstractOSKeyStore {
public:
@ -47,11 +52,11 @@ class AbstractOSKeyStore {
/* These helper functions are implemented in OSKeyStore.cpp and implement
* common functionality of the abstract key store to encrypt and decrypt.
*/
nsresult DoCipher(const UniquePK11SymKey& aSymKey,
nsresult DoCipher(const mozilla::UniquePK11SymKey& aSymKey,
const std::vector<uint8_t>& inBytes,
std::vector<uint8_t>& outBytes, bool aEncrypt);
nsresult BuildAesGcmKey(std::vector<uint8_t> keyBytes,
/* out */ UniquePK11SymKey& aKey);
/* out */ mozilla::UniquePK11SymKey& aKey);
private:
const size_t mKeyByteLength = 16;

Просмотреть файл

@ -8,9 +8,15 @@
#include "OSKeyStore.h"
#include "nsNetCID.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/Logging.h"
#include "nsISupportsUtils.h"
#include "nsThreadUtils.h"
NS_IMPL_ISUPPORTS(OSReauthenticator, nsIOSReauthenticator)
extern mozilla::LazyLogModule gCredentialManagerSecretLog;
using namespace mozilla;
using dom::Promise;

Просмотреть файл

@ -1136,10 +1136,6 @@ void GatherRootCATelemetry(const UniqueCERTCertList& certList) {
rootCert);
}
// These time are appoximate, i.e., doesn't account for leap seconds, etc
const uint64_t ONE_WEEK_IN_SECONDS = (7 * (24 * 60 * 60));
const uint64_t ONE_YEAR_IN_WEEKS = 52;
// There are various things that we want to measure about certificate
// chains that we accept. This is a single entry point for all of them.
void GatherSuccessfulValidationTelemetry(const UniqueCERTCertList& certList) {

Просмотреть файл

@ -26,6 +26,7 @@
#include "nsXULAppAPI.h"
#include "mozpkix/pkixtypes.h"
#include "secerr.h"
#include "ssl.h"
//#define DEBUG_SSL_VERBOSE //Enable this define to get minimal
// reports when doing SSL read/write

Просмотреть файл

@ -39,7 +39,7 @@ class nsKeyObject final : public nsIKeyObject {
// Disallow copy constructor
nsKeyObject(nsKeyObject&);
UniquePK11SymKey mSymKey;
mozilla::UniquePK11SymKey mSymKey;
};
class nsKeyObjectFactory final : public nsIKeyObjectFactory {

Просмотреть файл

@ -30,6 +30,7 @@
#include "nsNSSCertHelper.h"
#include "nsNSSCertificate.h"
#include "nsNSSComponent.h"
#include "nsNSSHelper.h"
#include "nsNSSIOLayer.h"
#include "nsNetUtil.h"
#include "nsProtectedAuthThread.h"

Просмотреть файл

@ -20,7 +20,9 @@
#include "nsNSSCertificate.h"
#include "nsReadableUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h"
#include "prerror.h"
#include "prnetdb.h"
#include "secder.h"
using namespace mozilla;

Просмотреть файл

@ -9,9 +9,11 @@
#include "ExtendedValidation.h"
#include "NSSCertDBTrustDomain.h"
#include "certdb.h"
#include "ipc/IPCMessageUtils.h"
#include "mozilla/Assertions.h"
#include "mozilla/Base64.h"
#include "mozilla/Casting.h"
#include "mozilla/ipc/TransportSecurityInfoUtils.h"
#include "mozilla/NotNull.h"
#include "mozilla/Span.h"
#include "mozilla/Unused.h"

Просмотреть файл

@ -19,6 +19,7 @@
#include "TransportSecurityInfo.h"
#include "mozilla/MacroArgs.h"
#include "mozilla/ModuleUtils.h"
#include "mozilla/SyncRunnable.h"
#include "nsCURILoader.h"
#include "nsCertOverrideService.h"
#include "nsCryptoHash.h"

Просмотреть файл

@ -497,7 +497,8 @@ static nsresult GenerateType3Msg(const nsString& domain,
// There is no negotiation for NTLMv2, so we just do it unless we are forced
// by explict user configuration to use the older DES-based cryptography.
bool ntlmv2 = StaticPrefs::network_auth_force_generic_ntlm_v1() == false;
bool ntlmv2 =
mozilla::StaticPrefs::network_auth_force_generic_ntlm_v1() == false;
// temporary buffers for unicode strings
#ifdef IS_BIG_ENDIAN

Просмотреть файл

@ -11,6 +11,7 @@
#include "mozilla/Casting.h"
#include "mozilla/Unused.h"
#include "nsISupports.h"
#include "nsNSSCertHelper.h"
#include "nsNSSComponent.h"
#include "nsPromiseFlatString.h"
#include "nsReadableUtils.h"
@ -29,7 +30,7 @@ nsPK11Token::nsPK11Token(PK11SlotInfo* slot) : mUIContext(new PipUIContext()) {
PK11_IsInternal(mSlot.get()) && !PK11_IsInternalKeySlot(mSlot.get());
mIsInternalKeyToken = PK11_IsInternalKeySlot(mSlot.get());
mSeries = PK11_GetSlotSeries(slot);
Unused << refreshTokenInfo();
mozilla::Unused << refreshTokenInfo();
}
nsresult nsPK11Token::refreshTokenInfo() {
@ -53,7 +54,7 @@ nsresult nsPK11Token::refreshTokenInfo() {
}
CK_TOKEN_INFO tokInfo;
nsresult rv = MapSECStatus(PK11_GetTokenInfo(mSlot.get(), &tokInfo));
nsresult rv = mozilla::MapSECStatus(PK11_GetTokenInfo(mSlot.get(), &tokInfo));
if (NS_FAILED(rv)) {
return rv;
}
@ -160,14 +161,15 @@ nsPK11Token::Login(bool force) {
rv = setPassword(mSlot.get(), mUIContext);
if (NS_FAILED(rv)) return rv;
return MapSECStatus(PK11_Authenticate(mSlot.get(), true, mUIContext));
return mozilla::MapSECStatus(
PK11_Authenticate(mSlot.get(), true, mUIContext));
}
NS_IMETHODIMP
nsPK11Token::LogoutSimple() {
// PK11_Logout() can fail if the user wasn't logged in beforehand. We want
// this method to succeed even in this case, so we ignore the return value.
Unused << PK11_Logout(mSlot.get());
mozilla::Unused << PK11_Logout(mSlot.get());
return NS_OK;
}
@ -187,7 +189,7 @@ nsPK11Token::LogoutAndDropAuthenticatedResources() {
NS_IMETHODIMP
nsPK11Token::Reset() {
return MapSECStatus(PK11_ResetToken(mSlot.get(), nullptr));
return mozilla::MapSECStatus(PK11_ResetToken(mSlot.get(), nullptr));
}
NS_IMETHODIMP
@ -228,9 +230,11 @@ nsPK11Token::InitPassword(const nsACString& initialPassword) {
return rv;
}
if (!PK11_NeedUserInit(mSlot.get()) && !hasPassword) {
return MapSECStatus(PK11_ChangePW(mSlot.get(), "", passwordCStr.get()));
return mozilla::MapSECStatus(
PK11_ChangePW(mSlot.get(), "", passwordCStr.get()));
}
return MapSECStatus(PK11_InitPin(mSlot.get(), "", passwordCStr.get()));
return mozilla::MapSECStatus(
PK11_InitPin(mSlot.get(), "", passwordCStr.get()));
}
NS_IMETHODIMP
@ -240,7 +244,7 @@ nsPK11Token::ChangePassword(const nsACString& oldPassword,
// nullptr. In order to support this difference, we need to check IsVoid() to
// find out if our caller supplied null/undefined args or just empty strings.
// See Bug 447589.
return MapSECStatus(PK11_ChangePW(
return mozilla::MapSECStatus(PK11_ChangePW(
mSlot.get(),
oldPassword.IsVoid() ? nullptr : PromiseFlatCString(oldPassword).get(),
newPassword.IsVoid() ? nullptr : PromiseFlatCString(newPassword).get()));
@ -270,7 +274,7 @@ NS_IMPL_ISUPPORTS(nsPK11TokenDB, nsIPK11TokenDB)
NS_IMETHODIMP
nsPK11TokenDB::GetInternalKeyToken(nsIPK11Token** _retval) {
NS_ENSURE_ARG_POINTER(_retval);
UniquePK11SlotInfo slot(PK11_GetInternalKeySlot());
mozilla::UniquePK11SlotInfo slot(PK11_GetInternalKeySlot());
if (!slot) {
return NS_ERROR_FAILURE;
}

Просмотреть файл

@ -12,6 +12,7 @@
#include "mozilla/Unused.h"
#include "nsCOMPtr.h"
#include "nsIMutableArray.h"
#include "nsNSSCertHelper.h"
#include "nsNSSComponent.h"
#include "nsPK11TokenDB.h"
#include "nsPromiseFlatString.h"
@ -30,12 +31,12 @@ nsPKCS11Slot::nsPKCS11Slot(PK11SlotInfo* slot) {
PK11_IsInternal(mSlot.get()) && !PK11_IsInternalKeySlot(mSlot.get());
mIsInternalKeySlot = PK11_IsInternalKeySlot(mSlot.get());
mSeries = PK11_GetSlotSeries(slot);
Unused << refreshSlotInfo();
mozilla::Unused << refreshSlotInfo();
}
nsresult nsPKCS11Slot::refreshSlotInfo() {
CK_SLOT_INFO slotInfo;
nsresult rv = MapSECStatus(PK11_GetSlotInfo(mSlot.get(), &slotInfo));
nsresult rv = mozilla::MapSECStatus(PK11_GetSlotInfo(mSlot.get(), &slotInfo));
if (NS_FAILED(rv)) {
return rv;
}
@ -260,7 +261,7 @@ nsPKCS11Module::ListSlots(nsISimpleEnumerator** _retval) {
* since it uses the WaitForSlotEvent call) need to hold the
* ModuleList Read lock to prevent the slot array from changing out
* from under it. */
AutoSECMODListReadLock lock;
mozilla::AutoSECMODListReadLock lock;
for (int i = 0; i < mModule->slotCount; i++) {
if (mModule->slots[i]) {
nsCOMPtr<nsIPKCS11Slot> slot = new nsPKCS11Slot(mModule->slots[i]);

Просмотреть файл

@ -7,10 +7,16 @@
#ifndef nsPKCS12Blob_h
#define nsPKCS12Blob_h
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
#include "nsCOMPtr.h"
#include "nsIInterfaceRequestor.h"
#include "nsIMutableArray.h"
#include "nsString.h"
#include "nsTArray.h"
#include "p12.h"
#include "prerror.h"
#include "ScopedNSSTypes.h"
#include "seccomon.h"
class nsIFile;