提交 d1e40b08 authored 作者: Travis Cross's avatar Travis Cross

Add OpenSSL version check around ECDH

...we'll try to support ancient OpenSSL versions on v1.2 for awhile
longer.
上级 13989756
...@@ -266,6 +266,8 @@ int tls_verify_cb(int ok, X509_STORE_CTX *store) ...@@ -266,6 +266,8 @@ int tls_verify_cb(int ok, X509_STORE_CTX *store)
static static
int tls_init_ecdh_curve(tls_t *tls) int tls_init_ecdh_curve(tls_t *tls)
{ {
#if OPENSSL_VERSION_NUMBER >= 0x0090800fL
#ifndef OPENSSL_NO_ECDH
int nid; int nid;
EC_KEY *ecdh; EC_KEY *ecdh;
if (!(nid = OBJ_sn2nid("prime256v1"))) { if (!(nid = OBJ_sn2nid("prime256v1"))) {
...@@ -282,6 +284,9 @@ int tls_init_ecdh_curve(tls_t *tls) ...@@ -282,6 +284,9 @@ int tls_init_ecdh_curve(tls_t *tls)
SSL_CTX_set_tmp_ecdh(tls->ctx, ecdh); SSL_CTX_set_tmp_ecdh(tls->ctx, ecdh);
EC_KEY_free(ecdh); EC_KEY_free(ecdh);
return 0; return 0;
#endif
#endif
return -1;
} }
static static
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论