monotone

View botan-1.10.patch

1#
2# old_revision [7cbb20501714be7f25f30734da82d41c7ac427ca]
3#
4# patch "src/database.cc"
5# from [4c259f963c440fc95564dfec99b2f832f0bad643]
6# to [87efeeff2d3263ba98af684a4022f1897434ed2d]
7#
8# patch "src/gzip.cc"
9# from [e7c19bee910e3d421fd073933810ec52092b1d9b]
10# to [bab290412cff6031b2d3bf9d1439a08499d39640]
11#
12# patch "src/gzip.hh"
13# from [649dfc0b250954f39c0f73870f8bec3f32f7fa43]
14# to [f462dfc1df71ae1e9a8203606fd29d9e0eda9b2a]
15#
16# patch "src/key_packet.cc"
17# from [d1306df89dd684badac02c03744cd446381c07d3]
18# to [c97262d161b23c9640972188979669b3e95afe7b]
19#
20# patch "src/key_store.cc"
21# from [64c4c4bed1fadc26b51207b9f61343f9dd7d3c6e]
22# to [6f2f1e0a60f5ee7d322539ca7a3c0acdc69617d7]
23#
24# patch "src/monotone.cc"
25# from [a25ecdd170a601db798b63a60add7681609a34c4]
26# to [2c5f57762bc687a90f75e732f39d2181fc50bd6d]
27#
28# patch "src/packet.cc"
29# from [f61360ed2524fdf53411bd24d022a2a3c9e6e9c7]
30# to [58e2b3070821fb540fc8fe8db92564579a25ce88]
31#
32# patch "src/sha1.cc"
33# from [5e1aa972d7c7d66e06320b039989652b830dcd75]
34# to [42e48b22fd88b25e0d38d4f91e1f13f8a83c7120]
35#
36# patch "src/ssh_agent.cc"
37# from [6d188e7012a0b82f782563b09bbd7adf3f70cf75]
38# to [4a0dcab873559e934e41c5f220b5434d35600d9b]
39#
40============================================================
41--- src/database.cc4c259f963c440fc95564dfec99b2f832f0bad643
42+++ src/database.cc87efeeff2d3263ba98af684a4022f1897434ed2d
43@@ -3425,9 +3425,8 @@ database::encrypt_rsa(key_id const & pub
44 rsa_pub_key pub;
45 get_key(pub_id, pub);
46
47- SecureVector<Botan::byte> pub_block;
48- pub_block.set(reinterpret_cast<Botan::byte const *>(pub().data()),
49- pub().size());
50+ SecureVector<Botan::byte> pub_block
51+ (reinterpret_cast<Botan::byte const *>(pub().data()), pub().size());
52
53 shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
54 shared_ptr<RSA_PublicKey> pub_key
55@@ -3471,14 +3470,13 @@ database::check_signature(key_id const &
56 else
57 {
58 rsa_pub_key pub;
59- SecureVector<Botan::byte> pub_block;
60
61 if (!public_key_exists(id))
62 return cert_unknown;
63
64 get_key(id, pub);
65- pub_block.set(reinterpret_cast<Botan::byte const *>(pub().data()),
66- pub().size());
67+ SecureVector<Botan::byte> pub_block
68+ (reinterpret_cast<Botan::byte const *>(pub().data()), pub().size());
69
70 L(FL("building verifier for %d-byte pub key") % pub_block.size());
71 shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
72============================================================
73--- src/gzip.cce7c19bee910e3d421fd073933810ec52092b1d9b
74+++ src/gzip.ccbab290412cff6031b2d3bf9d1439a08499d39640
75@@ -137,7 +137,7 @@ void Gzip_Compression::start_msg()
76 /*************************************************
77 * Compress Input with Gzip *
78 *************************************************/
79-void Gzip_Compression::write(const byte input[], u32bit length)
80+void Gzip_Compression::write(const byte input[], filter_length_t length)
81 {
82
83 count += length;
84@@ -267,7 +267,7 @@ void Gzip_Decompression::start_msg()
85 /*************************************************
86 * Decompress Input with Gzip *
87 *************************************************/
88-void Gzip_Decompression::write(const byte input[], u32bit length)
89+void Gzip_Decompression::write(const byte input[], filter_length_t length)
90 {
91 if(length) no_writes = false;
92
93@@ -284,8 +284,8 @@ void Gzip_Decompression::write(const byt
94 // Check the gzip header
95 if (pos < sizeof(GZIP::GZIP_HEADER))
96 {
97- u32bit len = std::min((u32bit)sizeof(GZIP::GZIP_HEADER)-pos, length);
98- u32bit cmplen = len;
99+ filter_length_t len = std::min((filter_length_t)sizeof(GZIP::GZIP_HEADER)-pos, length);
100+ filter_length_t cmplen = len;
101 // The last byte is the OS flag - we don't care about that
102 if (pos + len - 1 >= GZIP::HEADER_POS_OS)
103 cmplen--;
104@@ -346,8 +346,14 @@ u32bit Gzip_Decompression::eat_footer(co
105 if (footer.size() >= GZIP::FOOTER_LENGTH)
106 throw Decoding_Error("Gzip_Decompression: Data integrity error in footer");
107
108+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
109+ size_t eat_len = std::min(GZIP::FOOTER_LENGTH-footer.size(),
110+ static_cast<size_t>(length));
111+ footer += std::make_pair(input, eat_len);
112+#else
113 u32bit eat_len = std::min(GZIP::FOOTER_LENGTH-footer.size(), length);
114 footer.append(input, eat_len);
115+#endif
116
117 if (footer.size() == GZIP::FOOTER_LENGTH)
118 {
119@@ -377,7 +383,12 @@ void Gzip_Decompression::check_footer()
120 for (int i = 0; i < 4; i++)
121 buf[3-i] = tmpbuf[i];
122
123+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
124+ tmpbuf.resize(4);
125+ tmpbuf.copy(footer.begin(), 4);
126+#else
127 tmpbuf.set(footer.begin(), 4);
128+#endif
129 if (buf != tmpbuf)
130 throw Decoding_Error("Gzip_Decompression: Data integrity error - CRC32 error");
131
132@@ -412,7 +423,11 @@ void Gzip_Decompression::clear()
133 no_writes = true;
134 inflateReset(&(zlib->stream));
135
136+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
137+ footer.clear();
138+#else
139 footer.destroy();
140+#endif
141 pos = 0;
142 datacount = 0;
143 }
144============================================================
145--- src/gzip.hh649dfc0b250954f39c0f73870f8bec3f32f7fa43
146+++ src/gzip.hhf462dfc1df71ae1e9a8203606fd29d9e0eda9b2a
147@@ -7,6 +7,7 @@
148 #ifndef BOTAN_EXT_GZIP_H__
149 #define BOTAN_EXT_GZIP_H__
150
151+#include <botan/version.h>
152 #include <botan/filter.h>
153 #include <botan/pipe.h>
154
155@@ -30,13 +31,19 @@ namespace GZIP {
156
157 }
158
159+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
160+ typedef size_t filter_length_t;
161+#else
162+ typedef u32bit filter_length_t;
163+#endif
164+
165 /*************************************************
166 * Gzip Compression Filter *
167 *************************************************/
168 class Gzip_Compression : public Filter
169 {
170 public:
171- void write(const byte input[], u32bit length);
172+ void write(const byte input[], filter_length_t length);
173 void start_msg();
174 void end_msg();
175 std::string name() const { return "Gzip_Compression"; }
176@@ -60,7 +67,7 @@ class Gzip_Decompression : public Filter
177 class Gzip_Decompression : public Filter
178 {
179 public:
180- void write(const byte input[], u32bit length);
181+ void write(const byte input[], filter_length_t length);
182 void start_msg();
183 void end_msg();
184 std::string name() const { return "Gzip_Decompression"; }
185============================================================
186--- src/key_packet.ccd1306df89dd684badac02c03744cd446381c07d3
187+++ src/key_packet.ccc97262d161b23c9640972188979669b3e95afe7b
188@@ -106,8 +106,8 @@ namespace
189 void validate_public_key_data(string const & name, string const & keydata) const
190 {
191 string decoded = decode_base64_as<string>(keydata, origin::user);
192- Botan::SecureVector<Botan::byte> key_block;
193- key_block.set(reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
194+ Botan::SecureVector<Botan::byte> key_block
195+ (reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
196 try
197 {
198 Botan::X509::load_key(key_block);
199============================================================
200--- src/key_store.cc64c4c4bed1fadc26b51207b9f61343f9dd7d3c6e
201+++ src/key_store.cc6f2f1e0a60f5ee7d322539ca7a3c0acdc69617d7
202@@ -856,9 +856,9 @@ key_store::make_signature(database & db,
203 {
204 if (agent.connected()) {
205 //grab the monotone public key as an RSA_PublicKey
206- SecureVector<Botan::byte> pub_block;
207- pub_block.set(reinterpret_cast<Botan::byte const *>(key.pub().data()),
208- key.pub().size());
209+ SecureVector<Botan::byte> pub_block
210+ (reinterpret_cast<Botan::byte const *>(key.pub().data()),
211+ key.pub().size());
212 L(FL("make_signature: building %d-byte pub key") % pub_block.size());
213 shared_ptr<X509_PublicKey> x509_key =
214 shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
215@@ -1031,8 +1031,14 @@ key_store_state::migrate_old_key_pair
216 for (;;)
217 try
218 {
219+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
220+ arc4_key.resize(phrase().size());
221+ arc4_key.copy(reinterpret_cast<Botan::byte const *>(phrase().data()),
222+ phrase().size());
223+#else
224 arc4_key.set(reinterpret_cast<Botan::byte const *>(phrase().data()),
225 phrase().size());
226+#endif
227
228 Pipe arc4_decryptor(get_cipher("ARC4", arc4_key, Botan::DECRYPTION));
229
230============================================================
231--- src/monotone.cca25ecdd170a601db798b63a60add7681609a34c4
232+++ src/monotone.cc2c5f57762bc687a90f75e732f39d2181fc50bd6d
233@@ -170,11 +170,16 @@ cpp_main(int argc, char ** argv)
234 // versions, including all of the stable branch 1.8.x.
235 E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,9,0), origin::system,
236 F("this monotone binary does not work with Botan 1.9.x"));
237-#else
238+#elif BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,9,11)
239 E(linked_botan_version > BOTAN_VERSION_CODE_FOR(1,7,22), origin::system,
240 F("this monotone binary requires Botan 1.7.22 or newer"));
241 E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,9,0), origin::system,
242 F("this monotone binary does not work with Botan 1.9.x"));
243+#else
244+ E(linked_botan_version > BOTAN_VERSION_CODE_FOR(1,9,11), origin::system,
245+ F("this monotone binary requires Botan 1.9.11 or newer"));
246+ E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,11,0), origin::system,
247+ F("this monotone binary does not work with Botan 1.11.x"));
248 #endif
249
250 app_state app;
251============================================================
252--- src/packet.ccf61360ed2524fdf53411bd24d022a2a3c9e6e9c7
253+++ src/packet.cc58e2b3070821fb540fc8fe8db92564579a25ce88
254@@ -156,8 +156,8 @@ namespace
255 void validate_public_key_data(string const & name, string const & keydata) const
256 {
257 string decoded = decode_base64_as<string>(keydata, origin::user);
258- Botan::SecureVector<Botan::byte> key_block;
259- key_block.set(reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
260+ Botan::SecureVector<Botan::byte> key_block
261+ (reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
262 try
263 {
264 Botan::X509::load_key(key_block);
265============================================================
266--- src/sha1.cc5e1aa972d7c7d66e06320b039989652b830dcd75
267+++ src/sha1.cc42e48b22fd88b25e0d38d4f91e1f13f8a83c7120
268@@ -50,9 +50,12 @@ CMD_HIDDEN(benchmark_sha1, "benchmark_sh
269 Botan::Default_Benchmark_Timer timer;
270 std::map<std::string, double> results =
271 Botan::algorithm_benchmark("SHA-1", milliseconds, timer, rng, af);
272+#elif BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,9,11)
273+ std::map<std::string, double> results =
274+ Botan::algorithm_benchmark("SHA-1", milliseconds, rng, af);
275 #else
276 std::map<std::string, double> results =
277- Botan::algorithm_benchmark("SHA-1", milliseconds, rng, af);
278+ Botan::algorithm_benchmark("SHA-1", af, rng, milliseconds, 16);
279 #endif
280
281 for(std::map<std::string, double>::const_iterator i = results.begin();
282============================================================
283--- src/ssh_agent.cc6d188e7012a0b82f782563b09bbd7adf3f70cf75
284+++ src/ssh_agent.cc4a0dcab873559e934e41c5f220b5434d35600d9b
285@@ -385,9 +385,9 @@ ssh_agent::has_key(const keypair & key)
286 ssh_agent::has_key(const keypair & key)
287 {
288 //grab the monotone public key as an RSA_PublicKey
289- SecureVector<Botan::byte> pub_block;
290- pub_block.set(reinterpret_cast<Botan::byte const *>((key.pub)().data()),
291- (key.pub)().size());
292+ SecureVector<Botan::byte> pub_block
293+ (reinterpret_cast<Botan::byte const *>((key.pub)().data()),
294+ (key.pub)().size());
295 L(FL("has_key: building %d-byte pub key") % pub_block.size());
296 shared_ptr<X509_PublicKey> x509_key =
297 shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));

Archive Download this file

Attachment to issue 182

Created: 4 years 7 months ago by Martin von Gagern

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status