mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-07 04:05:49 +00:00
23a0cee1a8
nsPSMUITracker was problematic. Apparently it was originally intended to prevent NSS shutdown while NSS-related UI operations were going on (such as choosing a client certificate). However, when nsNSSComponent would receive the event that told it to shutdown NSS, it would attempt to call mShutdownObjectList->evaporateAllNSSResources(), which would call mActivityState.restrictActivityToCurrentThread(), which failed if such a UI operation was in progress. This actually prevented the important part of evaporateAllNSSResources, which is the releasing of all NSS objects in use by PSM objects. Importantly, nsNSSComponent didn't check for or handle this failure and proceeded to call NSS_Shutdown(), leaving PSM in an inconsistent state where it thought it was okay to keep using the NSS objects it had when in fact it wasn't. In any case, nsPSMUITracker isn't really necessary as long as we have the nsNSSShutDownPreventionLock mechanism, which mostly works and is what we should use instead (or not at all, if no such lock is needed for the operation being performed (for example, if no NSS functions are being called)).
77 lines
2.7 KiB
C++
77 lines
2.7 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef _NSKEYGENHANDLER_H_
|
|
#define _NSKEYGENHANDLER_H_
|
|
// Form Processor
|
|
#include "nsIFormProcessor.h"
|
|
#include "nsTArray.h"
|
|
#include "nsNSSShutDown.h"
|
|
|
|
nsresult GetSlotWithMechanism(uint32_t mechanism,
|
|
nsIInterfaceRequestor* ctx,
|
|
PK11SlotInfo** retSlot,
|
|
nsNSSShutDownPreventionLock& /*proofOfLock*/);
|
|
|
|
#define DEFAULT_RSA_KEYGEN_PE 65537L
|
|
#define DEFAULT_RSA_KEYGEN_ALG SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION
|
|
|
|
SECKEYECParams *decode_ec_params(const char *curve);
|
|
|
|
class nsKeygenFormProcessor : public nsIFormProcessor
|
|
, public nsNSSShutDownObject
|
|
{
|
|
public:
|
|
nsKeygenFormProcessor();
|
|
nsresult Init();
|
|
|
|
virtual nsresult ProcessValue(nsIDOMHTMLElement* aElement,
|
|
const nsAString& aName,
|
|
nsAString& aValue) override;
|
|
|
|
virtual nsresult ProcessValueIPC(const nsAString& aOldValue,
|
|
const nsAString& aChallenge,
|
|
const nsAString& aKeyType,
|
|
const nsAString& aKeyParams,
|
|
nsAString& aNewValue) override;
|
|
|
|
virtual nsresult ProvideContent(const nsAString& aFormType,
|
|
nsTArray<nsString>& aContent,
|
|
nsAString& aAttribute) override;
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
|
|
|
static nsresult Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult);
|
|
|
|
static void ExtractParams(nsIDOMHTMLElement* aElement,
|
|
nsAString& challengeValue,
|
|
nsAString& keyTypeValue,
|
|
nsAString& keyParamsValue);
|
|
|
|
// Nothing to release.
|
|
virtual void virtualDestroyNSSReference() override {}
|
|
|
|
protected:
|
|
virtual ~nsKeygenFormProcessor();
|
|
|
|
nsresult GetPublicKey(const nsAString& aValue, const nsAString& aChallenge,
|
|
const nsAFlatString& akeyType, nsAString& aOutPublicKey,
|
|
const nsAString& aPqg);
|
|
nsresult GetSlot(uint32_t aMechanism, PK11SlotInfo** aSlot);
|
|
private:
|
|
nsCOMPtr<nsIInterfaceRequestor> m_ctx;
|
|
|
|
typedef struct SECKeySizeChoiceInfoStr {
|
|
nsString name;
|
|
int size;
|
|
} SECKeySizeChoiceInfo;
|
|
|
|
enum { number_of_key_size_choices = 2 };
|
|
|
|
SECKeySizeChoiceInfo mSECKeySizeChoiceList[number_of_key_size_choices];
|
|
};
|
|
|
|
#endif //_NSKEYGENHANDLER_H_
|