rnp icon indicating copy to clipboard operation
rnp copied to clipboard

botan deprecations with botan 3

Open dkg opened this issue 2 months ago • 1 comments

Building 0.18.0 with Botan 3, i see these noisy deprecations:

In file included from […]/src/lib/crypto/exdsa_ecdhkem.cpp:27:
[…]/src/lib/crypto/exdsa_ecdhkem.h:95:52: warning: ‘Botan::Curve25519_PublicKey’ is deprecated: Use X25519_PublicKey [-Wdeprecated-declarations]
   95 |     Botan::Curve25519_PublicKey botan_key_x25519() const;
      |                                                    ^~~~~
In file included from […]/src/lib/crypto/exdsa_ecdhkem.h:41:
/usr/include/botan-3/botan/curve25519.h:17:67: note: declared here
   17 | BOTAN_DEPRECATED("Use X25519_PublicKey") typedef X25519_PublicKey Curve25519_PublicKey;
      |                                                                   ^~~~~~~~~~~~~~~~~~~~
[…]/src/lib/crypto/exdsa_ecdhkem.h:122:53: warning: ‘Botan::Curve25519_PrivateKey’ is deprecated: Use X25519_PrivateKey [-Wdeprecated-declarations]
  122 |     Botan::Curve25519_PrivateKey botan_key_x25519() const;
      |                                                     ^~~~~
/usr/include/botan-3/botan/curve25519.h:18:69: note: declared here
   18 | BOTAN_DEPRECATED("Use X25519_PrivateKey") typedef X25519_PrivateKey Curve25519_PrivateKey;
      |                                                                     ^~~~~~~~~~~~~~~~~~~~~
[…]/src/lib/crypto/exdsa_ecdhkem.cpp: In member function ‘Botan::ECDH_PrivateKey ecdh_kem_private_key_t::botan_key_ecdh(rnp::RNG*) const’:
[…]/src/lib/crypto/exdsa_ecdhkem.cpp:74:57: warning: ‘Botan::EC_Group::EC_Group(std::string_view)’ is deprecated: Use EC_Group::from_{name,OID,PEM} [-Wdeprecated-declarations]
   74 |       *(rng->obj()), Botan::EC_Group(ec_desc->botan_name), Botan::BigInt(key_));
      |                                                         ^
In file included from /usr/include/botan-3/botan/ecc_key.h:13,
                 from /usr/include/botan-3/botan/ecdsa.h:13,
                 from […]/src/lib/crypto/exdsa_ecdhkem.h:38:
/usr/include/botan-3/botan/ec_group.h:200:70: note: declared here
  200 |       BOTAN_DEPRECATED("Use EC_Group::from_{name,OID,PEM}") explicit EC_Group(std::string_view pem_or_oid);
      |                                                                      ^~~~~~~~
[…]/src/lib/crypto/exdsa_ecdhkem.cpp:74:79: warning: ‘Botan::ECDH_PrivateKey::ECDH_PrivateKey(Botan::RandomNumberGenerator&, const Botan::EC_Group&, const Botan::BigInt&)’ is deprecated: Use one of the other constructors [-Wdeprecated-declarations]
   74 |       *(rng->obj()), Botan::EC_Group(ec_desc->botan_name), Botan::BigInt(key_));
      |                                                                               ^
In file included from […]/src/lib/crypto/exdsa_ecdhkem.h:39:
/usr/include/botan-3/botan/ecdh.h:110:7: note: declared here
  110 |       ECDH_PrivateKey(RandomNumberGenerator& rng, const EC_Group& group, const BigInt& x) :
      |       ^~~~~~~~~~~~~~~
[…]/src/lib/crypto/exdsa_ecdhkem.cpp: In member function ‘Botan::ECDH_PublicKey ecdh_kem_public_key_t::botan_key_ecdh(rnp::RNG*) const’:
[…]/src/lib/crypto/exdsa_ecdhkem.cpp:83:46: warning: ‘Botan::EC_Group::EC_Group(std::string_view)’ is deprecated: Use EC_Group::from_{name,OID,PEM} [-Wdeprecated-declarations]
   83 |     Botan::EC_Group group(ec_desc->botan_name);
      |                                              ^
/usr/include/botan-3/botan/ec_group.h:200:70: note: declared here
  200 |       BOTAN_DEPRECATED("Use EC_Group::from_{name,OID,PEM}") explicit EC_Group(std::string_view pem_or_oid);
      |                                                                      ^~~~~~~~
