1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/manager/ssl/src/nsKeygenThread.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,70 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef _NSKEYGENTHREAD_H_ 1.11 +#define _NSKEYGENTHREAD_H_ 1.12 + 1.13 +#include "keyhi.h" 1.14 +#include "nspr.h" 1.15 + 1.16 +#include "mozilla/Mutex.h" 1.17 +#include "nsIKeygenThread.h" 1.18 +#include "nsCOMPtr.h" 1.19 + 1.20 +class nsIRunnable; 1.21 + 1.22 +class nsKeygenThread : public nsIKeygenThread 1.23 +{ 1.24 +private: 1.25 + mozilla::Mutex mutex; 1.26 + 1.27 + nsCOMPtr<nsIRunnable> mNotifyObserver; 1.28 + 1.29 + bool iAmRunning; 1.30 + bool keygenReady; 1.31 + bool statusDialogClosed; 1.32 + bool alreadyReceivedParams; 1.33 + 1.34 + SECKEYPrivateKey *privateKey; 1.35 + SECKEYPublicKey *publicKey; 1.36 + PK11SlotInfo *slot; 1.37 + PK11AttrFlags flags; 1.38 + PK11SlotInfo *altSlot; 1.39 + PK11AttrFlags altFlags; 1.40 + PK11SlotInfo *usedSlot; 1.41 + uint32_t keyGenMechanism; 1.42 + void *params; 1.43 + void *wincx; 1.44 + 1.45 + PRThread *threadHandle; 1.46 + 1.47 +public: 1.48 + nsKeygenThread(); 1.49 + virtual ~nsKeygenThread(); 1.50 + 1.51 + NS_DECL_NSIKEYGENTHREAD 1.52 + NS_DECL_THREADSAFE_ISUPPORTS 1.53 + 1.54 + void SetParams( 1.55 + PK11SlotInfo *a_slot, 1.56 + PK11AttrFlags a_flags, 1.57 + PK11SlotInfo *a_alternative_slot, 1.58 + PK11AttrFlags a_alternative_flags, 1.59 + uint32_t a_keyGenMechanism, 1.60 + void *a_params, 1.61 + void *a_wincx ); 1.62 + 1.63 + nsresult ConsumeResult( 1.64 + PK11SlotInfo **a_used_slot, 1.65 + SECKEYPrivateKey **a_privateKey, 1.66 + SECKEYPublicKey **a_publicKey); 1.67 + 1.68 + void Join(void); 1.69 + 1.70 + void Run(void); 1.71 +}; 1.72 + 1.73 +#endif //_NSKEYGENTHREAD_H_