View | Details | Raw Unified | Return to bug 189368
Collapse All | Expand All

(-)./Makefile (-3 / +2 lines)
Lines 1-9 Link Here
1
# Created by: Mark A. Wicks <mwicks@kettering.edu>
1
# Created by: Mark A. Wicks <mwicks@kettering.edu>
2
# $FreeBSD: head/devel/monotone/Makefile 345404 2014-02-21 13:36:12Z ehaupt $
2
# $FreeBSD: head/devel/monotone/Makefile 343634 2014-02-10 13:54:26Z ehaupt $
3
3
4
PORTNAME=	monotone
4
PORTNAME=	monotone
5
PORTVERSION=	1.0
5
PORTVERSION=	1.1
6
PORTREVISION=	3
7
CATEGORIES=	devel
6
CATEGORIES=	devel
8
MASTER_SITES=	http://www.monotone.ca/downloads/${PORTVERSION}/
7
MASTER_SITES=	http://www.monotone.ca/downloads/${PORTVERSION}/
9
8
(-)./distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (monotone-1.0.tar.bz2) = 5c530bc4652b2c08b5291659f0c130618a14780f075f981e947952dcaefc31dc
1
SHA256 (monotone-1.1.tar.bz2) = f95cf60a22d4e461bec9d0e72f5d3609c9a4576fb1cc45f553d0202ce2e38c88
2
SIZE (monotone-1.0.tar.bz2) = 3588074
2
SIZE (monotone-1.1.tar.bz2) = 3428699
(-)./files/patch-boost.diff (-95 lines)
Lines 1-95 Link Here
1
# Add support for Boost 1.53+.
2
# Upstream commit: dfe4b51c8db852b7281a125aac6f3ddee34906f6
3
============================================================
4
--- src/database.cc	87efeeff2d3263ba98af684a4022f1897434ed2d
5
+++ src/database.cc	39ab2644b936e09a536b99ebd28b93f6e0d7c162
6
@@ -92,7 +92,7 @@ using boost::shared_ptr;
7
 using std::accumulate;
8
 
9
 using boost::shared_ptr;
10
-using boost::shared_dynamic_cast;
11
+using boost::dynamic_pointer_cast;
12
 using boost::lexical_cast;
13
 using boost::get;
14
 using boost::tuple;
