I've attached a patch for building Monotone against Botan 2.x

This isn't quite complete for 2.2, because a lot of Monotone assumes
Botan::SecureVector is a type, and that botan.h includes more than it
does in 2.0-2.2. I made a change upstream
https://github.com/randombit/botan/commit/3f7dba2c4455bf53dae89d088bd56cdf9b2c94fe
to make some changes to botan.h to make this patch simpler, and in the
thought it will likely ease transition for other projects. This will
be included in 2.3 which is coming out next week.

Two other relevant pieces of information:

- All support for Botan 1.10 ends at the end of this year

- Botan now uses semantic versioning, so all Botan 2.x releases should
  be forward compatible. It is anticipated 2.x will be supported until
  at least 2021.

With this patch Monotone builds for me on Arch Linux x86-64. I ran the
tests, some passed and some failed, I did not investigate this further.

Hope this helps,
  Jack Lloyd

diff --git a/src/database.cc b/src/database.cc
index 7904b69..297dc40 100644
--- a/src/database.cc
+++ b/src/database.cc
@@ -28,7 +28,13 @@
 #include <botan/botan.h>
 #include <botan/rsa.h>
 #include <botan/pem.h>
-#include <botan/look_pk.h>
+#include <botan/x509_key.h>
+
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+  #include <botan/pubkey.h>
+#else
+  #include <botan/look_pk.h>
+#endif
 #include "lazy_rng.hh"
 
 #include <sqlite3.h>