[…]/src/lib/crypto/exdsa_ecdhkem.cpp:87:52: warning: ‘Botan::EC_Point Botan::EC_Group::point(const Botan::BigInt&, const Botan::BigInt&) const’ is deprecated: Deprecated - use EC_AffinePoint [-Wdeprecated-declarations]
   87 |     return Botan::ECDH_PublicKey(group, group.point(x, y));
      |                                         ~~~~~~~~~~~^~~~~~
/usr/include/botan-3/botan/ec_group.h:617:68: note: declared here
  617 |       BOTAN_DEPRECATED("Deprecated - use EC_AffinePoint") EC_Point point(const BigInt& x, const BigInt& y) const {
      |                                                                    ^~~~~
[…]/src/lib/crypto/exdsa_ecdhkem.cpp: At global scope:
[…]/src/lib/crypto/exdsa_ecdhkem.cpp:91:44: warning: ‘Botan::Curve25519_PrivateKey’ is deprecated: Use X25519_PrivateKey [-Wdeprecated-declarations]
   91 | ecdh_kem_private_key_t::botan_key_x25519() const
      |                                            ^~~~~
/usr/include/botan-3/botan/curve25519.h:18:69: note: declared here
   18 | BOTAN_DEPRECATED("Use X25519_PrivateKey") typedef X25519_PrivateKey Curve25519_PrivateKey;
      |                                                                     ^~~~~~~~~~~~~~~~~~~~~
[…]/src/lib/crypto/exdsa_ecdhkem.cpp:98:43: warning: ‘Botan::Curve25519_PublicKey’ is deprecated: Use X25519_PublicKey [-Wdeprecated-declarations]
   98 | ecdh_kem_public_key_t::botan_key_x25519() const
      |                                           ^~~~~
/usr/include/botan-3/botan/curve25519.h:17:67: note: declared here
   17 | BOTAN_DEPRECATED("Use X25519_PublicKey") typedef X25519_PublicKey Curve25519_PublicKey;
      |                                                                   ^~~~~~~~~~~~~~~~~~~~
[…]/src/lib/crypto/exdsa_ecdhkem.cpp: In member function ‘rnp_result_t ecdh_kem_public_key_t::encapsulate(rnp::RNG*, std::vector<unsigned char>&, std::vector<unsigned char>&) const’:
[…]/src/lib/crypto/exdsa_ecdhkem.cpp:122:49: warning: ‘Botan::Curve25519_PrivateKey’ is deprecated: Use X25519_PrivateKey [-Wdeprecated-declarations]
  122 |         Botan::Curve25519_PrivateKey eph_prv_key(*(rng->obj()));
      |                                                 ^
/usr/include/botan-3/botan/curve25519.h:18:69: note: declared here
   18 | BOTAN_DEPRECATED("Use X25519_PrivateKey") typedef X25519_PrivateKey Curve25519_PrivateKey;
      |                                                                     ^~~~~~~~~~~~~~~~~~~~~
[…]/src/lib/crypto/exdsa_ecdhkem.cpp:133:62: warning: ‘Botan::EC_Group::EC_Group(std::string_view)’ is deprecated: Use EC_Group::from_{name,OID,PEM} [-Wdeprecated-declarations]
  133 |         Botan::EC_Group         domain(curve_desc->botan_name);
      |                                                              ^
/usr/include/botan-3/botan/ec_group.h:200:70: note: declared here
  200 |       BOTAN_DEPRECATED("Use EC_Group::from_{name,OID,PEM}") explicit EC_Group(std::string_view pem_or_oid);
      |                                                                      ^~~~~~~~
[…]/src/lib/crypto/exdsa_ecdhkem.cpp: In member function ‘rnp_result_t ecdh_kem_private_key_t::decapsulate(rnp::RNG*, const std::vector<unsigned char>&, std::vector<unsigned char>&)’:
[…]/src/lib/crypto/exdsa_ecdhkem.cpp:148:38: warning: ‘Botan::Curve25519_PrivateKey’ is deprecated: Use X25519_PrivateKey [-Wdeprecated-declarations]
  148 |         Botan::Curve25519_PrivateKey priv_key = botan_key_x25519();
      |                                      ^~~~~~~~
/usr/include/botan-3/botan/curve25519.h:18:69: note: declared here
   18 | BOTAN_DEPRECATED("Use X25519_PrivateKey") typedef X25519_PrivateKey Curve25519_PrivateKey;
      |                                                                     ^~~~~~~~~~~~~~~~~~~~~
[…]/src/lib/crypto/exdsa_ecdhkem.cpp: In member function ‘Botan::ECDSA_PrivateKey exdsa_private_key_t::botan_key(rnp::RNG*) const’:
[…]/src/lib/crypto/exdsa_ecdhkem.cpp:216:57: warning: ‘Botan::EC_Group::EC_Group(std::string_view)’ is deprecated: Use EC_Group::from_{name,OID,PEM} [-Wdeprecated-declarations]
  216 |       *(rng->obj()), Botan::EC_Group(ec_desc->botan_name), Botan::BigInt(key_));
      |                                                         ^
