diff options
author | Stefan Strogin <stefan.strogin@gmail.com> | 2019-02-15 20:45:34 +0200 |
---|---|---|
committer | Stefan Strogin <stefan.strogin@gmail.com> | 2019-02-15 21:10:39 +0200 |
commit | 926afef019ca9f297cebbe13479159ac5c087f00 (patch) | |
tree | fa8eb92cdd038d3a46b56c59d5ca04f470d568e7 | |
parent | c21b2b3121a220b4a4402ab795007674d77dd488 (diff) | |
download | libnice-926afef019ca9f297cebbe13479159ac5c087f00.tar.gz |
stun: Fix LibreSSL support
Closes #71
-rw-r--r-- | stun/stunhmac.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/stun/stunhmac.c b/stun/stunhmac.c index c7d1432..c9d183f 100644 --- a/stun/stunhmac.c +++ b/stun/stunhmac.c @@ -75,7 +75,8 @@ void stun_sha1 (const uint8_t *msg, size_t len, size_t msg_len, uint8_t *sha, assert (ret == 1); #endif -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || \ + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL) HMAC_CTX stackctx; HMAC_CTX *ctx = &stackctx; HMAC_CTX_init (ctx); @@ -101,7 +102,8 @@ void stun_sha1 (const uint8_t *msg, size_t len, size_t msg_len, uint8_t *sha, TRY (HMAC_Final (ctx, sha, NULL)); -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || \ + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL) HMAC_CTX_cleanup (ctx); #else HMAC_CTX_free (ctx); @@ -172,7 +174,8 @@ void stun_hash_creds (const uint8_t *realm, size_t realm_len, #ifdef HAVE_OPENSSL EVP_MD_CTX *ctx; -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || \ + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL) ctx = EVP_MD_CTX_create (); #else ctx = EVP_MD_CTX_new (); @@ -186,7 +189,8 @@ void stun_hash_creds (const uint8_t *realm, size_t realm_len, EVP_DigestUpdate (ctx, password_trimmed, password_len); EVP_DigestFinal_ex (ctx, md5, NULL); -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || \ + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL) EVP_MD_CTX_destroy (ctx); #else EVP_MD_CTX_free (ctx); |