15
@@ -3430,7 +3430,7 @@ database::encrypt_rsa(key_id const & pub
16
 
17
   shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
18
   shared_ptr<RSA_PublicKey> pub_key
19
-    = shared_dynamic_cast<RSA_PublicKey>(x509_key);
20
+    = dynamic_pointer_cast<RSA_PublicKey>(x509_key);
21
   if (!pub_key)
22
     throw recoverable_failure(origin::system,
23
                               "Failed to get RSA encrypting key");
24
@@ -3481,7 +3481,7 @@ database::check_signature(key_id const &
25
       L(FL("building verifier for %d-byte pub key") % pub_block.size());
26
       shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
27
       shared_ptr<RSA_PublicKey> pub_key
28
-        = boost::shared_dynamic_cast<RSA_PublicKey>(x509_key);
29
+        = boost::dynamic_pointer_cast<RSA_PublicKey>(x509_key);
30
 
31
       E(pub_key, id.inner().made_from,
32
         F("failed to get RSA verifying key for %s") % id);
33
============================================================
34
--- src/key_store.cc	b7859345f7c665914d16357409bdff24a48b7996
35
+++ src/key_store.cc	1ca13b7ee527bc2872d9fc325cf5ef327ca053c2
36
@@ -43,7 +43,7 @@ using boost::shared_ptr;
37
 
38
 using boost::scoped_ptr;
39
 using boost::shared_ptr;
40
-using boost::shared_dynamic_cast;
41
+using boost::dynamic_pointer_cast;
42
 
43
 using Botan::RSA_PrivateKey;
44
 using Botan::RSA_PublicKey;
45
@@ -641,7 +641,7 @@ key_store_state::decrypt_private_key(key
46
   I(pkcs8_key);
47
 
48
   shared_ptr<RSA_PrivateKey> priv_key;
49
-  priv_key = shared_dynamic_cast<RSA_PrivateKey>(pkcs8_key);
50
+  priv_key = dynamic_pointer_cast<RSA_PrivateKey>(pkcs8_key);
51
   E(priv_key, origin::no_fault,
52
     F("failed to extract RSA private key from PKCS#8 keypair"));
53
 
54
@@ -879,7 +879,8 @@ key_store::make_signature(database & db,
55
         L(FL("make_signature: building %d-byte pub key") % pub_block.size());
56
         shared_ptr<X509_PublicKey> x509_key =
57
           shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
58
-        shared_ptr<RSA_PublicKey> pub_key = shared_dynamic_cast<RSA_PublicKey>(x509_key);
59
+        shared_ptr<RSA_PublicKey> pub_key =
60
+          dynamic_pointer_cast<RSA_PublicKey>(x509_key);
61
 
62
         if (!pub_key)
63
           throw recoverable_failure(origin::system,
64
@@ -1092,7 +1093,7 @@ key_store_state::migrate_old_key_pair
65
         continue;
66
       }
67
 
68
-  priv_key = shared_dynamic_cast<RSA_PrivateKey>(pkcs8_key);
69
+  priv_key = dynamic_pointer_cast<RSA_PrivateKey>(pkcs8_key);
70
   I(priv_key);
71
 
72
   // now we can write out the new key
73
============================================================
74
--- src/ssh_agent.cc	4a0dcab873559e934e41c5f220b5434d35600d9b
75
+++ src/ssh_agent.cc	6313ee3cdfca4112ba3957dc4a5f318472289dfa
76
@@ -32,7 +32,7 @@ using boost::shared_ptr;
77
 using std::vector;
78
 
79
 using boost::shared_ptr;
80
-using boost::shared_dynamic_cast;
81
+using boost::dynamic_pointer_cast;
82
 
83
 using Botan::RSA_PublicKey;
84
 using Botan::RSA_PrivateKey;
85
@@ -391,7 +391,8 @@ ssh_agent::has_key(const keypair & key)
86
   L(FL("has_key: building %d-byte pub key") % pub_block.size());
87
   shared_ptr<X509_PublicKey> x509_key =
88
     shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
89
-  shared_ptr<RSA_PublicKey> pub_key = shared_dynamic_cast<RSA_PublicKey>(x509_key);
90
+  shared_ptr<RSA_PublicKey> pub_key = 
91
+    dynamic_pointer_cast<RSA_PublicKey>(x509_key);
92
 
93
   if (!pub_key)
94
     throw recoverable_failure(origin::system,
95
(-)./files/patch-botan.diff (-631 lines)
Lines 1-631 Link Here
1
============================================================
2
--- src/database.cc	4c259f963c440fc95564dfec99b2f832f0bad643
3
+++ src/database.cc	87efeeff2d3263ba98af684a4022f1897434ed2d
4
@@ -3425,9 +3425,8 @@ database::encrypt_rsa(key_id const & pub
5
   rsa_pub_key pub;
6
   get_key(pub_id, pub);
7
 
8
-  SecureVector<Botan::byte> pub_block;
9
-  pub_block.set(reinterpret_cast<Botan::byte const *>(pub().data()),
10
-                pub().size());
11
+  SecureVector<Botan::byte> pub_block
12
+    (reinterpret_cast<Botan::byte const *>(pub().data()), pub().size());
13
 
14
   shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
15
   shared_ptr<RSA_PublicKey> pub_key
16
@@ -3471,14 +3470,13 @@ database::check_signature(key_id const &
17
   else
18
     {
19
       rsa_pub_key pub;
20
-      SecureVector<Botan::byte> pub_block;
21
 
22
       if (!public_key_exists(id))
23
         return cert_unknown;
24
 
25
       get_key(id, pub);
26
-      pub_block.set(reinterpret_cast<Botan::byte const *>(pub().data()),
27
-                    pub().size());
28
+      SecureVector<Botan::byte> pub_block
29
+        (reinterpret_cast<Botan::byte const *>(pub().data()), pub().size());
30
 
31
       L(FL("building verifier for %d-byte pub key") % pub_block.size());
32
       shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
33
============================================================
34
--- src/gzip.cc	e7c19bee910e3d421fd073933810ec52092b1d9b
35
+++ src/gzip.cc	9da41f6820cdf39707b22c716e3682e0fa0fd745
36
@@ -110,7 +110,7 @@ Gzip_Compression::Gzip_Compression(u32bi
37
    if(deflateInit2(&(zlib->stream), level, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY) != Z_OK)
38
       {
39
       delete zlib; zlib = 0;
40
-      throw Exception("Gzip_Compression: Memory allocation error");
41
+      throw Memory_Exhaustion();
42
       }
43
    }
44
 
45
@@ -137,7 +137,7 @@ void Gzip_Compression::start_msg()
46
 /*************************************************
47
 * Compress Input with Gzip                       *
48
 *************************************************/
49
-void Gzip_Compression::write(const byte input[], u32bit length)
50
+void Gzip_Compression::write(const byte input[], filter_length_t length)
51
    {
52
 
53
    count += length;
54
@@ -152,7 +152,7 @@ void Gzip_Compression::write(const byte 
55
       zlib->stream.avail_out = buffer.size();
56
       int rc = deflate(&(zlib->stream), Z_NO_FLUSH);
57
       if (rc != Z_OK && rc != Z_STREAM_END)
58
-         throw Exception("Internal error in Gzip_Compression deflate.");
59
+         throw Invalid_State("Internal error in Gzip_Compression deflate.");
60
       send(buffer.begin(), buffer.size() - zlib->stream.avail_out);
61
       }
62
    }
63
@@ -172,7 +172,7 @@ void Gzip_Compression::end_msg()
64
       zlib->stream.avail_out = buffer.size();
65
       rc = deflate(&(zlib->stream), Z_FINISH);
66
       if (rc != Z_OK && rc != Z_STREAM_END)
67
-         throw Exception("Internal error in Gzip_Compression finishing deflate.");
68
+         throw Invalid_State("Internal error in Gzip_Compression finishing deflate.");
69
       send(buffer.begin(), buffer.size() - zlib->stream.avail_out);
70
       }
71
 
72
@@ -228,7 +228,7 @@ Gzip_Decompression::Gzip_Decompression()
73
    no_writes(true), pipe(new Hash_Filter("CRC32")), footer(0)
74
    {
75
    if (DEFAULT_BUFFERSIZE < sizeof(GZIP::GZIP_HEADER))
76
-      throw Exception("DEFAULT_BUFFERSIZE is too small");
77
+      throw Decoding_Error("DEFAULT_BUFFERSIZE is too small");
78
 
79
    zlib = new Zlib_Stream;
80
 
81
@@ -237,7 +237,7 @@ Gzip_Decompression::Gzip_Decompression()
82
    if(inflateInit2(&(zlib->stream), -15) != Z_OK)
83
       {
84
       delete zlib; zlib = 0;
85
-      throw Exception("Gzip_Decompression: Memory allocation error");
86
+      throw Memory_Exhaustion();
87
       }
88
    }
89
 
90
@@ -256,7 +256,7 @@ void Gzip_Decompression::start_msg()
91
 void Gzip_Decompression::start_msg()
92
    {
93
    if (!no_writes)
94
-      throw Exception("Gzip_Decompression: start_msg after already writing");
95
+      throw Decoding_Error("Gzip_Decompression: start_msg after already writing");
96
 
97
    pipe.start_msg();
98
    datacount = 0;
99
@@ -267,7 +267,7 @@ void Gzip_Decompression::start_msg()
100
 /*************************************************
101
 * Decompress Input with Gzip                     *
102
 *************************************************/
103
-void Gzip_Decompression::write(const byte input[], u32bit length)
104
+void Gzip_Decompression::write(const byte input[], filter_length_t length)
105
    {
106
    if(length) no_writes = false;
107
 
108
@@ -277,15 +277,16 @@ void Gzip_Decompression::write(const byt
109
          u32bit eat_len = eat_footer(input, length);
110
          input += eat_len;
111
          length -= eat_len;
112
-         if (length == 0)
113
-            return;
114
       }
115
 
116
+   if (length == 0)
117
+     return;
118
+
119
    // Check the gzip header
120
    if (pos < sizeof(GZIP::GZIP_HEADER))
121
       {
122
-      u32bit len = std::min((u32bit)sizeof(GZIP::GZIP_HEADER)-pos, length);
123
-      u32bit cmplen = len;
124
+      filter_length_t len = std::min((filter_length_t)sizeof(GZIP::GZIP_HEADER)-pos, length);
125
+      filter_length_t cmplen = len;
126
       // The last byte is the OS flag - we don't care about that
127
       if (pos + len - 1 >= GZIP::HEADER_POS_OS)
128
          cmplen--;
129
@@ -317,8 +318,8 @@ void Gzip_Decompression::write(const byt
130
          if(rc == Z_NEED_DICT)
131
             throw Decoding_Error("Gzip_Decompression: Need preset dictionary");
132
          if(rc == Z_MEM_ERROR)
133
-            throw Exception("Gzip_Decompression: Memory allocation error");
134
-         throw Exception("Gzip_Decompression: Unknown decompress error");
135
+            throw Memory_Exhaustion();
136
+         throw Decoding_Error("Gzip_Decompression: Unknown decompress error");
137
          }
138
       send(buffer.begin(), buffer.size() - zlib->stream.avail_out);
139
       pipe.write(buffer.begin(), buffer.size() - zlib->stream.avail_out);
140
@@ -346,8 +347,14 @@ u32bit Gzip_Decompression::eat_footer(co
141
       if (footer.size() >= GZIP::FOOTER_LENGTH)
142
          throw Decoding_Error("Gzip_Decompression: Data integrity error in footer");
143
 
144
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
145
+      size_t eat_len = std::min(GZIP::FOOTER_LENGTH-footer.size(),
146
+                                static_cast<size_t>(length));
147
+      footer += std::make_pair(input, eat_len);
148
+#else
149
       u32bit eat_len = std::min(GZIP::FOOTER_LENGTH-footer.size(), length);
150
       footer.append(input, eat_len);
151
+#endif
152
 
153
       if (footer.size() == GZIP::FOOTER_LENGTH)
154
          {
155
@@ -364,7 +371,7 @@ void Gzip_Decompression::check_footer()
156
 void Gzip_Decompression::check_footer()
157
    {
158
    if (footer.size() != GZIP::FOOTER_LENGTH)
159
-      throw Exception("Gzip_Decompression: Error finalizing decompression");
160
+      throw Decoding_Error("Gzip_Decompression: Error finalizing decompression");
161
 
162
    pipe.end_msg();
163
 
164
@@ -377,7 +384,12 @@ void Gzip_Decompression::check_footer()
165
   for (int i = 0; i < 4; i++)
166
      buf[3-i] = tmpbuf[i];
167
 
168
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
169
+  tmpbuf.resize(4);
170
+  tmpbuf.copy(footer.begin(), 4);
171
+#else
172
   tmpbuf.set(footer.begin(), 4);
173
+#endif
174
   if (buf != tmpbuf)
175
       throw Decoding_Error("Gzip_Decompression: Data integrity error - CRC32 error");
176
 
177
@@ -400,7 +412,7 @@ void Gzip_Decompression::end_msg()
178
    // read, clear() will reset no_writes
179
    if(no_writes) return;
180
 
181
-   throw Exception("Gzip_Decompression: didn't find footer");
182
+   throw Decoding_Error("Gzip_Decompression: didn't find footer");
183
 
184
    }
185
 
186
@@ -412,7 +424,11 @@ void Gzip_Decompression::clear()
187
    no_writes = true;
188
    inflateReset(&(zlib->stream));
189
 
190
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
191
+   footer.clear();
192
+#else
193
    footer.destroy();
194
+#endif
195
    pos = 0;
196
    datacount = 0;
197
    }
198
============================================================
199
--- src/gzip.hh	649dfc0b250954f39c0f73870f8bec3f32f7fa43
200
+++ src/gzip.hh	aff9da63bb22366bccf69c2d75ee7790406d2455
201
@@ -7,11 +7,18 @@
202
 #ifndef BOTAN_EXT_GZIP_H__
203
 #define BOTAN_EXT_GZIP_H__
204
 
205
+#include <botan/version.h>
206
 #include <botan/filter.h>
207
 #include <botan/pipe.h>
208
 
209
 namespace Botan {
210
 
211
+#if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,9,4)
212
+// Only 1.9.4 and newer export the Memory_Exception. Give this gzip
213
+// implementation something compatible to work with.
214
+typedef std::bad_alloc Memory_Exhaustion;
215
+#endif
216
+
217
 namespace GZIP {
218
 
219
    /* A basic header - we only need to set the IDs and compression method */
220
@@ -30,13 +37,19 @@ namespace GZIP {
221
 
222
 }
223
 
224
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
225
+typedef size_t filter_length_t;
226
+#else
227
+typedef u32bit filter_length_t;
228
+#endif
229
+
230
 /*************************************************
231
 * Gzip Compression Filter                        *
232
 *************************************************/
233
 class Gzip_Compression : public Filter
234
    {
235
    public:
236
-      void write(const byte input[], u32bit length);
237
+      void write(const byte input[], filter_length_t length);
238
       void start_msg();
239
       void end_msg();
240
       std::string name() const { return "Gzip_Compression"; }
241
@@ -60,7 +73,7 @@ class Gzip_Decompression : public Filter
242
 class Gzip_Decompression : public Filter
243
    {
244
    public:
245
-      void write(const byte input[], u32bit length);
246
+      void write(const byte input[], filter_length_t length);
247
       void start_msg();
248
       void end_msg();
249
       std::string name() const { return "Gzip_Decompression"; }
250
============================================================
251
--- src/key_packet.cc	d1306df89dd684badac02c03744cd446381c07d3
252
+++ src/key_packet.cc	c97262d161b23c9640972188979669b3e95afe7b
253
@@ -106,8 +106,8 @@ namespace
254
     void validate_public_key_data(string const & name, string const & keydata) const
255
     {
256
       string decoded = decode_base64_as<string>(keydata, origin::user);
257
-      Botan::SecureVector<Botan::byte> key_block;
258
-      key_block.set(reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
259
+      Botan::SecureVector<Botan::byte> key_block
260
+        (reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
261
       try
262
         {
263
           Botan::X509::load_key(key_block);
264
============================================================
265
--- src/key_store.cc	64c4c4bed1fadc26b51207b9f61343f9dd7d3c6e
266
+++ src/key_store.cc	b7859345f7c665914d16357409bdff24a48b7996
267
@@ -572,13 +572,21 @@ key_store_state::decrypt_private_key(key
268
   try // with empty passphrase
269
     {
270
       Botan::DataSource_Memory ds(kp.priv());
271
-#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,7)
272
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
273
+      pkcs8_key.reset(Botan::PKCS8::load_key(ds, lazy_rng::get(), Dummy_UI()));
274
+#elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,7)
275
       pkcs8_key.reset(Botan::PKCS8::load_key(ds, lazy_rng::get(), ""));
276
 #else
277
       pkcs8_key.reset(Botan::PKCS8::load_key(ds, ""));
278
 #endif
279
     }
280
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
281
+  catch (Passphrase_Required & e)
282
+#elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,4)
283
+  catch (Botan::Invalid_Argument & e)
284
+#else
285
   catch (Botan::Exception & e)
286
+#endif
287
     {
288
       L(FL("failed to load key with no passphrase: %s") % e.what());
289
 
290
@@ -605,13 +613,18 @@ key_store_state::decrypt_private_key(key
291
           {
292
             Botan::DataSource_Memory ds(kp.priv());
293
 #if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,7)
294
-            pkcs8_key.reset(Botan::PKCS8::load_key(ds, lazy_rng::get(), phrase()));
295
+            pkcs8_key.reset(Botan::PKCS8::load_key(ds, lazy_rng::get(),
296
+                                                   phrase()));
297
 #else
298
             pkcs8_key.reset(Botan::PKCS8::load_key(ds, phrase()));
299
 #endif
300
             break;
301
           }
302
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,4)
303
+        catch (Botan::Invalid_Argument)
304
+#else
305
         catch (Botan::Exception & e)
306
+#endif
307
           {
308
             cycles++;
309
             L(FL("decrypt_private_key: failure %d to load encrypted key: %s")
310
@@ -822,10 +835,14 @@ key_store::decrypt_rsa(key_id const & id
311
       plaintext = string(reinterpret_cast<char const*>(plain.begin()),
312
                          plain.size());
313
     }
314
-  catch (Botan::Exception & ex)
315
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,4)
316
+  catch (std::exception & e)
317
+#else
318
+  catch (Botan::Exception & e)
319
+#endif
320
     {
321
       E(false, ciphertext.made_from,
322
-        F("Botan error decrypting data: '%s'") % ex.what());
323
+        F("Botan error decrypting data: '%s'") % e.what());
324
     }
325
 }
326
 
327
@@ -856,9 +873,9 @@ key_store::make_signature(database & db,
328
     {
329
       if (agent.connected()) {
330
         //grab the monotone public key as an RSA_PublicKey
331
-        SecureVector<Botan::byte> pub_block;
332
-        pub_block.set(reinterpret_cast<Botan::byte const *>(key.pub().data()),
333
-                      key.pub().size());
334
+        SecureVector<Botan::byte> pub_block
335
+          (reinterpret_cast<Botan::byte const *>(key.pub().data()),
336
+           key.pub().size());
337
         L(FL("make_signature: building %d-byte pub key") % pub_block.size());
338
         shared_ptr<X509_PublicKey> x509_key =
339
           shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
340
@@ -1031,8 +1048,14 @@ key_store_state::migrate_old_key_pair
341
   for (;;)
342
     try
343
       {
344
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
345
+        arc4_key.resize(phrase().size());
346
+        arc4_key.copy(reinterpret_cast<Botan::byte const *>(phrase().data()),
347
+                      phrase().size());
348
+#else
349
         arc4_key.set(reinterpret_cast<Botan::byte const *>(phrase().data()),
350
                      phrase().size());
351
+#endif
352
 
353
         Pipe arc4_decryptor(get_cipher("ARC4", arc4_key, Botan::DECRYPTION));
354
 
355
@@ -1051,7 +1074,11 @@ key_store_state::migrate_old_key_pair
356
 #endif
357
         break;
358
       }
359
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,4)
360
+    catch (Botan::Invalid_Argument & e)
361
+#else
362
     catch (Botan::Exception & e)
363
+#endif
364
       {
365
         L(FL("migrate_old_key_pair: failure %d to load old private key: %s")
366
           % cycles % e.what());
367
============================================================
368
--- src/monotone.cc	a25ecdd170a601db798b63a60add7681609a34c4
369
+++ src/monotone.cc	764bc9ca406b41d21efd552a0d810bc2849e0588
370
@@ -156,27 +156,53 @@ cpp_main(int argc, char ** argv)
371
       E(linked_botan_version != BOTAN_VERSION_CODE_FOR(1,7,14), origin::system,
372
         F("monotone does not support Botan 1.7.14"));
373
 
374
-#if BOTAN_VERSION_CODE <= BOTAN_VERSION_CODE_FOR(1,7,6)
375
+      // In Botan 1.9.9, the DataSink_Stream cannot be instantiated per
376
+      // se. As 1.10.1 is already out, let's simply disable support for
377
+      // that specific (testing) version of botan.
378
+      E(linked_botan_version != BOTAN_VERSION_CODE_FOR(1,9,9), origin::system,
379
+        F("monotone does not support Botan 1.9.9"));
380
+
381
+#if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,7,7)
382
+      // motonote binary compiled against botan younger than 1.7.7
383
       E(linked_botan_version >= BOTAN_VERSION_CODE_FOR(1,6,3), origin::system,
384
         F("this monotone binary requires Botan 1.6.3 or newer"));
385
-      E(linked_botan_version <= BOTAN_VERSION_CODE_FOR(1,7,6), origin::system,
386
-        F("this monotone binary does not work with Botan newer than 1.7.6"));
387
-#elif BOTAN_VERSION_CODE <= BOTAN_VERSION_CODE_FOR(1,7,22)
388
-      E(linked_botan_version > BOTAN_VERSION_CODE_FOR(1,7,6), origin::system,
389
+      E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,7,7), origin::system,
390
+        F("this monotone binary does not work with Botan 1.7.7 or newer"));
391
+
392
+#elif BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,7,22)
393
+      // motonote binary compiled against botan 1.7.7 - 1.7.21
394
+      E(linked_botan_version >= BOTAN_VERSION_CODE_FOR(1,7,7), origin::system,
395
         F("this monotone binary requires Botan 1.7.7 or newer"));
396
-      // While compiling against 1.7.22 or newer is recommended, because
397
-      // it enables new features of Botan, the monotone binary compiled
398
-      // against Botan 1.7.21 and before should still work with newer Botan
399
-      // versions, including all of the stable branch 1.8.x.
400
-      E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,9,0), origin::system,
401
-        F("this monotone binary does not work with Botan 1.9.x"));
402
-#else
403
-      E(linked_botan_version > BOTAN_VERSION_CODE_FOR(1,7,22), origin::system,
404
+      // While compiling against 1.7.22 or newer is recommended, because it
405
+      // enables new features of Botan, the monotone binary compiled against
406
+      // Botan 1.7.21 and before should still work with newer Botan version,
407
+      // including all of the stable branch 1.8.x, up to and including
408
+      // 1.9.3.
409
+      E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,9,4), origin::system,
410
+        F("this monotone binary does not work with Botan 1.9.4 or newer"));
411
+
412
+#elif BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,9,4)
413
+      // motonote binary compiled against botan 1.7.22 - 1.9.3
414
+      E(linked_botan_version >= BOTAN_VERSION_CODE_FOR(1,7,22), origin::system,
415
         F("this monotone binary requires Botan 1.7.22 or newer"));
416
-      E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,9,0), origin::system,
417
-        F("this monotone binary does not work with Botan 1.9.x"));
418
+      E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,9,4), origin::system,
419
+        F("this monotone binary does not work with Botan 1.9.4 or newer"));
420
+
421
+#elif BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,9,11)
422
+      // motonote binary compiled against botan 1.9.4 - 1.9.10
423
+#pragma message ( "The resulting monotone binary won't be able to run with any stable release of botan." )
424
+      E(linked_botan_version >= BOTAN_VERSION_CODE_FOR(1,9,4), origin::system,
425
+        F("this monotone binary requires Botan 1.9.4 or newer"));
426
+      E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,9,11), origin::system,
427
+        F("this monotone binary does not work with Botan 1.9.11 or newer"));
428
+
429
+#else
430
+      // motonote binary compiled against botan 1.9.11 and newer
431
+      E(linked_botan_version >= BOTAN_VERSION_CODE_FOR(1,9,11), origin::system,
432
+        F("this monotone binary requires Botan 1.9.11 or newer"));
433
 #endif
434
 
435
+
436
       app_state app;
437
       try
438
         {
439
============================================================
440
--- src/packet.cc	f61360ed2524fdf53411bd24d022a2a3c9e6e9c7
441
+++ src/packet.cc	571ff6eae1d269a146da74f2730b70376957d3bb
442
@@ -156,8 +156,8 @@ namespace
443
     void validate_public_key_data(string const & name, string const & keydata) const
444
     {
445
       string decoded = decode_base64_as<string>(keydata, origin::user);
446
-      Botan::SecureVector<Botan::byte> key_block;
447
-      key_block.set(reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
448
+      Botan::SecureVector<Botan::byte> key_block
449
+        (reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
450
       try
451
         {
452
           Botan::X509::load_key(key_block);
453
@@ -175,7 +175,9 @@ namespace
454
       Botan::DataSource_Memory ds(decoded);
455
       try
456
         {
457
-#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,7)
458
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
459
+          Botan::PKCS8::load_key(ds, lazy_rng::get(), Dummy_UI());
460
+#elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,7)
461
           Botan::PKCS8::load_key(ds, lazy_rng::get(), string());
462
 #else
463
           Botan::PKCS8::load_key(ds, string());
464
@@ -189,7 +191,11 @@ namespace
465
         }
466
       // since we do not want to prompt for a password to decode it finally,
467
       // we ignore all other exceptions
468
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
469
+      catch (Passphrase_Required) {}
470
+#else
471
       catch (Botan::Invalid_Argument) {}
472
+#endif
473
     }
474
     void validate_certname(string const & cn) const
475
     {
476
@@ -460,8 +466,16 @@ read_packets(istream & in, packet_consum
477
   return count;
478
 }
479
 
480
+// Dummy User_Interface implementation for Botan
481
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
482
+std::string
483
+Dummy_UI::get_passphrase(const std::string &, const std::string &,
484
+                         Botan::User_Interface::UI_Result&) const
485
+{
486
+  throw Passphrase_Required("Passphrase required");
487
+}
488
+#endif
489
 
490
-
491
 // Local Variables:
492
 // mode: C++
493
 // fill-column: 76
494
============================================================
495
--- src/packet.hh	0a224e6e92f244e2c3e9a5cdb935eb8613d7e85b
496
+++ src/packet.hh	9c43d30145f0292d6ceda5e717e366fdead5a4d6
497
@@ -10,6 +10,10 @@
498
 #ifndef __PACKET_HH__
499
 #define __PACKET_HH__
500
 
501
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
502
+#include <botan/ui.h>
503
+#endif
504
+
505
 #include "vocab.hh"
506
 
507
 struct cert;
508
@@ -84,8 +88,23 @@ size_t read_packets(std::istream & in, p
509
 
510
 size_t read_packets(std::istream & in, packet_consumer & cons);
511
 
512
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
513
+// A helper class implementing Botan::User_Interface - which doesn't really
514
+// interface with the user, but provides the necessary plumbing for Botan.
515
+//
516
+// See Botan commit 2d09d7d0cd4bd0e7155d001dd65a4f29103b158c
517
+typedef std::runtime_error Passphrase_Required;
518
+
519
+class Dummy_UI : public Botan::User_Interface
520
+{
521
+public:
522
+  virtual std::string get_passphrase(const std::string &, const std::string &,
523
+                                     Botan::User_Interface::UI_Result &) const;
524
+};
525
 #endif
526
 
527
+#endif
528
+
529
 // Local Variables:
530
 // mode: C++
531
 // fill-column: 76
532
============================================================
533
--- src/sha1.cc	5e1aa972d7c7d66e06320b039989652b830dcd75
534
+++ src/sha1.cc	42e48b22fd88b25e0d38d4f91e1f13f8a83c7120
535
@@ -50,9 +50,12 @@ CMD_HIDDEN(benchmark_sha1, "benchmark_sh
536
   Botan::Default_Benchmark_Timer timer;
537
   std::map<std::string, double> results =
538
     Botan::algorithm_benchmark("SHA-1",  milliseconds, timer, rng, af);
539
+#elif BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,9,11)
540
+  std::map<std::string, double> results =
541
+    Botan::algorithm_benchmark("SHA-1",  milliseconds, rng, af);
542
 #else
543
   std::map<std::string, double> results =
544
-    Botan::algorithm_benchmark("SHA-1",  milliseconds, rng, af);
545
+    Botan::algorithm_benchmark("SHA-1",  af, rng, milliseconds, 16);
546
 #endif
547
 
548
   for(std::map<std::string, double>::const_iterator i = results.begin();
549
============================================================
550
--- src/ssh_agent.cc	6d188e7012a0b82f782563b09bbd7adf3f70cf75
551
+++ src/ssh_agent.cc	4a0dcab873559e934e41c5f220b5434d35600d9b
552
@@ -385,9 +385,9 @@ ssh_agent::has_key(const keypair & key)
553
 ssh_agent::has_key(const keypair & key)
554
 {
555
   //grab the monotone public key as an RSA_PublicKey
556
-  SecureVector<Botan::byte> pub_block;
557
-  pub_block.set(reinterpret_cast<Botan::byte const *>((key.pub)().data()),
558
-                (key.pub)().size());
559
+  SecureVector<Botan::byte> pub_block
560
+    (reinterpret_cast<Botan::byte const *>((key.pub)().data()),
561
+     (key.pub)().size());
562
   L(FL("has_key: building %d-byte pub key") % pub_block.size());
563
   shared_ptr<X509_PublicKey> x509_key =
564
     shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
565
============================================================
566
--- src/transforms.cc	cdfb6854ef4992faba21074145f3c8269b845b11
567
+++ src/transforms.cc	b99278ffe95c0081bf4986bc74d3699c37a52948
568
@@ -53,15 +53,16 @@ using Botan::Hash_Filter;
569
 // paradigm "must" be used. this program is intended for source code
570
 // control and I make no bones about it.
571
 
572
-NORETURN(static inline void error_in_transform(Botan::Exception & e));
573
+NORETURN(static inline void error_in_transform(std::exception & e));
574
 
575
 static inline void
576
-error_in_transform(Botan::Exception & e, origin::type caused_by)
577
+error_in_transform(std::exception & e, origin::type caused_by)
578
 {
579
   // these classes can all indicate data corruption
580
   if (typeid(e) == typeid(Botan::Encoding_Error)
581
       || typeid(e) == typeid(Botan::Decoding_Error)
582
       || typeid(e) == typeid(Botan::Stream_IO_Error)
583
+      || typeid(e) == typeid(Botan::Invalid_Argument)
584
       || typeid(e) == typeid(Botan::Integrity_Failure))
585
     {
586
       // clean up the what() string a little: throw away the
587
@@ -107,7 +108,7 @@ error_in_transform(Botan::Exception & e,
588
         pipe->process_msg(in);                                  \
589
         out = pipe->read_all_as_string(Pipe::LAST_MESSAGE);     \
590
       }                                                         \
591
-    catch (Botan::Exception & e)                                \
592
+    catch (std::exception & e)                                   \
593
       {                                                         \
594
         pipe.reset(new Pipe(new T(carg)));                      \
595
         error_in_transform(e, made_from);                       \
596
@@ -173,7 +174,7 @@ template<> string xform<Botan::Hex_Decod
597
             {
598
               throw Botan::Decoding_Error(string("invalid hex character '") + (char)c + "'");
599
             }
600
-          catch(Botan::Exception & e)
601
+          catch(std::exception & e)
602
             {
603
               error_in_transform(e, made_from);
604
             }
605
@@ -219,7 +220,7 @@ void pack(T const & in, base64< gzip<T> 
606
       tmp = pipe->read_all_as_string(Pipe::LAST_MESSAGE);
607
       out = base64< gzip<T> >(tmp, in.made_from);
608
     }
609
-  catch (Botan::Exception & e)
610
+  catch (std::exception & e)
611
     {
612
       pipe.reset(new Pipe(new Gzip_Compression,
613
                           new Base64_Encoder));
614
@@ -237,7 +238,7 @@ void unpack(base64< gzip<T> > const & in
615
       pipe->process_msg(in());
616
       out = T(pipe->read_all_as_string(Pipe::LAST_MESSAGE), in.made_from);
617
     }
618
-  catch (Botan::Exception & e)
619
+  catch (std::exception & e)
620
     {
621
       pipe.reset(new Pipe(new Base64_Decoder,
622
                           new Gzip_Decompression));
623
@@ -264,7 +265,7 @@ calculate_ident(data const & dat,
624
       p->process_msg(dat());
625
       ident = id(p->read_all_as_string(Pipe::LAST_MESSAGE), dat.made_from);
626
     }
627
-  catch (Botan::Exception & e)
628
+  catch (std::exception & e)
629
     {
630
       p.reset(new Pipe(new Hash_Filter("SHA-160")));
631
       error_in_transform(e, dat.made_from);
(-)./files/patch-configure (-13 lines)
Lines 1-13 Link Here
1
--- configure.orig	2014-01-22 00:48:12.855108408 +0100
2
+++ configure	2014-01-22 00:48:54.244105202 +0100
3
@@ -4594,9 +4594,7 @@ fi
4
 
5
 # The dummy "pkg-config" package is guaranteed to exist.
6
 if test -n "$PKG_CONFIG"; then
7
-  mtn__full_pkg_config_path=`$PKG_CONFIG --debug pkg-config 2>&1 |
8
-    sed -ne "/^Scanning directory '/{; s///; s/'$//; p;}" |
9
-    tr "$as_nl" ':' | sed 's/:$//'`
10
+  mtn__full_pkg_config_path=`$PKG_CONFIG --variable=pc_path pkg-config 2>&1 | sed 's/:.*$//'`
11
   #AC_MSG_NOTICE([detected pkg-config path: $mtn__full_pkg_config_path])
12
 fi
13
 
(-)./files/patch-src_automate_reader.hh (-10 lines)
Lines 1-10 Link Here
1
--- src/automate_reader.hh.orig	2014-01-22 01:04:27.675051506 +0100
2
+++ src/automate_reader.hh	2014-01-22 01:04:41.682040341 +0100
3
@@ -13,6 +13,7 @@
4
 #define __AUTOMATE_READER_HH__
5
 
6
 #include <vector>
7
+#include <iostream>
8
 
9
 class automate_reader
10
 {

Return to bug 189368