00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file SSLIOP_EVP_PKEY.h 00006 * 00007 * $Id: SSLIOP_EVP_PKEY.h 75865 2006-12-06 16:09:53Z johnnyw $ 00008 * 00009 * @author Ossama Othman <ossama@dre.vanderbilt.edu> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_SSLIOP_EVP_PKEY_H 00014 #define TAO_SSLIOP_EVP_PKEY_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "ace/config-all.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 #pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "orbsvcs/SSLIOP/SSLIOP_OpenSSL_st_T.h" 00025 00026 #include <openssl/evp.h> 00027 #include <openssl/crypto.h> 00028 00029 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00030 00031 namespace TAO 00032 { 00033 namespace SSLIOP 00034 { 00035 // OpenSSL @c EVP_PKEY structure traits specialization. 00036 template <> 00037 struct OpenSSL_traits< ::EVP_PKEY > 00038 { 00039 /// OpenSSL lock ID for use in OpenSSL CRYPTO_add() reference 00040 /// count manipulation function. 00041 enum { LOCK_ID = CRYPTO_LOCK_EVP_PKEY }; 00042 00043 /// Increase the reference count on the given OpenSSL structure. 00044 /** 00045 * @note This used to be in a function template but MSVC++ 6 00046 * can't handle function templates correctly so reproduce 00047 * the code in each specialization. *sigh* 00048 */ 00049 static ::EVP_PKEY * _duplicate (::EVP_PKEY * st) 00050 { 00051 if (st != 0) 00052 CRYPTO_add (&(st->references), 00053 1, 00054 LOCK_ID); 00055 00056 return st; 00057 } 00058 00059 /// Perform deep copy of the given OpenSSL structure. 00060 static ::EVP_PKEY * copy (::EVP_PKEY const & key); 00061 00062 /// Decrease the reference count on the given OpenSSL 00063 /// structure. 00064 static void release (::EVP_PKEY * st) 00065 { 00066 ::EVP_PKEY_free (st); 00067 } 00068 }; 00069 00070 typedef OpenSSL_st_var< ::EVP_PKEY > EVP_PKEY_var; 00071 00072 } // End SSLIOP namespace. 00073 } // End TAO namespace. 00074 00075 TAO_END_VERSIONED_NAMESPACE_DECL 00076 00077 #include /**/ "ace/post.h" 00078 00079 #endif /* TAO_SSLIOP_EVP_PKEY_H */