/usr/include/botan-3/botan/ec_group.h:200:70: note: declared here
  200 |       BOTAN_DEPRECATED("Use EC_Group::from_{name,OID,PEM}") explicit EC_Group(std::string_view pem_or_oid);
      |                                                                      ^~~~~~~~
[…]/src/lib/crypto/exdsa_ecdhkem.cpp:216:79: warning: ‘Botan::ECDSA_PrivateKey::ECDSA_PrivateKey(Botan::RandomNumberGenerator&, const Botan::EC_Group&, const Botan::BigInt&)’ is deprecated: Use one of the other constructors [-Wdeprecated-declarations]
  216 |       *(rng->obj()), Botan::EC_Group(ec_desc->botan_name), Botan::BigInt(key_));
      |                                                                               ^
/usr/include/botan-3/botan/ecdsa.h:123:7: note: declared here
  123 |       ECDSA_PrivateKey(RandomNumberGenerator& rng, const EC_Group& group, const BigInt& x) :
      |       ^~~~~~~~~~~~~~~~
[…]/src/lib/crypto/exdsa_ecdhkem.cpp: In member function ‘Botan::ECDSA_PublicKey exdsa_public_key_t::botan_key() const’:
[…]/src/lib/crypto/exdsa_ecdhkem.cpp:225:46: warning: ‘Botan::EC_Group::EC_Group(std::string_view)’ is deprecated: Use EC_Group::from_{name,OID,PEM} [-Wdeprecated-declarations]
  225 |     Botan::EC_Group group(ec_desc->botan_name);
      |                                              ^
/usr/include/botan-3/botan/ec_group.h:200:70: note: declared here
  200 |       BOTAN_DEPRECATED("Use EC_Group::from_{name,OID,PEM}") explicit EC_Group(std::string_view pem_or_oid);
      |                                                                      ^~~~~~~~
[…]/src/lib/crypto/exdsa_ecdhkem.cpp:229:53: warning: ‘Botan::EC_Point Botan::EC_Group::point(const Botan::BigInt&, const Botan::BigInt&) const’ is deprecated: Deprecated - use EC_AffinePoint [-Wdeprecated-declarations]
  229 |     return Botan::ECDSA_PublicKey(group, group.point(x, y));
      |                                          ~~~~~~~~~~~^~~~~~
