Repository: randombit/botan
Pull request #2471 (2020-11-08 11:56:34)

Remove various deprecated functions


Patch:
diff --git a/src/lib/asn1/oids.cpp b/src/lib/asn1/oids.cpp
index bece7a9b4..3ebe5c063 100644
--- a/src/lib/asn1/oids.cpp
+++ b/src/lib/asn1/oids.cpp
@@ -61,12 +61,6 @@ class OID_Map final
          return OID();
          }
 
-      bool have_oid(const std::string& str)
-         {
-         lock_guard_type<mutex_type> lock(m_mutex);
-         return m_str2oid.find(str) != m_str2oid.end();
-         }
-
       static OID_Map& global_registry()
          {
          static OID_Map g_map;
@@ -126,9 +120,4 @@ std::string OIDS::oid2str_or_throw(const OID& oid)
    return s;
    }
 
-bool OIDS::have_oid(const std::string& name)
-   {
-   return OID_Map::global_registry().have_oid(name);
-   }
-
 }
diff --git a/src/lib/asn1/oids.h b/src/lib/asn1/oids.h
index 9af451fe4..c469e5bc2 100644
--- a/src/lib/asn1/oids.h
+++ b/src/lib/asn1/oids.h
@@ -47,50 +47,6 @@ BOTAN_UNSTABLE_API OID str2oid_or_empty(const std::string& name);
 
 BOTAN_UNSTABLE_API std::string oid2str_or_throw(const OID& oid);
 
-/**
-* See if an OID exists in the internal table.
-* @param oid the oid to check for
-* @return true if the oid is registered
-*/
-BOTAN_UNSTABLE_API bool BOTAN_DEPRECATED("Just lookup the value instead") have_oid(const std::string& oid);
-
-/**
-* Tests whether the specified OID stands for the specified name.
-* @param oid the OID to check
-* @param name the name to check
-* @return true if the specified OID stands for the specified name
-*/
-inline bool BOTAN_DEPRECATED("Use oid == OID::from_string(name)") name_of(const OID& oid, const std::string& name)
-   {
-   return (oid == str2oid_or_empty(name));
-   }
-
-/**
-* Prefer oid2str_or_empty
-*/
-inline std::string lookup(const OID& oid)
-   {
-   return oid2str_or_empty(oid);
-   }
-
-/**
-* Prefer str2oid_or_empty
-*/
-inline OID lookup(const std::string& name)
-   {
-   return str2oid_or_empty(name);
-   }
-
-inline std::string BOTAN_DEPRECATED("Use oid2str_or_empty") oid2str(const OID& oid)
-   {
-   return oid2str_or_empty(oid);
-   }
-
-inline OID BOTAN_DEPRECATED("Use str2oid_or_empty") str2oid(const std::string& name)
-   {
-   return str2oid_or_empty(name);
-   }
-
 }
 
 }
diff --git a/src/lib/base/scan_name.h b/src/lib/base/scan_name.h
index 1a4349859..c4b2a034f 100644
--- a/src/lib/base/scan_name.h
+++ b/src/lib/base/scan_name.h
@@ -40,11 +40,6 @@ class BOTAN_PUBLIC_API(2,0) SCAN_Name final
       */
       const std::string& to_string() const { return m_orig_algo_spec; }
 
-      BOTAN_DEPRECATED("Use SCAN_Name::to_string") const std::string& as_string() const
-         {
-         return this->to_string();
-         }
-
       /**
       * @return algorithm name
       */
diff --git a/src/lib/base/symkey.h b/src/lib/base/symkey.h
index 69becdd4e..4dc6adf55 100644
--- a/src/lib/base/symkey.h
+++ b/src/lib/base/symkey.h
@@ -45,11 +45,6 @@ class BOTAN_PUBLIC_API(2,0) OctetString final
       */
       std::string to_string() const;
 
-      std::string BOTAN_DEPRECATED("Use OctetString::to_string") as_string() const
-         {
-         return this->to_string();
-         }
-
       /**
       * XOR the contents of another octet string into this one
       * @param other octet string
diff --git a/src/lib/math/bigint/big_code.cpp b/src/lib/math/bigint/big_code.cpp
index 4f38b100e..d6b1db02a 100644
--- a/src/lib/math/bigint/big_code.cpp
+++ b/src/lib/math/bigint/big_code.cpp
@@ -48,63 +48,6 @@ std::string BigInt::to_hex_string() const
       return hex_encode(bits);
    }
 
-/*
-* Encode a BigInt
-*/
-void BigInt::encode(uint8_t output[], const BigInt& n, Base base)
-   {
-   secure_vector<uint8_t> enc = n.encode_locked(base);
-   copy_mem(output, enc.data(), enc.size());
-   }
-
-namespace {
-
-std::vector<uint8_t> str_to_vector(const std::string& s)
-   {
-   std::vector<uint8_t> v(s.size());
-   std::memcpy(v.data(), s.data(), s.size());
-   return v;
-   }
-
-secure_vector<uint8_t> str_to_lvector(const std::string& s)
-   {
-   secure_vector<uint8_t> v(s.size());
-   std::memcpy(v.data(), s.data(), s.size());
-   return v;
-   }
-
-}
-
-/*
-* Encode a BigInt
-*/
-std::vector<uint8_t> BigInt::encode(const BigInt& n, Base base)
-   {
-   if(base == Binary)
-      return BigInt::encode(n);
-   else if(base == Hexadecimal)
-      return str_to_vector(n.to_hex_string());
-   else if(base == Decimal)
-      return str_to_vector(n.to_dec_string());
-   else
-      throw Invalid_Argument("Unknown BigInt encoding base");
-   }
-
-/*
-* Encode a BigInt
-*/
-secure_vector<uint8_t> BigInt::encode_locked(const BigInt& n, Base base)
-   {
-   if(base == Binary)
-      return BigInt::encode_locked(n);
-   else if(base == Hexadecimal)
-      return str_to_lvector(n.to_hex_string());
-   else if(base == Decimal)
-      return str_to_lvector(n.to_dec_string());
-   else
-      throw Invalid_Argument("Unknown BigInt encoding base");
-   }
-
 /*
 * Encode a BigInt, with leading 0s if needed
 */
