Commit 07fb5854 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Compile with openssl 1.0.2

parent b56a99bf
......@@ -193,11 +193,23 @@ int servername_callback(SSL *ssl, int *al, void *arg) {
for (auto ssl_ctx : ssl_ctx_list) {
auto cert = SSL_CTX_get0_certificate(ssl_ctx);
#if OPENSSL_1_1_API
auto pubkey = X509_get0_pubkey(cert);
#else // !OPENSSL_1_1_API
auto pubkey = X509_get_pubkey(cert);
#endif // !OPENSSL_1_1_API
if (EVP_PKEY_base_id(pubkey) != EVP_PKEY_EC) {
continue;
}
#if OPENSSL_1_1_API
auto eckey = EVP_PKEY_get0_EC_KEY(pubkey);
#else // !OPENSSL_1_1_API
auto eckey = EVP_PKEY_get1_EC_KEY(pubkey);
#endif // !OPENSSL_1_1_API
if (eckey == nullptr) {
continue;
}
......@@ -205,6 +217,11 @@ int servername_callback(SSL *ssl, int *al, void *arg) {
auto ecgroup = EC_KEY_get0_group(eckey);
auto cert_curve = EC_GROUP_get_curve_name(ecgroup);
#if !OPENSSL_1_1_API
EC_KEY_free(eckey);
EVP_PKEY_free(pubkey);
#endif // !OPENSSL_1_1_API
if (shared_curve == cert_curve) {
SSL_set_SSL_CTX(ssl, ssl_ctx);
return SSL_TLSEXT_ERR_OK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment