Repository: randombit/botan
Pull request #2470 (2020-11-08 10:09:53)

Remove deprecated functions from pubkey


Patch:
diff --git a/doc/contents.rst b/doc/contents.rst
index ef0d14278..dadbd4947 100644
--- a/doc/contents.rst
+++ b/doc/contents.rst
@@ -8,7 +8,6 @@ Contents
    goals
    support
    building
-   migration_guide
    api_ref/contents
    cli
    deprecated
diff --git a/src/cli/roughtime.cpp b/src/cli/roughtime.cpp
index 239143b7a..4c71ff56a 100644
--- a/src/cli/roughtime.cpp
+++ b/src/cli/roughtime.cpp
@@ -47,7 +47,7 @@ class RoughtimeCheck final : public Command
             if(flag_set("raw-time"))
                { output() << Botan::Roughtime::Response::sys_microseconds64(response.utc_midpoint()).time_since_epoch().count(); }
             else
-               { output() << Botan::calendar_point_from_time_point(response.utc_midpoint()).to_string(); }
+               { output() << Botan::calendar_value(response.utc_midpoint()).to_string(); }
             output() << " (+-" << Botan::Roughtime::Response::microseconds32(response.utc_radius()).count() << "us)\n";
             }
          }
@@ -116,7 +116,7 @@ class Roughtime final : public Command
          if(flag_set("raw-time"))
             { output() << "UTC " << Botan::Roughtime::Response::sys_microseconds64(response.utc_midpoint()).time_since_epoch().count(); }
          else
-            { output() << "UTC " << Botan::calendar_point_from_time_point(response.utc_midpoint()).to_string(); }
+            { output() << "UTC " << Botan::calendar_value(response.utc_midpoint()).to_string(); }
          output() << " (+-" << Botan::Roughtime::Response::microseconds32(response.utc_radius()).count() << "us)";
          if(!response.validate(public_key))
             {
diff --git a/src/lib/asn1/asn1_time.cpp b/src/lib/asn1/asn1_time.cpp
index a49e92d1b..719e79277 100644
--- a/src/lib/asn1/asn1_time.cpp
+++ b/src/lib/asn1/asn1_time.cpp
@@ -18,7 +18,7 @@ namespace Botan {
 
 ASN1_Time::ASN1_Time(const std::chrono::system_clock::time_point& time)
    {
-   calendar_point cal = calendar_point_from_time_point(time);
+   calendar_point cal = calendar_value(time);
 
    m_year   = cal.get_year();
    m_month  = cal.get_month();
diff --git a/src/lib/ffi/ffi_pk_op.cpp b/src/lib/ffi/ffi_pk_op.cpp
index 2efb297ac..98129596d 100644
--- a/src/lib/ffi/ffi_pk_op.cpp
+++ b/src/lib/ffi/ffi_pk_op.cpp
@@ -9,6 +9,7 @@
 #include <botan/internal/ffi_pkey.h>
 #include <botan/internal/ffi_rng.h>
 #include <botan/pubkey.h>
+#include <botan/system_rng.h>
 
 extern "C" {
 
diff --git a/src/lib/pubkey/dl_group/dl_group.cpp b/src/lib/pubkey/dl_group/dl_group.cpp
index f147c33fb..6c4709611 100644
--- a/src/lib/pubkey/dl_group/dl_group.cpp
+++ b/src/lib/pubkey/dl_group/dl_group.cpp
@@ -623,24 +623,4 @@ DL_Group DL_Group::DL_Group_from_PEM(const std::string& pem)
    return DL_Group(ber, format);
    }
 
-/*
-* Decode PEM encoded parameters
-*/
-void DL_Group::PEM_decode(const std::string& pem)
-   {
-   std::string label;
-   const std::vector<uint8_t> ber = unlock(PEM_Code::decode(pem, label));
-   Format format = pem_label_to_dl_format(label);
-
-   m_data = BER_decode_DL_group(ber.data(), ber.size(), format, DL_Group_Source::ExternalSource);
-   }
-
-//static
-std::string DL_Group::PEM_for_named_group(const std::string& name)
-   {
-   DL_Group group(name);
-   DL_Group::Format format = group.get_q().is_zero() ? DL_Group::PKCS_3 : DL_Group::ANSI_X9_42;
-   return group.PEM_encode(format);
-   }
-
 }
diff --git a/src/lib/pubkey/dl_group/dl_group.h b/src/lib/pubkey/dl_group/dl_group.h
index 98ce7a7ad..14ad5c7b3 100644
--- a/src/lib/pubkey/dl_group/dl_group.h
+++ b/src/lib/pubkey/dl_group/dl_group.h
@@ -316,20 +316,8 @@ class BOTAN_PUBLIC_API(2,0) DL_Group final
       */
       void BER_decode(const std::vector<uint8_t>& ber, Format format);
 
-      /**
-      * Decode a PEM encoded group into this instance.
-      * @param pem the PEM encoding of the group
-      */
-      void BOTAN_DEPRECATED("Use DL_Group_from_PEM") PEM_decode(const std::string& pem);
-
       DL_Group_Source source() const;
 
-      /**
-      * Return PEM representation of named DL group
-      */
-      static std::string BOTAN_DEPRECATED("Use DL_Group(name).PEM_encode()")
-         PEM_for_named_group(const std::string& name);
-
       /*
       * For internal use only
       */
diff --git a/src/lib/pubkey/ec_group/ec_group.cpp b/src/lib/pubkey/ec_group/ec_group.cpp
index bb60bacf7..ab4a059fc 100644
--- a/src/lib/pubkey/ec_group/ec_group.cpp
+++ b/src/lib/pubkey/ec_group/ec_group.cpp
@@ -412,20 +412,6 @@ EC_Group EC_Group::EC_Group_from_PEM(const std::string& pem)
    return EC_Group(ber.data(), ber.size());
    }
 
-//static
-std::string EC_Group::PEM_for_named_group(const std::string& name)
-   {
-   try
-      {
-      EC_Group group(name);
-      return group.PEM_encode();
-      }
-   catch(...)
-      {
-      return "";
-      }
-   }
-
 EC_Group::EC_Group(const BigInt& p,
                    const BigInt& a,
                    const BigInt& b,
@@ -451,11 +437,6 @@ const EC_Group_Data& EC_Group::data() const
    return *m_data;
    }
 
-const CurveGFp& EC_Group::get_curve() const
-   {
-   return data().curve();
-   }
-
 bool EC_Group::a_is_minus_3() const
    {
    return data().a_is_minus_3();
diff --git a/src/lib/pubkey/ec_group/ec_group.h b/src/lib/pubkey/ec_group/ec_group.h
index 8f583a309..2a7876610 100644
--- a/src/lib/pubkey/ec_group/ec_group.h
+++ b/src/lib/pubkey/ec_group/ec_group.h
@@ -46,26 +46,6 @@ class BOTAN_PUBLIC_API(2,0) EC_Group final
    {
    public:
 
-      /**
-      * Construct Domain paramers from specified parameters
-      * @param curve elliptic curve
-      * @param base_point a base point
-      * @param order the order of the base point
-      * @param cofactor the cofactor
-      */
-      BOTAN_DEPRECATED("Use version taking all BigInts")
-      EC_Group(const CurveGFp& curve,
-               const PointGFp& base_point,
-               const BigInt& order,
-               const BigInt& cofactor) :
-         EC_Group(curve.get_p(),
-                  curve.get_a(),
-                  curve.get_b(),
-                  base_point.get_affine_x(),
-                  base_point.get_affine_y(),
-                  order,
-                  cofactor) {}
-
       /**
       * Construct Domain paramers from specified parameters
       * @param p the elliptic curve p
@@ -141,12 +121,6 @@ class BOTAN_PUBLIC_API(2,0) EC_Group final
       */
       std::string PEM_encode() const;
 
-      /**
-      * Return domain parameter curve
-      * @result domain parameter curve
-      */
-      BOTAN_DEPRECATED("Avoid CurveGFp") const CurveGFp& get_curve() const;
-
       /**
       * Return if a == -3 mod p
       */
@@ -253,12 +227,6 @@ class BOTAN_PUBLIC_API(2,0) EC_Group final
       */
       bool verify_public_element(const PointGFp& y) const;
 
-      /**
-      * Return the OID of these domain parameters
-      * @result the OID as a string
-      */
-      std::string BOTAN_DEPRECATED("Use get_curve_oid") get_oid() const { return get_curve_oid().to_string(); }
-
       /**
       * Return the OID of these domain parameters
       * @result the OID
@@ -346,12 +314,6 @@ class BOTAN_PUBLIC_API(2,0) EC_Group final
 
       EC_Group_Source source() const;
 
-      /**
-      * Return PEM representation of named EC group
-      * Deprecated: Use EC_Group(name).PEM_encode() if this is needed
-      */
-      static std::string BOTAN_DEPRECATED("See header comment") PEM_for_named_group(const std::string& name);
-
       /**
       * Return a set of known named EC groups
       */
diff --git a/src/lib/pubkey/ec_group/point_gfp.h b/src/lib/pubkey/ec_group/point_gfp.h
index 13752c4a4..054b36517 100644
--- a/src/lib/pubkey/ec_group/point_gfp.h
+++ b/src/lib/pubkey/ec_group/point_gfp.h
@@ -380,14 +380,6 @@ inline PointGFp operator*(const PointGFp& point, const BigInt& scalar)
    return scalar * point;
    }
 
-// encoding and decoding
-inline secure_vector<uint8_t> BOTAN_DEPRECATED("Use PointGFp::encode")
-   EC2OSP(const PointGFp& point, uint8_t format)
-   {
-   std::vector<uint8_t> enc = point.encode(static_cast<PointGFp::Compression_Type>(format));
-   return secure_vector<uint8_t>(enc.begin(), enc.end());
-   }
-
 /**
 * Perform point decoding
 * Use EC_Group::OS2ECP instead
@@ -416,24 +408,6 @@ PointGFp OS2ECP(const std::vector<uint8_t, Alloc>& data, const CurveGFp& curve)
 
 class PointGFp_Var_Point_Precompute;
 
-/**
-* Deprecated API for point multiplication
-* Use EC_Group::blinded_base_point_multiply or EC_Group::blinded_var_point_multiply
-*/
-class BOTAN_PUBLIC_API(2,0) Blinded_Point_Multiply final
-   {
-   public:
-      Blinded_Point_Multiply(const PointGFp& base, const BigInt& order, size_t h = 0);
-
-      ~Blinded_Point_Multiply();
-
-      PointGFp BOTAN_DEPRECATED("Use alternative APIs") blinded_multiply(const BigInt& scalar, RandomNumberGenerator& rng);
-   private:
-      std::vector<BigInt> m_ws;
-      const BigInt& m_order;
-      std::unique_ptr<PointGFp_Var_Point_Precompute> m_point_mul;
-   };
-
 }
 
 namespace std {
diff --git a/src/lib/pubkey/ec_group/point_mul.cpp b/src/lib/pubkey/ec_group/point_mul.cpp
index 2dff959d7..8d861d2c2 100644
--- a/src/lib/pubkey/ec_group/point_mul.cpp
+++ b/src/lib/pubkey/ec_group/point_mul.cpp
@@ -29,28 +29,6 @@ PointGFp multi_exponentiate(const PointGFp& x, const BigInt& z1,
    return xy_mul.multi_exp(z1, z2);
    }
 
-Blinded_Point_Multiply::Blinded_Point_Multiply(const PointGFp& base,
-                                               const BigInt& order,
-                                               size_t h) :
-   m_ws(PointGFp::WORKSPACE_SIZE),
-   m_order(order)
-   {
-   BOTAN_UNUSED(h);
-   Null_RNG null_rng;
-   m_point_mul.reset(new PointGFp_Var_Point_Precompute(base, null_rng, m_ws));
-   }
-
-Blinded_Point_Multiply::~Blinded_Point_Multiply()
-   {
-   /* for ~unique_ptr */
-   }
-
-PointGFp Blinded_Point_Multiply::blinded_multiply(const BigInt& scalar,
-                                                  RandomNumberGenerator& rng)
-   {
-   return m_point_mul->mul(scalar, rng, m_order, m_ws);
-   }
-
 PointGFp_Base_Point_Precompute::PointGFp_Base_Point_Precompute(const PointGFp& base,
                                                                const Modular_Reducer& mod_order) :
    m_base_point(base),
diff --git a/src/lib/pubkey/mce/gf2m_small_m.h b/src/lib/pubkey/mce/gf2m_small_m.h
index 3e25702b5..ae3eab226 100644
--- a/src/lib/pubkey/mce/gf2m_small_m.h
+++ b/src/lib/pubkey/mce/gf2m_small_m.h
@@ -15,6 +15,8 @@
 #include <botan/types.h>
 #include <vector>
 
+BOTAN_FUTURE_INTERNAL_HEADER(gf2m_small_m.h)
+
 namespace Botan {
 
 typedef uint16_t gf2m;
@@ -22,7 +24,7 @@ typedef uint16_t gf2m;
 /**
 * GF(2^m) field for m = [2...16]
 */
-class BOTAN_TEST_API GF2m_Field
+class BOTAN_PUBLIC_API(2,0) GF2m_Field
    {
    public:
       explicit GF2m_Field(size_t extdeg);
diff --git a/src/lib/pubkey/pk_keys.h b/src/lib/pubkey/pk_keys.h
index bf2be6bbd..404cd683f 100644
--- a/src/lib/pubkey/pk_keys.h
+++ b/src/lib/pubkey/pk_keys.h
@@ -211,12 +211,6 @@ class BOTAN_PUBLIC_API(2,0) Private_Key : public virtual Public_Key
        */
       std::string fingerprint_private(const std::string& alg) const;
 
-      BOTAN_DEPRECATED("Use fingerprint_private or fingerprint_public")
-         inline std::string fingerprint(const std::string& alg) const
-         {
-         return fingerprint_private(alg); // match behavior in previous versions
-         }
-
       /**
       * This is an internal library function exposed on key types.
       * In almost all cases applications should use wrappers in pubkey.h
diff --git a/src/lib/pubkey/pubkey.h b/src/lib/pubkey/pubkey.h
index 2aa8ea916..96fed6efc 100644
--- a/src/lib/pubkey/pubkey.h
+++ b/src/lib/pubkey/pubkey.h
@@ -13,11 +13,6 @@
 #include <botan/symkey.h>
 #include <string>
 
-#if defined(BOTAN_HAS_SYSTEM_RNG)
-  #include <botan/system_rng.h>
-  #define BOTAN_PUBKEY_INCLUDE_DEPRECATED_CONSTRUCTORS
-#endif
-
 namespace Botan {
 
 class RandomNumberGenerator;
@@ -182,23 +177,6 @@ class BOTAN_PUBLIC_API(2,0) PK_Signer final
                 Signature_Format format = IEEE_1363,
                 const std::string& provider = "");
 
-#if defined(BOTAN_PUBKEY_INCLUDE_DEPRECATED_CONSTRUCTORS)
-      /**
-      * Construct a PK Signer.
-      * @param key the key to use inside this signer
-      * @param emsa the EMSA to use
-      * An example would be "EMSA1(SHA-224)".
-      * @param format the signature format to use
-      */
-      BOTAN_DEPRECATED("Use constructor taking a RNG object")
-      PK_Signer(const Private_Key& key,
-                const std::string& emsa,
-                Signature_Format format = IEEE_1363,
-                const std::string& provider = "") :
-         PK_Signer(key, system_rng(), emsa, format, provider)
-         {}
-#endif
-
       ~PK_Signer();
 
       PK_Signer(const PK_Signer&) = delete;
@@ -426,21 +404,6 @@ class BOTAN_PUBLIC_API(2,0) PK_Key_Agreement final
                        const std::string& kdf,
                        const std::string& provider = "");
 
-#if defined(BOTAN_PUBKEY_INCLUDE_DEPRECATED_CONSTRUCTORS)
-      /**
-      * Construct a PK Key Agreement.
-      * @param key the key to use
-      * @param kdf name of the KDF to use (or 'Raw' for no KDF)
-      * @param provider the algo provider to use (or empty for default)
-      */
-      BOTAN_DEPRECATED("Use constructor taking a RNG object")
-      PK_Key_Agreement(const Private_Key& key,
-                       const std::string& kdf,
-                       const std::string& provider = "") :
-         PK_Key_Agreement(key, system_rng(), kdf, provider)
-         {}
-#endif
-
       ~PK_Key_Agreement();
 
       // For ECIES
@@ -543,19 +506,6 @@ class BOTAN_PUBLIC_API(2,0) PK_Encryptor_EME final : public PK_Encryptor
                        const std::string& padding,
                        const std::string& provider = "");
 
-#if defined(BOTAN_PUBKEY_INCLUDE_DEPRECATED_CONSTRUCTORS)
-      /**
-      * Construct an instance.
-      * @param key the key to use inside the encryptor
-      * @param padding the message encoding scheme to use (eg "OAEP(SHA-256)")
-      */
-      BOTAN_DEPRECATED("Use constructor taking a RNG object")
-      PK_Encryptor_EME(const Public_Key& key,
-                       const std::string& padding,
-                       const std::string& provider = "") :
-         PK_Encryptor_EME(key, system_rng(), padding, provider) {}
-#endif
-
       ~PK_Encryptor_EME();
 
       PK_Encryptor_EME& operator=(const PK_Encryptor_EME&) = delete;
@@ -591,20 +541,6 @@ class BOTAN_PUBLIC_API(2,0) PK_Decryptor_EME final : public PK_Decryptor
                        const std::string& eme,
                        const std::string& provider = "");
 
-
-#if defined(BOTAN_PUBKEY_INCLUDE_DEPRECATED_CONSTRUCTORS)
-      /**
-      * Construct an instance.
-      * @param key the key to use inside the decryptor
-      * @param eme the message encoding scheme to use (eg "OAEP(SHA-256)")
-      */
-      BOTAN_DEPRECATED("Use constructor taking a RNG object")
-      PK_Decryptor_EME(const Private_Key& key,
-                       const std::string& eme,
-                       const std::string& provider = "") :
-         PK_Decryptor_EME(key, system_rng(), eme, provider) {}
-#endif
-
       size_t plaintext_length(size_t ptext_len) const override;
 
       ~PK_Decryptor_EME();
@@ -636,14 +572,6 @@ class BOTAN_PUBLIC_API(2,0) PK_KEM_Encryptor final
                        const std::string& kem_param = "",
                        const std::string& provider = "");
 
-#if defined(BOTAN_PUBKEY_INCLUDE_DEPRECATED_CONSTRUCTORS)
-      BOTAN_DEPRECATED("Use constructor taking a RNG object")
-      PK_KEM_Encryptor(const Public_Key& key,
-                       const std::string& kem_param = "",
-                       const std::string& provider = "") :
-         PK_KEM_Encryptor(key, system_rng(), kem_param, provider) {}
-#endif
-
       ~PK_KEM_Encryptor();
 
       PK_KEM_Encryptor& operator=(const PK_KEM_Encryptor&) = delete;
@@ -730,15 +658,6 @@ class BOTAN_PUBLIC_API(2,0) PK_KEM_Decryptor final
                        const std::string& kem_param = "",
                        const std::string& provider = "");
 
-#if defined(BOTAN_PUBKEY_INCLUDE_DEPRECATED_CONSTRUCTORS)
-      BOTAN_DEPRECATED("Use constructor taking a RNG object")
-      PK_KEM_Decryptor(const Private_Key& key,
-                       const std::string& kem_param = "",
-                       const std::string& provider = "") :
-         PK_KEM_Decryptor(key, system_rng(), kem_param, provider)
-         {}
-#endif
-
       ~PK_KEM_Decryptor();
       PK_KEM_Decryptor& operator=(const PK_KEM_Decryptor&) = delete;
       PK_KEM_Decryptor(const PK_KEM_Decryptor&) = delete;