diff --git a/src/lib/math/bigint/bigint.cpp b/src/lib/math/bigint/bigint.cpp
index 3771d1820..5fc201cef 100644
--- a/src/lib/math/bigint/bigint.cpp
+++ b/src/lib/math/bigint/bigint.cpp
@@ -306,23 +306,6 @@ size_t BigInt::bits() const
    return full_words + top_bits;
    }
 
-/*
-* Calcluate the size in a certain base
-*/
-size_t BigInt::encoded_size(Base base) const
-   {
-   static const double LOG_2_BASE_10 = 0.30102999566;
-
-   if(base == Binary)
-      return bytes();
-   else if(base == Hexadecimal)
-      return 2*bytes();
-   else if(base == Decimal)
-      return static_cast<size_t>((bits() * LOG_2_BASE_10) + 1);
-   else
-      throw Invalid_Argument("Unknown base for BigInt encoding");
-   }
-
 /*
 * Return the negation of this number
 */
@@ -520,32 +503,4 @@ void BigInt::const_time_unpoison() const
    }
 #endif
 
-void BigInt::const_time_lookup(secure_vector<word>& output,
-                               const std::vector<BigInt>& vec,
-                               size_t idx)
-   {
-   const size_t words = output.size();
-
-   clear_mem(output.data(), output.size());
-
-   CT::poison(&idx, sizeof(idx));
-
-   for(size_t i = 0; i != vec.size(); ++i)
-      {
-      BOTAN_ASSERT(vec[i].size() >= words,
-                   "Word size as expected in const_time_lookup");
-
-      const auto mask = CT::Mask<word>::is_equal(i, idx);
-
-      for(size_t w = 0; w != words; ++w)
-         {
-         const word viw = vec[i].word_at(w);
-         output[w] = mask.if_set_return(viw);
-         }
-      }
-
-   CT::unpoison(idx);
-   CT::unpoison(output.data(), output.size());
-   }
-
 }
diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h
index 33e79d012..0784dbed7 100644
--- a/src/lib/math/bigint/bigint.h
+++ b/src/lib/math/bigint/bigint.h
@@ -635,15 +635,6 @@ class BOTAN_PUBLIC_API(2,0) BigInt final
      */
      void grow_to(size_t n) const { m_data.grow_to(n); }
 
-     /**
-     * Resize the vector to the minimum word size to hold the integer, or
-     * min_size words, whichever is larger
-     */
-     void BOTAN_DEPRECATED("Use resize if required") shrink_to_fit(size_t min_size = 0)
-        {
-        m_data.shrink_to_fit(min_size);
-        }
-
      void resize(size_t s) { m_data.resize(s); }
 
      /**
@@ -694,16 +685,6 @@ class BOTAN_PUBLIC_API(2,0) BigInt final
         binary_decode(buf.data(), buf.size());
         }
 
-     /**
-     * @param base the base to measure the size for
-     * @return size of this integer in base base
-     *
-     * Deprecated. This is only needed when using the `encode` and
-     * `encode_locked` functions, which are also deprecated.
-     */
-     BOTAN_DEPRECATED("See comments on declaration")
-     size_t encoded_size(Base base = Binary) const;
-
      /**
      * Place the value into out, zero-padding up to size words
      * Throw if *this cannot be represented in size words
@@ -786,16 +767,6 @@ class BOTAN_PUBLIC_API(2,0) BigInt final
         return output;
         }
 
-     /**
-     * Encode the integer value from a BigInt to a byte array
-     * @param buf destination byte array for the encoded integer
-     * @param n the BigInt to use as integer source
-     */
-     static BOTAN_DEPRECATED("Use n.binary_encode") void encode(uint8_t buf[], const BigInt& n)
-        {
-        n.binary_encode(buf);
-        }
-
      /**
      * Create a BigInt from an integer in a byte array
      * @param buf the binary value to load
@@ -818,46 +789,6 @@ class BOTAN_PUBLIC_API(2,0) BigInt final
         return BigInt(buf);
         }
 
-     /**
-     * Encode the integer value from a BigInt to a std::vector of bytes
-     * @param n the BigInt to use as integer source
-     * @param base number-base of resulting byte array representation
-     * @result secure_vector of bytes containing the integer with given base
-     *
-     * Deprecated. If you need Binary, call the version of encode that doesn't
-     * take a Base. If you need Hex or Decimal output, use to_hex_string or
-     * to_dec_string resp.
-     */
-     BOTAN_DEPRECATED("See comments on declaration")
-     static std::vector<uint8_t> encode(const BigInt& n, Base base);
-
-     /**
-     * Encode the integer value from a BigInt to a secure_vector of bytes
-     * @param n the BigInt to use as integer source
-     * @param base number-base of resulting byte array representation
-     * @result secure_vector of bytes containing the integer with given base
-     *
-     * Deprecated. If you need Binary, call the version of encode_locked that
-     * doesn't take a Base. If you need Hex or Decimal output, use to_hex_string
-     * or to_dec_string resp.
-     */
-     BOTAN_DEPRECATED("See comments on declaration")
-     static secure_vector<uint8_t> encode_locked(const BigInt& n,
-                                                 Base base);
-
-     /**
-     * Encode the integer value from a BigInt to a byte array
-     * @param buf destination byte array for the encoded integer
-     * value with given base
-     * @param n the BigInt to use as integer source
-     * @param base number-base of resulting byte array representation
-     *
-     * Deprecated. If you need Binary, call binary_encode. If you need
-     * Hex or Decimal output, use to_hex_string or to_dec_string resp.
-     */
-     BOTAN_DEPRECATED("See comments on declaration")
-     static void encode(uint8_t buf[], const BigInt& n, Base base);
-
      /**
      * Create a BigInt from an integer in a byte array
      * @param buf the binary value to load
@@ -901,17 +832,6 @@ class BOTAN_PUBLIC_API(2,0) BigInt final
      */
      static secure_vector<uint8_t> encode_fixed_length_int_pair(const BigInt& n1, const BigInt& n2, size_t bytes);
 
