fix openssl build

This commit is contained in:
Arvid Norberg 2012-12-10 10:43:39 +00:00
parent 70740a0ecd
commit ae8e3bc04f
1 changed files with 13 additions and 0 deletions

View File

@ -75,6 +75,8 @@ namespace libtorrent
{
#ifdef TORRENT_USE_GCRYPT
gcry_md_open(&m_context, GCRY_MD_SHA1, 0);
#elif defined TORRENT_USE_OPENSSL
SHA1_Init(&m_context);
#else
SHA1_init(&m_context);
#endif
@ -86,6 +88,9 @@ namespace libtorrent
#ifdef TORRENT_USE_GCRYPT
gcry_md_open(&m_context, GCRY_MD_SHA1, 0);
gcry_md_write(m_context, data, len);
#elif defined TORRENT_USE_OPENSSL
SHA1_Init(&m_context);
SHA1_Update(&m_context, reinterpret_cast<unsigned char const*>(data), len);
#else
SHA1_init(&m_context);
SHA1_update(&m_context, reinterpret_cast<unsigned char const*>(data), len);
@ -113,6 +118,8 @@ namespace libtorrent
TORRENT_ASSERT(len > 0);
#ifdef TORRENT_USE_GCRYPT
gcry_md_write(m_context, data, len);
#elif defined TORRENT_USE_OPENSSL
SHA1_Update(&m_context, reinterpret_cast<unsigned char const*>(data), len);
#else
SHA1_update(&m_context, reinterpret_cast<unsigned char const*>(data), len);
#endif
@ -124,6 +131,8 @@ namespace libtorrent
#ifdef TORRENT_USE_GCRYPT
gcry_md_final(m_context);
digest.assign((const char*)gcry_md_read(m_context, 0));
#elif defined TORRENT_USE_OPENSSL
SHA1_Final(digest.begin(), &m_context);
#else
SHA1_final(digest.begin(), &m_context);
#endif
@ -134,6 +143,8 @@ namespace libtorrent
{
#ifdef TORRENT_USE_GCRYPT
gcry_md_reset(m_context);
#elif defined TORRENT_USE_OPENSSL
SHA1_Init(&m_context);
#else
SHA1_init(&m_context);
#endif
@ -150,6 +161,8 @@ namespace libtorrent
#ifdef TORRENT_USE_GCRYPT
gcry_md_hd_t m_context;
#elif defined TORRENT_USE_OPENSSL
SHA_CTX m_context;
#else
sha_ctx m_context;
#endif