diff --git a/src/lib/pubkey/workfactor.h b/src/lib/pubkey/workfactor.h
index 8847ee8e0..2c8c87642 100644
--- a/src/lib/pubkey/workfactor.h
+++ b/src/lib/pubkey/workfactor.h
@@ -9,6 +9,7 @@
 #define BOTAN_WORKFACTOR_H_
 
 #include <botan/types.h>
+BOTAN_FUTURE_INTERNAL_HEADER(workfactor.h)
 
 namespace Botan {
 
@@ -17,7 +18,7 @@ namespace Botan {
 * @param prime_group_size size of the group in bits
 * @return estimated security level for this group
 */
-size_t BOTAN_TEST_API dl_work_factor(size_t prime_group_size);
+BOTAN_PUBLIC_API(2,0) size_t dl_work_factor(size_t prime_group_size);
 
 /**
 * Return the appropriate exponent size to use for a particular prime
@@ -29,21 +30,21 @@ size_t BOTAN_TEST_API dl_work_factor(size_t prime_group_size);
 * algorithm can compute the DL in sqrt(x) operations) while minimizing
 * the exponent size for performance reasons.
 */
-size_t BOTAN_TEST_API dl_exponent_size(size_t prime_group_size);
+BOTAN_PUBLIC_API(2,0) size_t dl_exponent_size(size_t prime_group_size);
 
 /**
 * Estimate work factor for integer factorization
 * @param n_bits size of modulus in bits
 * @return estimated security level for this modulus
 */
-size_t BOTAN_TEST_API if_work_factor(size_t n_bits);
+BOTAN_PUBLIC_API(2,0) size_t if_work_factor(size_t n_bits);
 
 /**
 * Estimate work factor for EC discrete logarithm
 * @param prime_group_size size of the group in bits
 * @return estimated security level for this group
 */
-size_t ecp_work_factor(size_t prime_group_size);
+BOTAN_PUBLIC_API(2,0) size_t ecp_work_factor(size_t prime_group_size);
 
 }
 
diff --git a/src/lib/utils/calendar.cpp b/src/lib/utils/calendar.cpp
index b45f2b4bf..51f4869d6 100644
--- a/src/lib/utils/calendar.cpp
+++ b/src/lib/utils/calendar.cpp
@@ -107,7 +107,9 @@ std::string calendar_point::to_string() const
    return output.str();
    }
 
