NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
openssl-helper.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #include "openssl-helper.hpp"
23 
24 namespace ndn {
25 namespace security {
26 namespace detail {
27 
28 const EVP_MD*
30 {
31  switch (algo) {
33  return EVP_sha256();
34  default:
35  return nullptr;
36  }
37 }
38 
40  : m_key(nullptr)
41 {
42 }
43 
45 {
46  EVP_PKEY_free(m_key);
47 }
48 
49 EvpPkeyCtx::EvpPkeyCtx(EVP_PKEY* key)
50  : m_ctx(EVP_PKEY_CTX_new(key, nullptr))
51 {
52  BOOST_ASSERT(m_ctx != nullptr);
53 }
54 
56  : m_ctx(EVP_PKEY_CTX_new_id(id, nullptr))
57 {
58  BOOST_ASSERT(m_ctx != nullptr);
59 }
60 
62 {
63  EVP_PKEY_CTX_free(m_ctx);
64 }
65 
66 #if OPENSSL_VERSION_NUMBER < 0x1010000fL
67 Bio::Bio(BIO_METHOD* method)
68 #else
69 Bio::Bio(const BIO_METHOD* method)
70 #endif // OPENSSL_VERSION_NUMBER < 0x1010000fL
71  : m_bio(BIO_new(method))
72 {
73  BOOST_ASSERT(m_bio != nullptr);
74 }
75 
77 {
78  BIO_free_all(m_bio);
79 }
80 
81 } // namespace detail
82 } // namespace security
83 } // namespace ndn
Copyright (c) 2011-2015 Regents of the University of California.
Bio(BIO_METHOD *method)
const EVP_MD * toDigestEvpMd(DigestAlgorithm algo)