nsPKCS11Slot.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2. *
  3. * This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6. #ifndef nsPKCS11Slot_h
  7. #define nsPKCS11Slot_h
  8. #include "ScopedNSSTypes.h"
  9. #include "nsICryptoFIPSInfo.h"
  10. #include "nsIPKCS11Module.h"
  11. #include "nsIPKCS11ModuleDB.h"
  12. #include "nsIPKCS11Slot.h"
  13. #include "nsISupports.h"
  14. #include "nsNSSShutDown.h"
  15. #include "nsString.h"
  16. #include "pk11func.h"
  17. class nsPKCS11Slot : public nsIPKCS11Slot,
  18. public nsNSSShutDownObject
  19. {
  20. public:
  21. NS_DECL_ISUPPORTS
  22. NS_DECL_NSIPKCS11SLOT
  23. explicit nsPKCS11Slot(PK11SlotInfo* slot);
  24. protected:
  25. virtual ~nsPKCS11Slot();
  26. private:
  27. mozilla::UniquePK11SlotInfo mSlot;
  28. nsCString mSlotDesc;
  29. nsCString mSlotManufacturerID;
  30. nsCString mSlotHWVersion;
  31. nsCString mSlotFWVersion;
  32. int mSeries;
  33. virtual void virtualDestroyNSSReference() override;
  34. void destructorSafeDestroyNSSReference();
  35. nsresult refreshSlotInfo(const nsNSSShutDownPreventionLock& proofOfLock);
  36. nsresult GetAttributeHelper(const nsACString& attribute,
  37. /*out*/ nsACString& xpcomOutParam);
  38. };
  39. class nsPKCS11Module : public nsIPKCS11Module,
  40. public nsNSSShutDownObject
  41. {
  42. public:
  43. NS_DECL_ISUPPORTS
  44. NS_DECL_NSIPKCS11MODULE
  45. explicit nsPKCS11Module(SECMODModule* module);
  46. protected:
  47. virtual ~nsPKCS11Module();
  48. private:
  49. mozilla::UniqueSECMODModule mModule;
  50. virtual void virtualDestroyNSSReference() override;
  51. void destructorSafeDestroyNSSReference();
  52. };
  53. class nsPKCS11ModuleDB : public nsIPKCS11ModuleDB
  54. , public nsICryptoFIPSInfo
  55. , public nsNSSShutDownObject
  56. {
  57. public:
  58. NS_DECL_ISUPPORTS
  59. NS_DECL_NSIPKCS11MODULEDB
  60. NS_DECL_NSICRYPTOFIPSINFO
  61. nsPKCS11ModuleDB();
  62. protected:
  63. virtual ~nsPKCS11ModuleDB();
  64. // Nothing to release.
  65. virtual void virtualDestroyNSSReference() override {}
  66. };
  67. #define NS_PKCS11MODULEDB_CID \
  68. { 0xff9fbcd7, 0x9517, 0x4334, \
  69. { 0xb9, 0x7a, 0xce, 0xed, 0x78, 0x90, 0x99, 0x74 }}
  70. #endif // nsPKCS11Slot_h