-calendar_point calendar_point_from_time_point(const std::chrono::system_clock::time_point& time_point)
+//static
+calendar_point
+calendar_point::from_time_point(const std::chrono::system_clock::time_point& time_point)
    {
    std::tm tm = do_gmtime(std::chrono::system_clock::to_time_t(time_point));
 
diff --git a/src/lib/utils/calendar.h b/src/lib/utils/calendar.h
index f58836aba..ff6767986 100644
--- a/src/lib/utils/calendar.h
+++ b/src/lib/utils/calendar.h
@@ -54,6 +54,14 @@ class BOTAN_TEST_API calendar_point
       calendar_point(uint32_t y, uint32_t mon, uint32_t d, uint32_t h, uint32_t min, uint32_t sec) :
          year(y), month(mon), day(d), hour(h), minutes(min), seconds(sec) {}
 
+      /**
+      * Convert a time_point to a calendar_point
+      * @param time_point a time point from the system clock
+      * @return calendar_point object representing this time point
+      */
+      static calendar_point from_time_point(
+         const std::chrono::system_clock::time_point& time_point);
+
       /**
       * Returns an STL timepoint object
       */
@@ -78,12 +86,10 @@ class BOTAN_TEST_API calendar_point
       uint32_t seconds;
    };
 
-/**
-* Convert a time_point to a calendar_point
-* @param time_point a time point from the system clock
-* @return calendar_point object representing this time point
-*/
-calendar_point BOTAN_TEST_API calendar_point_from_time_point(const std::chrono::system_clock::time_point& time_point);
+inline calendar_point calendar_value(const std::chrono::system_clock::time_point& time_point)
+   {
+   return calendar_point::from_time_point(time_point);
+   }
 
 }
 


