Permalink
Browse files

Use openssl built-in function for setting up ECDH curves (thanks to u…

…ser pitchum)

This should fixes #20
  • Loading branch information...
prefiks committed Jul 10, 2017
1 parent d0f8fc0 commit b9c17209cc4a9cf149f8a64903b4c2b46c125dac
Showing with 3 additions and 14 deletions.
  1. +3 −14 c_src/fast_tls.c
View
@@ -59,9 +59,6 @@ typedef unsigned __int32 uint32_t;
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#define DH_set0_pqg(dh, dh_p, param, dh_g) (dh)->p = dh_p; (dh)->g = dh_g
#endif
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#define our_alloc enif_alloc
#define our_realloc enif_realloc
#define our_free enif_free
@@ -76,6 +73,8 @@ static void * our_realloc(void *ptr, size_t size, const char *file, int line) {
static void our_free(void *ptr, const char *file, int line) {
enif_free(ptr);
}
#undef SSL_CTX_set_ecdh_auto
#define SSL_CTX_set_ecdh_auto(A, B) do {} while(0)
#endif
@@ -376,17 +375,7 @@ static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) {
#ifndef OPENSSL_NO_ECDH
static void setup_ecdh(SSL_CTX *ctx) {
EC_KEY *ecdh;
if (SSLeay() < 0x1000005fL) {
return;
}
ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
SSL_CTX_set_options(ctx, SSL_OP_SINGLE_ECDH_USE);
SSL_CTX_set_tmp_ecdh(ctx, ecdh);
EC_KEY_free(ecdh);
SSL_CTX_set_ecdh_auto(ctx, 1);
}
#endif

0 comments on commit b9c1720

Please sign in to comment.