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

Archive Download this file

Attachment to issue 182

Created: 12 years 7 months ago by Martin von Gagern

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