Test patch:
diff --git a/src/tests/test_dl_group.cpp b/src/tests/test_dl_group.cpp
index 7e4b2c4c5..0a792473b 100644
--- a/src/tests/test_dl_group.cpp
+++ b/src/tests/test_dl_group.cpp
@@ -68,10 +68,6 @@ class DL_Group_Tests final : public Test
          result.test_eq("Same q in X9.42 decoding", group1.get_q(), orig.get_q());
          result.test_eq("Same g in X9.42 decoding", group1.get_g(), orig.get_g());
 
-         result.test_eq("PEM encodings match",
-                        group1.PEM_encode(Botan::DL_Group::ANSI_X9_42),
-                        Botan::DL_Group::PEM_for_named_group("modp/ietf/1024"));
-
          Botan::DL_Group group2(pem2);
 
          result.test_eq("Same p in X9.57 decoding", group2.get_p(), orig.get_p());
diff --git a/src/tests/test_utils.cpp b/src/tests/test_utils.cpp
index 9ca76f6cd..c9385ce86 100644
--- a/src/tests/test_utils.cpp
+++ b/src/tests/test_utils.cpp
@@ -451,7 +451,7 @@ class Date_Format_Tests final : public Text_Based_Test
                }
             else
                {
-               Botan::calendar_point c2 = Botan::calendar_point_from_time_point(c.to_std_timepoint());
+               Botan::calendar_point c2 = Botan::calendar_value(c.to_std_timepoint());
                result.test_is_eq(date_str + " year", c2.get_year(), d[0]);
                result.test_is_eq(date_str + " month", c2.get_month(), d[1]);
                result.test_is_eq(date_str + " day", c2.get_day(), d[2]);
diff --git a/src/tests/unit_x509.cpp b/src/tests/unit_x509.cpp
index 98343ebcf..f6eceb768 100644
--- a/src/tests/unit_x509.cpp
+++ b/src/tests/unit_x509.cpp
@@ -30,7 +30,7 @@ namespace {
 
 Botan::X509_Time from_date(const int y, const int m, const int d)
    {
-   const size_t this_year = Botan::calendar_point_from_time_point(std::chrono::system_clock::now()).get_year();
+   const size_t this_year = Botan::calendar_value(std::chrono::system_clock::now()).get_year();
 
    Botan::calendar_point t(static_cast<uint32_t>(this_year + y), m, d, 0, 0, 0);
    return Botan::X509_Time(t.to_std_timepoint());