Gentoo Archives: gentoo-commits

From: "Peter Volkov (pva)" <pva@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-vcs/monotone/files: monotone-1.0-pcre3.patch monotone-1.0-botan-1.10-v2.patch
Date: Wed, 28 Aug 2013 13:36:00
Message-Id: 20130828133554.C54E02004E@flycatcher.gentoo.org
1 pva 13/08/28 13:35:54
2
3 Added: monotone-1.0-pcre3.patch
4 monotone-1.0-botan-1.10-v2.patch
5 Log:
6 Fixed test failure with botan-1.10, thank Martin von Gagern for patch in bug #380257. Fixed another failure with pcre3 (patch from debian).
7
8 (Portage version: 2.1.12.2/cvs/Linux x86_64, signed Manifest commit with key F1989B07)
9
10 Revision Changes Path
11 1.1 dev-vcs/monotone/files/monotone-1.0-pcre3.patch
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-vcs/monotone/files/monotone-1.0-pcre3.patch?rev=1.1&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-vcs/monotone/files/monotone-1.0-pcre3.patch?rev=1.1&content-type=text/plain
15
16 Index: monotone-1.0-pcre3.patch
17 ===================================================================
18 Author: Francis Russell
19 Bug-Debian: http://bugs.debian.org/665448
20 Description: The test 'syntax_errors_in_.mtn-ignore' from the monotone
21 test suite contains a .mtn-ignore file which contains a number of
22 regular expressions. Some of these are intended to match and fail to
23 match the names of files created by the test harness. The rest have
24 invalid syntax and should be ignored.
25 .
26 One regex, '(?<=\C)' is presumably intended to be invalid, but with
27 the most recent version of pcre3 matches most files and therefore
28 causes the test to fail. In fact, it appears to be a valid regex that
29 performs a positive look behind to match a single data unit (usually a
30 byte, even in UTF mode). This patch removes the problematic regex until
31 the issue can be addressed upstream.
32 Index: monotone-1.0/test/func/syntax_errors_in_.mtn-ignore/mtn-ignore
33 ===================================================================
34 --- monotone-1.0.orig/test/func/syntax_errors_in_.mtn-ignore/mtn-ignore 2011-03-26 06:41:05.000000000 +0000
35 +++ monotone-1.0/test/func/syntax_errors_in_.mtn-ignore/mtn-ignore 2012-03-25 20:02:37.695875219 +0100
36 @@ -21,7 +21,6 @@
37 [[:fnord:]]
38 \\x{123456}
39 (?(0))
40 -(?<=\C)
41 \l
42 (?C256)
43 (?C1
44
45
46
47 1.1 dev-vcs/monotone/files/monotone-1.0-botan-1.10-v2.patch
48
49 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-vcs/monotone/files/monotone-1.0-botan-1.10-v2.patch?rev=1.1&view=markup
50 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-vcs/monotone/files/monotone-1.0-botan-1.10-v2.patch?rev=1.1&content-type=text/plain
51
52 Index: monotone-1.0-botan-1.10-v2.patch
53 ===================================================================
54 Make monotone work with botan 1.10.
55
56 Patch generated using the following command:
57 mtn diff -r 972ee5c3eab3fb5ba0b80684193293d18438a9d0 \
58 -r f4feb3fdc68e4f955909450b2dcb3ff9312dbc9e
59
60 Authors: Martin von Gagern, Markus Wanner
61
62 References:
63 https://bugs.gentoo.org/380257
64 https://code.monotone.ca/p/monotone/issues/182/
65 https://code.monotone.ca/p/monotone/source/commit/f4feb3fd
66
67 ============================================================
68 --- src/database.cc 4c259f963c440fc95564dfec99b2f832f0bad643
69 +++ src/database.cc 87efeeff2d3263ba98af684a4022f1897434ed2d
70 @@ -3425,9 +3425,8 @@ database::encrypt_rsa(key_id const & pub
71 rsa_pub_key pub;
72 get_key(pub_id, pub);
73
74 - SecureVector<Botan::byte> pub_block;
75 - pub_block.set(reinterpret_cast<Botan::byte const *>(pub().data()),
76 - pub().size());
77 + SecureVector<Botan::byte> pub_block
78 + (reinterpret_cast<Botan::byte const *>(pub().data()), pub().size());
79
80 shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
81 shared_ptr<RSA_PublicKey> pub_key
82 @@ -3471,14 +3470,13 @@ database::check_signature(key_id const &
83 else
84 {
85 rsa_pub_key pub;
86 - SecureVector<Botan::byte> pub_block;
87
88 if (!public_key_exists(id))
89 return cert_unknown;
90
91 get_key(id, pub);
92 - pub_block.set(reinterpret_cast<Botan::byte const *>(pub().data()),
93 - pub().size());
94 + SecureVector<Botan::byte> pub_block
95 + (reinterpret_cast<Botan::byte const *>(pub().data()), pub().size());
96
97 L(FL("building verifier for %d-byte pub key") % pub_block.size());
98 shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
99 ============================================================
100 --- src/gzip.cc e7c19bee910e3d421fd073933810ec52092b1d9b
101 +++ src/gzip.cc 9da41f6820cdf39707b22c716e3682e0fa0fd745
102 @@ -110,7 +110,7 @@ Gzip_Compression::Gzip_Compression(u32bi
103 if(deflateInit2(&(zlib->stream), level, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY) != Z_OK)
104 {
105 delete zlib; zlib = 0;
106 - throw Exception("Gzip_Compression: Memory allocation error");
107 + throw Memory_Exhaustion();
108 }
109 }
110
111 @@ -137,7 +137,7 @@ void Gzip_Compression::start_msg()
112 /*************************************************
113 * Compress Input with Gzip *
114 *************************************************/
115 -void Gzip_Compression::write(const byte input[], u32bit length)
116 +void Gzip_Compression::write(const byte input[], filter_length_t length)
117 {
118
119 count += length;
120 @@ -152,7 +152,7 @@ void Gzip_Compression::write(const byte
121 zlib->stream.avail_out = buffer.size();
122 int rc = deflate(&(zlib->stream), Z_NO_FLUSH);
123 if (rc != Z_OK && rc != Z_STREAM_END)
124 - throw Exception("Internal error in Gzip_Compression deflate.");
125 + throw Invalid_State("Internal error in Gzip_Compression deflate.");
126 send(buffer.begin(), buffer.size() - zlib->stream.avail_out);
127 }
128 }
129 @@ -172,7 +172,7 @@ void Gzip_Compression::end_msg()
130 zlib->stream.avail_out = buffer.size();
131 rc = deflate(&(zlib->stream), Z_FINISH);
132 if (rc != Z_OK && rc != Z_STREAM_END)
133 - throw Exception("Internal error in Gzip_Compression finishing deflate.");
134 + throw Invalid_State("Internal error in Gzip_Compression finishing deflate.");
135 send(buffer.begin(), buffer.size() - zlib->stream.avail_out);
136 }
137
138 @@ -228,7 +228,7 @@ Gzip_Decompression::Gzip_Decompression()
139 no_writes(true), pipe(new Hash_Filter("CRC32")), footer(0)
140 {
141 if (DEFAULT_BUFFERSIZE < sizeof(GZIP::GZIP_HEADER))
142 - throw Exception("DEFAULT_BUFFERSIZE is too small");
143 + throw Decoding_Error("DEFAULT_BUFFERSIZE is too small");
144
145 zlib = new Zlib_Stream;
146
147 @@ -237,7 +237,7 @@ Gzip_Decompression::Gzip_Decompression()
148 if(inflateInit2(&(zlib->stream), -15) != Z_OK)
149 {
150 delete zlib; zlib = 0;
151 - throw Exception("Gzip_Decompression: Memory allocation error");
152 + throw Memory_Exhaustion();
153 }
154 }
155
156 @@ -256,7 +256,7 @@ void Gzip_Decompression::start_msg()
157 void Gzip_Decompression::start_msg()
158 {
159 if (!no_writes)
160 - throw Exception("Gzip_Decompression: start_msg after already writing");
161 + throw Decoding_Error("Gzip_Decompression: start_msg after already writing");
162
163 pipe.start_msg();
164 datacount = 0;
165 @@ -267,7 +267,7 @@ void Gzip_Decompression::start_msg()
166 /*************************************************
167 * Decompress Input with Gzip *
168 *************************************************/
169 -void Gzip_Decompression::write(const byte input[], u32bit length)
170 +void Gzip_Decompression::write(const byte input[], filter_length_t length)
171 {
172 if(length) no_writes = false;
173
174 @@ -277,15 +277,16 @@ void Gzip_Decompression::write(const byt
175 u32bit eat_len = eat_footer(input, length);
176 input += eat_len;
177 length -= eat_len;
178 - if (length == 0)
179 - return;
180 }
181
182 + if (length == 0)
183 + return;
184 +
185 // Check the gzip header
186 if (pos < sizeof(GZIP::GZIP_HEADER))
187 {
188 - u32bit len = std::min((u32bit)sizeof(GZIP::GZIP_HEADER)-pos, length);
189 - u32bit cmplen = len;
190 + filter_length_t len = std::min((filter_length_t)sizeof(GZIP::GZIP_HEADER)-pos, length);
191 + filter_length_t cmplen = len;
192 // The last byte is the OS flag - we don't care about that
193 if (pos + len - 1 >= GZIP::HEADER_POS_OS)
194 cmplen--;
195 @@ -317,8 +318,8 @@ void Gzip_Decompression::write(const byt
196 if(rc == Z_NEED_DICT)
197 throw Decoding_Error("Gzip_Decompression: Need preset dictionary");
198 if(rc == Z_MEM_ERROR)
199 - throw Exception("Gzip_Decompression: Memory allocation error");
200 - throw Exception("Gzip_Decompression: Unknown decompress error");
201 + throw Memory_Exhaustion();
202 + throw Decoding_Error("Gzip_Decompression: Unknown decompress error");
203 }
204 send(buffer.begin(), buffer.size() - zlib->stream.avail_out);
205 pipe.write(buffer.begin(), buffer.size() - zlib->stream.avail_out);
206 @@ -346,8 +347,14 @@ u32bit Gzip_Decompression::eat_footer(co
207 if (footer.size() >= GZIP::FOOTER_LENGTH)
208 throw Decoding_Error("Gzip_Decompression: Data integrity error in footer");
209
210 +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
211 + size_t eat_len = std::min(GZIP::FOOTER_LENGTH-footer.size(),
212 + static_cast<size_t>(length));
213 + footer += std::make_pair(input, eat_len);
214 +#else
215 u32bit eat_len = std::min(GZIP::FOOTER_LENGTH-footer.size(), length);
216 footer.append(input, eat_len);
217 +#endif
218
219 if (footer.size() == GZIP::FOOTER_LENGTH)
220 {
221 @@ -364,7 +371,7 @@ void Gzip_Decompression::check_footer()
222 void Gzip_Decompression::check_footer()
223 {
224 if (footer.size() != GZIP::FOOTER_LENGTH)
225 - throw Exception("Gzip_Decompression: Error finalizing decompression");
226 + throw Decoding_Error("Gzip_Decompression: Error finalizing decompression");
227
228 pipe.end_msg();
229
230 @@ -377,7 +384,12 @@ void Gzip_Decompression::check_footer()
231 for (int i = 0; i < 4; i++)
232 buf[3-i] = tmpbuf[i];
233
234 +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
235 + tmpbuf.resize(4);
236 + tmpbuf.copy(footer.begin(), 4);
237 +#else
238 tmpbuf.set(footer.begin(), 4);
239 +#endif
240 if (buf != tmpbuf)
241 throw Decoding_Error("Gzip_Decompression: Data integrity error - CRC32 error");
242
243 @@ -400,7 +412,7 @@ void Gzip_Decompression::end_msg()
244 // read, clear() will reset no_writes
245 if(no_writes) return;
246
247 - throw Exception("Gzip_Decompression: didn't find footer");
248 + throw Decoding_Error("Gzip_Decompression: didn't find footer");
249
250 }
251
252 @@ -412,7 +424,11 @@ void Gzip_Decompression::clear()
253 no_writes = true;
254 inflateReset(&(zlib->stream));
255
256 +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
257 + footer.clear();
258 +#else
259 footer.destroy();
260 +#endif
261 pos = 0;
262 datacount = 0;
263 }
264 ============================================================
265 --- src/gzip.hh 649dfc0b250954f39c0f73870f8bec3f32f7fa43
266 +++ src/gzip.hh aff9da63bb22366bccf69c2d75ee7790406d2455
267 @@ -7,11 +7,18 @@
268 #ifndef BOTAN_EXT_GZIP_H__
269 #define BOTAN_EXT_GZIP_H__
270
271 +#include <botan/version.h>
272 #include <botan/filter.h>
273 #include <botan/pipe.h>
274
275 namespace Botan {
276
277 +#if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,9,4)
278 +// Only 1.9.4 and newer export the Memory_Exception. Give this gzip
279 +// implementation something compatible to work with.
280 +typedef std::bad_alloc Memory_Exhaustion;
281 +#endif
282 +
283 namespace GZIP {
284
285 /* A basic header - we only need to set the IDs and compression method */
286 @@ -30,13 +37,19 @@ namespace GZIP {
287
288 }
289
290 +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
291 +typedef size_t filter_length_t;
292 +#else
293 +typedef u32bit filter_length_t;
294 +#endif
295 +
296 /*************************************************
297 * Gzip Compression Filter *
298 *************************************************/
299 class Gzip_Compression : public Filter
300 {
301 public:
302 - void write(const byte input[], u32bit length);
303 + void write(const byte input[], filter_length_t length);
304 void start_msg();
305 void end_msg();
306 std::string name() const { return "Gzip_Compression"; }
307 @@ -60,7 +73,7 @@ class Gzip_Decompression : public Filter
308 class Gzip_Decompression : public Filter
309 {
310 public:
311 - void write(const byte input[], u32bit length);
312 + void write(const byte input[], filter_length_t length);
313 void start_msg();
314 void end_msg();
315 std::string name() const { return "Gzip_Decompression"; }
316 ============================================================
317 --- src/key_packet.cc d1306df89dd684badac02c03744cd446381c07d3
318 +++ src/key_packet.cc c97262d161b23c9640972188979669b3e95afe7b
319 @@ -106,8 +106,8 @@ namespace
320 void validate_public_key_data(string const & name, string const & keydata) const
321 {
322 string decoded = decode_base64_as<string>(keydata, origin::user);
323 - Botan::SecureVector<Botan::byte> key_block;
324 - key_block.set(reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
325 + Botan::SecureVector<Botan::byte> key_block
326 + (reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
327 try
328 {
329 Botan::X509::load_key(key_block);
330 ============================================================
331 --- src/key_store.cc 64c4c4bed1fadc26b51207b9f61343f9dd7d3c6e
332 +++ src/key_store.cc b7859345f7c665914d16357409bdff24a48b7996
333 @@ -572,13 +572,21 @@ key_store_state::decrypt_private_key(key
334 try // with empty passphrase
335 {
336 Botan::DataSource_Memory ds(kp.priv());
337 -#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,7)
338 +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
339 + pkcs8_key.reset(Botan::PKCS8::load_key(ds, lazy_rng::get(), Dummy_UI()));
340 +#elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,7)
341 pkcs8_key.reset(Botan::PKCS8::load_key(ds, lazy_rng::get(), ""));
342 #else
343 pkcs8_key.reset(Botan::PKCS8::load_key(ds, ""));
344 #endif
345 }
346 +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
347 + catch (Passphrase_Required & e)
348 +#elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,4)
349 + catch (Botan::Invalid_Argument & e)
350 +#else
351 catch (Botan::Exception & e)
352 +#endif
353 {
354 L(FL("failed to load key with no passphrase: %s") % e.what());
355
356 @@ -605,13 +613,18 @@ key_store_state::decrypt_private_key(key
357 {
358 Botan::DataSource_Memory ds(kp.priv());
359 #if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,7)
360 - pkcs8_key.reset(Botan::PKCS8::load_key(ds, lazy_rng::get(), phrase()));
361 + pkcs8_key.reset(Botan::PKCS8::load_key(ds, lazy_rng::get(),
362 + phrase()));
363 #else
364 pkcs8_key.reset(Botan::PKCS8::load_key(ds, phrase()));
365 #endif
366 break;
367 }
368 +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,4)
369 + catch (Botan::Invalid_Argument)
370 +#else
371 catch (Botan::Exception & e)
372 +#endif
373 {
374 cycles++;
375 L(FL("decrypt_private_key: failure %d to load encrypted key: %s")
376 @@ -822,10 +835,14 @@ key_store::decrypt_rsa(key_id const & id
377 plaintext = string(reinterpret_cast<char const*>(plain.begin()),
378 plain.size());
379 }
380 - catch (Botan::Exception & ex)
381 +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,4)
382 + catch (std::exception & e)
383 +#else
384 + catch (Botan::Exception & e)
385 +#endif
386 {
387 E(false, ciphertext.made_from,
388 - F("Botan error decrypting data: '%s'") % ex.what());
389 + F("Botan error decrypting data: '%s'") % e.what());
390 }
391 }
392
393 @@ -856,9 +873,9 @@ key_store::make_signature(database & db,
394 {
395 if (agent.connected()) {
396 //grab the monotone public key as an RSA_PublicKey
397 - SecureVector<Botan::byte> pub_block;
398 - pub_block.set(reinterpret_cast<Botan::byte const *>(key.pub().data()),
399 - key.pub().size());
400 + SecureVector<Botan::byte> pub_block
401 + (reinterpret_cast<Botan::byte const *>(key.pub().data()),
402 + key.pub().size());
403 L(FL("make_signature: building %d-byte pub key") % pub_block.size());
404 shared_ptr<X509_PublicKey> x509_key =
405 shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
406 @@ -1031,8 +1048,14 @@ key_store_state::migrate_old_key_pair
407 for (;;)
408 try
409 {
410 +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
411 + arc4_key.resize(phrase().size());
412 + arc4_key.copy(reinterpret_cast<Botan::byte const *>(phrase().data()),
413 + phrase().size());
414 +#else
415 arc4_key.set(reinterpret_cast<Botan::byte const *>(phrase().data()),
416 phrase().size());
417 +#endif
418
419 Pipe arc4_decryptor(get_cipher("ARC4", arc4_key, Botan::DECRYPTION));
420
421 @@ -1051,7 +1074,11 @@ key_store_state::migrate_old_key_pair
422 #endif
423 break;
424 }
425 +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,4)
426 + catch (Botan::Invalid_Argument & e)
427 +#else
428 catch (Botan::Exception & e)
429 +#endif
430 {
431 L(FL("migrate_old_key_pair: failure %d to load old private key: %s")
432 % cycles % e.what());
433 ============================================================
434 --- src/monotone.cc a25ecdd170a601db798b63a60add7681609a34c4
435 +++ src/monotone.cc 764bc9ca406b41d21efd552a0d810bc2849e0588
436 @@ -156,27 +156,53 @@ cpp_main(int argc, char ** argv)
437 E(linked_botan_version != BOTAN_VERSION_CODE_FOR(1,7,14), origin::system,
438 F("monotone does not support Botan 1.7.14"));
439
440 -#if BOTAN_VERSION_CODE <= BOTAN_VERSION_CODE_FOR(1,7,6)
441 + // In Botan 1.9.9, the DataSink_Stream cannot be instantiated per
442 + // se. As 1.10.1 is already out, let's simply disable support for
443 + // that specific (testing) version of botan.
444 + E(linked_botan_version != BOTAN_VERSION_CODE_FOR(1,9,9), origin::system,
445 + F("monotone does not support Botan 1.9.9"));
446 +
447 +#if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,7,7)
448 + // motonote binary compiled against botan younger than 1.7.7
449 E(linked_botan_version >= BOTAN_VERSION_CODE_FOR(1,6,3), origin::system,
450 F("this monotone binary requires Botan 1.6.3 or newer"));
451 - E(linked_botan_version <= BOTAN_VERSION_CODE_FOR(1,7,6), origin::system,
452 - F("this monotone binary does not work with Botan newer than 1.7.6"));
453 -#elif BOTAN_VERSION_CODE <= BOTAN_VERSION_CODE_FOR(1,7,22)
454 - E(linked_botan_version > BOTAN_VERSION_CODE_FOR(1,7,6), origin::system,
455 + E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,7,7), origin::system,
456 + F("this monotone binary does not work with Botan 1.7.7 or newer"));
457 +
458 +#elif BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,7,22)
459 + // motonote binary compiled against botan 1.7.7 - 1.7.21
460 + E(linked_botan_version >= BOTAN_VERSION_CODE_FOR(1,7,7), origin::system,
461 F("this monotone binary requires Botan 1.7.7 or newer"));
462 - // While compiling against 1.7.22 or newer is recommended, because
463 - // it enables new features of Botan, the monotone binary compiled
464 - // against Botan 1.7.21 and before should still work with newer Botan
465 - // versions, including all of the stable branch 1.8.x.
466 - E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,9,0), origin::system,
467 - F("this monotone binary does not work with Botan 1.9.x"));
468 -#else
469 - E(linked_botan_version > BOTAN_VERSION_CODE_FOR(1,7,22), origin::system,
470 + // While compiling against 1.7.22 or newer is recommended, because it
471 + // enables new features of Botan, the monotone binary compiled against
472 + // Botan 1.7.21 and before should still work with newer Botan version,
473 + // including all of the stable branch 1.8.x, up to and including
474 + // 1.9.3.
475 + E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,9,4), origin::system,
476 + F("this monotone binary does not work with Botan 1.9.4 or newer"));
477 +
478 +#elif BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,9,4)
479 + // motonote binary compiled against botan 1.7.22 - 1.9.3
480 + E(linked_botan_version >= BOTAN_VERSION_CODE_FOR(1,7,22), origin::system,
481 F("this monotone binary requires Botan 1.7.22 or newer"));
482 - E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,9,0), origin::system,
483 - F("this monotone binary does not work with Botan 1.9.x"));
484 + E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,9,4), origin::system,
485 + F("this monotone binary does not work with Botan 1.9.4 or newer"));
486 +
487 +#elif BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,9,11)
488 + // motonote binary compiled against botan 1.9.4 - 1.9.10
489 +#pragma message ( "The resulting monotone binary won't be able to run with any stable release of botan." )
490 + E(linked_botan_version >= BOTAN_VERSION_CODE_FOR(1,9,4), origin::system,
491 + F("this monotone binary requires Botan 1.9.4 or newer"));
492 + E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,9,11), origin::system,
493 + F("this monotone binary does not work with Botan 1.9.11 or newer"));
494 +
495 +#else
496 + // motonote binary compiled against botan 1.9.11 and newer
497 + E(linked_botan_version >= BOTAN_VERSION_CODE_FOR(1,9,11), origin::system,
498 + F("this monotone binary requires Botan 1.9.11 or newer"));
499 #endif
500
501 +
502 app_state app;
503 try
504 {
505 ============================================================
506 --- src/packet.cc f61360ed2524fdf53411bd24d022a2a3c9e6e9c7
507 +++ src/packet.cc 571ff6eae1d269a146da74f2730b70376957d3bb
508 @@ -156,8 +156,8 @@ namespace
509 void validate_public_key_data(string const & name, string const & keydata) const
510 {
511 string decoded = decode_base64_as<string>(keydata, origin::user);
512 - Botan::SecureVector<Botan::byte> key_block;
513 - key_block.set(reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
514 + Botan::SecureVector<Botan::byte> key_block
515 + (reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
516 try
517 {
518 Botan::X509::load_key(key_block);
519 @@ -175,7 +175,9 @@ namespace
520 Botan::DataSource_Memory ds(decoded);
521 try
522 {
523 -#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,7)
524 +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
525 + Botan::PKCS8::load_key(ds, lazy_rng::get(), Dummy_UI());
526 +#elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,7,7)
527 Botan::PKCS8::load_key(ds, lazy_rng::get(), string());
528 #else
529 Botan::PKCS8::load_key(ds, string());
530 @@ -189,7 +191,11 @@ namespace
531 }
532 // since we do not want to prompt for a password to decode it finally,
533 // we ignore all other exceptions
534 +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
535 + catch (Passphrase_Required) {}
536 +#else
537 catch (Botan::Invalid_Argument) {}
538 +#endif
539 }
540 void validate_certname(string const & cn) const
541 {
542 @@ -460,8 +466,16 @@ read_packets(istream & in, packet_consum
543 return count;
544 }
545
546 +// Dummy User_Interface implementation for Botan
547 +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
548 +std::string
549 +Dummy_UI::get_passphrase(const std::string &, const std::string &,
550 + Botan::User_Interface::UI_Result&) const
551 +{
552 + throw Passphrase_Required("Passphrase required");
553 +}
554 +#endif
555
556 -
557 // Local Variables:
558 // mode: C++
559 // fill-column: 76
560 ============================================================
561 --- src/packet.hh 0a224e6e92f244e2c3e9a5cdb935eb8613d7e85b
562 +++ src/packet.hh 9c43d30145f0292d6ceda5e717e366fdead5a4d6
563 @@ -10,6 +10,10 @@
564 #ifndef __PACKET_HH__
565 #define __PACKET_HH__
566
567 +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
568 +#include <botan/ui.h>
569 +#endif
570 +
571 #include "vocab.hh"
572
573 struct cert;
574 @@ -84,8 +88,23 @@ size_t read_packets(std::istream & in, p
575
576 size_t read_packets(std::istream & in, packet_consumer & cons);
577
578 +#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
579 +// A helper class implementing Botan::User_Interface - which doesn't really
580 +// interface with the user, but provides the necessary plumbing for Botan.
581 +//
582 +// See Botan commit 2d09d7d0cd4bd0e7155d001dd65a4f29103b158c
583 +typedef std::runtime_error Passphrase_Required;
584 +
585 +class Dummy_UI : public Botan::User_Interface
586 +{
587 +public:
588 + virtual std::string get_passphrase(const std::string &, const std::string &,
589 + Botan::User_Interface::UI_Result &) const;
590 +};
591 #endif
592
593 +#endif
594 +
595 // Local Variables:
596 // mode: C++
597 // fill-column: 76
598 ============================================================
599 --- src/sha1.cc 5e1aa972d7c7d66e06320b039989652b830dcd75
600 +++ src/sha1.cc 42e48b22fd88b25e0d38d4f91e1f13f8a83c7120
601 @@ -50,9 +50,12 @@ CMD_HIDDEN(benchmark_sha1, "benchmark_sh
602 Botan::Default_Benchmark_Timer timer;
603 std::map<std::string, double> results =
604 Botan::algorithm_benchmark("SHA-1", milliseconds, timer, rng, af);
605 +#elif BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,9,11)
606 + std::map<std::string, double> results =
607 + Botan::algorithm_benchmark("SHA-1", milliseconds, rng, af);
608 #else
609 std::map<std::string, double> results =
610 - Botan::algorithm_benchmark("SHA-1", milliseconds, rng, af);
611 + Botan::algorithm_benchmark("SHA-1", af, rng, milliseconds, 16);
612 #endif
613
614 for(std::map<std::string, double>::const_iterator i = results.begin();
615 ============================================================
616 --- src/ssh_agent.cc 6d188e7012a0b82f782563b09bbd7adf3f70cf75
617 +++ src/ssh_agent.cc 4a0dcab873559e934e41c5f220b5434d35600d9b
618 @@ -385,9 +385,9 @@ ssh_agent::has_key(const keypair & key)
619 ssh_agent::has_key(const keypair & key)
620 {
621 //grab the monotone public key as an RSA_PublicKey
622 - SecureVector<Botan::byte> pub_block;
623 - pub_block.set(reinterpret_cast<Botan::byte const *>((key.pub)().data()),
624 - (key.pub)().size());
625 + SecureVector<Botan::byte> pub_block
626 + (reinterpret_cast<Botan::byte const *>((key.pub)().data()),
627 + (key.pub)().size());
628 L(FL("has_key: building %d-byte pub key") % pub_block.size());
629 shared_ptr<X509_PublicKey> x509_key =
630 shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
631 ============================================================
632 --- src/transforms.cc cdfb6854ef4992faba21074145f3c8269b845b11
633 +++ src/transforms.cc b99278ffe95c0081bf4986bc74d3699c37a52948
634 @@ -53,15 +53,16 @@ using Botan::Hash_Filter;
635 // paradigm "must" be used. this program is intended for source code
636 // control and I make no bones about it.
637
638 -NORETURN(static inline void error_in_transform(Botan::Exception & e));
639 +NORETURN(static inline void error_in_transform(std::exception & e));
640
641 static inline void
642 -error_in_transform(Botan::Exception & e, origin::type caused_by)
643 +error_in_transform(std::exception & e, origin::type caused_by)
644 {
645 // these classes can all indicate data corruption
646 if (typeid(e) == typeid(Botan::Encoding_Error)
647 || typeid(e) == typeid(Botan::Decoding_Error)
648 || typeid(e) == typeid(Botan::Stream_IO_Error)
649 + || typeid(e) == typeid(Botan::Invalid_Argument)
650 || typeid(e) == typeid(Botan::Integrity_Failure))
651 {
652 // clean up the what() string a little: throw away the
653 @@ -107,7 +108,7 @@ error_in_transform(Botan::Exception & e,
654 pipe->process_msg(in); \
655 out = pipe->read_all_as_string(Pipe::LAST_MESSAGE); \
656 } \
657 - catch (Botan::Exception & e) \
658 + catch (std::exception & e) \
659 { \
660 pipe.reset(new Pipe(new T(carg))); \
661 error_in_transform(e, made_from); \
662 @@ -173,7 +174,7 @@ template<> string xform<Botan::Hex_Decod
663 {
664 throw Botan::Decoding_Error(string("invalid hex character '") + (char)c + "'");
665 }
666 - catch(Botan::Exception & e)
667 + catch(std::exception & e)
668 {
669 error_in_transform(e, made_from);
670 }
671 @@ -219,7 +220,7 @@ void pack(T const & in, base64< gzip<T>
672 tmp = pipe->read_all_as_string(Pipe::LAST_MESSAGE);
673 out = base64< gzip<T> >(tmp, in.made_from);
674 }
675 - catch (Botan::Exception & e)
676 + catch (std::exception & e)
677 {
678 pipe.reset(new Pipe(new Gzip_Compression,
679 new Base64_Encoder));
680 @@ -237,7 +238,7 @@ void unpack(base64< gzip<T> > const & in
681 pipe->process_msg(in());
682 out = T(pipe->read_all_as_string(Pipe::LAST_MESSAGE), in.made_from);
683 }
684 - catch (Botan::Exception & e)
685 + catch (std::exception & e)
686 {
687 pipe.reset(new Pipe(new Base64_Decoder,
688 new Gzip_Decompression));
689 @@ -264,7 +265,7 @@ calculate_ident(data const & dat,
690 p->process_msg(dat());
691 ident = id(p->read_all_as_string(Pipe::LAST_MESSAGE), dat.made_from);
692 }
693 - catch (Botan::Exception & e)
694 + catch (std::exception & e)
695 {
696 p.reset(new Pipe(new Hash_Filter("SHA-160")));
697 error_in_transform(e, dat.made_from);