mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-23 19:25:25 +03:00
53 lines
1.9 KiB
Diff
53 lines
1.9 KiB
Diff
diff --git a/src/sslpp/sslcontext.cpp b/src/sslpp/sslcontext.cpp
|
|
index a701325..341b2da 100644
|
|
--- a/src/sslpp/sslcontext.cpp
|
|
+++ b/src/sslpp/sslcontext.cpp
|
|
@@ -723,7 +723,7 @@ int SslContext::enableSpdy(int level)
|
|
#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
|
|
SSL_CTX_set_alpn_select_cb(m_pCtx, SSLConntext_alpn_select_cb, this);
|
|
#endif
|
|
-#ifdef TLSEXT_TYPE_next_proto_neg
|
|
+#if defined(TLSEXT_TYPE_next_proto_neg) || defined(LIBRESSL_VERSION_NUMBER)
|
|
SSL_CTX_set_next_protos_advertised_cb(m_pCtx,
|
|
SslConnection_ssl_npn_advertised_cb, this);
|
|
#else
|
|
diff --git a/src/sslpp/sslutil.cpp b/src/sslpp/sslutil.cpp
|
|
index 6561c04..afd9272 100644
|
|
--- a/src/sslpp/sslutil.cpp
|
|
+++ b/src/sslpp/sslutil.cpp
|
|
@@ -851,7 +851,16 @@ int SslUtil::getPrivateKeyPem(SSL_CTX *pCtx, AutoBuf *pBuf)
|
|
{
|
|
int ret = -1;
|
|
BIO *pOut = BIO_new(BIO_s_mem());
|
|
- EVP_PKEY *pKey = SSL_CTX_get0_privatekey(pCtx);
|
|
+ EVP_PKEY *pKey = NULL;
|
|
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(LIBRESSL_VERSION_NUMBER)
|
|
+ pKey = SSL_CTX_get0_privatekey(pCtx);
|
|
+#else
|
|
+ SSL *ssl = SSL_new(pCtx);
|
|
+ if (!ssl)
|
|
+ return ret;
|
|
+ pKey = SSL_get_privatekey(ssl);
|
|
+ SSL_free(ssl);
|
|
+#endif
|
|
|
|
if (PEM_write_bio_PrivateKey(pOut, pKey, NULL, NULL, 0, NULL, NULL))
|
|
ret = bioToBuf(pOut, pBuf);
|
|
@@ -863,7 +872,16 @@ int SslUtil::getCertPem(SSL_CTX *pCtx, AutoBuf *pBuf)
|
|
{
|
|
int ret = -1;
|
|
BIO *pOut = BIO_new(BIO_s_mem());
|
|
- X509 *pCert = SSL_CTX_get0_certificate(pCtx);
|
|
+ X509 *pCert = NULL;
|
|
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(LIBRESSL_VERSION_NUMBER)
|
|
+ pCert = SSL_CTX_get0_certificate(pCtx);
|
|
+#else
|
|
+ SSL *ssl = SSL_new(pCtx);
|
|
+ if (!ssl)
|
|
+ return ret;
|
|
+ pCert = SSL_get_certificate(ssl);
|
|
+ SSL_free(ssl);
|
|
+#endif
|
|
|
|
if (PEM_write_bio_X509(pOut, pCert))
|
|
ret = bioToBuf(pOut, pBuf);
|