/usr/include/botan-3/botan/ec_group.h:617:68: note: declared here
  617 |       BOTAN_DEPRECATED("Deprecated - use EC_AffinePoint") EC_Point point(const BigInt& x, const BigInt& y) const {
      |                                                                    ^~~~~
[ 38%] Building CXX object src/lib/CMakeFiles/librnp-obj.dir/sig_material.cpp.o
cd […]/build/src/lib && /usr/bin/c++ -D_GNU_SOURCE -Dlibrnp_EXPORTS -I[…]/build/src/lib -I[…]/src/common -I[…]/include -I[…]/src/lib -I[…]/src -isystem /usr/include/json-c -isystem /usr/include/botan-3 -g -O2 -ffile-prefix-map=[…]=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -DS2K_MINIMUM_TUNING_RATIO=4 -Wdate-time -D_FORTIFY_SOURCE=2 -std=c++20 -fPIC -fvisibility=hidden -Wall -Wextra -Wunreachable-code -Wpointer-arith -Wmissing-declarations -Wno-pedantic -Wno-ignored-qualifiers -Wno-unused-parameter -Wno-missing-field-initializers -MD -MT src/lib/CMakeFiles/librnp-obj.dir/sig_material.cpp.o -MF CMakeFiles/librnp-obj.dir/sig_material.cpp.o.d -o CMakeFiles/librnp-obj.dir/sig_material.cpp.o -c […]/src/lib/sig_material.cpp
[…]/src/lib/crypto/hkdf_botan.cpp: In member function ‘virtual void rnp::Hkdf_Botan::extract_expand(const uint8_t*, size_t, const uint8_t*, size_t, const uint8_t*, size_t, uint8_t*, size_t)’:
[…]/src/lib/crypto/hkdf_botan.cpp:65:26: warning: ‘T Botan::KDF::derive_key(std::size_t, const uint8_t*, std::size_t, const uint8_t*, std::size_t, const uint8_t*, std::size_t) const [with T = std::vector<unsigned char, Botan::secure_allocator<unsigned char> >; std::size_t = long unsigned int; uint8_t = unsigned char]’ is deprecated: Use std::span or std::string_view overloads [-Wdeprecated-declarations]
   65 |     OKM = kdf->derive_key(output_length, ikm, ikm_len, salt, salt_len, info, info_len);
      |           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from […]/src/lib/crypto/x25519.cpp:30:
[…]/src/lib/crypto/exdsa_ecdhkem.h:95:52: warning: ‘Botan::Curve25519_PublicKey’ is deprecated: Use X25519_PublicKey [-Wdeprecated-declarations]
   95 |     Botan::Curve25519_PublicKey botan_key_x25519() const;
      |                                                    ^~~~~
In file included from […]/src/lib/crypto/hkdf_botan.hpp:35,
                 from […]/src/lib/crypto/hkdf_botan.cpp:31:
/usr/include/botan-3/botan/kdf.h:91:9: note: declared here
   91 |       T derive_key(size_t key_len,
      |         ^~~~~~~~~~
In file included from […]/src/lib/crypto/x25519.cpp:28:
/usr/include/botan-3/botan/curve25519.h:17:67: note: declared here
   17 | BOTAN_DEPRECATED("Use X25519_PublicKey") typedef X25519_PublicKey Curve25519_PublicKey;
      |                                                                   ^~~~~~~~~~~~~~~~~~~~
[…]/src/lib/crypto/exdsa_ecdhkem.h:122:53: warning: ‘Botan::Curve25519_PrivateKey’ is deprecated: Use X25519_PrivateKey [-Wdeprecated-declarations]
  122 |     Botan::Curve25519_PrivateKey botan_key_x25519() const;
      |                                                     ^~~~~
/usr/include/botan-3/botan/curve25519.h:18:69: note: declared here
   18 | BOTAN_DEPRECATED("Use X25519_PrivateKey") typedef X25519_PrivateKey Curve25519_PrivateKey;
      |                                                                     ^~~~~~~~~~~~~~~~~~~~~
[…]/src/lib/crypto/x25519.cpp: In function ‘rnp_result_t x25519_validate_key_native(rnp::RNG*, const pgp_x25519_key_t*, bool)’:
[…]/src/lib/crypto/x25519.cpp:158:41: warning: ‘Botan::Curve25519_PublicKey’ is deprecated: Use X25519_PublicKey [-Wdeprecated-declarations]
  158 |     Botan::Curve25519_PublicKey pub_key(key->priv);
      |                                         ^~~
/usr/include/botan-3/botan/curve25519.h:17:67: note: declared here
   17 | BOTAN_DEPRECATED("Use X25519_PublicKey") typedef X25519_PublicKey Curve25519_PublicKey;
      |                                                                   ^~~~~~~~~~~~~~~~~~~~
[…]/src/lib/crypto/x25519.cpp:163:41: warning: ‘Botan::Curve25519_PrivateKey’ is deprecated: Use X25519_PrivateKey [-Wdeprecated-declarations]
  163 |           Botan::secure_vector<uint8_t>(key->priv.begin(), key->priv.end()));
      |                                         ^~~
/usr/include/botan-3/botan/curve25519.h:18:69: note: declared here
   18 | BOTAN_DEPRECATED("Use X25519_PrivateKey") typedef X25519_PrivateKey Curve25519_PrivateKey;
      |                                                                     ^~~~~~~~~~~~~~~~~~~~~
[…]/src/lib/crypto/x25519.cpp: In function ‘rnp_result_t generate_x25519_native(rnp::RNG*, std::vector<unsigned char>&, std::vector<unsigned char>&)’:
[…]/src/lib/crypto/x25519.cpp:180:42: warning: ‘Botan::Curve25519_PrivateKey’ is deprecated: Use X25519_PrivateKey [-Wdeprecated-declarations]
  180 |     Botan::Curve25519_PrivateKey priv_key(*(rng->obj()));
      |                                          ^
/usr/include/botan-3/botan/curve25519.h:18:69: note: declared here
   18 | BOTAN_DEPRECATED("Use X25519_PrivateKey") typedef X25519_PrivateKey Curve25519_PrivateKey;
      |                                                                     ^~~~~~~~~~~~~~~~~~~~~

It would be good to move to the newer Botan API so that these warnings don't flood out other warning messages.

dkg avatar Oct 08 '25 14:10 dkg

As additional context, these warnings are only seen when building the experimental Crypto Refresh / PQC code. If I remember correctly, Botan changed the concerned API at around the 3.4 or 3.5 release.

The newer names are already used in https://github.com/rnpgp/rnp/pull/2355 which contains the most up-to-date Crypto Refresh / PQC implementation.

TJ-91 avatar Oct 29 '25 14:10 TJ-91