Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions include/cassandra.h
Original file line number Diff line number Diff line change
Expand Up @@ -3247,6 +3247,37 @@ cass_aggregate_meta_field_by_name_n(const CassAggregateMeta* aggregate_meta,
CASS_EXPORT CassSsl*
cass_ssl_new();

/**
* Creates a new SSL context <b>without</b> initializing the underlying library
* implementation. The integrating application is responsible for
* initializing the underlying SSL implementation. The driver uses the SSL
* implmentation from several threads concurrently so it's important that it's
* properly setup for multithreaded use e.g. lock callbacks for OpenSSL.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parenthesis around (e.g. ....) might improve readability

*
* <b>Important:</b> The SSL library must be initialized before calling this
* function.
*
* When using OpenSSL the following components need to be initialized:
*
* SSL_library_init();
* SSL_load_error_strings();
* OpenSSL_add_all_algorithms();
*
* The following thread-safety callbacks also need to be set:
*
* CRYPTO_set_locking_callback(...);
* CRYPTO_set_id_callback(...);
*
* @public @memberof CassSsl
*
* @return Returns a SSL context that must be freed.
*
* @see cass_ssl_new()
* @see cass_ssl_free()
*/
CASS_EXPORT CassSsl*
cass_ssl_new_no_lib_init();

/**
* Frees a SSL context instance.
*
Expand Down
6 changes: 5 additions & 1 deletion src/ssl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
extern "C" {

CassSsl* cass_ssl_new() {
cass::SslContextFactory::init();
return cass_ssl_new_no_lib_init();
}

CassSsl* cass_ssl_new_no_lib_init() {
cass::SslContext* ssl_context = cass::SslContextFactory::create();
ssl_context->inc_ref();
return CassSsl::to(ssl_context);
Expand Down Expand Up @@ -82,7 +87,6 @@ static uv_once_t ssl_init_guard = UV_ONCE_INIT;

template<class T>
SslContext* SslContextFactoryBase<T>::create() {
init();
return T::create();
}

Expand Down