Skip to content

Commit 6c968a0

Browse files
committed
Merge InitSslContext() into MakeAsioSslContext()
1 parent fa08e90 commit 6c968a0

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

lib/base/tlsutility.cpp

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,21 @@ void InitializeOpenSSL()
7373
l_SSLInitialized = true;
7474
}
7575

76-
static void InitSslContext(const Shared<TlsContext>::Ptr& context, const String& pubkey, const String& privkey, const String& cakey)
76+
/**
77+
* Initializes an SSL context using the specified certificates.
78+
*
79+
* @param pubkey The public key.
80+
* @param privkey The matching private key.
81+
* @param cakey CA certificate chain file.
82+
* @returns An SSL context.
83+
*/
84+
Shared<TlsContext>::Ptr MakeAsioSslContext(const String& pubkey, const String& privkey, const String& cakey)
7785
{
86+
namespace ssl = boost::asio::ssl;
87+
88+
InitializeOpenSSL();
89+
90+
auto context (Shared<TlsContext>::Make(TlsContext::tls));
7891
char errbuf[256];
7992

8093
// Enforce TLS v1.2 as minimum
@@ -193,25 +206,6 @@ static void InitSslContext(const Shared<TlsContext>::Ptr& context, const String&
193206

194207
SSL_CTX_set_client_CA_list(sslContext, cert_names);
195208
}
196-
}
197-
198-
/**
199-
* Initializes an SSL context using the specified certificates.
200-
*
201-
* @param pubkey The public key.
202-
* @param privkey The matching private key.
203-
* @param cakey CA certificate chain file.
204-
* @returns An SSL context.
205-
*/
206-
Shared<TlsContext>::Ptr MakeAsioSslContext(const String& pubkey, const String& privkey, const String& cakey)
207-
{
208-
namespace ssl = boost::asio::ssl;
209-
210-
InitializeOpenSSL();
211-
212-
auto context (Shared<TlsContext>::Make(TlsContext::tls));
213-
214-
InitSslContext(context, pubkey, privkey, cakey);
215209

216210
return context;
217211
}

0 commit comments

Comments
 (0)