diff options
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_EVP_PKEY.h')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_EVP_PKEY.h | 97 |
1 files changed, 62 insertions, 35 deletions
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_EVP_PKEY.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_EVP_PKEY.h index 903828b73d5..a316efd37c7 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_EVP_PKEY.h +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_EVP_PKEY.h @@ -6,7 +6,7 @@ * * $Id$ * - * @author Ossama Othman <ossama@dre,vanderbilt.edu> + * @author Ossama Othman <ossama@uci.edu> */ //============================================================================= @@ -21,56 +21,83 @@ #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "SSLIOP_OpenSSL_st_T.h" +#include "tao/varbase.h" -#include <openssl/evp.h> #include <openssl/crypto.h> - +#include <openssl/evp.h> namespace TAO { namespace SSLIOP { - // OpenSSL @c EVP_PKEY structure traits specialization. - template <> - struct OpenSSL_traits< ::EVP_PKEY > + /** + * @name CORBA-style Reference Count Manipulation Methods + */ + /// Increase the reference count on the given EVP_PKEY structure. + ::EVP_PKEY *_duplicate (::EVP_PKEY *key); + + /// Decrease the reference count on the given EVP_PKEY structure. + void release (::EVP_PKEY *key); + + /** + * @class EVP_PKEY_var + * + * @brief "_var" class for the OpenSSL @param EVP_PKEY structure. + * + * This class is simply used to make operations on instances of + * the OpenSSL @param EVP_PKEY structures exception safe. It is + * only used internally by the SSLIOP pluggable protocol. + */ + class EVP_PKEY_var : private TAO_Base_var { - /// OpenSSL lock ID for use in OpenSSL CRYPTO_add() reference - /// count manipulation function. - enum { LOCK_ID = CRYPTO_LOCK_EVP_PKEY }; + public: - /// Increase the reference count on the given OpenSSL structure. /** - * @note This used to be in a function template but MSVC++ 6 - * can't handle function templates correctly so reproduce - * the code in each specialization. *sigh* + * @name Constructors */ - static ::EVP_PKEY * _duplicate (::EVP_PKEY * st) - { - if (st != 0) - CRYPTO_add (&(st->references), - 1, - LOCK_ID); - - return st; - } - - /// Perform deep copy of the given OpenSSL structure. - static ::EVP_PKEY * copy (::EVP_PKEY const & key); - - /// Decrease the reference count on the given OpenSSL - /// structure. - static void release (::EVP_PKEY * st) - { - ::EVP_PKEY_free (st); - } - }; + //@{ + EVP_PKEY_var (void); + EVP_PKEY_var (::EVP_PKEY *x); + EVP_PKEY_var (const EVP_PKEY_var &); + //@} + + /// Destructor + ~EVP_PKEY_var (void); + + EVP_PKEY_var &operator= (::EVP_PKEY *); + EVP_PKEY_var &operator= (const EVP_PKEY_var &); + const ::EVP_PKEY *operator-> (void) const; + ::EVP_PKEY *operator-> (void); + + operator const ::EVP_PKEY &() const; + operator ::EVP_PKEY &(); - typedef OpenSSL_st_var< ::EVP_PKEY > EVP_PKEY_var; + ::EVP_PKEY *in (void) const; + ::EVP_PKEY *&inout (void); + ::EVP_PKEY *&out (void); + ::EVP_PKEY *_retn (void); + ::EVP_PKEY *ptr (void) const; + + private: + + // Unimplemented - prevents widening assignment. + EVP_PKEY_var (const TAO_Base_var &rhs); + EVP_PKEY_var &operator= (const TAO_Base_var &rhs); + + private: + + /// The OpenSSL @c EVP_PKEY structure that represents a private + /// key. + ::EVP_PKEY *evp_; + + }; } // End SSLIOP namespace. } // End TAO namespace. +#if defined (__ACE_INLINE__) +#include "SSLIOP_EVP_PKEY.inl" +#endif /* __ACE_INLINE__ */ #include /**/ "ace/post.h" |