-     /**
-     * Set output = vec[idx].m_reg in constant time
-     *
-     * All elements of vec must have the same size, and output must be
-     * pre-allocated with the same size.
-     */
-     static void BOTAN_DEPRECATED("No longer in use") const_time_lookup(
-        secure_vector<word>& output,
-        const std::vector<BigInt>& vec,
-        size_t idx);
-
    private:
 
      class Data
diff --git a/src/lib/math/numbertheory/numthry.cpp b/src/lib/math/numbertheory/numthry.cpp
index 18e372c58..a735bd15b 100644
--- a/src/lib/math/numbertheory/numthry.cpp
+++ b/src/lib/math/numbertheory/numthry.cpp
@@ -148,35 +148,6 @@ int32_t jacobi(const BigInt& a, const BigInt& n)
    return J;
    }
 
-/*
-* Multiply-Add Operation
-*/
-BigInt mul_add(const BigInt& a, const BigInt& b, const BigInt& c)
-   {
-   if(c.is_negative())
-      throw Invalid_Argument("mul_add: Third argument must be > 0");
-
-   BigInt::Sign sign = BigInt::Positive;
-   if(a.sign() != b.sign())
-      sign = BigInt::Negative;
-
-   const size_t a_sw = a.sig_words();
-   const size_t b_sw = b.sig_words();
-   const size_t c_sw = c.sig_words();
-
-   BigInt r(sign, std::max(a_sw + b_sw, c_sw) + 1);
-   secure_vector<word> workspace(r.size());
-
-   bigint_mul(r.mutable_data(), r.size(),
-              a.data(), a.size(), a_sw,
-              b.data(), b.size(), b_sw,
-              workspace.data(), workspace.size());
-
-   const size_t r_size = std::max(r.sig_words(), c_sw);
-   bigint_add2(r.mutable_data(), r_size, c.data(), c_sw);
-   return r;
-   }
-
 /*
 * Square a BigInt
 */
diff --git a/src/lib/math/numbertheory/numthry.h b/src/lib/math/numbertheory/numthry.h
index 4bf572f5b..e1a16a570 100644
--- a/src/lib/math/numbertheory/numthry.h
+++ b/src/lib/math/numbertheory/numthry.h
@@ -14,18 +14,6 @@ namespace Botan {
 
 class RandomNumberGenerator;
 
-/**
-* Fused multiply-add
-* @param a an integer
-* @param b an integer
-* @param c an integer
-* @return (a*b)+c
-*/
-BigInt BOTAN_PUBLIC_API(2,0) BOTAN_DEPRECATED("Just use (a*b)+c")
-   mul_add(const BigInt& a,
-           const BigInt& b,
-           const BigInt& c);
-
 /**
 * Return the absolute value
 * @param n an integer
diff --git a/src/lib/pubkey/rsa/rsa.cpp b/src/lib/pubkey/rsa/rsa.cpp
index a32aa44e4..b7d05e456 100644
--- a/src/lib/pubkey/rsa/rsa.cpp
+++ b/src/lib/pubkey/rsa/rsa.cpp
@@ -453,7 +453,7 @@ class RSA_Private_Operation
          */
 
          j1 = m_private->m_mod_p.multiply(m_private->m_mod_p.reduce((m_private->get_p() + j1) - j2), m_private->get_c());
-         return mul_add(j1, m_private->get_q(), j2);
+         return j1*m_private->get_q() + j2;
          }
 
       std::shared_ptr<const RSA_Public_Data> m_public;
diff --git a/src/lib/rng/rng.cpp b/src/lib/rng/rng.cpp
index 85022e5db..c4a521c88 100644
--- a/src/lib/rng/rng.cpp
+++ b/src/lib/rng/rng.cpp
@@ -66,26 +66,4 @@ void RandomNumberGenerator::reseed_from_rng(RandomNumberGenerator& rng, size_t p
       }
    }
 
-RandomNumberGenerator* RandomNumberGenerator::make_rng()
-   {
-#if defined(BOTAN_HAS_AUTO_SEEDING_RNG)
-   return new AutoSeeded_RNG;
-#else
-   throw Not_Implemented("make_rng failed, no AutoSeeded_RNG in this build");
-#endif
-   }
-
-#if defined(BOTAN_TARGET_OS_HAS_THREADS)
-
-#if defined(BOTAN_HAS_AUTO_SEEDING_RNG)
-Serialized_RNG::Serialized_RNG() : m_rng(new AutoSeeded_RNG) {}
-#else
-Serialized_RNG::Serialized_RNG()
-   {
-   throw Not_Implemented("Serialized_RNG default constructor failed: AutoSeeded_RNG disabled in build");
-   }
-#endif
-
-#endif
-
 }
diff --git a/src/lib/rng/rng.h b/src/lib/rng/rng.h
index 54a8ea831..b98f20bc8 100644
--- a/src/lib/rng/rng.h
+++ b/src/lib/rng/rng.h
@@ -175,14 +175,6 @@ class BOTAN_PUBLIC_API(2,0) RandomNumberGenerator
             b = this->next_byte();
          return b;
          }
