summaryrefslogtreecommitdiffstats
path: root/security/nss/cpputil/nss_scoped_ptrs.h
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-01-02 21:06:40 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-01-02 21:06:40 +0100
commitf4a12fc67689a830e9da1c87fd11afe5bc09deb3 (patch)
tree211ae0cd022a6c11b0026ecc7761a550c584583c /security/nss/cpputil/nss_scoped_ptrs.h
parentf7d30133221896638f7bf4f66c504255c4b14f48 (diff)
downloadUXP-f4a12fc67689a830e9da1c87fd11afe5bc09deb3.tar
UXP-f4a12fc67689a830e9da1c87fd11afe5bc09deb3.tar.gz
UXP-f4a12fc67689a830e9da1c87fd11afe5bc09deb3.tar.lz
UXP-f4a12fc67689a830e9da1c87fd11afe5bc09deb3.tar.xz
UXP-f4a12fc67689a830e9da1c87fd11afe5bc09deb3.zip
Issue #1338 - Part 2: Update NSS to 3.48-RTM
Diffstat (limited to 'security/nss/cpputil/nss_scoped_ptrs.h')
-rw-r--r--security/nss/cpputil/nss_scoped_ptrs.h40
1 files changed, 27 insertions, 13 deletions
diff --git a/security/nss/cpputil/nss_scoped_ptrs.h b/security/nss/cpputil/nss_scoped_ptrs.h
index 03979f2c5..501f9dfe8 100644
--- a/security/nss/cpputil/nss_scoped_ptrs.h
+++ b/security/nss/cpputil/nss_scoped_ptrs.h
@@ -11,21 +11,30 @@
#include "cert.h"
#include "keyhi.h"
#include "p12.h"
+#include "pk11pqg.h"
#include "pk11pub.h"
#include "pkcs11uri.h"
+#include "secmod.h"
struct ScopedDelete {
void operator()(CERTCertificate* cert) { CERT_DestroyCertificate(cert); }
void operator()(CERTCertificateList* list) {
CERT_DestroyCertificateList(list);
}
+ void operator()(CERTDistNames* names) { CERT_FreeDistNames(names); }
void operator()(CERTName* name) { CERT_DestroyName(name); }
void operator()(CERTCertList* list) { CERT_DestroyCertList(list); }
void operator()(CERTSubjectPublicKeyInfo* spki) {
SECKEY_DestroySubjectPublicKeyInfo(spki);
}
+ void operator()(PK11Context* context) { PK11_DestroyContext(context, true); }
+ void operator()(PK11GenericObject* obj) { PK11_DestroyGenericObject(obj); }
void operator()(PK11SlotInfo* slot) { PK11_FreeSlot(slot); }
+ void operator()(PK11SlotList* slots) { PK11_FreeSlotList(slots); }
void operator()(PK11SymKey* key) { PK11_FreeSymKey(key); }
+ void operator()(PK11URI* uri) { PK11URI_DestroyURI(uri); }
+ void operator()(PLArenaPool* arena) { PORT_FreeArena(arena, PR_FALSE); }
+ void operator()(PQGParams* pqg) { PK11_PQG_DestroyParams(pqg); }
void operator()(PRFileDesc* fd) { PR_Close(fd); }
void operator()(SECAlgorithmID* id) { SECOID_DestroyAlgorithmID(id, true); }
void operator()(SECKEYEncryptedPrivateKeyInfo* e) {
@@ -37,14 +46,10 @@ struct ScopedDelete {
void operator()(SECKEYPrivateKeyList* list) {
SECKEY_DestroyPrivateKeyList(list);
}
- void operator()(PK11URI* uri) { PK11URI_DestroyURI(uri); }
- void operator()(PLArenaPool* arena) { PORT_FreeArena(arena, PR_FALSE); }
- void operator()(PK11Context* context) { PK11_DestroyContext(context, true); }
- void operator()(PK11GenericObject* obj) { PK11_DestroyGenericObject(obj); }
+ void operator()(SECMODModule* module) { SECMOD_DestroyModule(module); }
void operator()(SEC_PKCS12DecoderContext* dcx) {
SEC_PKCS12DecoderFinish(dcx);
}
- void operator()(CERTDistNames* names) { CERT_FreeDistNames(names); }
};
template <class T>
@@ -59,27 +64,36 @@ struct ScopedMaybeDelete {
#define SCOPED(x) typedef std::unique_ptr<x, ScopedMaybeDelete<x> > Scoped##x
+SCOPED(CERTCertList);
SCOPED(CERTCertificate);
SCOPED(CERTCertificateList);
-SCOPED(CERTCertList);
+SCOPED(CERTDistNames);
SCOPED(CERTName);
SCOPED(CERTSubjectPublicKeyInfo);
+SCOPED(PK11Context);
+SCOPED(PK11GenericObject);
SCOPED(PK11SlotInfo);
+SCOPED(PK11SlotList);
SCOPED(PK11SymKey);
+SCOPED(PK11URI);
+SCOPED(PLArenaPool);
+SCOPED(PQGParams);
SCOPED(PRFileDesc);
SCOPED(SECAlgorithmID);
-SCOPED(SECKEYEncryptedPrivateKeyInfo);
SCOPED(SECItem);
-SCOPED(SECKEYPublicKey);
+SCOPED(SECKEYEncryptedPrivateKeyInfo);
SCOPED(SECKEYPrivateKey);
SCOPED(SECKEYPrivateKeyList);
-SCOPED(PK11URI);
-SCOPED(PLArenaPool);
-SCOPED(PK11Context);
-SCOPED(PK11GenericObject);
+SCOPED(SECKEYPublicKey);
+SCOPED(SECMODModule);
SCOPED(SEC_PKCS12DecoderContext);
-SCOPED(CERTDistNames);
#undef SCOPED
+struct StackSECItem : public SECItem {
+ StackSECItem() : SECItem({siBuffer, nullptr, 0}) {}
+ ~StackSECItem() { Reset(); }
+ void Reset() { SECITEM_FreeItem(this, PR_FALSE); }
+};
+
#endif // nss_scoped_ptrs_h__