aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/c_src/crypto.c
diff options
context:
space:
mode:
authorMagnus Henoch <[email protected]>2016-09-08 15:49:13 +0100
committerMagnus Henoch <[email protected]>2016-09-14 14:31:31 +0100
commit6b4cf6c5759d1f1f952708ab191f563175950aa0 (patch)
treeb6fe7af2e460b4c91c1f0dc144397e9257b71e7f /lib/crypto/c_src/crypto.c
parent176b7c94e4146a65ccd2bd729d58487098dddd9c (diff)
downloadotp-6b4cf6c5759d1f1f952708ab191f563175950aa0.tar.gz
otp-6b4cf6c5759d1f1f952708ab191f563175950aa0.tar.bz2
otp-6b4cf6c5759d1f1f952708ab191f563175950aa0.zip
Fix compilation when OpenSSL doesn't support RC2
When OpenSSL has been configured with the "no-rc2" option, the header file rc2.h doesn't exist, and neither does the function EVP_rc2_cbc. Let's handle those by checking whether OPENSSL_NO_RC2 is defined. Also update pbe_SUITE, which uses RC2-CBC in one of the tests.
Diffstat (limited to 'lib/crypto/c_src/crypto.c')
-rw-r--r--lib/crypto/c_src/crypto.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c
index 00fc81c84f..c2ca990a3d 100644
--- a/lib/crypto/c_src/crypto.c
+++ b/lib/crypto/c_src/crypto.c
@@ -51,7 +51,9 @@
#include <openssl/bn.h>
#include <openssl/objects.h>
#include <openssl/rc4.h>
-#include <openssl/rc2.h>
+#ifndef OPENSSL_NO_RC2
+ #include <openssl/rc2.h>
+#endif
#include <openssl/blowfish.h>
#include <openssl/rand.h>
#include <openssl/evp.h>
@@ -468,7 +470,13 @@ struct cipher_type_t {
struct cipher_type_t cipher_types[] =
{
- {{"rc2_cbc"}, {&EVP_rc2_cbc}},
+ {{"rc2_cbc"},
+#ifndef OPENSSL_NO_RC2
+ {&EVP_rc2_cbc}
+#else
+ {NULL}
+#endif
+ },
{{"des_cbc"}, {COND_NO_DES_PTR(&EVP_des_cbc)}},
{{"des_cfb"}, {COND_NO_DES_PTR(&EVP_des_cfb8)}},
{{"des_ecb"}, {COND_NO_DES_PTR(&EVP_des_ecb)}},
@@ -827,7 +835,9 @@ static void init_algorithms_types(ErlNifEnv* env)
algo_cipher[algo_cipher_cnt++] = enif_make_atom(env,"blowfish_cfb64");
algo_cipher[algo_cipher_cnt++] = enif_make_atom(env,"blowfish_ofb64");
algo_cipher[algo_cipher_cnt++] = enif_make_atom(env,"blowfish_ecb");
+#ifndef OPENSSL_NO_RC2
algo_cipher[algo_cipher_cnt++] = enif_make_atom(env,"rc2_cbc");
+#endif
algo_cipher[algo_cipher_cnt++] = enif_make_atom(env,"rc4");
#if defined(HAVE_GCM)
algo_cipher[algo_cipher_cnt++] = enif_make_atom(env,"aes_gcm");