Skip to content

Commit

Permalink
TLS API updates (#11)
Browse files Browse the repository at this point in the history
* Updated to latest aws-c-common, aws-c-io

* API updates for TLS API changes in aws-c-io

* added .idea (clion) to gitignore

* .DS_Store added to gitignore

* Forced commit hashes on aws-c-common and aws-c-io to hopefully appease CI

* No pkcs12 on non-apple

* clang-format

* Update to aws-c-common v0.3.4

* Respect the configured allocator

* Updated to aws-c-mqtt v0.2.2

* clang-format

* Updated to aws-c-io v0.2.3
  • Loading branch information
justinboswell authored Mar 16, 2019
1 parent c6e356e commit 6b805cb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
.DS_Store
6 changes: 3 additions & 3 deletions aws-common-runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set(AWS_DEPS_DOWNLOAD_DIR "${AWS_DEPS_BUILD_DIR}/downloads" CACHE PATH "Dependen

message("install dir ${AWS_DEPS_INSTALL_DIR}")
set(AWS_C_COMMON_URL "https://github.com/awslabs/aws-c-common.git")
set(AWS_C_COMMON_SHA "v0.3.2")
set(AWS_C_COMMON_SHA "v0.3.4")
include(BuildAwsCCommon)

if (UNIX AND NOT APPLE)
Expand All @@ -27,11 +27,11 @@ if (UNIX AND NOT APPLE)
endif()

set(AWS_C_IO_URL "https://github.com/awslabs/aws-c-io.git")
set(AWS_C_IO_SHA "v0.2.2")
set(AWS_C_IO_SHA "v0.2.3")
include(BuildAwsCIO)

set(AWS_C_MQTT_URL "https://github.com/awslabs/aws-c-mqtt.git")
set(AWS_C_MQTT_SHA "v0.2.1")
set(AWS_C_MQTT_SHA "v0.2.2")
include(BuildAwsCMqtt)

set(AWS_C_CAL_URL "https://github.com/awslabs/aws-c-cal.git")
Expand Down
13 changes: 8 additions & 5 deletions source/io/TlsOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,28 @@ namespace Aws
TlsContextOptions TlsContextOptions::InitDefaultClient() noexcept
{
TlsContextOptions ctxOptions;
aws_tls_ctx_options_init_default_client(&ctxOptions.m_options);
aws_tls_ctx_options_init_default_client(&ctxOptions.m_options, g_allocator);
return ctxOptions;
}

TlsContextOptions TlsContextOptions::InitClientWithMtls(const char *certPath, const char *pKeyPath) noexcept
{
TlsContextOptions ctxOptions;
aws_tls_ctx_options_init_client_mtls(&ctxOptions.m_options, certPath, pKeyPath);
aws_tls_ctx_options_init_client_mtls_from_path(&ctxOptions.m_options, g_allocator, certPath, pKeyPath);
return ctxOptions;
}

#ifdef __APPLE__
TlsContextOptions TlsContextOptions::InitClientWithMtlsPkcs12(
const char *pkcs12Path,
const char *pkcs12Pwd) noexcept
{
TlsContextOptions ctxOptions;
aws_tls_ctx_options_init_client_mtls_pkcs12(&ctxOptions.m_options, pkcs12Path, pkcs12Pwd);
struct aws_byte_cursor password = aws_byte_cursor_from_c_str(pkcs12Pwd);
aws_tls_ctx_options_init_client_mtls_pkcs12_from_path(
&ctxOptions.m_options, g_allocator, pkcs12Path, &password);
return ctxOptions;
}
#endif

bool TlsContextOptions::IsAlpnSupported() noexcept { return aws_tls_is_alpn_available(); }

Expand All @@ -61,7 +64,7 @@ namespace Aws

void TlsContextOptions::OverrideDefaultTrustStore(const char *caPath, const char *caFile) noexcept
{
aws_tls_ctx_options_override_default_trust_store(&m_options, caPath, caFile);
aws_tls_ctx_options_override_default_trust_store_from_path(&m_options, caPath, caFile);
}

void InitTlsStaticState(Aws::Crt::Allocator *alloc) noexcept { aws_tls_init_static_state(alloc); }
Expand Down

0 comments on commit 6b805cb

Please sign in to comment.