diff options
author | Jack Lloyd <[email protected]> | 2017-10-09 10:29:29 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-10-09 10:29:29 -0400 |
commit | 03292e638bede9b386f07e02e8bbdefd0fef53dd (patch) | |
tree | bfce51d5b2637ebe58ecbad52e2602c062750dc2 /src/lib/tls | |
parent | 95185297aa91edf34c68fd56f7f095df16a7197f (diff) |
Add a special Compat_Callbacks constructor to silence deprecation warnings.
That way we avoid the warning internally even in amalgamation mode.
GH #1243
Diffstat (limited to 'src/lib/tls')
-rw-r--r-- | src/lib/tls/tls_blocking.cpp | 7 | ||||
-rw-r--r-- | src/lib/tls/tls_callbacks.h | 20 | ||||
-rw-r--r-- | src/lib/tls/tls_channel.cpp | 4 |
3 files changed, 24 insertions, 7 deletions
diff --git a/src/lib/tls/tls_blocking.cpp b/src/lib/tls/tls_blocking.cpp index 5e3713d4a..75f7154a4 100644 --- a/src/lib/tls/tls_blocking.cpp +++ b/src/lib/tls/tls_blocking.cpp @@ -6,12 +6,6 @@ * Botan is released under the Simplified BSD License (see license.txt) */ -/* -This API is itself deprecated, so we don't care that it relies on -other deprecated things -*/ -#define BOTAN_NO_DEPRECATED_WARNINGS - #include <botan/tls_blocking.h> namespace Botan { @@ -31,6 +25,7 @@ Blocking_Client::Blocking_Client(read_fn reader, const std::vector<std::string>& next) : m_read(reader), m_callbacks(new TLS::Compat_Callbacks( + TLS::Compat_Callbacks::SILENCE_DEPRECATION_WARNING::PLEASE, writer, std::bind(&Blocking_Client::data_cb, this, _1, _2), std::function<void (Alert)>(std::bind(&Blocking_Client::alert_cb, this, _1)), diff --git a/src/lib/tls/tls_callbacks.h b/src/lib/tls/tls_callbacks.h index d89fbf22d..50077c4a9 100644 --- a/src/lib/tls/tls_callbacks.h +++ b/src/lib/tls/tls_callbacks.h @@ -238,6 +238,26 @@ class BOTAN_PUBLIC_API(2,0) Compat_Callbacks final : public Callbacks m_alert_cb(alert_cb), m_hs_cb(hs_cb), m_hs_msg_cb(hs_msg_cb), m_next_proto(next_proto) {} + enum class SILENCE_DEPRECATION_WARNING { PLEASE = 0 }; + Compat_Callbacks(SILENCE_DEPRECATION_WARNING, + output_fn output_fn, data_cb app_data_cb, + std::function<void (Alert)> alert_cb, + handshake_cb hs_cb, + handshake_msg_cb hs_msg_cb = nullptr, + next_protocol_fn next_proto = nullptr) + : m_output_function(output_fn), m_app_data_cb(app_data_cb), + m_alert_cb(alert_cb), + m_hs_cb(hs_cb), m_hs_msg_cb(hs_msg_cb), m_next_proto(next_proto) {} + + Compat_Callbacks(SILENCE_DEPRECATION_WARNING, + output_fn output_fn, data_cb app_data_cb, alert_cb alert_cb, + handshake_cb hs_cb, handshake_msg_cb hs_msg_cb = nullptr, + next_protocol_fn next_proto = nullptr) + : m_output_function(output_fn), m_app_data_cb(app_data_cb), + m_alert_cb(std::bind(alert_cb, std::placeholders::_1, nullptr, 0)), + m_hs_cb(hs_cb), m_hs_msg_cb(hs_msg_cb), m_next_proto(next_proto) {} + + void tls_emit_data(const uint8_t data[], size_t size) override { BOTAN_ASSERT(m_output_function != nullptr, diff --git a/src/lib/tls/tls_channel.cpp b/src/lib/tls/tls_channel.cpp index 78f681765..143453ba3 100644 --- a/src/lib/tls/tls_channel.cpp +++ b/src/lib/tls/tls_channel.cpp @@ -49,7 +49,9 @@ Channel::Channel(output_fn out, bool is_datagram, size_t io_buf_sz) : m_is_datagram(is_datagram), - m_compat_callbacks(new Compat_Callbacks(out, app_data_cb, alert_cb, hs_cb, hs_msg_cb)), + m_compat_callbacks(new Compat_Callbacks( + Compat_Callbacks::SILENCE_DEPRECATION_WARNING::PLEASE, + out, app_data_cb, alert_cb, hs_cb, hs_msg_cb)), m_callbacks(*m_compat_callbacks.get()), m_session_manager(session_manager), m_policy(policy), |