@@ -3428,17 +3434,27 @@ database::encrypt_rsa(key_id const & pub_id,
   rsa_pub_key pub;
   get_key(pub_id, pub);
 
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+  Botan::DataSource_Memory pub_block(
+    (reinterpret_cast<Botan::byte const *>(pub().data())), pub().size());
+  shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
+#else
   SecureVector<Botan::byte> pub_block
     (reinterpret_cast<Botan::byte const *>(pub().data()), pub().size());
 
   shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
+#endif
   shared_ptr<RSA_PublicKey> pub_key
     = dynamic_pointer_cast<RSA_PublicKey>(x509_key);
   if (!pub_key)
     throw recoverable_failure(origin::system,
                               "Failed to get RSA encrypting key");
 
-  SecureVector<Botan::byte> ct;
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+     std::vector<Botan::byte> ct;
+#else
+     SecureVector<Botan::byte> ct;
+#endif
 
 #if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,5)
   PK_Encryptor_EME encryptor(*pub_key, "EME1(SHA-1)");
@@ -3462,7 +3478,11 @@ database::encrypt_rsa(key_id const & pub_id,
 #endif
 
   ciphertext = rsa_oaep_sha_data(
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+    string(reinterpret_cast<char const *>(ct.data()), ct.size()),
+#else
     string(reinterpret_cast<char const *>(ct.begin()), ct.size()),
+#endif
     origin::database);
 }
 
@@ -3487,10 +3507,10 @@ database::check_signature(key_id const & id,
         return cert_unknown;
 
       get_key(id, pub);
-      SecureVector<Botan::byte> pub_block
-        (reinterpret_cast<Botan::byte const *>(pub().data()), pub().size());
+      Botan::DataSource_Memory pub_block(
+        (reinterpret_cast<Botan::byte const *>(pub().data())), pub().size());
 
-      L(FL("building verifier for %d-byte pub key") % pub_block.size());
+      L(FL("building verifier for %d-byte pub key") % pub().size());
       shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
       shared_ptr<RSA_PublicKey> pub_key
         = boost::dynamic_pointer_cast<RSA_PublicKey>(x509_key);
diff --git a/src/gzip.cc b/src/gzip.cc
index 2cfea09..6832e96 100644
--- a/src/gzip.cc
+++ b/src/gzip.cc
@@ -38,9 +38,6 @@ class Zlib_Alloc_Info
    {
    public:
       std::map<void*, u32bit> current_allocs;
-      Allocator* alloc;
-
-      Zlib_Alloc_Info() { alloc = Allocator::get(false); }
    };
 
 /*************************************************
@@ -49,7 +46,7 @@ class Zlib_Alloc_Info
 void* zlib_malloc(void* info_ptr, unsigned int n, unsigned int size)
    {
    Zlib_Alloc_Info* info = static_cast<Zlib_Alloc_Info*>(info_ptr);
-   void* ptr = info->alloc->allocate(n * size);
+   void* ptr = calloc(n, size);
    info->current_allocs[ptr] = n * size;
    return ptr;
    }
@@ -63,7 +60,8 @@ void zlib_free(void* info_ptr, void* ptr)
    std::map<void*, u32bit>::const_iterator i = info->current_allocs.find(ptr);
    if(i == info->current_allocs.end())
       throw Invalid_Argument("zlib_free: Got pointer not allocated by us");
-   info->alloc->deallocate(ptr, i->second);
+   memset(ptr, 0, i->second);
+   free(ptr);
    }
 }
 
@@ -110,7 +108,7 @@ Gzip_Compression::Gzip_Compression(u32bit l) :
    if(deflateInit2(&(zlib->stream), level, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY) != Z_OK)
       {
       delete zlib; zlib = 0;
-      throw Memory_Exhaustion();
+      throw std::bad_alloc();
       }
    }
 
@@ -148,12 +146,12 @@ void Gzip_Compression::write(const byte input[], filter_length_t length)
 
    while(zlib->stream.avail_in != 0)
       {
-      zlib->stream.next_out = (Bytef*)buffer.begin();
+      zlib->stream.next_out = (Bytef*)&buffer[0];
       zlib->stream.avail_out = buffer.size();
       int rc = deflate(&(zlib->stream), Z_NO_FLUSH);
       if (rc != Z_OK && rc != Z_STREAM_END)
          throw Invalid_State("Internal error in Gzip_Compression deflate.");
-      send(buffer.begin(), buffer.size() - zlib->stream.avail_out);
+      send(&buffer[0], buffer.size() - zlib->stream.avail_out);
       }
    }
 
@@ -168,12 +166,12 @@ void Gzip_Compression::end_msg()
    int rc = Z_OK;
    while(rc != Z_STREAM_END)
       {
-      zlib->stream.next_out = (Bytef*)buffer.begin();
+      zlib->stream.next_out = (Bytef*)&buffer[0];
       zlib->stream.avail_out = buffer.size();
       rc = deflate(&(zlib->stream), Z_FINISH);
       if (rc != Z_OK && rc != Z_STREAM_END)
          throw Invalid_State("Internal error in Gzip_Compression finishing deflate.");
-      send(buffer.begin(), buffer.size() - zlib->stream.avail_out);
+      send(&buffer[0], buffer.size() - zlib->stream.avail_out);
       }
 
    pipe.end_msg();
@@ -206,19 +204,19 @@ void Gzip_Compression::put_footer()
    SecureVector<byte> buf(4);
    SecureVector<byte> tmpbuf(4);
 
-   pipe.read(tmpbuf.begin(), tmpbuf.size(), Pipe::LAST_MESSAGE);
+   pipe.read(&tmpbuf[0], tmpbuf.size(), Pipe::LAST_MESSAGE);
 
    // CRC32 is the reverse order to what gzip expects.
    for (int i = 0; i < 4; i++)
       buf[3-i] = tmpbuf[i];
 
-   send(buf.begin(), buf.size());
+   send(&buf[0], buf.size());
 
    // Length - LSB first
    for (int i = 0; i < 4; i++)
       buf[3-i] = get_byte(i, count);
 
-   send(buf.begin(), buf.size());
+   send(&buf[0], buf.size());
    }
 
 /*************************************************
@@ -237,7 +235,7 @@ Gzip_Decompression::Gzip_Decompression() : buffer(DEFAULT_BUFFERSIZE),
    if(inflateInit2(&(zlib->stream), -15) != Z_OK)
       {
       delete zlib; zlib = 0;
-      throw Memory_Exhaustion();
+      throw std::bad_alloc();
       }
    }
 
@@ -307,7 +305,7 @@ void Gzip_Decompression::write(const byte input[], filter_length_t length)
 
    while(zlib->stream.avail_in != 0)
       {
-      zlib->stream.next_out = (Bytef*)buffer.begin();
+      zlib->stream.next_out = (Bytef*)&buffer[0];
       zlib->stream.avail_out = buffer.size();
 
       int rc = inflate(&(zlib->stream), Z_SYNC_FLUSH);
@@ -318,11 +316,11 @@ void Gzip_Decompression::write(const byte input[], filter_length_t length)
          if(rc == Z_NEED_DICT)
             throw Decoding_Error("Gzip_Decompression: Need preset dictionary");
          if(rc == Z_MEM_ERROR)
-            throw Memory_Exhaustion();
+            throw std::bad_alloc();
          throw Decoding_Error("Gzip_Decompression: Unknown decompress error");
          }
-      send(buffer.begin(), buffer.size() - zlib->stream.avail_out);
-      pipe.write(buffer.begin(), buffer.size() - zlib->stream.avail_out);
+      send(&buffer[0], buffer.size() - zlib->stream.avail_out);
+      pipe.write(&buffer[0], buffer.size() - zlib->stream.avail_out);
       datacount += buffer.size() - zlib->stream.avail_out;
 
       // Reached the end - we now need to check the footer
@@ -378,13 +376,15 @@ void Gzip_Decompression::check_footer()
    // 4 byte CRC32, and 4 byte length field
    SecureVector<byte> buf(4);
    SecureVector<byte> tmpbuf(4);
-   pipe.read(tmpbuf.begin(), tmpbuf.size(), Pipe::LAST_MESSAGE);
+   pipe.read(&tmpbuf[0], tmpbuf.size(), Pipe::LAST_MESSAGE);
 
   // CRC32 is the reverse order to what gzip expects.
   for (int i = 0; i < 4; i++)
      buf[3-i] = tmpbuf[i];
 
-#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+  tmpbuf.assign(footer.begin(), footer.end());
+#elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
   tmpbuf.resize(4);
   tmpbuf.copy(footer.begin(), 4);
 #else
diff --git a/src/gzip.hh b/src/gzip.hh
index 7f23cb3..a3895fd 100644
--- a/src/gzip.hh
+++ b/src/gzip.hh
@@ -7,6 +7,7 @@
 #ifndef BOTAN_EXT_GZIP_H__
 #define BOTAN_EXT_GZIP_H__
 
+#include <botan/botan.h>
 #include <botan/version.h>
 #include <botan/filter.h>
 #include <botan/pipe.h>
diff --git a/src/key_packet.cc b/src/key_packet.cc
index 3a56c69..e827503 100644
--- a/src/key_packet.cc
+++ b/src/key_packet.cc
@@ -15,6 +15,8 @@
 #include <sstream>
 #include <botan/botan.h>
 #include <botan/rsa.h>
+#include <botan/x509_key.h>
+#include <botan/pkcs8.h>
 
 #include "cset.hh"
 #include "constants.hh"
@@ -106,7 +108,7 @@ namespace
     void validate_public_key_data(string const & name, string const & keydata) const
     {
       string decoded = decode_base64_as<string>(keydata, origin::user);
-      Botan::SecureVector<Botan::byte> key_block
+      Botan::DataSource_Memory key_block
         (reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
       try
         {
diff --git a/src/key_store.cc b/src/key_store.cc
index 9514180..a93f6c9 100644
--- a/src/key_store.cc
+++ b/src/key_store.cc
@@ -13,7 +13,13 @@
 #include <botan/botan.h>
 #include <botan/rsa.h>
 #include <botan/pem.h>
+#include <botan/pkcs8.h>
+
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+#include <botan/pubkey.h>
+#else
 #include <botan/look_pk.h>
+#endif
 
 #include "char_classifiers.hh"
 #include "key_store.hh"
@@ -53,7 +59,6 @@ using Botan::PKCS8_PrivateKey;
 using Botan::PK_Decryptor;
 using Botan::PK_Signer;
 using Botan::Pipe;
-using Botan::get_pk_decryptor;
 using Botan::get_cipher;
 using Botan::byte;
 
@@ -573,7 +578,9 @@ key_store_state::decrypt_private_key(key_id const & id,
   try // with empty passphrase
     {
       Botan::DataSource_Memory ds(kp.priv());
-#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+      pkcs8_key.reset(Botan::PKCS8::load_key(ds, lazy_rng::get()));
+#elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
       pkcs8_key.reset(Botan::PKCS8::load_key(ds, lazy_rng::get(), Dummy_UI()));
 #elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,7)
       pkcs8_key.reset(Botan::PKCS8::load_key(ds, lazy_rng::get(), ""));
@@ -581,7 +588,9 @@ key_store_state::decrypt_private_key(key_id const & id,
       pkcs8_key.reset(Botan::PKCS8::load_key(ds, ""));
 #endif
     }
-#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+  catch (Botan::Exception & e)
+#elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
   catch (Passphrase_Required & e)
 #elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,4)
   catch (Botan::Invalid_Argument & e)
@@ -719,6 +728,9 @@ key_store::create_key_pair(database & db,
     unfiltered_pipe->write(
       Botan::PKCS8::BER_encode(priv, lazy_rng::get(),
                                (*maybe_passphrase)(),
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+                               std::chrono::milliseconds(100),
+#endif
                                "PBE-PKCS5v20(SHA-1,TripleDES/CBC)"));
   else
     unfiltered_pipe->write(Botan::PKCS8::PEM_encode(priv));
@@ -818,6 +830,9 @@ key_store::change_key_passphrase(key_id const & id)
     unfiltered_pipe->write(
       Botan::PKCS8::BER_encode(*priv, lazy_rng::get(),
                                new_phrase(),
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+                               std::chrono::milliseconds(100),
+#endif
                                "PBE-PKCS5v20(SHA-1,TripleDES/CBC)"));
   else
     unfiltered_pipe->write(Botan::PKCS8::PEM_encode(*priv));
@@ -909,10 +924,10 @@ key_store::make_signature(database & db,
     {
       if (agent.connected()) {
         //grab the monotone public key as an RSA_PublicKey
-        SecureVector<byte> pub_block
+        Botan::DataSource_Memory pub_block
           (reinterpret_cast<byte const *>(key.pub().data()),
            key.pub().size());
-        L(FL("make_signature: building %d-byte pub key") % pub_block.size());
+        L(FL("make_signature: building %d-byte pub key") % key.pub().size());
         shared_ptr<X509_PublicKey> x509_key =
           shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
         shared_ptr<RSA_PublicKey> pub_key =
@@ -938,7 +953,11 @@ key_store::make_signature(database & db,
       || s->ssh_sign_mode == "check"
       || s->ssh_sign_mode == "no")
     {
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+      std::vector<byte> sig;
+#else
       SecureVector<byte> sig;
+#endif
 
       // we permit the user to relax security here, by caching a decrypted key
       // (if they permit it) through the life of a program run. this helps when
@@ -967,7 +986,7 @@ key_store::make_signature(database & db,
                      new PK_Signer(*priv_key, "EMSA3(SHA-1)"));
 #else
           signer = shared_ptr<PK_Signer>(
-                     get_pk_signer(*priv_key, "EMSA3(SHA-1)"));
+                    Botan::get_pk_signer(*priv_key, "EMSA3(SHA-1)"));
 #endif
 
           /* If persist_phrase is true, the RSA_PrivateKey object is
@@ -986,7 +1005,12 @@ key_store::make_signature(database & db,
         reinterpret_cast<byte const *>(tosign.data()),
         tosign.size());
 #endif
+
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+      sig_string = string(reinterpret_cast<char const*>(sig.data()), sig.size());
+#else
       sig_string = string(reinterpret_cast<char const*>(sig.begin()), sig.size());
+#endif
     }
 
   if (s->ssh_sign_mode == "check" && ssh_sig.length() > 0)
@@ -1053,6 +1077,9 @@ key_store::export_key_for_agent(key_id const & id,
     p.write(Botan::PKCS8::PEM_encode(*priv,
                                      lazy_rng::get(),
                                      new_phrase(),
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+                                     std::chrono::milliseconds(100),
+#endif
                                      "PBE-PKCS5v20(SHA-1,TripleDES/CBC)"));
   else
     p.write(Botan::PKCS8::PEM_encode(*priv));
@@ -1101,7 +1128,11 @@ key_store_state::migrate_old_key_pair
   for (;;)
     try
       {
-#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+        arc4_key.assign(reinterpret_cast<byte const *>(phrase().data()),
+                        reinterpret_cast<byte const *>(phrase().data()) + phrase().size());
+
+#elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
         arc4_key.resize(phrase().size());
         arc4_key.copy(reinterpret_cast<byte const *>(phrase().data()),
                       phrase().size());
@@ -1153,6 +1184,9 @@ key_store_state::migrate_old_key_pair
 #if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,10,0)
   unfiltered_pipe->write(Botan::PKCS8::BER_encode(
     *priv_key, lazy_rng::get(), phrase(),
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+    std::chrono::milliseconds(100),
+#endif
     "PBE-PKCS5v20(SHA-1,TripleDES/CBC)"));
 #else
   Botan::PKCS8::encrypt_key(*priv_key, *unfiltered_pipe,
@@ -1161,6 +1195,9 @@ key_store_state::migrate_old_key_pair
 #endif
                             phrase(),
                             "PBE-PKCS5v20(SHA-1,TripleDES/CBC)",
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+                            std::chrono::milliseconds(100),
+#endif
                             Botan::RAW_BER);
 #endif
   unfiltered_pipe->end_msg();
diff --git a/src/package_full_revision.cc b/src/package_full_revision.cc
index 787875e..36b1201 100644
--- a/src/package_full_revision.cc
+++ b/src/package_full_revision.cc
@@ -4,7 +4,7 @@
 
 
 extern char const package_full_revision_constant[];
-char const package_full_revision_constant[134] = {
+char const package_full_revision_constant[223] = {
 	102, 111, 114, 109, 97, 116, 95, 118, 101, 114, 115, 105, 111, 110, 
 	32, 34, 49, 34, 10, 10, 110, 101, 119, 95, 109, 97, 110, 105, 
 	102, 101, 115, 116, 32, 91, 51, 102, 52, 57, 101, 102, 57, 53, 
@@ -14,5 +14,11 @@ char const package_full_revision_constant[134] = {
 	105, 115, 105, 111, 110, 32, 91, 56, 49, 102, 97, 57, 54, 54, 
 	52, 52, 48, 53, 54, 53, 53, 98, 49, 51, 98, 100, 101, 57, 
 	55, 49, 98, 100, 100, 100, 56, 48, 50, 100, 101, 50, 53, 48, 
-	57, 54, 48, 55, 51, 93, 10, 0
+	57, 54, 48, 55, 51, 93, 10, 10, 32, 32, 71, 101, 110, 101, 
+	114, 97, 116, 101, 100, 32, 102, 114, 111, 109, 32, 100, 97, 116, 
+	97, 32, 99, 97, 99, 104, 101, 100, 32, 105, 110, 32, 116, 104, 
+	101, 32, 100, 105, 115, 116, 114, 105, 98, 117, 116, 105, 111, 110, 
+	59, 10, 32, 32, 102, 117, 114, 116, 104, 101, 114, 32, 99, 104, 
+	97, 110, 103, 101, 115, 32, 109, 97, 121, 32, 104, 97, 118, 101, 
+	32, 98, 101, 101, 110, 32, 109, 97, 100, 101, 46, 10, 0
 };
diff --git a/src/packet.cc b/src/packet.cc
index f592d50..805525b 100644
--- a/src/packet.cc
+++ b/src/packet.cc
@@ -11,6 +11,7 @@
 #include <sstream>
 #include <botan/botan.h>
 #include <botan/rsa.h>
+#include <botan/pkcs8.h>
 
 #include "cset.hh"
 #include "constants.hh"
@@ -156,7 +157,7 @@ namespace
     void validate_public_key_data(string const & name, string const & keydata) const
     {
       string decoded = decode_base64_as<string>(keydata, origin::user);
-      Botan::SecureVector<Botan::byte> key_block
+      Botan::DataSource_Memory key_block
         (reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
       try
         {
@@ -175,7 +176,9 @@ namespace
       Botan::DataSource_Memory ds(decoded);
       try
         {
-#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+          Botan::PKCS8::load_key(ds, lazy_rng::get());
+#elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
           Botan::PKCS8::load_key(ds, lazy_rng::get(), Dummy_UI());
 #elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,7)
           Botan::PKCS8::load_key(ds, lazy_rng::get(), string());
@@ -191,7 +194,7 @@ namespace
         }
       // since we do not want to prompt for a password to decode it finally,
       // we ignore all other exceptions
-#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11) && BOTAN_VERSION_CODE <= BOTAN_VERSION_CODE_FOR(1,11,0)
       catch (Passphrase_Required) {}
 #else
       catch (Botan::Invalid_Argument) {}
@@ -467,7 +470,7 @@ read_packets(istream & in, packet_consumer & cons)
 }
 
 // Dummy User_Interface implementation for Botan
-#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11) && BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,11,0)
 std::string
 Dummy_UI::get_passphrase(const std::string &, const std::string &,
                          Botan::User_Interface::UI_Result&) const
diff --git a/src/packet.hh b/src/packet.hh
index 3d5c1b5..afa42c6 100644
--- a/src/packet.hh
+++ b/src/packet.hh
@@ -10,7 +10,7 @@
 #ifndef __PACKET_HH__
 #define __PACKET_HH__
 
-#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11) && BOTAN_VERSION_CODE <= BOTAN_VERSION_CODE_FOR(2,0,0)
 #include <botan/ui.h>
 #endif
 
@@ -88,7 +88,7 @@ struct packet_writer : public packet_consumer
 
 size_t read_packets(std::istream & in, packet_consumer & cons);
 
-#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11) && BOTAN_VERSION_CODE <= BOTAN_VERSION_CODE_FOR(2,0,0)
 // A helper class implementing Botan::User_Interface - which doesn't really
 // interface with the user, but provides the necessary plumbing for Botan.
 //
diff --git a/src/sha1.cc b/src/sha1.cc
index 5f47f90..d14f94d 100644
--- a/src/sha1.cc
+++ b/src/sha1.cc
@@ -17,7 +17,7 @@
 // Botan 1.7.23+ and 1.8.x specific sha1 benchmarking code uses botan's
 // own timer and measures botan's different SHA1 providers, instead of
 // only measuring one.
-#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,23)
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,23) && BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,11,0)
   #include <botan/libstate.h>
   #include <botan/benchmark.h>
 #endif
@@ -37,7 +37,7 @@ CMD_HIDDEN(benchmark_sha1, "benchmark_sha1", "", CMD_REF(debug), "",
 {
   P(F("Benchmarking botan's SHA-1 core"));
 
-#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,23)
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,23) && BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,11,0)
 
   Botan::AutoSeeded_RNG rng;
   Botan::Algorithm_Factory& af =
diff --git a/src/ssh_agent.cc b/src/ssh_agent.cc
index e7c2adb..4b65800 100644
--- a/src/ssh_agent.cc
+++ b/src/ssh_agent.cc
@@ -13,6 +13,7 @@
 #include <boost/shared_ptr.hpp>
 #include <botan/botan.h>
 #include <botan/rsa.h>
+#include <botan/x509_key.h>
 #include <botan/numthry.h>
 
 #include "ssh_agent.hh"
@@ -208,11 +209,20 @@ put_bigint_into_buf(BigInt const & bi, string & buf)
   L(FL("ssh_agent: put_bigint_into_buf: bigint.bytes(): %u, bigint: %s")
     % bi.bytes()
     % bi);
-  SecureVector<Botan::byte> bi_buf = BigInt::encode(bi);
+
   string bi_str;
+
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
+  std::vector<Botan::byte> bi_buf = BigInt::encode(bi);
+  if (*bi_buf.data() & 0x80)
+    bi_str.append(1, static_cast<char>(0));
+  bi_str.append((char *) bi_buf.data(), bi_buf.size());
+#else
+  SecureVector<Botan::byte> bi_buf = BigInt::encode(bi);
   if (*bi_buf.begin() & 0x80)
     bi_str.append(1, static_cast<char>(0));
   bi_str.append((char *) bi_buf.begin(), bi_buf.size());
+#endif
   put_string_into_buf(bi_str, buf);
   L(FL("ssh_agent: put_bigint_into_buf: buf len now %i") % buf.length());
 }
@@ -385,10 +395,10 @@ bool
 ssh_agent::has_key(const keypair & key)
 {
   //grab the monotone public key as an RSA_PublicKey
-  SecureVector<Botan::byte> pub_block
+  Botan::DataSource_Memory pub_block
     (reinterpret_cast<Botan::byte const *>((key.pub)().data()),
      (key.pub)().size());
-  L(FL("has_key: building %d-byte pub key") % pub_block.size());
+  L(FL("has_key: building %d-byte pub key") % key.pub().size());
   shared_ptr<X509_PublicKey> x509_key =
     shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
   shared_ptr<RSA_PublicKey> pub_key = 
diff --git a/test/unit/tests/merge_3way.cc b/test/unit/tests/merge_3way.cc
index 09ec4d6..bbfff92 100644
--- a/test/unit/tests/merge_3way.cc
+++ b/test/unit/tests/merge_3way.cc
@@ -17,6 +17,8 @@
 #include "../randomfile.hh"
 #include "../../../src/simplestring_xform.hh"
 
+#include <iostream>
+
 using std::cerr;
 using std::cout;
 using std::stringstream;
_______________________________________________
Monotone-devel mailing list
Monotone-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/monotone-devel

Reply via email to