# # # delete "botan/es_file.cpp" # # delete "botan/es_file.h" # # delete "botan/inifile.cpp" # # add_file "botan/es_dev.cpp" # content [903d37082b372d65135f66cb43f5cfe84f5a930f] # # add_file "botan/es_dev.h" # content [a733463b4efc81e44fa058cc9f496ae6235e0ad2] # # patch "Makefile.am" # from [dfaa00d12056b5dc7a53ea779ba605d890669470] # to [d93d338b348a7a4b2012cfa2b4f91cf27ba5143c] # # patch "NEWS" # from [dd8203903ced79ac590535703f7ce080478bc9d1] # to [d93a68b1714527e32ecc7b0e58f42e8b10ddb26b] # # patch "botan/aes.cpp" # from [90c19327b41ac342532515f8949205302ad89114] # to [64cbb7d0ea9ab07ed15096a583ad4338617dbd59] # # patch "botan/allocate.h" # from [532035d3cdec5a2c8fd3250f87a78fa7f3d77eb4] # to [acaf4aa6a1213de0c71b128d79d4760cdb3159b3] # # patch "botan/asn1_alt.cpp" # from [ac84eab7afc78b1de20140301ee3ba62b976acca] # to [7e8452edabab705665021ecd21f3356fa07d4e3e] # # patch "botan/asn1_ku.cpp" # from [7d55d34b2291f34d75c1f14bbbfecae262e30a65] # to [442eee1c50bbbd7afb22bf2b2e23dd2db39ca218] # # patch "botan/asn1_obj.h" # from [dfbdbae68301d279de67562d713133df1258084c] # to [da21ba3ef127a710bbcf34fe370d4943a49f19cb] # # patch "botan/ber_dec.cpp" # from [d22b06ac717befb508e9dbe7d34bcf5681280287] # to [a7851af3cb4bf32890ffe35296b86c6918864cd8] # # patch "botan/big_base.cpp" # from [e0ee9ef996a0754bd45af121f5199bffff45aed4] # to [dd3002c65862ad61fac7ebd55f5f4835443b2622] # # patch "botan/big_ops2.cpp" # from [48afc3ad1501db0257ff9f9b24ab0ef1cb986165] # to [78437d7c067268e4505881c5ba72b3120de6ebe6] # # patch "botan/bit_ops.cpp" # from [d42b4bc18f574f8b848335613aa7b102868dcc59] # to [ebab53284a6ab9a749188fcbe417c8dcc73ac052] # # patch "botan/bit_ops.h" # from [77538dc92d95bf5bdca68230ea5626bf117c7994] # to [ace888ad7c2755ca077461722e24cb1a422a2ed5] # # patch "botan/buf_es.cpp" # from [0662ad86a41b68df7d8ca64b4f8fd944c558fa8f] # to [cd4e86efa29384aae6f685444297076319ba3490] # # patch "botan/build.h" # from [2239983ea39c409b32f0e0722d4f99bba86a87e9] # to [c0d1fe737887005a2d8b6b7a0547af2d8d1df568] # # patch "botan/crc32.cpp" # from [2ee196e8c63de2044782412cb88b5961603a4eea] # to [31b788eb10e2fcd3ac69880f24f9c02a72a85fa5] # # patch "botan/credits.txt" # from [9d06d23a922b731a18611d1935f3d5379d267346] # to [562b9695183b67e72232e6068b66c2d5a14c12bb] # # patch "botan/defalloc.cpp" # from [940db8ef03ae170341d257f9f7e4320ee3938935] # to [e51a9fe4f6a6e191818c3e968213cc58e98cc6c2] # # patch "botan/defalloc.h" # from [ef3958943a473c5a5068dbf77eae02e7cafa55fa] # to [e7507091a397628e401de0bd41be48bbbf929ff9] # # patch "botan/der_enc.cpp" # from [431f71f58e378c7de52d0f540e5271fe705f5e65] # to [44385fc6ff987d9e3025d291cff3fa18faf7de2d] # # patch "botan/des.cpp" # from [b4b952183124098874fc21851366dfec58fdd8de] # to [5f7b629ff5ba2cf0374defe0ec88e7ef16761422] # # patch "botan/dsa_gen.cpp" # from [71213b478a52c337f6aad69d3942bdcb51193e3e] # to [c1a6e61bf86dc05674879f70d6b34f55338ba2b4] # # patch "botan/es_egd.cpp" # from [39d2684aac4c7a382253daf8e50b1c00d797d437] # to [e68c9f084c8c7b175f347363a848824f718fd19e] # # patch "botan/hex.cpp" # from [e49d63031296f49e80205e2e18bf56cc9097ac41] # to [82a0b2616131326ade86372d7a688fc5089e8466] # # patch "botan/init.h" # from [4e6621c7bdf9dd3e309d28456d06cafaebf16029] # to [1844022acd8847f03728c907a4d390b7114af216] # # patch "botan/init_def.cpp" # from [032c0a1f7bd132c86506da3f4756a1f39a49e6aa] # to [4bd85664ecd76d33293aed8ba67da930cc08121a] # # patch "botan/init_opt.cpp" # from [b66c0ecf18aa8f66a11ffbef319395e5323c69ea] # to [9a0e31808f088cb63f2ec8563d937a69421f795f] # # patch "botan/kdf.cpp" # from [5a8a42038d9d402727e6ca1b11d0244954137a32] # to [51328f78da34fe2b8884e085cca87e3c1c4e7a5b] # # patch "botan/libstate.cpp" # from [233c9231a05eae79ae231f8136850b43c34914d3] # to [4cc7325e854efc2351e4f1e0726092e5d8fb760f] # # patch "botan/mdx_hash.cpp" # from [7e90baec5a8465c7405841bc2d1075fde1165797] # to [dfd1108e0b1c47cfea3d7c455483039fee5423b8] # # patch "botan/mem_pool.cpp" # from [399aa8cd9dac6bce28a803b11a262d5e6d1b3fcb] # to [6d123c425e59539c197b86596c4a2c01c1ba6757] # # patch "botan/mgf1.cpp" # from [833bdd2150cc0db702b39bc4d799426504dda7d5] # to [9a3f3843edef84efab329e1ab7b52a244ee4feca] # # patch "botan/modules.cpp" # from [310f410a77f14f2b559a24a0a00821880205b6c8] # to [d5fbabe263e5a39b8a85adf8a5084ec28405ee64] # # patch "botan/mp_mul.cpp" # from [dafb1262e69f06c17fe781aea9c7ed04ef789829] # to [4801f41f564dbaf9a3a0bacb03ad795f94c4a27b] # # patch "botan/parsing.cpp" # from [4c423baf1e0e9ba8d65a5feda7eb79e6be6fe445] # to [87ed49975088808462d85302cefc5b363fcc5754] # # patch "botan/parsing.h" # from [d706a1c3fe72a2466149994e8e3a256b243514f5] # to [461ef25f0cb18bb10c980d97d9fb0351081b2310] # # patch "botan/pkcs5.cpp" # from [74572fee997b93c59ca6e747e0d7f14b1ca47a46] # to [613526700b03c08fed46fbb63192a7cf213c2bb2] # # patch "botan/policy.cpp" # from [979a989d26dd9cbc7a01e489136831c7c8ea5bc2] # to [1cbaa37581f2e3a3cc3388766eb0f57f92c16a92] # # patch "botan/prf_x942.cpp" # from [94d6c065c580325db247150d2bce204a1b3e51ee] # to [e1877085d765ac659d96c0a7b20cca43de558022] # # patch "botan/pubkey.cpp" # from [413323d6652270bf268b614a10443c86987fddb9] # to [01bb597aad00093d35f276672867b87cc30bb6b4] # # patch "botan/randpool.cpp" # from [dcfe978754894d39838888a39221519c5ca9b260] # to [cf40501448e5f6f3bcaa3d00b43dd3cc33c39170] # # patch "botan/reducer.cpp" # from [cbb17f184cc998fba5ca47c08ae25423826c7bf3] # to [74e281342c802809f6fd56caaa75a3be2b06b3e2] # # patch "botan/sha160.cpp" # from [7f151f0f0f0f3c5358f422625c85d9fbfbc2520f] # to [1e4669389c7963842f6a1da3e247f9b4ff0924d8] # # patch "botan/sha256.cpp" # from [c301182d8aaf2804b5c52543987d0bd713acd7e2] # to [dd26a6d28f8a614772afa56b98b9807e00f41df4] # # patch "botan/x509cert.cpp" # from [d5de5f096e8a47ab498b0b0d90042775c3a1c0fa] # to [f0061d4c02f30534521000d90299395feff1172f] # # patch "botan/x509self.cpp" # from [5f92488b35e43625413b0215aac9d1f46a1d7a99] # to [91acdb2db0e5bc5b678bf758ca05bfc385604b9a] # # patch "botan/x509self.h" # from [9aac88cb666ace50f762e4371408402e4618b33f] # to [08a310e8d92f3897b2b1e62f4177b44cd615c195] # # patch "gzip.cc" # from [4afdc6ca701b77c1184cea944e1711fd7beb127d] # to [93f149779d9f0132940a206e008eeef3ca618b92] # ============================================================ --- botan/es_dev.cpp 903d37082b372d65135f66cb43f5cfe84f5a930f +++ botan/es_dev.cpp 903d37082b372d65135f66cb43f5cfe84f5a930f @@ -0,0 +1,118 @@ +/************************************************* +* Device EntropySource Source File * +* (C) 1999-2007 The Botan Project * +*************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +namespace Botan { + +namespace { + +/************************************************* +* A class handling reading from a device * +*************************************************/ +class Device_Reader + { + public: + typedef int fd_type; + + Device_Reader(fd_type device_fd) : fd(device_fd) {} + ~Device_Reader() { ::close(fd); } + u32bit get(byte out[], u32bit length); + + static fd_type open(const std::string& pathname); + private: + fd_type fd; + }; + +/************************************************* +* Read from a device file * +*************************************************/ +u32bit Device_Reader::get(byte out[], u32bit length) + { + if(fd < 0) + return 0; + + if(fd >= FD_SETSIZE) + return 0; + + const u32bit READ_WAIT_MS = 10; + + fd_set read_set; + FD_ZERO(&read_set); + FD_SET(fd, &read_set); + + struct ::timeval timeout; + timeout.tv_sec = 0; + timeout.tv_usec = READ_WAIT_MS * 1000; + + if(::select(fd + 1, &read_set, 0, 0, &timeout) < 0) + return 0; + + if(!(FD_ISSET(fd, &read_set))) + return 0; + + const ssize_t got = ::read(fd, out, length); + if(got <= 0) + return 0; + + const u32bit ret = static_cast(got); + + if(ret > length) + return 0; + + return ret; + } + +/************************************************* +* Attempt to open a device * +*************************************************/ +int Device_Reader::open(const std::string& pathname) + { +#ifndef O_NONBLOCK + #define O_NONBLOCK 0 +#endif + +#ifndef O_NOCTTY + #define O_NOCTTY 0 +#endif + + const int flags = O_RDONLY | O_NONBLOCK | O_NOCTTY; + return ::open(pathname.c_str(), flags); + } + +} + +/************************************************* +* Gather entropy from a RNG device * +*************************************************/ +u32bit Device_EntropySource::slow_poll(byte output[], u32bit length) + { + std::vector sources = + global_config().option_as_list("rng/es_files"); + + u32bit read = 0; + + for(size_t j = 0; j != sources.size(); ++j) + { + const std::string source = sources[j]; + + Device_Reader reader(Device_Reader::open(source)); + + read += reader.get(output + read, length - read); + + if(read == length) + break; + } + + return read; + } + +} ============================================================ --- botan/es_dev.h a733463b4efc81e44fa058cc9f496ae6235e0ad2 +++ botan/es_dev.h a733463b4efc81e44fa058cc9f496ae6235e0ad2 @@ -0,0 +1,24 @@ +/************************************************* +* Device EntropySource Header File * +* (C) 1999-2007 The Botan Project * +*************************************************/ + +#ifndef BOTAN_ENTROPY_SRC_DEVICE_H__ +#define BOTAN_ENTROPY_SRC_DEVICE_H__ + +#include + +namespace Botan { + +/************************************************* +* Device Based Entropy Source * +*************************************************/ +class Device_EntropySource : public EntropySource + { + public: + u32bit slow_poll(byte[], u32bit); + }; + +} + +#endif ============================================================ --- Makefile.am dfaa00d12056b5dc7a53ea779ba605d890669470 +++ Makefile.am d93d338b348a7a4b2012cfa2b4f91cf27ba5143c @@ -123,12 +123,12 @@ BOTAN_SOURCES = \ botan/dlies.cpp botan/eax.cpp botan/ecb.cpp botan/eme1.cpp \ botan/eme_pkcs.cpp botan/emsa1.cpp botan/emsa2.cpp \ botan/emsa3.cpp botan/emsa4.cpp botan/emsa_raw.cpp \ - botan/eng_base.cpp botan/engine.cpp botan/es_file.cpp \ + botan/eng_base.cpp botan/engine.cpp botan/es_dev.cpp \ botan/exceptn.cpp botan/filter.cpp botan/filters.cpp \ botan/fips140.cpp \ botan/get_algo.cpp botan/get_enc.cpp botan/get_pbe.cpp \ botan/hash_id.cpp botan/hex.cpp botan/hmac.cpp \ - botan/if_algo.cpp botan/inifile.cpp botan/init_def.cpp \ + botan/if_algo.cpp botan/init_def.cpp \ botan/kdf.cpp botan/keypair.cpp botan/look_pk.cpp \ botan/make_prm.cpp botan/mdx_hash.cpp \ botan/mem_pool.cpp botan/mgf1.cpp botan/mlock.cpp \ @@ -182,7 +182,7 @@ BOTAN_SOURCES = \ botan/hmac.h botan/mp_core.h botan/pkcs10.h botan/sha160.h \ botan/crl_ent.h botan/emsa.h botan/eng_def.h \ botan/if_algo.h botan/pkcs8.h \ - botan/basefilt.h botan/ctr.h botan/engine.h \ + botan/basefilt.h botan/ctr.h botan/engine.h botan/es_dev.h \ botan/init.h botan/mp_types.h botan/pk_filts.h botan/symkey.h \ botan/base.h botan/cts.h botan/enums.h botan/kdf.h \ botan/mutex.h botan/pk_keys.h botan/timers.h botan/ber_dec.h \ @@ -190,7 +190,7 @@ BOTAN_SOURCES = \ botan/numthry.h botan/pk_ops.h botan/types.h botan/bigint.h \ botan/data_src.h botan/es_egd.h botan/look_add.h botan/ofb.h \ botan/pk_util.h botan/ui.h botan/blinding.h botan/defalloc.h \ - botan/es_file.h botan/look_pk.h botan/oids.h botan/pubkey.h \ + botan/look_pk.h botan/oids.h botan/pubkey.h \ botan/util.h botan/charset.h botan/hash_id.h \ botan/des.h botan/pkcs5.h \ botan/x931_rng.h botan/sha256.h \ ============================================================ --- NEWS dd8203903ced79ac590535703f7ce080478bc9d1 +++ NEWS d93a68b1714527e32ecc7b0e58f42e8b10ddb26b @@ -50,6 +50,10 @@ directories. The typical case of listing files that need attention now runs at least four times faster. + Internal + + - Update Botan to 1.7.3. + Wed Dec 12 21:21:15 UTC 2007 0.38 release. ============================================================ --- botan/aes.cpp 90c19327b41ac342532515f8949205302ad89114 +++ botan/aes.cpp 64cbb7d0ea9ab07ed15096a583ad4338617dbd59 @@ -1,9 +1,10 @@ /************************************************* * AES Source File * * (C) 1999-2007 The Botan Project * *************************************************/ #include +#include #include namespace Botan { ============================================================ --- botan/allocate.h 532035d3cdec5a2c8fd3250f87a78fa7f3d77eb4 +++ botan/allocate.h acaf4aa6a1213de0c71b128d79d4760cdb3159b3 @@ -12,7 +12,7 @@ namespace Botan { namespace Botan { /************************************************* -* Allocator * +* Allocator Interface * *************************************************/ class Allocator { @@ -30,10 +30,6 @@ class Allocator virtual ~Allocator() {} }; -/************************************************* -* Get an allocator * -*************************************************/ - } #endif ============================================================ --- botan/asn1_alt.cpp ac84eab7afc78b1de20140301ee3ba62b976acca +++ botan/asn1_alt.cpp 7e8452edabab705665021ecd21f3356fa07d4e3e @@ -9,6 +9,8 @@ #include #include #include +#include +#include namespace Botan { @@ -17,11 +19,13 @@ AlternativeName::AlternativeName(const s *************************************************/ AlternativeName::AlternativeName(const std::string& email_addr, const std::string& uri, - const std::string& dns) + const std::string& dns, + const std::string& ip) { add_attribute("RFC822", email_addr); add_attribute("DNS", dns); add_attribute("URI", uri); + add_attribute("IP", ip); } /************************************************* @@ -109,8 +113,18 @@ void encode_entries(DER_Encoder& encoder std::pair range = attr.equal_range(type); for(iter j = range.first; j != range.second; ++j) { - ASN1_String asn1_string(j->second, IA5_STRING); - encoder.add_object(tagging, CONTEXT_SPECIFIC, asn1_string.iso_8859()); + if(type == "RFC822" || type == "DNS" || type == "URI") + { + ASN1_String asn1_string(j->second, IA5_STRING); + encoder.add_object(tagging, CONTEXT_SPECIFIC, asn1_string.iso_8859()); + } + else if(type == "IP") + { + u32bit ip = string_to_ipv4(j->second); + byte ip_buf[4] = { 0 }; + store_be(ip, ip_buf); + encoder.add_object(tagging, CONTEXT_SPECIFIC, ip_buf, 4); + } } } @@ -126,6 +140,7 @@ void AlternativeName::encode_into(DER_En encode_entries(der, alt_info, "RFC822", ASN1_Tag(1)); encode_entries(der, alt_info, "DNS", ASN1_Tag(2)); encode_entries(der, alt_info, "URI", ASN1_Tag(6)); + encode_entries(der, alt_info, "IP", ASN1_Tag(7)); std::multimap::const_iterator i; for(i = othernames.begin(); i != othernames.end(); ++i) @@ -195,6 +210,14 @@ void AlternativeName::decode_from(BER_De if(tag == 2) add_attribute("DNS", value); if(tag == 6) add_attribute("URI", value); } + else if(tag == 7) + { + if(obj.value.size() == 4) + { + u32bit ip = load_be(obj.value.begin(), 0); + add_attribute("IP", ipv4_to_string(ip)); + } + } } } ============================================================ --- botan/asn1_ku.cpp 7d55d34b2291f34d75c1f14bbbfecae262e30a65 +++ botan/asn1_ku.cpp 442eee1c50bbbd7afb22bf2b2e23dd2db39ca218 @@ -6,7 +6,6 @@ #include #include #include -#include namespace Botan { ============================================================ --- botan/asn1_obj.h dfbdbae68301d279de67562d713133df1258084c +++ botan/asn1_obj.h da21ba3ef127a710bbcf34fe370d4943a49f19cb @@ -129,7 +129,7 @@ class AlternativeName : public ASN1_Obje bool has_items() const; AlternativeName(const std::string& = "", const std::string& = "", - const std::string& = ""); + const std::string& = "", const std::string& = ""); private: std::multimap alt_info; std::multimap othernames; ============================================================ --- botan/ber_dec.cpp d22b06ac717befb508e9dbe7d34bcf5681280287 +++ botan/ber_dec.cpp a7851af3cb4bf32890ffe35296b86c6918864cd8 @@ -5,7 +5,7 @@ #include #include -#include +#include namespace Botan { ============================================================ --- botan/big_base.cpp e0ee9ef996a0754bd45af121f5199bffff45aed4 +++ botan/big_base.cpp dd3002c65862ad61fac7ebd55f5f4835443b2622 @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include ============================================================ --- botan/big_ops2.cpp 48afc3ad1501db0257ff9f9b24ab0ef1cb986165 +++ botan/big_ops2.cpp 78437d7c067268e4505881c5ba72b3120de6ebe6 @@ -1,13 +1,11 @@ /************************************************* * BigInt Assignment Operators Source File * * (C) 1999-2007 The Botan Project * *************************************************/ #include -#include #include #include -#include #include namespace Botan { ============================================================ --- botan/bit_ops.cpp d42b4bc18f574f8b848335613aa7b102868dcc59 +++ botan/bit_ops.cpp ebab53284a6ab9a749188fcbe417c8dcc73ac052 @@ -1,14 +1,15 @@ /************************************************* * Bit/Word Operations Source File * * (C) 1999-2007 The Botan Project * *************************************************/ #include +#include namespace Botan { /************************************************* -* XOR arrays together * +* Array XOR * *************************************************/ void xor_buf(byte data[], const byte mask[], u32bit length) { @@ -24,6 +25,9 @@ void xor_buf(byte data[], const byte mas data[j] ^= mask[j]; } +/************************************************* +* Array XOR * +*************************************************/ void xor_buf(byte out[], const byte in[], const byte mask[], u32bit length) { while(length >= 8) @@ -39,6 +43,35 @@ void xor_buf(byte out[], const byte in[] } /************************************************* +* Reverse bytes * +*************************************************/ +u16bit reverse_bytes(u16bit input) + { + return rotate_left(input, 8); + } + +/************************************************* +* Reverse bytes * +*************************************************/ +u32bit reverse_bytes(u32bit input) + { + input = ((input & 0xFF00FF00) >> 8) | ((input & 0x00FF00FF) << 8); + return rotate_left(input, 16); + } + +/************************************************* +* Reverse bytes * +*************************************************/ +u64bit reverse_bytes(u64bit input) + { + input = ((input & 0xFF00FF00FF00FF00) >> 8) | + ((input & 0x00FF00FF00FF00FF) << 8); + input = ((input & 0xFFFF0000FFFF0000) >> 16) | + ((input & 0x0000FFFF0000FFFF) << 16); + return rotate_left(input, 32); + } + +/************************************************* * Return true iff arg is 2**n for some n > 0 * *************************************************/ bool power_of_2(u64bit arg) ============================================================ --- botan/bit_ops.h 77538dc92d95bf5bdca68230ea5626bf117c7994 +++ botan/bit_ops.h ace888ad7c2755ca077461722e24cb1a422a2ed5 @@ -7,7 +7,6 @@ #define BOTAN_BIT_OPS_H__ #include -#include namespace Botan { @@ -25,13 +24,20 @@ template inline T rotate_rig } /************************************************* -* XOR Functions * +* Byteswap * *************************************************/ +u16bit reverse_bytes(u16bit); +u32bit reverse_bytes(u32bit); +u64bit reverse_bytes(u64bit); + +/************************************************* +* Array XOR * +*************************************************/ void xor_buf(byte[], const byte[], u32bit); void xor_buf(byte[], const byte[], const byte[], u32bit); /************************************************* -* Misc Utility Functions * +* Simple Bit Manipulation * *************************************************/ bool power_of_2(u64bit); u32bit high_bit(u64bit); ============================================================ --- botan/buf_es.cpp 0662ad86a41b68df7d8ca64b4f8fd944c558fa8f +++ botan/buf_es.cpp cd4e86efa29384aae6f685444297076319ba3490 @@ -36,6 +36,7 @@ u32bit Buffered_EntropySource::slow_poll u32bit Buffered_EntropySource::slow_poll(byte out[], u32bit length) { do_slow_poll(); + done_slow_poll = true; return copy_out(out, length, buffer.size()); } @@ -53,6 +54,7 @@ void Buffered_EntropySource::add_bytes(c void Buffered_EntropySource::add_bytes(const void* entropy_ptr, u32bit length) { const byte* bytes = static_cast(entropy_ptr); + while(length) { u32bit copied = std::min(length, buffer.size() - write_pos); ============================================================ --- botan/build.h 2239983ea39c409b32f0e0722d4f99bba86a87e9 +++ botan/build.h c0d1fe737887005a2d8b6b7a0547af2d8d1df568 @@ -16,4 +16,8 @@ #define BOTAN_KARAT_MUL_THRESHOLD 12 #define BOTAN_KARAT_SQR_THRESHOLD 12 +#ifndef WIN32 +#define BOTAN_EXT_ENTROPY_SRC_DEVICE #endif + +#endif ============================================================ --- botan/crc32.cpp 2ee196e8c63de2044782412cb88b5961603a4eea +++ botan/crc32.cpp 31b788eb10e2fcd3ac69880f24f9c02a72a85fa5 @@ -1,10 +1,10 @@ /************************************************* * CRC32 Source File * * (C) 1999-2007 The Botan Project * *************************************************/ #include -#include +#include namespace Botan { ============================================================ --- botan/credits.txt 9d06d23a922b731a18611d1935f3d5379d267346 +++ botan/credits.txt 562b9695183b67e72232e6068b66c2d5a14c12bb @@ -20,6 +20,7 @@ N: Yves Jerschow E: address@hidden D: Optimizations for memory load/store and HMAC +D: Support for IPv4 addresses in X.509 alternative names S: Germany N: Matt Johnston @@ -42,5 +43,5 @@ N: Luca Piccarreta E: address@hidden -D: x86/amd64 assembler, BigInt optimizations, Win32 mutex +D: x86/amd64 assembler, BigInt optimizations, Win32 mutex module S: Italy ============================================================ --- botan/defalloc.cpp 940db8ef03ae170341d257f9f7e4320ee3938935 +++ botan/defalloc.cpp e51a9fe4f6a6e191818c3e968213cc58e98cc6c2 @@ -50,7 +50,7 @@ void do_free(void* ptr, u32bit n, bool d /************************************************* * Malloc_Allocator's Allocation * *************************************************/ -void* Malloc_Allocator::alloc_block(u32bit n) +void* Malloc_Allocator::allocate(u32bit n) { return do_malloc(n, false); } @@ -58,7 +58,7 @@ void* Malloc_Allocator::alloc_block(u32b /************************************************* * Malloc_Allocator's Deallocation * *************************************************/ -void Malloc_Allocator::dealloc_block(void* ptr, u32bit n) +void Malloc_Allocator::deallocate(void* ptr, u32bit n) { do_free(ptr, n, false); } ============================================================ --- botan/defalloc.h ef3958943a473c5a5068dbf77eae02e7cafa55fa +++ botan/defalloc.h e7507091a397628e401de0bd41be48bbbf929ff9 @@ -13,14 +13,13 @@ namespace Botan { /************************************************* * Malloc Allocator * *************************************************/ -class Malloc_Allocator : public Pooling_Allocator +class Malloc_Allocator : public Allocator { public: - Malloc_Allocator() : Pooling_Allocator(64*1024, false) {} + void* allocate(u32bit); + void deallocate(void*, u32bit); + std::string type() const { return "malloc"; } - private: - void* alloc_block(u32bit); - void dealloc_block(void*, u32bit); }; /************************************************* ============================================================ --- botan/der_enc.cpp 431f71f58e378c7de52d0f540e5271fe705f5e65 +++ botan/der_enc.cpp 44385fc6ff987d9e3025d291cff3fa18faf7de2d @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include ============================================================ --- botan/des.cpp b4b952183124098874fc21851366dfec58fdd8de +++ botan/des.cpp 5f7b629ff5ba2cf0374defe0ec88e7ef16761422 @@ -1,9 +1,10 @@ /************************************************* * DES Source File * * (C) 1999-2007 The Botan Project * *************************************************/ #include +#include #include namespace Botan { ============================================================ --- botan/dsa_gen.cpp 71213b478a52c337f6aad69d3942bdcb51193e3e +++ botan/dsa_gen.cpp c1a6e61bf86dc05674879f70d6b34f55338ba2b4 @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include ============================================================ --- botan/es_egd.cpp 39d2684aac4c7a382253daf8e50b1c00d797d437 +++ botan/es_egd.cpp e68c9f084c8c7b175f347363a848824f718fd19e @@ -52,25 +52,25 @@ u32bit EGD_EntropySource::do_poll(byte o throw Exception("EGD_EntropySource: Socket path is too long"); std::strcpy(addr.sun_path, path.c_str()); - int fd = socket(addr.sun_family, SOCK_STREAM, 0); + int fd = ::socket(addr.sun_family, SOCK_STREAM, 0); if(fd == -1) return 0; int len = sizeof(addr.sun_family) + std::strlen(addr.sun_path) + 1; - if(connect(fd, (struct sockaddr*)&addr, len)) - { close(fd); return 0; } + if(::connect(fd, reinterpret_cast(&addr), len)) + { ::close(fd); return 0; } byte buffer[2]; buffer[0] = 1; buffer[1] = static_cast(length); - if(write(fd, buffer, 2) != 2) { close(fd); return 0; } - if(read(fd, buffer, 1) != 1) { close(fd); return 0; } + if(::write(fd, buffer, 2) != 2) { ::close(fd); return 0; } + if(::read(fd, buffer, 1) != 1) { ::close(fd); return 0; } - ssize_t count = read(fd, output, buffer[0]); + ssize_t count = ::read(fd, output, buffer[0]); if(count == -1) { close(fd); return 0; } - close(fd); + ::close(fd); return count; } ============================================================ --- botan/hex.cpp e49d63031296f49e80205e2e18bf56cc9097ac41 +++ botan/hex.cpp 82a0b2616131326ade86372d7a688fc5089e8466 @@ -1,10 +1,9 @@ /************************************************* * Hex Encoder/Decoder Source File * * (C) 1999-2007 The Botan Project * *************************************************/ #include -#include #include #include #include ============================================================ --- botan/init.h 4e6621c7bdf9dd3e309d28456d06cafaebf16029 +++ botan/init.h 1844022acd8847f03728c907a4d390b7114af216 @@ -24,8 +24,6 @@ class InitializerOptions bool fips_mode() const; bool self_test() const; - std::string config_file() const; - InitializerOptions(const std::string&); private: std::map args; ============================================================ --- botan/init_def.cpp 032c0a1f7bd132c86506da3f4756a1f39a49e6aa +++ botan/init_def.cpp 4bd85664ecd76d33293aed8ba67da930cc08121a @@ -6,7 +6,6 @@ #include #include #include -#include namespace Botan { @@ -21,12 +20,6 @@ void LibraryInitializer::initialize(cons set_global_state(new Library_State); global_state().initialize(args, modules); - - if(args.fips_mode() || args.self_test()) - { - if(!FIPS140::passes_self_tests()) - throw Self_Test_Failure("FIPS-140 startup tests"); - } } catch(...) { ============================================================ --- botan/init_opt.cpp b66c0ecf18aa8f66a11ffbef319395e5323c69ea +++ botan/init_opt.cpp 9a0e31808f088cb63f2ec8563d937a69421f795f @@ -86,15 +86,6 @@ bool InitializerOptions::self_test() con } /************************************************* -* Return the config file to load, if any * -*************************************************/ -std::string InitializerOptions::config_file() const - { - std::map::const_iterator i = args.find("config"); - return (i != args.end()) ? i->second : ""; - } - -/************************************************* * Setup an InitializerOptions * *************************************************/ InitializerOptions::InitializerOptions(const std::string& arg_string) ============================================================ --- botan/kdf.cpp 5a8a42038d9d402727e6ca1b11d0244954137a32 +++ botan/kdf.cpp 51328f78da34fe2b8884e085cca87e3c1c4e7a5b @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include ============================================================ --- botan/libstate.cpp 233c9231a05eae79ae231f8136850b43c34914d3 +++ botan/libstate.cpp 4cc7325e854efc2351e4f1e0726092e5d8fb760f @@ -13,6 +13,7 @@ #include #include #include +#include #include namespace Botan { @@ -339,9 +340,6 @@ void Library_State::initialize(const Ini timer = modules.timer(); transcoder = modules.transcoder(); - if(args.config_file() != "") - config().load_inifile(args.config_file()); - locks["settings"] = get_mutex(); locks["allocator"] = get_mutex(); locks["rng"] = get_mutex(); @@ -378,6 +376,12 @@ void Library_State::initialize(const Ini if(!rng_is_seeded()) throw PRNG_Unseeded("Unable to collect sufficient entropy"); } + + if(args.fips_mode() || args.self_test()) + { + if(!FIPS140::passes_self_tests()) + throw Self_Test_Failure("FIPS-140 startup tests"); + } } /************************************************* ============================================================ --- botan/mdx_hash.cpp 7e90baec5a8465c7405841bc2d1075fde1165797 +++ botan/mdx_hash.cpp dfd1108e0b1c47cfea3d7c455483039fee5423b8 @@ -1,10 +1,10 @@ /************************************************* * MDx Hash Function Source File * * (C) 1999-2007 The Botan Project * *************************************************/ #include -#include +#include namespace Botan { ============================================================ --- botan/mem_pool.cpp 399aa8cd9dac6bce28a803b11a262d5e6d1b3fcb +++ botan/mem_pool.cpp 6d123c425e59539c197b86596c4a2c01c1ba6757 @@ -6,7 +6,6 @@ #include #include #include -#include #include #include ============================================================ --- botan/mgf1.cpp 833bdd2150cc0db702b39bc4d799426504dda7d5 +++ botan/mgf1.cpp 9a3f3843edef84efab329e1ab7b52a244ee4feca @@ -5,6 +5,7 @@ #include #include +#include #include #include #include ============================================================ --- botan/modules.cpp 310f410a77f14f2b559a24a0a00821880205b6c8 +++ botan/modules.cpp d5fbabe263e5a39b8a85adf8a5084ec28405ee64 @@ -7,7 +7,6 @@ #include #include #include -#include #include #if defined(BOTAN_EXT_MUTEX_PTHREAD) @@ -48,6 +47,10 @@ #include #endif +#if defined(BOTAN_EXT_ENTROPY_SRC_DEVICE) + #include +#endif + #if defined(BOTAN_EXT_ENTROPY_SRC_EGD) #include #endif @@ -149,8 +152,6 @@ std::vector Builtin_Modu { std::vector sources; - sources.push_back(new File_EntropySource); - #if defined(BOTAN_EXT_ENTROPY_SRC_AEP) sources.push_back(new AEP_EntropySource); #endif @@ -159,6 +160,10 @@ std::vector Builtin_Modu sources.push_back(new EGD_EntropySource); #endif +#if defined(BOTAN_EXT_ENTROPY_SRC_DEVICE) + sources.push_back(new Device_EntropySource); +#endif + #if defined(BOTAN_EXT_ENTROPY_SRC_CAPI) sources.push_back(new Win32_CAPI_EntropySource); #endif ============================================================ --- botan/mp_mul.cpp dafb1262e69f06c17fe781aea9c7ed04ef789829 +++ botan/mp_mul.cpp 4801f41f564dbaf9a3a0bacb03ad795f94c4a27b @@ -95,8 +95,8 @@ u32bit karatsuba_size(u32bit z_size, ((y_size == y_sw) && (y_size % 2))) return 0; - u32bit start = (x_sw > y_sw) ? x_sw : y_sw; - u32bit end = (x_size < y_size) ? x_size : y_size; + const u32bit start = (x_sw > y_sw) ? x_sw : y_sw; + const u32bit end = (x_size < y_size) ? x_size : y_size; if(start == end) { ============================================================ --- botan/parsing.cpp 4c423baf1e0e9ba8d65a5feda7eb79e6be6fe445 +++ botan/parsing.cpp 87ed49975088808462d85302cefc5b363fcc5754 @@ -6,6 +6,7 @@ #include #include #include +#include namespace Botan { @@ -30,7 +31,6 @@ u32bit to_u32bit(const std::string& numb return n; } - /************************************************* * Convert an integer into a string * *************************************************/ @@ -238,4 +238,46 @@ u32bit parse_expr(const std::string& exp return to_u32bit(expr); } +/************************************************* +* Convert a decimal-dotted string to binary IP * +*************************************************/ +u32bit string_to_ipv4(const std::string& str) + { + std::vector parts = split_on(str, '.'); + + if(parts.size() != 4) + throw Decoding_Error("Invalid IP string " + str); + + u32bit ip = 0; + + for(size_t j = 0; j != parts.size(); j++) + { + u32bit octet = to_u32bit(parts[j]); + + if(octet > 255) + throw Decoding_Error("Invalid IP string " + str); + + ip = (ip << 8) | (octet & 0xFF); + } + + return ip; + } + +/************************************************* +* Convert an IP address to decimal-dotted string * +*************************************************/ +std::string ipv4_to_string(u32bit ip) + { + std::string str; + + for(size_t j = 0; j != sizeof(ip); j++) + { + if(j) + str += "."; + str += to_string(get_byte(j, ip)); + } + + return str; + } + } ============================================================ --- botan/parsing.h d706a1c3fe72a2466149994e8e3a256b243514f5 +++ botan/parsing.h 461ef25f0cb18bb10c980d97d9fb0351081b2310 @@ -27,6 +27,12 @@ u32bit to_u32bit(const std::string&); std::string to_string(u64bit, u32bit = 0); u32bit to_u32bit(const std::string&); +/************************************************* +* String/Network Address Conversions * +*************************************************/ +u32bit string_to_ipv4(const std::string&); +std::string ipv4_to_string(u32bit); + } #endif ============================================================ --- botan/pkcs5.cpp 74572fee997b93c59ca6e747e0d7f14b1ca47a46 +++ botan/pkcs5.cpp 613526700b03c08fed46fbb63192a7cf213c2bb2 @@ -5,6 +5,7 @@ #include #include +#include #include #include #include ============================================================ --- botan/policy.cpp 979a989d26dd9cbc7a01e489136831c7c8ea5bc2 +++ botan/policy.cpp 1cbaa37581f2e3a3cc3388766eb0f57f92c16a92 @@ -228,8 +228,8 @@ void set_default_config(Config& config) config.set_option("pem/width", "64"); config.set_option("rng/ms_capi_prov_type", "INTEL_SEC:RSA_FULL"); - config.set_option("rng/unix_path", "/usr/ucb:/usr/etc:/etc"); - config.set_option("rng/es_files", "/dev/urandom:/dev/random"); + config.set_option("rng/unix_path", "/bin:/sbin:/usr/bin:/usr/sbin"); + config.set_option("rng/es_files", "/dev/random:/dev/srandom:/dev/urandom"); config.set_option("rng/egd_path", "/var/run/egd-pool:/dev/egd-pool"); config.set_option("rng/slow_poll_request", "256"); ============================================================ --- botan/prf_x942.cpp 94d6c065c580325db247150d2bce204a1b3e51ee +++ botan/prf_x942.cpp e1877085d765ac659d96c0a7b20cca43de558022 @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include @@ -40,7 +40,7 @@ SecureVector X942_PRF::derive(u32b SecureVector key; u32bit counter = 1; - while(key.size() != key_len) + while(key.size() != key_len && counter) { hash->update(secret, secret_len); ============================================================ --- botan/pubkey.cpp 413323d6652270bf268b614a10443c86987fddb9 +++ botan/pubkey.cpp 01bb597aad00093d35f276672867b87cc30bb6b4 @@ -1,15 +1,15 @@ /************************************************* * Public Key Base Source File * * (C) 1999-2007 The Botan Project * *************************************************/ #include +#include #include #include #include #include #include -#include #include namespace Botan { ============================================================ --- botan/randpool.cpp dcfe978754894d39838888a39221519c5ca9b260 +++ botan/randpool.cpp cf40501448e5f6f3bcaa3d00b43dd3cc33c39170 @@ -5,12 +5,11 @@ #include #include +#include #include #include #include -#include - namespace Botan { namespace { ============================================================ --- botan/reducer.cpp cbb17f184cc998fba5ca47c08ae25423826c7bf3 +++ botan/reducer.cpp 74e281342c802809f6fd56caaa75a3be2b06b3e2 @@ -1,10 +1,9 @@ /************************************************* * Modular Reducer Source File * * (C) 1999-2007 The Botan Project * *************************************************/ #include -#include #include #include ============================================================ --- botan/sha160.cpp 7f151f0f0f0f3c5358f422625c85d9fbfbc2520f +++ botan/sha160.cpp 1e4669389c7963842f6a1da3e247f9b4ff0924d8 @@ -1,9 +1,10 @@ /************************************************* * SHA-160 Source File * * (C) 1999-2007 The Botan Project * *************************************************/ #include +#include #include namespace Botan { ============================================================ --- botan/sha256.cpp c301182d8aaf2804b5c52543987d0bd713acd7e2 +++ botan/sha256.cpp dd26a6d28f8a614772afa56b98b9807e00f41df4 @@ -1,9 +1,10 @@ /************************************************* * SHA-256 Source File * * (C) 1999-2007 The Botan Project * *************************************************/ #include +#include #include namespace Botan { ============================================================ --- botan/x509cert.cpp d5de5f096e8a47ab498b0b0d90042775c3a1c0fa +++ botan/x509cert.cpp f0061d4c02f30534521000d90299395feff1172f @@ -350,7 +350,7 @@ AlternativeName create_alt_name(const Da }; std::multimap names = - info.search_with(AltName_Matcher("RFC822/DNS/URI")); + info.search_with(AltName_Matcher("RFC822/DNS/URI/IP")); AlternativeName alt_name; ============================================================ --- botan/x509self.cpp 5f92488b35e43625413b0215aac9d1f46a1d7a99 +++ botan/x509self.cpp 91acdb2db0e5bc5b678bf758ca05bfc385604b9a @@ -50,7 +50,7 @@ void load_info(const X509_Cert_Options& subject_dn.add_attribute("X520.Organization", opts.organization); subject_dn.add_attribute("X520.OrganizationalUnit", opts.org_unit); subject_dn.add_attribute("X520.SerialNumber", opts.serial_number); - subject_alt = AlternativeName(opts.email, opts.uri, opts.dns); + subject_alt = AlternativeName(opts.email, opts.uri, opts.dns, opts.ip); subject_alt.add_othername(OIDS::lookup("PKIX.XMPPAddr"), opts.xmpp, UTF8_STRING); } ============================================================ --- botan/x509self.h 9aac88cb666ace50f762e4371408402e4618b33f +++ botan/x509self.h 08a310e8d92f3897b2b1e62f4177b44cd615c195 @@ -26,7 +26,7 @@ class X509_Cert_Options std::string state; std::string serial_number; - std::string email, uri, dns, xmpp; + std::string email, uri, dns, ip, xmpp; std::string challenge; ============================================================ --- gzip.cc 4afdc6ca701b77c1184cea944e1711fd7beb127d +++ gzip.cc 93f149779d9f0132940a206e008eeef3ca618b92 @@ -14,6 +14,7 @@ #include #include +#include #include #include #include