-
-      /**
-      * Create a seeded and active RNG object for general application use
-      * Added in 1.8.0
-      * Use AutoSeeded_RNG instead
-      */
-      BOTAN_DEPRECATED("Use AutoSeeded_RNG")
-      static RandomNumberGenerator* make_rng();
    };
 
 /**
@@ -279,8 +271,6 @@ class BOTAN_PUBLIC_API(2,0) Serialized_RNG final : public RandomNumberGenerator
          m_rng->add_entropy(in, len);
          }
 
-      BOTAN_DEPRECATED("Use Serialized_RNG(new AutoSeeded_RNG) instead") Serialized_RNG();
-
       /*
       * Since 2.16.0 this is no longer needed for any RNG type. This
       * class will be removed in a future major release.
diff --git a/src/lib/tls/tls_callbacks.h b/src/lib/tls/tls_callbacks.h
index 995c02e2d..795663e22 100644
--- a/src/lib/tls/tls_callbacks.h
+++ b/src/lib/tls/tls_callbacks.h
@@ -358,125 +358,6 @@ class BOTAN_PUBLIC_API(2,0) Callbacks
           }
    };
 
-/**
-* TLS::Callbacks using std::function for compatability with the old API signatures.
-* This type is only provided for backward compatibility.
-* New implementations should derive from TLS::Callbacks instead.
-*/
-class BOTAN_PUBLIC_API(2,0) Compat_Callbacks final : public Callbacks
-   {
-   public:
-      typedef std::function<void (const uint8_t[], size_t)> output_fn;
-      typedef std::function<void (const uint8_t[], size_t)> data_cb;
-      typedef std::function<void (Alert, const uint8_t[], size_t)> alert_cb;
-      typedef std::function<bool (const Session&)> handshake_cb;
-      typedef std::function<void (const Handshake_Message&)> handshake_msg_cb;
-      typedef std::function<std::string (std::vector<std::string>)> next_protocol_fn;
-
-      /**
-       * @param data_output_fn is called with data for the outbound socket
-       *
-       * @param app_data_cb is called when new application data is received
-       *
-       * @param recv_alert_cb is called when a TLS alert is received
-       *
-       * @param hs_cb is called when a handshake is completed
-       *
-       * @param hs_msg_cb is called for each handshake message received
-       *
-       * @param next_proto is called with ALPN protocol data sent by the client
-       */
-       BOTAN_DEPRECATED("Use TLS::Callbacks (virtual interface).")
-       Compat_Callbacks(output_fn data_output_fn, data_cb app_data_cb, alert_cb recv_alert_cb,
-                        handshake_cb hs_cb, handshake_msg_cb hs_msg_cb = nullptr,
-                        next_protocol_fn next_proto = nullptr)
-          : m_output_function(data_output_fn), m_app_data_cb(app_data_cb),
-            m_alert_cb(std::bind(recv_alert_cb, std::placeholders::_1, nullptr, 0)),
-            m_hs_cb(hs_cb), m_hs_msg_cb(hs_msg_cb), m_next_proto(next_proto) {}
-
-       BOTAN_DEPRECATED("Use TLS::Callbacks (virtual interface).")
-       Compat_Callbacks(output_fn data_output_fn, data_cb app_data_cb,
-                        std::function<void (Alert)> recv_alert_cb,
-                        handshake_cb hs_cb,
-                        handshake_msg_cb hs_msg_cb = nullptr,
-                        next_protocol_fn next_proto = nullptr)
-          : m_output_function(data_output_fn), m_app_data_cb(app_data_cb),
-            m_alert_cb(recv_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 data_output_fn, data_cb app_data_cb,
-                        std::function<void (Alert)> recv_alert_cb,
-                        handshake_cb hs_cb,
-                        handshake_msg_cb hs_msg_cb = nullptr,
-                        next_protocol_fn next_proto = nullptr)
-          : m_output_function(data_output_fn),
-            m_app_data_cb(app_data_cb),
-            m_alert_cb(recv_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 data_output_fn, data_cb app_data_cb, alert_cb recv_alert_cb,
-                        handshake_cb hs_cb, handshake_msg_cb hs_msg_cb = nullptr,
-                        next_protocol_fn next_proto = nullptr)
-          : m_output_function(data_output_fn), m_app_data_cb(app_data_cb),
-            m_alert_cb(std::bind(recv_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,
-                       "Invalid TLS output function callback.");
-          m_output_function(data, size);
-          }
-
-       void tls_record_received(uint64_t /*seq_no*/, const uint8_t data[], size_t size) override
-          {
-          BOTAN_ASSERT(m_app_data_cb != nullptr,
-                       "Invalid TLS app data callback.");
-          m_app_data_cb(data, size);
-          }
-
-       void tls_alert(Alert alert) override
-          {
-          BOTAN_ASSERT(m_alert_cb != nullptr,
-                       "Invalid TLS alert callback.");
-          m_alert_cb(alert);
-          }
-
-       bool tls_session_established(const Session& session) override
-          {
-          BOTAN_ASSERT(m_hs_cb != nullptr,
-                       "Invalid TLS handshake callback.");
-          return m_hs_cb(session);
-          }
-
-       std::string tls_server_choose_app_protocol(const std::vector<std::string>& client_protos) override
-          {
-          if(m_next_proto != nullptr) { return m_next_proto(client_protos); }
-          return "";
-          }
-
-       void tls_inspect_handshake_msg(const Handshake_Message& hmsg) override
-          {
-          // The handshake message callback is optional so we can
-          // not assume it has been set.
-          if(m_hs_msg_cb != nullptr) { m_hs_msg_cb(hmsg); }
-          }
-
-    private:
-         const output_fn m_output_function;
-         const data_cb m_app_data_cb;
-         const std::function<void (Alert)> m_alert_cb;
-         const handshake_cb m_hs_cb;
-         const handshake_msg_cb m_hs_msg_cb;
-         const next_protocol_fn m_next_proto;
-   };
-
 }
 
 }
diff --git a/src/lib/tls/tls_channel.cpp b/src/lib/tls/tls_channel.cpp
index 64a557691..1a3a61f05 100644
--- a/src/lib/tls/tls_channel.cpp
+++ b/src/lib/tls/tls_channel.cpp
@@ -37,47 +37,13 @@ Channel::Channel(Callbacks& callbacks,
    m_policy(policy),
    m_rng(rng),
    m_has_been_closed(false)
-   {
-   init(reserved_io_buffer_size);
-   }
-
-Channel::Channel(output_fn out,
-                 data_cb app_data_cb,
-                 alert_cb recv_alert_cb,
-                 handshake_cb hs_cb,
-                 handshake_msg_cb hs_msg_cb,
-                 Session_Manager& session_manager,
-                 RandomNumberGenerator& rng,
-                 const Policy& policy,
-                 bool is_server,
-                 bool is_datagram,
-                 size_t io_buf_sz) :
-    m_is_server(is_server),
-    m_is_datagram(is_datagram),
-    m_compat_callbacks(new Compat_Callbacks(
-                          /*
-                          this Channel constructor is also deprecated so its ok that it
-                          relies on a deprecated API
-                          */
-                          Compat_Callbacks::SILENCE_DEPRECATION_WARNING::PLEASE,
-                          out, app_data_cb, recv_alert_cb, hs_cb, hs_msg_cb)),
-    m_callbacks(*m_compat_callbacks.get()),
-    m_session_manager(session_manager),
-    m_policy(policy),
-    m_rng(rng),
-    m_has_been_closed(false)
-    {
-    init(io_buf_sz);
-    }
-
-void Channel::init(size_t io_buf_sz)
    {
    /* epoch 0 is plaintext, thus null cipher state */
    m_write_cipher_states[0] = nullptr;
    m_read_cipher_states[0] = nullptr;
 
-   m_writebuf.reserve(io_buf_sz);
-   m_readbuf.reserve(io_buf_sz);
+   m_writebuf.reserve(reserved_io_buffer_size);
+   m_readbuf.reserve(reserved_io_buffer_size);
    }
 
 void Channel::reset_state()
diff --git a/src/lib/tls/tls_channel.h b/src/lib/tls/tls_channel.h
index 046560e22..35f81cc1a 100644
--- a/src/lib/tls/tls_channel.h
+++ b/src/lib/tls/tls_channel.h
@@ -66,24 +66,6 @@ class BOTAN_PUBLIC_API(2,0) Channel
               bool is_datagram,
               size_t io_buf_sz = IO_BUF_DEFAULT_SIZE);
 
