aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/c_src/crypto_callback.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2015-11-16 19:40:24 +0100
committerSverker Eriksson <[email protected]>2015-11-17 12:20:52 +0100
commitcfc8f82f1f39da114574a28c57f5d4a29ebbafaf (patch)
tree07f9f3052c14845894d445384b693a11cd803836 /lib/crypto/c_src/crypto_callback.c
parente9442a7b93f6946b736b6b1e3621b405667ef672 (diff)
downloadotp-cfc8f82f1f39da114574a28c57f5d4a29ebbafaf.tar.gz
otp-cfc8f82f1f39da114574a28c57f5d4a29ebbafaf.tar.bz2
otp-cfc8f82f1f39da114574a28c57f5d4a29ebbafaf.zip
crypto: Refactor nif code to use EVP interface
Using the generic EVP_* API makes it possible to unify algorithm-specific nif functions to a single generic function. Effectively the same change that took place on the Erlang API in R16B01 is now applied to the C code. The old implementation using the low-level API is kept for compiling against old OpenSSL, as parts of the EVP API were introduced in OpenSSL 1.0.0. There are various minor improvements as well: - supported algorithms are now provided by the nif code (not a mix of the C and Erlang code) - remove unnecessary variables and macro definitions Most of the changes in this commit comes from Dániel Szoboszlay https://github.com/dszoboszlay/otp/commit/07f7056f955b324df4ace which is part of his 'fips' branch. Now also rebased on master branch.
Diffstat (limited to 'lib/crypto/c_src/crypto_callback.c')
-rw-r--r--lib/crypto/c_src/crypto_callback.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/crypto/c_src/crypto_callback.c b/lib/crypto/c_src/crypto_callback.c
index e0de16074c..aab43232c9 100644
--- a/lib/crypto/c_src/crypto_callback.c
+++ b/lib/crypto/c_src/crypto_callback.c
@@ -51,8 +51,6 @@
DLLEXPORT struct crypto_callbacks* get_crypto_callbacks(int nlocks);
-static ErlNifRWLock** lock_vec = NULL; /* Static locks used by openssl */
-
static void nomem(size_t size, const char* op)
{
fprintf(stderr, "Out of memory abort. Crypto failed to %s %zu bytes.\r\n",
@@ -84,6 +82,8 @@ static void crypto_free(void* ptr)
#ifdef OPENSSL_THREADS /* vvvvvvvvvvvvvvv OPENSSL_THREADS vvvvvvvvvvvvvvvv */
+static ErlNifRWLock** lock_vec = NULL; /* Static locks used by openssl */
+
#include <openssl/crypto.h>
static INLINE void locking(int mode, ErlNifRWLock* lock)