OpenDDS::Security::SSL::hash_serialized_impl Class Reference

List of all members.

Public Member Functions

 hash_serialized_impl ()
 ~hash_serialized_impl ()
int operator() (const DDS::BinaryPropertySeq &src, DDS::OctetSeq &dst)

Private Attributes

EVP_MD_CTX * hash_ctx

Detailed Description

Definition at line 145 of file Utils.cpp.


Constructor & Destructor Documentation

OpenDDS::Security::SSL::hash_serialized_impl::hash_serialized_impl (  )  [inline]

Definition at line 148 of file Utils.cpp.

References EVP_MD_CTX_new, and OPENDDS_SSL_LOG_ERR.

00148                            : hash_ctx(NULL)
00149     {
00150       hash_ctx = EVP_MD_CTX_new();
00151       if (!hash_ctx) {
00152         OPENDDS_SSL_LOG_ERR("EVP_MD_CTX_new failed");
00153       }
00154     }

OpenDDS::Security::SSL::hash_serialized_impl::~hash_serialized_impl (  )  [inline]

Definition at line 156 of file Utils.cpp.

References EVP_MD_CTX_free.

00157     {
00158       if (hash_ctx) EVP_MD_CTX_free(hash_ctx);
00159     }


Member Function Documentation

int OpenDDS::Security::SSL::hash_serialized_impl::operator() ( const DDS::BinaryPropertySeq src,
DDS::OctetSeq dst 
) [inline]

Definition at line 161 of file Utils.cpp.

References ACE_TEXT(), OpenDDS::DCPS::Serializer::ALIGN_INITIALIZE, OpenDDS::DCPS::gen_find_size(), ACE_Message_Block::length(), LM_ERROR, ACE_Message_Block::rd_ptr(), size, and OpenDDS::DCPS::Serializer::SWAP_BE.

00162     {
00163       if (!hash_ctx) return 1;
00164 
00165       EVP_DigestInit_ex(hash_ctx, EVP_sha256(), NULL);
00166 
00167       size_t size = 0u, padding = 0u;
00168       DCPS::gen_find_size(src, size, padding);
00169       ACE_Message_Block buffer(size + padding);
00170 
00171       OpenDDS::DCPS::Serializer serializer(
00172         &buffer, OpenDDS::DCPS::Serializer::SWAP_BE,
00173         OpenDDS::DCPS::Serializer::ALIGN_INITIALIZE);
00174       if (serializer << src) {
00175         EVP_DigestUpdate(hash_ctx, buffer.rd_ptr(), buffer.length());
00176 
00177         dst.length(EVP_MAX_MD_SIZE);
00178 
00179         unsigned int newlen = 0u;
00180         EVP_DigestFinal_ex(hash_ctx, dst.get_buffer(), &newlen);
00181 
00182         dst.length(newlen);
00183 
00184       } else {
00185         ACE_ERROR((LM_ERROR,
00186                    ACE_TEXT("(%P|%t) SSL::hash_serialized_impl::operator(): ERROR, failed to "
00187                             "serialize binary-property-sequence\n")));
00188 
00189         return 1;
00190       }
00191 
00192       return 0;
00193     }

Here is the call graph for this function:


Member Data Documentation

Definition at line 196 of file Utils.cpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1