diff options
-rw-r--r-- | src/lib/asn1/oids.cpp | 11 | ||||
-rw-r--r-- | src/lib/asn1/oids.h | 44 | ||||
-rw-r--r-- | src/lib/base/scan_name.h | 5 | ||||
-rw-r--r-- | src/lib/base/symkey.h | 5 | ||||
-rw-r--r-- | src/lib/math/bigint/big_code.cpp | 57 | ||||
-rw-r--r-- | src/lib/math/bigint/bigint.cpp | 45 | ||||
-rw-r--r-- | src/lib/math/bigint/bigint.h | 80 | ||||
-rw-r--r-- | src/lib/rng/rng.cpp | 22 | ||||
-rw-r--r-- | src/lib/rng/rng.h | 10 | ||||
-rw-r--r-- | src/lib/utils/cpuid/cpuid.cpp | 6 | ||||
-rw-r--r-- | src/lib/utils/cpuid/cpuid.h | 7 | ||||
-rw-r--r-- | src/lib/x509/x509_ca.h | 14 | ||||
-rw-r--r-- | src/lib/x509/x509_ext.h | 3 | ||||
-rw-r--r-- | src/lib/x509/x509cert.cpp | 39 | ||||
-rw-r--r-- | src/lib/x509/x509cert.h | 36 | ||||
-rw-r--r-- | src/tests/test_oid.cpp | 8 |
16 files changed, 5 insertions, 387 deletions
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 @@ -49,63 +49,6 @@ std::string BigInt::to_hex_string() const } /* -* 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 */ secure_vector<uint8_t> BigInt::encode_1363(const BigInt& n, size_t bytes) 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 @@ -307,23 +307,6 @@ size_t BigInt::bits() const } /* -* 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 */ BigInt BigInt::operator-() const @@ -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); } /** @@ -695,16 +686,6 @@ class BOTAN_PUBLIC_API(2,0) BigInt final } /** - * @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 */ @@ -787,16 +768,6 @@ class BOTAN_PUBLIC_API(2,0) BigInt final } /** - * 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 * @param length size of buf @@ -819,46 +790,6 @@ class BOTAN_PUBLIC_API(2,0) BigInt final } /** - * 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 * @param length size of buf @@ -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/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/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 @@ -84,12 +84,6 @@ std::string CPUID::to_string() } //static -void CPUID::print(std::ostream& o) - { - o << "CPUID flags: " << CPUID::to_string() << "\n"; - } - -//static void CPUID::initialize() { state() = CPUID_Data(); 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 @@ -46,13 +46,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 * will be arbitrary. This list only contains values that are useful to 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..195423e30 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(); @@ -722,40 +717,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 @@ -148,24 +148,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 */ @@ -258,14 +240,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. */ @@ -292,14 +266,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. * @return key usage @@ -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; /** 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"); |