-      /**
-       * DEPRECATED. This constructor is only provided for backward
-       * compatibility and should not be used in new implementations.
-       * (Not marked deprecated since it is only called internally, by
-       * other deprecated constructors)
-       */
-      Channel(output_fn out,
-              data_cb app_data_cb,
-              alert_cb alert_cb,
-              handshake_cb hs_cb,
-              handshake_msg_cb hs_msg_cb,
-              Session_Manager& session_manager,
-              RandomNumberGenerator& rng,
-              const Policy& policy,
-              bool is_server,
-              bool is_datagram,
-              size_t io_buf_sz = IO_BUF_DEFAULT_SIZE);
-
       Channel(const Channel&) = delete;
 
       Channel& operator=(const Channel&) = delete;
@@ -244,8 +226,6 @@ class BOTAN_PUBLIC_API(2,0) Channel
       void reset_active_association_state();
 
    private:
-      void init(size_t io_buf_sze);
-
       void send_record(uint8_t record_type, const std::vector<uint8_t>& record);
 
       void send_record_under_epoch(uint16_t epoch, uint8_t record_type,
@@ -284,7 +264,6 @@ class BOTAN_PUBLIC_API(2,0) Channel
       const bool m_is_datagram;
 
       /* callbacks */
-      std::unique_ptr<Compat_Callbacks> m_compat_callbacks;
       Callbacks& m_callbacks;
 
       /* external state */
diff --git a/src/lib/tls/tls_client.cpp b/src/lib/tls/tls_client.cpp
index e5d90c950..091e649a9 100644
--- a/src/lib/tls/tls_client.cpp
+++ b/src/lib/tls/tls_client.cpp
@@ -68,63 +68,17 @@ Client::Client(Callbacks& callbacks,
                RandomNumberGenerator& rng,
                const Server_Information& info,
                const Protocol_Version& offer_version,
-               const std::vector<std::string>& next_protos,
+               const std::vector<std::string>& next_protocols,
                size_t io_buf_sz) :
    Channel(callbacks, session_manager, rng, policy,
            false, offer_version.is_datagram_protocol(), io_buf_sz),
    m_creds(creds),
    m_info(info)
    {
-   init(offer_version, next_protos);
-   }
-
-Client::Client(output_fn data_output_fn,
-               data_cb proc_cb,
-               alert_cb recv_alert_cb,
-               handshake_cb hs_cb,
-               Session_Manager& session_manager,
-               Credentials_Manager& creds,
-               const Policy& policy,
-               RandomNumberGenerator& rng,
-               const Server_Information& info,
-               const Protocol_Version& offer_version,
-               const std::vector<std::string>& next_protos,
-               size_t io_buf_sz) :
-   Channel(data_output_fn, proc_cb, recv_alert_cb, hs_cb, Channel::handshake_msg_cb(),
-           session_manager, rng, policy, false, offer_version.is_datagram_protocol(), io_buf_sz),
-   m_creds(creds),
-   m_info(info)
-   {
-   init(offer_version, next_protos);
-   }
-
-Client::Client(output_fn data_output_fn,
-               data_cb proc_cb,
-               alert_cb recv_alert_cb,
-               handshake_cb hs_cb,
-               handshake_msg_cb hs_msg_cb,
-               Session_Manager& session_manager,
-               Credentials_Manager& creds,
-               const Policy& policy,
-               RandomNumberGenerator& rng,
-               const Server_Information& info,
-               const Protocol_Version& offer_version,
-               const std::vector<std::string>& next_protos) :
-   Channel(data_output_fn, proc_cb, recv_alert_cb, hs_cb, hs_msg_cb,
-           session_manager, rng, policy, false, offer_version.is_datagram_protocol()),
-   m_creds(creds),
-   m_info(info)
-   {
-   init(offer_version, next_protos);
-   }
-
-void Client::init(const Protocol_Version& protocol_version,
-                  const std::vector<std::string>& next_protocols)
-   {
    const std::string srp_identifier = m_creds.srp_identifier("tls-client", m_info.hostname());
 
-   Handshake_State& state = create_handshake_state(protocol_version);
-   send_client_hello(state, false, protocol_version,
+   Handshake_State& state = create_handshake_state(offer_version);
+   send_client_hello(state, false, offer_version,
                      srp_identifier, next_protocols);
    }
 
diff --git a/src/lib/tls/tls_client.h b/src/lib/tls/tls_client.h
index 0e08b4595..7440e59ef 100644
--- a/src/lib/tls/tls_client.h
+++ b/src/lib/tls/tls_client.h
@@ -61,82 +61,11 @@ class BOTAN_PUBLIC_API(2,0) Client final : public Channel
             size_t reserved_io_buffer_size = TLS::Client::IO_BUF_DEFAULT_SIZE
          );
 
-      /**
-      * DEPRECATED. This constructor is only provided for backward
-      * compatibility and should not be used in new code. It will be
-      * removed in a future release.
-      *
-      * Set up a new TLS client session
-      *
-      * @param data_output_fn is called with data for the outbound socket
-      *
-      * @param app_data_cb is called when new application data is received
-      *
-      * @param recv_alert_cb is called when a TLS alert is received
-      *
-      * @param hs_cb is called when a handshake is completed
-      *
-      * @param session_manager manages session state
-      *
-      * @param creds manages application/user credentials
-      *
-      * @param policy specifies other connection policy information
-      *
-      * @param rng a random number generator
-      *
-      * @param server_info is identifying information about the TLS server
-      *
-      * @param offer_version specifies which version we will offer
-      *        to the TLS server.
-      *
-      * @param next_protocols specifies protocols to advertise with ALPN
-      *
-      * @param reserved_io_buffer_size This many bytes of memory will
-      *        be preallocated for the read and write buffers. Smaller
-      *        values just mean reallocations and copies are more likely.
-      */
-      BOTAN_DEPRECATED("Use TLS::Client(TLS::Callbacks ...)")
-      Client(output_fn data_output_fn,
-             data_cb app_data_cb,
-             alert_cb recv_alert_cb,
-             handshake_cb hs_cb,
-             Session_Manager& session_manager,
-             Credentials_Manager& creds,
-             const Policy& policy,
-             RandomNumberGenerator& rng,
-             const Server_Information& server_info = Server_Information(),
-             const Protocol_Version& offer_version = Protocol_Version::latest_tls_version(),
-             const std::vector<std::string>& next_protocols = {},
-             size_t reserved_io_buffer_size = TLS::Client::IO_BUF_DEFAULT_SIZE
-         );
-
-      /**
-       * DEPRECATED. This constructor is only provided for backward
-       * compatibility and should not be used in new implementations.
-       */
-      BOTAN_DEPRECATED("Use TLS::Client(TLS::Callbacks ...)")
-      Client(output_fn out,
-             data_cb app_data_cb,
-             alert_cb alert_cb,
-             handshake_cb hs_cb,
-             handshake_msg_cb hs_msg_cb,
-             Session_Manager& session_manager,
-             Credentials_Manager& creds,
-             const Policy& policy,
-             RandomNumberGenerator& rng,
-             const Server_Information& server_info = Server_Information(),
-             const Protocol_Version& offer_version = Protocol_Version::latest_tls_version(),
-             const std::vector<std::string>& next_protocols = {}
-         );
-
       /**
       * @return network protocol as advertised by the TLS server, if server sent the ALPN extension
       */
       std::string application_protocol() const override { return m_application_protocol; }
    private:
-      void init(const Protocol_Version& protocol_version,
-                const std::vector<std::string>& next_protocols);
-
       std::vector<X509_Certificate>
          get_peer_cert_chain(const Handshake_State& state) const override;
 
diff --git a/src/lib/tls/tls_server.cpp b/src/lib/tls/tls_server.cpp
index e2a0bf242..62fdd2d90 100644
--- a/src/lib/tls/tls_server.cpp
+++ b/src/lib/tls/tls_server.cpp
@@ -308,43 +308,6 @@ Server::Server(Callbacks& callbacks,
    {
    }
 
-Server::Server(output_fn output,
-               data_cb got_data_cb,
-               alert_cb recv_alert_cb,
-               handshake_cb hs_cb,
-               Session_Manager& session_manager,
-               Credentials_Manager& creds,
-               const Policy& policy,
-               RandomNumberGenerator& rng,
-               next_protocol_fn next_proto,
-               bool is_datagram,
-               size_t io_buf_sz) :
-   Channel(output, got_data_cb, recv_alert_cb, hs_cb,
-           Channel::handshake_msg_cb(), session_manager,
-           rng, policy, true, is_datagram, io_buf_sz),
-   m_creds(creds),
-   m_choose_next_protocol(next_proto)
-   {
-   }
-
-Server::Server(output_fn output,
-               data_cb got_data_cb,
-               alert_cb recv_alert_cb,
-               handshake_cb hs_cb,
-               handshake_msg_cb hs_msg_cb,
-               Session_Manager& session_manager,
-               Credentials_Manager& creds,
-               const Policy& policy,
-               RandomNumberGenerator& rng,
-               next_protocol_fn next_proto,
-               bool is_datagram) :
-   Channel(output, got_data_cb, recv_alert_cb, hs_cb, hs_msg_cb,
-           session_manager, rng, policy, true, is_datagram),
-   m_creds(creds),
-   m_choose_next_protocol(next_proto)
-   {
-   }
-
 Handshake_State* Server::new_handshake_state(Handshake_IO* io)
    {
    std::unique_ptr<Handshake_State> state(new Server_Handshake_State(io, callbacks()));
diff --git a/src/lib/tls/tls_server.h b/src/lib/tls/tls_server.h
index c601e8c6e..f5b480334 100644
--- a/src/lib/tls/tls_server.h
+++ b/src/lib/tls/tls_server.h
@@ -58,44 +58,6 @@ class BOTAN_PUBLIC_API(2,0) Server final : public Channel
              size_t reserved_io_buffer_size = TLS::Server::IO_BUF_DEFAULT_SIZE
          );
 
-      /**
-       * DEPRECATED. This constructor is only provided for backward
-       * compatibility and should not be used in new implementations.
-       * It will be removed in a future release.
-       */
-      BOTAN_DEPRECATED("Use TLS::Server(TLS::Callbacks ...)")
-      Server(output_fn output,
-             data_cb data_cb,
-             alert_cb recv_alert_cb,
-             handshake_cb hs_cb,
-             Session_Manager& session_manager,
-             Credentials_Manager& creds,
-             const Policy& policy,
-             RandomNumberGenerator& rng,
-             next_protocol_fn next_proto = next_protocol_fn(),
-             bool is_datagram = false,
-             size_t reserved_io_buffer_size = TLS::Server::IO_BUF_DEFAULT_SIZE
-         );
-
-      /**
-       * DEPRECATED. This constructor is only provided for backward
-       * compatibility and should not be used in new implementations.
-       * It will be removed in a future release.
-       */
-      BOTAN_DEPRECATED("Use TLS::Server(TLS::Callbacks ...)")
-      Server(output_fn output,
-             data_cb data_cb,
-             alert_cb recv_alert_cb,
-             handshake_cb hs_cb,
-             handshake_msg_cb hs_msg_cb,
-             Session_Manager& session_manager,
-             Credentials_Manager& creds,
-             const Policy& policy,
-             RandomNumberGenerator& rng,
-             next_protocol_fn next_proto = next_protocol_fn(),
-             bool is_datagram = false
-         );
-
       /**
       * Return the protocol notification set by the client (using the
       * ALPN extension) for this connection, if any. This value is not
diff --git a/src/lib/utils/cpuid/cpuid.cpp b/src/lib/utils/cpuid/cpuid.cpp
index 2aeec792d..a85960e71 100644
--- a/src/lib/utils/cpuid/cpuid.cpp
+++ b/src/lib/utils/cpuid/cpuid.cpp
@@ -83,12 +83,6 @@ std::string CPUID::to_string()
    return string_join(flags, ' ');
    }
 
-//static
-void CPUID::print(std::ostream& o)
-   {
-   o << "CPUID flags: " << CPUID::to_string() << "\n";
-   }
-
 //static
 void CPUID::initialize()
    {
diff --git a/src/lib/utils/cpuid/cpuid.h b/src/lib/utils/cpuid/cpuid.h
index 04d0bbd19..468b004b5 100644
--- a/src/lib/utils/cpuid/cpuid.h
+++ b/src/lib/utils/cpuid/cpuid.h
@@ -45,13 +45,6 @@ class BOTAN_PUBLIC_API(2,1) CPUID final
 
       static bool has_simd_32();
 
-      /**
-      * Deprecated equivalent to
-      * o << "CPUID flags: " << CPUID::to_string() << "\n";
-      */
-      BOTAN_DEPRECATED("Use CPUID::to_string")
-      static void print(std::ostream& o);
-
       /**
       * Return a possibly empty string containing list of known CPU
       * extensions. Each name will be seperated by a space, and the ordering
diff --git a/src/lib/x509/x509_ca.h b/src/lib/x509/x509_ca.h
index 20e9b1bcc..5437cafd8 100644
--- a/src/lib/x509/x509_ca.h
+++ b/src/lib/x509/x509_ca.h
@@ -13,12 +13,9 @@
 #include <chrono>
 #include <map>
 
-#if defined(BOTAN_HAS_SYSTEM_RNG)
-  #include <botan/system_rng.h>
-#endif
-
 namespace Botan {
 
+class RandomNumberGenerator;
 class BigInt;
 class Private_Key;
 class PKCS10_Request;
@@ -188,15 +185,6 @@ class BOTAN_PUBLIC_API(2,0) X509_CA final
               const std::string& hash_fn,
               RandomNumberGenerator& rng);
 
-#if defined(BOTAN_HAS_SYSTEM_RNG)
-      BOTAN_DEPRECATED("Use version taking RNG object")
-      X509_CA(const X509_Certificate& ca_certificate,
-              const Private_Key& key,
-              const std::string& hash_fn) :
-         X509_CA(ca_certificate, key, hash_fn, system_rng())
-         {}
-#endif
-
       X509_CA(const X509_CA&) = delete;
       X509_CA& operator=(const X509_CA&) = delete;
 
diff --git a/src/lib/x509/x509_ext.h b/src/lib/x509/x509_ext.h
index f761a2448..bdb8ebd20 100644
--- a/src/lib/x509/x509_ext.h
+++ b/src/lib/x509/x509_ext.h
@@ -261,9 +261,6 @@ class BOTAN_PUBLIC_API(2,0) Certificate_Policies final : public Certificate_Exte
       Certificate_Policies() = default;
       explicit Certificate_Policies(const std::vector<OID>& o) : m_oids(o) {}
 
-      BOTAN_DEPRECATED("Use get_policy_oids")
-      std::vector<OID> get_oids() const { return m_oids; }
-
       const std::vector<OID>& get_policy_oids() const { return m_oids; }
 
       static OID static_oid() { return OID("2.5.29.32"); }
diff --git a/src/lib/x509/x509cert.cpp b/src/lib/x509/x509cert.cpp
index c511dab4f..8c142a6a1 100644
--- a/src/lib/x509/x509cert.cpp
+++ b/src/lib/x509/x509cert.cpp
@@ -583,11 +583,6 @@ bool X509_Certificate::has_constraints(Key_Constraints constraints) const
    return ((this->constraints() & constraints) != 0);
    }
 
-bool X509_Certificate::has_ex_constraint(const std::string& ex_constraint) const
-   {
-   return has_ex_constraint(OID::from_string(ex_constraint));
-   }
-
 bool X509_Certificate::has_ex_constraint(const OID& usage) const
    {
    const std::vector<OID>& ex = extended_key_usage();
@@ -645,23 +640,6 @@ X509_Certificate::subject_info(const std::string& req) const
    if(subject_alt_name().has_field(req))
       return subject_alt_name().get_attribute(req);
 
-   // These will be removed later:
-   if(req == "X509.Certificate.v2.key_id")
-      return {hex_encode(this->v2_subject_key_id())};
-   if(req == "X509v3.SubjectKeyIdentifier")
-      return {hex_encode(this->subject_key_id())};
-   if(req == "X509.Certificate.dn_bits")
-      return {hex_encode(this->raw_subject_dn())};
-   if(req == "X509.Certificate.start")
-      return {not_before().to_string()};
-   if(req == "X509.Certificate.end")
-      return {not_after().to_string()};
-
-   if(req == "X509.Certificate.version")
-      return {std::to_string(x509_version())};
-   if(req == "X509.Certificate.serial")
-      return {hex_encode(serial_number())};
-
    return {};
    }
 
@@ -677,14 +655,6 @@ X509_Certificate::issuer_info(const std::string& req) const
    if(issuer_alt_name().has_field(req))
       return issuer_alt_name().get_attribute(req);
 
-   // These will be removed later:
-   if(req == "X509.Certificate.v2.key_id")
-      return {hex_encode(this->v2_issuer_key_id())};
-   if(req == "X509v3.AuthorityKeyIdentifier")
-      return {hex_encode(this->authority_key_id())};
-   if(req == "X509.Certificate.dn_bits")
-      return {hex_encode(this->raw_issuer_dn())};
-
    return {};
    }
 
@@ -722,40 +692,6 @@ std::vector<uint8_t> X509_Certificate::raw_subject_dn_sha256() const
    return data().m_subject_dn_bits_sha256;
    }
 
-namespace {
-
-/*
-* Lookup each OID in the vector
-*/
-std::vector<std::string> lookup_oids(const std::vector<OID>& oids)
-   {
-   std::vector<std::string> out;
-
-   for(const OID& oid : oids)
-      {
-      out.push_back(oid.to_formatted_string());
-      }
-   return out;
-   }
-
-}
-
-/*
-* Return the list of extended key usage OIDs
-*/
-std::vector<std::string> X509_Certificate::ex_constraints() const
-   {
-   return lookup_oids(extended_key_usage());
-   }
-
-/*
-* Return the list of certificate policies
-*/
-std::vector<std::string> X509_Certificate::policies() const
-   {
-   return lookup_oids(certificate_policy_oids());
-   }
-
 std::string X509_Certificate::fingerprint(const std::string& hash_name) const
    {
    /*
diff --git a/src/lib/x509/x509cert.h b/src/lib/x509/x509cert.h
index 0355bbb58..a2e2218b3 100644
--- a/src/lib/x509/x509cert.h
+++ b/src/lib/x509/x509cert.h
@@ -147,24 +147,6 @@ class BOTAN_PUBLIC_API(2,0) X509_Certificate : public X509_Object
       */
       std::vector<uint8_t> raw_subject_dn_sha256() const;
 
-      /**
-      * Get the notBefore of the certificate as a string
-      * @return notBefore of the certificate
-      */
-      std::string BOTAN_DEPRECATED("Use not_before().to_string()") start_time() const
-         {
-         return not_before().to_string();
-         }
-
-      /**
-      * Get the notAfter of the certificate as a string
-      * @return notAfter of the certificate
-      */
-      std::string BOTAN_DEPRECATED("Use not_after().to_string()") end_time() const
-         {
-         return not_after().to_string();
-         }
-
       /**
       * Get the notBefore of the certificate as X509_Time
       * @return notBefore of the certificate
@@ -257,14 +239,6 @@ class BOTAN_PUBLIC_API(2,0) X509_Certificate : public X509_Object
       */
       bool has_constraints(Key_Constraints constraints) const;
 
-      /**
-      * Returns true if and only if @param ex_constraint (referring to an
-      * extended key constraint, eg "PKIX.ServerAuth") is included in the
-      * extended key extension.
-      */
-      bool BOTAN_DEPRECATED("Use version taking an OID")
-         has_ex_constraint(const std::string& ex_constraint) const;
-
       /**
       * Returns true if and only if OID @param ex_constraint is
       * included in the extended key extension.
@@ -291,14 +265,6 @@ class BOTAN_PUBLIC_API(2,0) X509_Certificate : public X509_Object
       */
       Key_Constraints constraints() const;
 
-      /**
-      * Get the key constraints as defined in the ExtendedKeyUsage
-      * extension of this certificate.
-      * @return key constraints
-      */
-      std::vector<std::string>
-         BOTAN_DEPRECATED("Use extended_key_usage") ex_constraints() const;
-
       /**
       * Get the key usage as defined in the ExtendedKeyUsage extension
       * of this certificate, or else an empty vector.
@@ -318,8 +284,6 @@ class BOTAN_PUBLIC_API(2,0) X509_Certificate : public X509_Object
       * of this certificate.
       * @return certificate policies
       */
-      std::vector<std::string> BOTAN_DEPRECATED("Use certificate_policy_oids") policies() const;
-
       const std::vector<OID>& certificate_policy_oids() const;
 
       /**


Test patch:
diff --git a/src/tests/test_oid.cpp b/src/tests/test_oid.cpp
index 7b9880268..141c11e9e 100644
--- a/src/tests/test_oid.cpp
+++ b/src/tests/test_oid.cpp
@@ -22,11 +22,11 @@ Test::Result test_add_have_OID()
    {
    Test::Result result("OID add");
 
-   result.test_eq("there is no OID 'botan-test-oid1'", Botan::OIDS::have_oid("botan-test-oid1"), false);
+   result.test_eq("there is no OID 'botan-test-oid1'", Botan::OIDS::str2oid_or_empty("botan-test-oid1").has_value(), false);
 
    Botan::OIDS::add_oid(Botan::OID("1.2.345.6.666"), "botan-test-oid1");
 
-   result.test_eq("OID 'botan-test-oid1' added successfully", Botan::OIDS::have_oid("botan-test-oid1"), true);
+   result.test_eq("OID 'botan-test-oid1' added successfully", Botan::OIDS::str2oid_or_empty("botan-test-oid1").has_value(), true);
 
    result.test_eq("name of OID '1.2.345.6.666' is 'botan-test-oid1'",
                   Botan::OIDS::oid2str_or_throw(Botan::OID("1.2.345.6.666")), "botan-test-oid1");
@@ -38,11 +38,11 @@ Test::Result test_add_have_OID_str()
    {
    Test::Result result("OID add string");
 
-   result.test_eq("there is no OID 'botan-test-oid2'", Botan::OIDS::have_oid("botan-test-oid2"), false);
+   result.test_eq("there is no OID 'botan-test-oid2'", Botan::OIDS::str2oid_or_empty("botan-test-oid2").has_value(), false);
 
    Botan::OIDS::add_oidstr("1.2.345.6.777", "botan-test-oid2");
 
-   result.test_eq("OID 'botan-test-oid2' added successfully", Botan::OIDS::have_oid("botan-test-oid2"), true);
+   result.test_eq("OID 'botan-test-oid2' added successfully", Botan::OIDS::str2oid_or_empty("botan-test-oid2").has_value(), true);
 
    result.test_eq("name of OID '1.2.345.6.777' is 'botan-test-oid2'",
                   Botan::OIDS::oid2str_or_throw(Botan::OID("1.2.345.6.777")), "botan-test-oid2");