summaryrefslogtreecommitdiff
path: root/cpp/src/IceSSL/OpenSSLJanitors.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2002-04-24 21:13:00 +0000
committerMark Spruiell <mes@zeroc.com>2002-04-24 21:13:00 +0000
commit5409c1ecef0f226dedc77721c0d2fc8dfe9e85de (patch)
tree97ba75bc47a143726d6d8382be3a462e51716700 /cpp/src/IceSSL/OpenSSLJanitors.cpp
parentcleaning up sample impls (diff)
downloadice-5409c1ecef0f226dedc77721c0d2fc8dfe9e85de.tar.bz2
ice-5409c1ecef0f226dedc77721c0d2fc8dfe9e85de.tar.xz
ice-5409c1ecef0f226dedc77721c0d2fc8dfe9e85de.zip
merging from plugins branch
Diffstat (limited to 'cpp/src/IceSSL/OpenSSLJanitors.cpp')
-rw-r--r--cpp/src/IceSSL/OpenSSLJanitors.cpp142
1 files changed, 142 insertions, 0 deletions
diff --git a/cpp/src/IceSSL/OpenSSLJanitors.cpp b/cpp/src/IceSSL/OpenSSLJanitors.cpp
new file mode 100644
index 00000000000..7779f3a0959
--- /dev/null
+++ b/cpp/src/IceSSL/OpenSSLJanitors.cpp
@@ -0,0 +1,142 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <IceSSL/OpenSSLJanitors.h>
+
+IceSSL::OpenSSL::RSAJanitor::RSAJanitor(RSA* rsa) :
+ _rsa(rsa)
+{
+ assert(_rsa != 0);
+}
+
+IceSSL::OpenSSL::RSAJanitor::~RSAJanitor()
+{
+ if (_rsa)
+ {
+ RSA_free(_rsa);
+ }
+}
+
+void
+IceSSL::OpenSSL::RSAJanitor::clear()
+{
+ _rsa = 0;
+}
+
+RSA*
+IceSSL::OpenSSL::RSAJanitor::get() const
+{
+ return _rsa;
+}
+
+IceSSL::OpenSSL::EVP_PKEYJanitor::EVP_PKEYJanitor(EVP_PKEY* evp_pkey) :
+ _evp_pkey(evp_pkey)
+{
+ assert(_evp_pkey != 0);
+}
+
+IceSSL::OpenSSL::EVP_PKEYJanitor::~EVP_PKEYJanitor()
+{
+ if (_evp_pkey)
+ {
+ EVP_PKEY_free(_evp_pkey);
+ }
+}
+
+void
+IceSSL::OpenSSL::EVP_PKEYJanitor::clear()
+{
+ _evp_pkey = 0;
+}
+
+EVP_PKEY*
+IceSSL::OpenSSL::EVP_PKEYJanitor::get() const
+{
+ return _evp_pkey;
+}
+
+IceSSL::OpenSSL::X509_REQJanitor::X509_REQJanitor(X509_REQ* x509_req) :
+ _x509_req(x509_req)
+{
+ assert(_x509_req != 0);
+}
+
+IceSSL::OpenSSL::X509_REQJanitor::~X509_REQJanitor()
+{
+ if (_x509_req)
+ {
+ X509_REQ_free(_x509_req);
+ }
+}
+
+void
+IceSSL::OpenSSL::X509_REQJanitor::clear()
+{
+ _x509_req = 0;
+}
+
+X509_REQ*
+IceSSL::OpenSSL::X509_REQJanitor::get() const
+{
+ return _x509_req;
+}
+
+IceSSL::OpenSSL::X509Janitor::X509Janitor(X509* x509) :
+ _x509(x509)
+{
+ assert(_x509 != 0);
+}
+
+IceSSL::OpenSSL::X509Janitor::~X509Janitor()
+{
+ if (_x509)
+ {
+ X509_free(_x509);
+ }
+}
+
+void
+IceSSL::OpenSSL::X509Janitor::clear()
+{
+ _x509 = 0;
+}
+
+X509*
+IceSSL::OpenSSL::X509Janitor::get() const
+{
+ return _x509;
+}
+
+IceSSL::OpenSSL::BIOJanitor::BIOJanitor(BIO* bio) :
+ _bio(bio)
+{
+ assert(_bio != 0);
+}
+
+IceSSL::OpenSSL::BIOJanitor::~BIOJanitor()
+{
+ if (_bio)
+ {
+ BIO_free(_bio);
+ }
+}
+
+void
+IceSSL::OpenSSL::BIOJanitor::clear()
+{
+ _bio = 0;
+}
+
+BIO*
+IceSSL::OpenSSL::BIOJanitor::get() const
+{
+ return _bio;
+}
+