From 95033a027fcda13453010805880ad7450d3ac3ff Mon Sep 17 00:00:00 2001 From: lloyd Date: Sat, 6 Jun 2009 19:57:46 +0000 Subject: Mark Skein_512 with the BOTAN_DLL macro Add a comment that the limitation of the personalization string being a maximum of 64 characters is due to the implementation and not the specification (but it makes it easy to implement, and in this particular case 64 characters is probably fine). Add some tests for the personalization option, generated by the Skein reference implementation. Disable stripping whitespace in checks/misc.cpp:strip - it strips the personalization tag, which breaks the test, and isn't needed otherwise because the test files are well-formed. --- src/hash/skein/skein_512.cpp | 6 ++++++ src/hash/skein/skein_512.h | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/hash/skein/skein_512.cpp b/src/hash/skein/skein_512.cpp index c8a26ae82..eaef641ed 100644 --- a/src/hash/skein/skein_512.cpp +++ b/src/hash/skein/skein_512.cpp @@ -132,6 +132,7 @@ void initial_block(u64bit H[9], u64bit T[3], u32bit output_bits, { clear_mem(H, 9); + // ASCII("SHA3") followed by version (0x0001) code byte config_str[32] = { 0x53, 0x48, 0x41, 0x33, 0x01, 0x00, 0 }; store_le(output_bits, config_str + 8); @@ -140,6 +141,11 @@ void initial_block(u64bit H[9], u64bit T[3], u32bit output_bits, if(personalization != "") { + /* + This is a limitation of this implementation, and not of the + algorithm specification. Could be fixed relatively easily, but + doesn't seem worth the trouble. + */ if(personalization.length() > 64) throw Invalid_Argument("Skein personalization must be <= 64 bytes"); diff --git a/src/hash/skein/skein_512.h b/src/hash/skein/skein_512.h index 2192767ca..fa558fc0d 100644 --- a/src/hash/skein/skein_512.h +++ b/src/hash/skein/skein_512.h @@ -5,8 +5,8 @@ * Distributed under the terms of the Botan license */ -#ifndef BOTAN_SKEIN_H__ -#define BOTAN_SKEIN_H__ +#ifndef BOTAN_SKEIN_512_H__ +#define BOTAN_SKEIN_512_H__ #include #include @@ -14,7 +14,7 @@ namespace Botan { -class Skein_512 : public HashFunction +class BOTAN_DLL Skein_512 : public HashFunction { public: Skein_512(u32bit output_bits = 512, -- cgit v1.2.3 From 5da417b56d5ad772c32a981a56f048c3487dfff0 Mon Sep 17 00:00:00 2001 From: lloyd Date: Sat, 6 Jun 2009 20:06:53 +0000 Subject: Fix Gentoo bug 272242 --- doc/log.txt | 1 + src/build-data/makefile/unix_shr.in | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/doc/log.txt b/doc/log.txt index f5cdbf745..9ca274ff4 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -3,6 +3,7 @@ - Add the Skein-512 hash function - Add XTS mode from IEEE P1619 - Use a default value for AutoSeeded_RNG::reseed + - Fix Gentoo bug 272242 * 1.8.2, 2009-04-07 - Make entropy polling more flexible and in most cases faster diff --git a/src/build-data/makefile/unix_shr.in b/src/build-data/makefile/unix_shr.in index fec3a3654..1b139e0dc 100644 --- a/src/build-data/makefile/unix_shr.in +++ b/src/build-data/makefile/unix_shr.in @@ -85,7 +85,7 @@ all: $(LIBRARIES) # Link Commands # ################################################## $(CHECK): $(LIBRARIES) $(CHECKOBJS) - $(CXX) $(CHECKOBJS) -L. -lbotan $(LINK_TO) -o $(CHECK) + $(CXX) $(LDFLAGS) $(CHECKOBJS) -o $(CHECK) -L. -lbotan-@{var:version} $(LINK_TO) $(STATIC_LIB): $(LIBOBJS) $(RM) $(STATIC_LIB) @@ -93,7 +93,7 @@ $(STATIC_LIB): $(LIBOBJS) $(RANLIB) $(STATIC_LIB) $(SHARED_LIB): $(LIBOBJS) - $(SO_LINK_CMD) $(LINK_TO) $(LIBOBJS) -o $(SHARED_LIB) + $(SO_LINK_CMD) $(LDFLAGS) $(LIBOBJS) -o $(SHARED_LIB) $(LINK_TO) $(LN) $(SHARED_LIB) $(SYMLINK) ################################################## -- cgit v1.2.3 From f92ebabfe414d19003e83db40e808d6d8315fa14 Mon Sep 17 00:00:00 2001 From: lloyd Date: Sat, 6 Jun 2009 20:12:33 +0000 Subject: Patch to fix --as-needed bug was slightly wrong: linked to -lbotan-@{version}, but with the most recent change to decouple version # and so version this is wrong - use @{var:so_version} instead. --- src/build-data/makefile/unix_shr.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/build-data/makefile/unix_shr.in b/src/build-data/makefile/unix_shr.in index 1b139e0dc..5b1522f70 100644 --- a/src/build-data/makefile/unix_shr.in +++ b/src/build-data/makefile/unix_shr.in @@ -85,7 +85,7 @@ all: $(LIBRARIES) # Link Commands # ################################################## $(CHECK): $(LIBRARIES) $(CHECKOBJS) - $(CXX) $(LDFLAGS) $(CHECKOBJS) -o $(CHECK) -L. -lbotan-@{var:version} $(LINK_TO) + $(CXX) $(LDFLAGS) $(CHECKOBJS) -o $(CHECK) -L. -lbotan-@{var:so_version} $(LINK_TO) $(STATIC_LIB): $(LIBOBJS) $(RM) $(STATIC_LIB) -- cgit v1.2.3 From a970f838ffcd050147cae46fb40b0d85e38453ce Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 9 Jun 2009 22:38:17 +0000 Subject: Change the order of preference for /dev/*random polling to /dev/urandom /dev/random /dev/srandom (OpenBSD-specific) --- src/rng/auto_rng/auto_rng.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/rng/auto_rng/auto_rng.cpp b/src/rng/auto_rng/auto_rng.cpp index 578047afc..171c83cca 100644 --- a/src/rng/auto_rng/auto_rng.cpp +++ b/src/rng/auto_rng/auto_rng.cpp @@ -93,7 +93,7 @@ void add_entropy_sources(RandomNumberGenerator* rng) #if defined(BOTAN_HAS_ENTROPY_SRC_DEVICE) rng->add_entropy_source( new Device_EntropySource( - split_on("/dev/random:/dev/srandom:/dev/urandom", ':') + split_on("/dev/urandom:/dev/random:/dev/srandom", ':') ) ); #endif -- cgit v1.2.3 From d2db951559bf4c17a658de55b48f7971885e53fd Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 9 Jun 2009 22:43:15 +0000 Subject: Changes to /dev/*random poller - read up to 48 bytes, and wait longer in select loop (up to a second) --- src/entropy/dev_random/es_dev.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/entropy/dev_random/es_dev.cpp b/src/entropy/dev_random/es_dev.cpp index 6fcdcbfea..e6033753d 100644 --- a/src/entropy/dev_random/es_dev.cpp +++ b/src/entropy/dev_random/es_dev.cpp @@ -103,10 +103,9 @@ Device_EntropySource::~Device_EntropySource() */ void Device_EntropySource::poll(Entropy_Accumulator& accum) { - u32bit go_get = std::min(accum.desired_remaining_bits() / 8, 16); - - u32bit read_wait_ms = go_get / 16; + u32bit go_get = std::min(accum.desired_remaining_bits() / 8, 48); + u32bit read_wait_ms = std::max(go_get, 1000); MemoryRegion& io_buffer = accum.get_io_buffer(go_get); for(size_t i = 0; i != devices.size(); ++i) -- cgit v1.2.3 From 0b512325b23e29ce400b5b03cdfa502fb6fcefa5 Mon Sep 17 00:00:00 2001 From: lloyd Date: Fri, 19 Jun 2009 14:27:44 +0000 Subject: Add variable names to decls in kdf.h --- src/kdf/kdf.h | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/kdf/kdf.h b/src/kdf/kdf.h index aa6cd94cd..70f636b6c 100644 --- a/src/kdf/kdf.h +++ b/src/kdf/kdf.h @@ -19,17 +19,23 @@ namespace Botan { class BOTAN_DLL KDF { public: - SecureVector derive_key(u32bit, const MemoryRegion&, - const std::string& = "") const; - SecureVector derive_key(u32bit, const MemoryRegion&, - const MemoryRegion&) const; - SecureVector derive_key(u32bit, const MemoryRegion&, - const byte[], u32bit) const; - - SecureVector derive_key(u32bit, const byte[], u32bit, - const std::string& = "") const; - SecureVector derive_key(u32bit, const byte[], u32bit, - const byte[], u32bit) const; + SecureVector derive_key(u32bit key_len, + const MemoryRegion& secret, + const std::string& salt = "") const; + SecureVector derive_key(u32bit key_len, + const MemoryRegion& secret, + const MemoryRegion& salt) const; + + SecureVector derive_key(u32bit key_len, + const MemoryRegion& secret, + const byte salt[], u32bit salt_len) const; + + SecureVector derive_key(u32bit key_len, + const byte secret[], u32bit secret_len, + const std::string& salt = "") const; + SecureVector derive_key(u32bit key_len, + const byte secret[], u32bit secret_len, + const byte salt[], u32bit salt_len) const; virtual ~KDF() {} private: @@ -43,7 +49,9 @@ class BOTAN_DLL KDF class BOTAN_DLL MGF { public: - virtual void mask(const byte[], u32bit, byte[], u32bit) const = 0; + virtual void mask(const byte in[], u32bit in_len, + byte out[], u32bit out_len) const = 0; + virtual ~MGF() {} }; -- cgit v1.2.3 From 41f381d1873bc343bf472e97f5bae718471365c9 Mon Sep 17 00:00:00 2001 From: lloyd Date: Sun, 21 Jun 2009 19:02:34 +0000 Subject: Improve handling of low-entropy situations in HMAC_RNG and Randpool. When a reseed is attempted, up to poll_bits attempts will be made, running in order through the set of available sources. So for instance if poll_bits is set to the default 256, then up to 256 polls will be performed (some of which might not provide any entropy, of course) before stopping; of course if the accumulators goal is achived before that point, then the polling stops. This should greatly help to resolve the recent rash of PRNG unseeded problems some people have been having. --- doc/log.txt | 7 ++++--- src/rng/hmac_rng/hmac_rng.cpp | 11 +++++++---- src/rng/randpool/randpool.cpp | 11 +++++++---- 3 files changed, 18 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/doc/log.txt b/doc/log.txt index 9ca274ff4..d29f00f36 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -1,8 +1,9 @@ * 1.8.3-pre, 2009-??-?? - - Add the Skein-512 hash function - - Add XTS mode from IEEE P1619 - - Use a default value for AutoSeeded_RNG::reseed + - Improve handling of low-entropy situations during PRNG seeding + - Add the Skein-512 SHA-3 candidate hash function + - Add the XTS block cipher mode from IEEE P1619 + - Provide a default value for AutoSeeded_RNG::reseed - Fix Gentoo bug 272242 * 1.8.2, 2009-04-07 diff --git a/src/rng/hmac_rng/hmac_rng.cpp b/src/rng/hmac_rng/hmac_rng.cpp index 757f59037..113489db3 100644 --- a/src/rng/hmac_rng/hmac_rng.cpp +++ b/src/rng/hmac_rng/hmac_rng.cpp @@ -72,12 +72,15 @@ void HMAC_RNG::reseed_with_input(u32bit poll_bits, Entropy_Accumulator_BufferedComputation accum(*extractor, poll_bits); - for(u32bit i = 0; i < entropy_sources.size(); ++i) + if(!entropy_sources.empty()) { - if(accum.polling_goal_achieved()) - break; + u32bit poll_attempt = 0; - entropy_sources[i]->poll(accum); + while(!accum.polling_goal_achieved() && poll_attempt < poll_bits) + { + entropy_sources[poll_attempt % entropy_sources.size()]->poll(accum); + ++poll_attempt; + } } // And now add the user-provided input, if any diff --git a/src/rng/randpool/randpool.cpp b/src/rng/randpool/randpool.cpp index f9e05c246..77a5228c6 100644 --- a/src/rng/randpool/randpool.cpp +++ b/src/rng/randpool/randpool.cpp @@ -105,12 +105,15 @@ void Randpool::reseed(u32bit poll_bits) { Entropy_Accumulator_BufferedComputation accum(*mac, poll_bits); - for(u32bit i = 0; i != entropy_sources.size(); ++i) + if(!entropy_sources.empty()) { - entropy_sources[i]->poll(accum); + u32bit poll_attempt = 0; - if(accum.polling_goal_achieved()) - break; + while(!accum.polling_goal_achieved() && poll_attempt < poll_bits) + { + entropy_sources[poll_attempt % entropy_sources.size()]->poll(accum); + ++poll_attempt; + } } SecureVector mac_val = mac->final(); -- cgit v1.2.3 From c843de07db11df1087a9e711fe44b111fdcf95fa Mon Sep 17 00:00:00 2001 From: lloyd Date: Mon, 22 Jun 2009 19:23:32 +0000 Subject: Use an input insensitive implementation of same_mem instead of memcmp. I don't know that having same_mem be sensitive to input would actually allow any form of timing attack in the current codebase, but it seemed like a prudent thing to do in any case. --- doc/log.txt | 1 + src/utils/mem_ops.h | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/doc/log.txt b/doc/log.txt index d29f00f36..6454c6573 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -1,6 +1,7 @@ * 1.8.3-pre, 2009-??-?? - Improve handling of low-entropy situations during PRNG seeding + - Use an input insensitive implementation of same_mem instead of memcmp - Add the Skein-512 SHA-3 candidate hash function - Add the XTS block cipher mode from IEEE P1619 - Provide a default value for AutoSeeded_RNG::reseed diff --git a/src/utils/mem_ops.h b/src/utils/mem_ops.h index f6557c744..0fcf34ba8 100644 --- a/src/utils/mem_ops.h +++ b/src/utils/mem_ops.h @@ -26,7 +26,14 @@ template inline void set_mem(T* ptr, u32bit n, byte val) { std::memset(ptr, val, sizeof(T)*n); } template inline bool same_mem(const T* p1, const T* p2, u32bit n) - { return (std::memcmp(p1, p2, sizeof(T)*n) == 0); } + { + bool is_same = true; + + for(u32bit i = 0; i != n; ++i) + is_same &= (p1[i] == p2[i]); + + return is_same; + } } -- cgit v1.2.3 From d7e38c44e851d1ffc8b7c4181eded8f8c3291cb7 Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 24 Jun 2009 13:48:29 +0000 Subject: DataSource::discard_next did not actually return the number of discarded bytes. Bug noted by Falko Strenzke, fix by M. Braun. (bug id 31) --- doc/log.txt | 1 + src/utils/data_src.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/doc/log.txt b/doc/log.txt index 6454c6573..cb761b6fc 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -5,6 +5,7 @@ - Add the Skein-512 SHA-3 candidate hash function - Add the XTS block cipher mode from IEEE P1619 - Provide a default value for AutoSeeded_RNG::reseed + - Correct DataSource::discard_next to return the number of discarded bytes - Fix Gentoo bug 272242 * 1.8.2, 2009-04-07 diff --git a/src/utils/data_src.cpp b/src/utils/data_src.cpp index 4164a6dd3..e6387c4ba 100644 --- a/src/utils/data_src.cpp +++ b/src/utils/data_src.cpp @@ -38,7 +38,7 @@ u32bit DataSource::discard_next(u32bit n) u32bit discarded = 0; byte dummy; for(u32bit j = 0; j != n; ++j) - discarded = read_byte(dummy); + discarded += read_byte(dummy); return discarded; } -- cgit v1.2.3 From e0bf42e441f864312e6107a3e254d1969ed66971 Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 1 Jul 2009 16:30:28 +0000 Subject: Move mutex.h from utils/ to mutex/ dir as more relevant area --- src/mutex/mutex.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/utils/info.txt | 1 - src/utils/mutex.h | 56 ------------------------------------------------------ 3 files changed, 56 insertions(+), 57 deletions(-) create mode 100644 src/mutex/mutex.h delete mode 100644 src/utils/mutex.h (limited to 'src') diff --git a/src/mutex/mutex.h b/src/mutex/mutex.h new file mode 100644 index 000000000..a04ff83c9 --- /dev/null +++ b/src/mutex/mutex.h @@ -0,0 +1,56 @@ +/* +* Mutex +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_MUTEX_H__ +#define BOTAN_MUTEX_H__ + +#include + +namespace Botan { + +/* +* Mutex Base Class +*/ +class BOTAN_DLL Mutex + { + public: + virtual void lock() = 0; + virtual void unlock() = 0; + virtual ~Mutex() {} + }; + +/* +* Mutex Factory +*/ +class BOTAN_DLL Mutex_Factory + { + public: + virtual Mutex* make() = 0; + virtual ~Mutex_Factory() {} + }; + +/* +* Mutex Holding Class +*/ +class BOTAN_DLL Mutex_Holder + { + public: + Mutex_Holder(Mutex* m) : mux(m) + { + if(!mux) + throw Invalid_Argument("Mutex_Holder: Argument was NULL"); + mux->lock(); + } + + ~Mutex_Holder() { mux->unlock(); } + private: + Mutex* mux; + }; + +} + +#endif diff --git a/src/utils/info.txt b/src/utils/info.txt index ffc19c852..815ad4efc 100644 --- a/src/utils/info.txt +++ b/src/utils/info.txt @@ -27,7 +27,6 @@ exceptn.h loadstor.h mem_ops.h mlock.cpp -mutex.h parsing.cpp parsing.h rotate.h diff --git a/src/utils/mutex.h b/src/utils/mutex.h deleted file mode 100644 index a04ff83c9..000000000 --- a/src/utils/mutex.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -* Mutex -* (C) 1999-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#ifndef BOTAN_MUTEX_H__ -#define BOTAN_MUTEX_H__ - -#include - -namespace Botan { - -/* -* Mutex Base Class -*/ -class BOTAN_DLL Mutex - { - public: - virtual void lock() = 0; - virtual void unlock() = 0; - virtual ~Mutex() {} - }; - -/* -* Mutex Factory -*/ -class BOTAN_DLL Mutex_Factory - { - public: - virtual Mutex* make() = 0; - virtual ~Mutex_Factory() {} - }; - -/* -* Mutex Holding Class -*/ -class BOTAN_DLL Mutex_Holder - { - public: - Mutex_Holder(Mutex* m) : mux(m) - { - if(!mux) - throw Invalid_Argument("Mutex_Holder: Argument was NULL"); - mux->lock(); - } - - ~Mutex_Holder() { mux->unlock(); } - private: - Mutex* mux; - }; - -} - -#endif -- cgit v1.2.3 From 0050518a350638e9969ab4fb226a3919b80d634a Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 1 Jul 2009 18:08:52 +0000 Subject: Add missing mutex info.txt file --- src/mutex/info.txt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/mutex/info.txt (limited to 'src') diff --git a/src/mutex/info.txt b/src/mutex/info.txt new file mode 100644 index 000000000..ff79bf753 --- /dev/null +++ b/src/mutex/info.txt @@ -0,0 +1,9 @@ +realname "Mutex Wrappers" + +define MUTEX_WRAPPERS + +load_on auto + + +mutex.h + -- cgit v1.2.3 From 461602d1d2662cdad9f898bc350d9074b267cc6a Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 1 Jul 2009 18:39:46 +0000 Subject: Make the install_cmd_{data,exec} items in the build-data files quoted, since they often contain spaces. This doesn't matter to configure.pl's hand-done regex 'parser', but it makes things more consistent and makes it possible to use the shlex parser included with python to parse all of the data files. Also remove the unused entry in darwin - this information had previously be removed from all the other files but I guess that one was missed. --- configure.pl | 8 ++++---- src/build-data/os/darwin | 7 ------- src/build-data/os/defaults | 4 ++-- src/build-data/os/mingw | 4 ++-- src/build-data/os/windows | 4 ++-- 5 files changed, 10 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/configure.pl b/configure.pl index 53b7897e5..d94b376e2 100755 --- a/configure.pl +++ b/configure.pl @@ -1726,7 +1726,9 @@ sub get_os_info { $info{'name'} = $name; while($_ = &$reader()) { - match_any_of($_, \%info, 'quoted', 'realname', 'ar_command'); + match_any_of($_, \%info, + 'quoted', 'realname', 'ar_command', + 'install_cmd_data', 'install_cmd_exec'); match_any_of($_, \%info, 'unquoted', 'os_type', @@ -1736,9 +1738,7 @@ sub get_os_info { 'install_root', 'header_dir', 'lib_dir', 'doc_dir', - 'ar_needs_ranlib', - 'install_cmd_data', - 'install_cmd_exec'); + 'ar_needs_ranlib'); read_list($_, $reader, 'aliases', list_push(\@{$info{'aliases'}})); diff --git a/src/build-data/os/darwin b/src/build-data/os/darwin index aa28dc59b..298621216 100644 --- a/src/build-data/os/darwin +++ b/src/build-data/os/darwin @@ -14,13 +14,6 @@ doc_dir doc all - -ia32 -amd64 -ppc -ppc64 # g5! - - macosx diff --git a/src/build-data/os/defaults b/src/build-data/os/defaults index 88fd82252..5648643a9 100644 --- a/src/build-data/os/defaults +++ b/src/build-data/os/defaults @@ -15,5 +15,5 @@ header_dir include lib_dir lib doc_dir share/doc -install_cmd_data install -m 644 -install_cmd_exec install -m 755 +install_cmd_data "install -m 644" +install_cmd_exec "install -m 755" diff --git a/src/build-data/os/mingw b/src/build-data/os/mingw index 8c41fbc21..eb25017fc 100644 --- a/src/build-data/os/mingw +++ b/src/build-data/os/mingw @@ -13,8 +13,8 @@ header_dir include lib_dir lib doc_dir share/doc -install_cmd_data install -m 644 -install_cmd_exec install -m 755 +install_cmd_data "install -m 644" +install_cmd_exec "install -m 755" msys diff --git a/src/build-data/os/windows b/src/build-data/os/windows index 823c60d6c..a04d609b8 100644 --- a/src/build-data/os/windows +++ b/src/build-data/os/windows @@ -9,8 +9,8 @@ static_suffix lib install_root c:\Botan doc_dir docs -install_cmd_data copy -install_cmd_exec copy +install_cmd_data "copy" +install_cmd_exec "copy" win32_virtual_lock -- cgit v1.2.3 From 21308960d04c28e90ee63485b4d95636f4fe9240 Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 1 Jul 2009 21:59:19 +0000 Subject: Change the makefile template language somewhat. Previously variables had been denoted with @{var:NAME}, this has changed to %{NAME}. This is pretty much a wash for configure.pl but it makes it much easier to process the templates using Python's string.Template. The logic being the 'var:' prefix had been to support conditional statements in the templates (using an 'if:' prefix), but this functionality was not being used and support for it is removed from configure.pl in this revision. For a similiar reason, rename a number of template variables with hyphens in their name to use underscores instead. This is slightly more consistent anyway (since many variable names had already used _ instead of -) but more importantly makes them much easier to deal with using aforementioned Python template code. This should not result in any user-visible change (unless I messed up). --- configure.pl | 59 +++++++++++++---------------- doc/log.txt | 9 +++-- src/build-data/botan-config.in | 12 +++--- src/build-data/botan.doxy.in | 2 +- src/build-data/botan.pc.in | 8 ++-- src/build-data/buildh.in | 26 ++++++------- src/build-data/makefile/nmake.in | 60 +++++++++++++++--------------- src/build-data/makefile/unix.in | 60 +++++++++++++++--------------- src/build-data/makefile/unix_shr.in | 74 ++++++++++++++++++------------------- 9 files changed, 151 insertions(+), 159 deletions(-) (limited to 'src') diff --git a/configure.pl b/configure.pl index d94b376e2..f290f002d 100755 --- a/configure.pl +++ b/configure.pl @@ -65,12 +65,12 @@ sub main { $$config{'base-dir'} = $base_dir; $$config{'src-dir'} = File::Spec->catdir($base_dir, 'src'); $$config{'checks-dir'} = File::Spec->catdir($base_dir, 'checks'); - $$config{'doc-dir'} = File::Spec->catdir($base_dir, 'doc'); + $$config{'doc_src_dir'} = File::Spec->catdir($base_dir, 'doc'); $$config{'config-dir'} = File::Spec->catdir($$config{'src-dir'}, 'build-data'); - $$config{'command-line'} = $0 . ' ' . join(' ', @ARGV); + $$config{'command_line'} = $0 . ' ' . join(' ', @ARGV); $$config{'timestamp'} = gmtime; $$config{'user'} = getlogin || getpwuid($<) || ''; $$config{'hostname'} = hostname; @@ -103,12 +103,12 @@ sub main { # Goes into build-specific dirs (maybe) - $$config{'build-dir'} = 'build'; - $$config{'botan-config'} = File::Spec->catfile( - $$config{'build-dir'}, 'botan-config'); + $$config{'build_dir'} = 'build'; + $$config{'botan_config'} = File::Spec->catfile( + $$config{'build_dir'}, 'botan-config'); - $$config{'botan-pkgconfig'} = File::Spec->catfile( - $$config{'build-dir'}, + $$config{'botan_pkgconfig'} = File::Spec->catfile( + $$config{'build_dir'}, 'botan-' . $MAJOR_VERSION . '.' . $MINOR_VERSION . '.pc'); $$config{'makefile'} = 'Makefile'; @@ -116,9 +116,9 @@ sub main { $$config{'lib_prefix'} = ''; if(defined($$config{'with_build_dir'})) { - for my $var ('build-dir', - 'botan-config', - 'botan-pkgconfig', + for my $var ('build_dir', + 'botan_config', + 'botan_pkgconfig', 'makefile', 'check_prefix', 'lib_prefix') @@ -147,12 +147,12 @@ sub main { add_to($config, { 'includedir' => os_info_for($os, 'header_dir'), - 'build_lib' => File::Spec->catdir($$config{'build-dir'}, 'lib'), - 'build_check' => File::Spec->catdir($$config{'build-dir'}, 'checks'), + 'build_lib' => File::Spec->catdir($$config{'build_dir'}, 'lib'), + 'build_check' => File::Spec->catdir($$config{'build_dir'}, 'checks'), 'build_include' => - File::Spec->catdir($$config{'build-dir'}, 'include'), + File::Spec->catdir($$config{'build_dir'}, 'include'), 'build_include_botan' => - File::Spec->catdir($$config{'build-dir'}, 'include', 'botan'), + File::Spec->catdir($$config{'build_dir'}, 'include', 'botan'), 'mp_bits' => find_mp_bits(sort keys %{$$config{'modules'}}), 'mod_libs' => @@ -170,7 +170,7 @@ sub main { load_modules($config); - my @dirs = mkdirs($$config{'build-dir'}, + my @dirs = mkdirs($$config{'build_dir'}, $$config{'build_include'}, $$config{'build_include_botan'}, $$config{'build_lib'}, @@ -183,15 +183,15 @@ sub main { determine_config($config); process_template(File::Spec->catfile($$config{'config-dir'}, 'buildh.in'), - File::Spec->catfile($$config{'build-dir'}, 'build.h'), + File::Spec->catfile($$config{'build_dir'}, 'build.h'), $config); process_template(File::Spec->catfile( $$config{'config-dir'}, 'botan.doxy.in'), - File::Spec->catfile($$config{'doc-dir'}, 'botan.doxy'), + File::Spec->catfile($$config{'doc_src_dir'}, 'botan.doxy'), $config); - $$config{'includes'}{'build.h'} = $$config{'build-dir'}; + $$config{'includes'}{'build.h'} = $$config{'build_dir'}; generate_makefile($config); @@ -1246,7 +1246,7 @@ sub load_modules { push @mod_names, $mod; } - $$config{'mod-list'} = join("\n", @mod_names); + $$config{'mod_list'} = join("\n", @mod_names); my $unaligned_ok = 0; @@ -1468,19 +1468,10 @@ sub process_template { next; } - $contents =~ s/@\{var:$name\}/$val/g; - - unless($val eq 'no' or $val eq 'false') { - $contents =~ s/\@\{if:$name (.*)\}/$1/g; - $contents =~ s/\@\{if:$name (.*) (.*)\}/$1/g; - } else { - $contents =~ s/\@\{if:$name (.*)\}//g; - $contents =~ s/\@\{if:$name (.*) (.*)\}/$2/g; - } + $contents =~ s/\%\{$name\}/$val/g; } - if($contents =~ /@\{var:([a-z_]*)\}/ or - $contents =~ /@\{if:(.*) /) { + if($contents =~ /\%\{([a-z_]*)\}/) { sub summarize { my ($n, $s) = @_; @@ -1823,7 +1814,7 @@ sub write_pkg_config { $$config{'link_to'} = libs('-l', '', 'm', @{$$config{'mod_libs'}}); - my $botan_config = $$config{'botan-config'}; + my $botan_config = $$config{'botan_config'}; process_template( File::Spec->catfile($$config{'config-dir'}, 'botan-config.in'), @@ -1832,7 +1823,7 @@ sub write_pkg_config { process_template( File::Spec->catfile($$config{'config-dir'}, 'botan.pc.in'), - $$config{'botan-pkgconfig'}, $config); + $$config{'botan_pkgconfig'}, $config); delete $$config{'link_to'}; } @@ -2029,10 +2020,10 @@ sub generate_makefile { my ($config) = @_; my $is_in_doc_dir = - sub { -e File::Spec->catfile($$config{'doc-dir'}, $_[0]) }; + sub { -e File::Spec->catfile($$config{'doc_src_dir'}, $_[0]) }; my $docs = file_list(undef, undef, undef, - map_to($$config{'doc-dir'}, + map_to($$config{'doc_src_dir'}, grep { &$is_in_doc_dir($_); } @DOCS)); $docs .= File::Spec->catfile($$config{'base-dir'}, 'readme.txt'); diff --git a/doc/log.txt b/doc/log.txt index e6ca6bdcd..e41262747 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -1,12 +1,13 @@ * 1.8.3-pre, 2009-??-?? - - Improve handling of low-entropy situations during PRNG seeding - - Use an input insensitive implementation of same_mem instead of memcmp - - Change random device polling to prefer /dev/urandom over /dev/random - Add the Skein-512 SHA-3 candidate hash function - Add the XTS block cipher mode from IEEE P1619 - - Provide a default value for AutoSeeded_RNG::reseed + - Improve handling of low-entropy situations during PRNG seeding + - Change random device polling to prefer /dev/urandom over /dev/random + - Use an input insensitive implementation of same_mem instead of memcmp - Correct DataSource::discard_next to return the number of discarded bytes + - Various changes to the makefile template language for easier parsing + - Provide a default value for AutoSeeded_RNG::reseed - Fix Gentoo bug 272242 * 1.8.2, 2009-04-07 diff --git a/src/build-data/botan-config.in b/src/build-data/botan-config.in index 28b494254..f3fa3db94 100644 --- a/src/build-data/botan-config.in +++ b/src/build-data/botan-config.in @@ -2,15 +2,15 @@ # For normal builds: guess_prefix=`dirname \`dirname $0\`` -includedir=@{var:includedir} -libdir=@{var:libdir} +includedir=%{includedir} +libdir=%{libdir} # For workspace builds: #guess_prefix=`dirname $0` #includedir=build/include #libdir= -install_prefix=@{var:prefix} +install_prefix=%{prefix} prefix= usage() @@ -42,7 +42,7 @@ while test $# -gt 0; do echo $prefix ;; --version) - echo @{var:version} + echo %{version} exit 0 ;; --cflags) @@ -54,9 +54,9 @@ while test $# -gt 0; do --libs) if [ $prefix != "/usr" -a $prefix != "/usr/local" ] then - echo -L$prefix/$libdir -lbotan @{var:link_to} + echo -L$prefix/$libdir -lbotan %{link_to} else - echo -lbotan @{var:link_to} + echo -lbotan %{link_to} fi ;; *) diff --git a/src/build-data/botan.doxy.in b/src/build-data/botan.doxy.in index 82796a272..2da5e1244 100644 --- a/src/build-data/botan.doxy.in +++ b/src/build-data/botan.doxy.in @@ -5,7 +5,7 @@ #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = Botan -PROJECT_NUMBER = @{var:version} +PROJECT_NUMBER = %{version} OUTPUT_DIRECTORY = doc/doxygen CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English diff --git a/src/build-data/botan.pc.in b/src/build-data/botan.pc.in index 6fbf43862..70ed65d70 100644 --- a/src/build-data/botan.pc.in +++ b/src/build-data/botan.pc.in @@ -1,12 +1,12 @@ -prefix=@{var:prefix} +prefix=%{prefix} exec_prefix=${prefix} -libdir=${prefix}/@{var:libdir} +libdir=${prefix}/%{libdir} includedir=${prefix}/include Name: Botan Description: Multi-platform C++ crypto library -Version: @{var:version} +Version: %{version} Libs: -L${libdir} -lbotan -Libs.private: @{var:link_to} +Libs.private: %{link_to} Cflags: -I${includedir} diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in index d49f976fb..496826d91 100644 --- a/src/build-data/buildh.in +++ b/src/build-data/buildh.in @@ -2,14 +2,14 @@ #ifndef BOTAN_BUILD_CONFIG_H__ #define BOTAN_BUILD_CONFIG_H__ -/* This file was automatically generated @{var:timestamp} UTC */ +/* This file was automatically generated %{timestamp} UTC */ -#define BOTAN_VERSION_MAJOR @{var:version_major} -#define BOTAN_VERSION_MINOR @{var:version_minor} -#define BOTAN_VERSION_PATCH @{var:version_patch} +#define BOTAN_VERSION_MAJOR %{version_major} +#define BOTAN_VERSION_MINOR %{version_minor} +#define BOTAN_VERSION_PATCH %{version_patch} #ifndef BOTAN_DLL - #define BOTAN_DLL @{var:dll_export_flags} + #define BOTAN_DLL %{dll_export_flags} #endif /* Chunk sizes */ @@ -17,7 +17,7 @@ #define BOTAN_MEM_POOL_CHUNK_SIZE 64*1024 /* BigInt toggles */ -#define BOTAN_MP_WORD_BITS @{var:mp_bits} +#define BOTAN_MP_WORD_BITS %{mp_bits} #define BOTAN_KARAT_MUL_THRESHOLD 32 #define BOTAN_KARAT_SQR_THRESHOLD 32 #define BOTAN_PRIVATE_KEY_OP_BLINDING_BITS 64 @@ -38,21 +38,21 @@ /* Target identification and feature test macros */ -@{var:defines} -@{var:local_config} +%{defines} +%{local_config} /* -@{var:user}@@{var:hostname} ran '@{var:command-line}' +%{user}@%{hostname} ran '%{command_line}' Target ------- -Compiler: @{var:cc} @{var:lib_opt} @{var:mach_opt} -Arch: @{var:submodel}/@{var:arch} -OS: @{var:os} +Compiler: %{cc} %{lib_opt} %{mach_opt} +Arch: %{submodel}/%{arch} +OS: %{os} Modules ------- -@{var:mod-list} +%{mod_list} */ #endif diff --git a/src/build-data/makefile/nmake.in b/src/build-data/makefile/nmake.in index b730beab1..b1e651551 100644 --- a/src/build-data/makefile/nmake.in +++ b/src/build-data/makefile/nmake.in @@ -1,40 +1,40 @@ ################################################## # Compiler Options # ################################################## -CXX = @{var:cc} -LIB_OPT = @{var:lib_opt} -CHECK_OPT = @{var:check_opt} -MACH_OPT = @{var:mach_opt} -LANG_FLAGS = @{var:lang_flags} -WARN_FLAGS = @{var:warn_flags} -LINK_TO = @{var:link_to} +CXX = %{cc} +LIB_OPT = %{lib_opt} +CHECK_OPT = %{check_opt} +MACH_OPT = %{mach_opt} +LANG_FLAGS = %{lang_flags} +WARN_FLAGS = %{warn_flags} +LINK_TO = %{link_to} ################################################## # Version Numbers # ################################################## -MAJOR = @{var:version_major} -MINOR = @{var:version_minor} -PATCH = @{var:version_patch} +MAJOR = %{version_major} +MINOR = %{version_minor} +PATCH = %{version_patch} VERSION = $(MAJOR).$(MINOR).$(PATCH) ################################################## # Installation Settings # ################################################## -DESTDIR = @{var:prefix} +DESTDIR = %{prefix} -LIBDIR = $(DESTDIR)\@{var:libdir} -HEADERDIR = $(DESTDIR)\@{var:includedir}\botan -DOCDIR = $(DESTDIR)\@{var:docdir}\Botan-$(VERSION) +LIBDIR = $(DESTDIR)\%{libdir} +HEADERDIR = $(DESTDIR)\%{includedir}\botan +DOCDIR = $(DESTDIR)\%{docdir}\Botan-$(VERSION) ################################################## # Aliases for Common Programs # ################################################## -AR = @{var:ar_command} +AR = %{ar_command} CD = @cd ECHO = @echo -INSTALL = @{var:install_cmd_exec} -INSTALL_CMD = @{var:install_cmd_exec} +INSTALL = %{install_cmd_exec} +INSTALL_CMD = %{install_cmd_exec} MKDIR = @md MKDIR_INSTALL = @md RM = @del /Q @@ -45,13 +45,13 @@ RMDIR = @rmdir ################################################## CHECK = check -DOCS = @{var:doc_files} +DOCS = %{doc_files} -HEADERS = @{var:include_files} +HEADERS = %{include_files} -LIBOBJS = @{var:lib_objs} +LIBOBJS = %{lib_objs} -CHECKOBJS = @{var:check_objs} +CHECKOBJS = %{check_objs} LIB_FLAGS = $(LIB_OPT) $(MACH_OPT) $(LANG_FLAGS) $(WARN_FLAGS) CHECK_FLAGS = $(CHECK_OPT) $(LANG_FLAGS) $(WARN_FLAGS) @@ -59,16 +59,16 @@ CHECK_FLAGS = $(CHECK_OPT) $(LANG_FLAGS) $(WARN_FLAGS) LIBRARIES = $(STATIC_LIB) LIBNAME = libbotan -STATIC_LIB = $(LIBNAME).@{var:static_suffix} +STATIC_LIB = $(LIBNAME).%{static_suffix} all: $(LIBRARIES) ################################################## # Build Commands # ################################################## -@{var:lib_build_cmds} +%{lib_build_cmds} -@{var:check_build_cmds} +%{check_build_cmds} ################################################## # Link Commands # @@ -93,15 +93,15 @@ static: $(STATIC_LIB) # Fake Targets # ################################################## clean: - $(RM) @{var:build-dir}\lib\* @{var:build-dir}\checks\* + $(RM) %{build-dir}\lib\* %{build-dir}\checks\* $(RM) $(LIBRARIES) $(CHECK) distclean: clean - $(RM) @{var:build-dir}\build.h - $(RM) @{var:build-dir}\include\botan\* - $(RMDIR) @{var:build-dir}\include\botan @{var:build-dir}\include - $(RMDIR) @{var:build-dir}\lib @{var:build-dir}\checks - $(RMDIR) @{var:build-dir} + $(RM) %{build-dir}\build.h + $(RM) %{build-dir}\include\botan\* + $(RMDIR) %{build-dir}\include\botan %{build-dir}\include + $(RMDIR) %{build-dir}\lib %{build-dir}\checks + $(RMDIR) %{build-dir} $(RM) Makefile ################################################## diff --git a/src/build-data/makefile/unix.in b/src/build-data/makefile/unix.in index 4025eed29..95859d16d 100644 --- a/src/build-data/makefile/unix.in +++ b/src/build-data/makefile/unix.in @@ -1,67 +1,67 @@ ################################################## # Compiler Options # ################################################## -CXX = @{var:cc} -LIB_OPT = @{var:lib_opt} -CHECK_OPT = @{var:check_opt} -MACH_OPT = @{var:mach_opt} -LANG_FLAGS = @{var:lang_flags} -WARN_FLAGS = @{var:warn_flags} -LINK_TO = @{var:link_to} +CXX = %{cc} +LIB_OPT = %{lib_opt} +CHECK_OPT = %{check_opt} +MACH_OPT = %{mach_opt} +LANG_FLAGS = %{lang_flags} +WARN_FLAGS = %{warn_flags} +LINK_TO = %{link_to} ################################################## # Version Numbers # ################################################## -VERSION = @{var:version} +VERSION = %{version} ################################################## # Installation Settings # ################################################## -DESTDIR = @{var:prefix} +DESTDIR = %{prefix} BINDIR = $(DESTDIR)/bin -LIBDIR = $(DESTDIR)/@{var:libdir} -HEADERDIR = $(DESTDIR)/@{var:includedir}/botan -DOCDIR = $(DESTDIR)/@{var:docdir}/Botan-$(VERSION) +LIBDIR = $(DESTDIR)/%{libdir} +HEADERDIR = $(DESTDIR)/%{includedir}/botan +DOCDIR = $(DESTDIR)/%{docdir}/Botan-$(VERSION) PKGCONF_DIR = $(LIBDIR)/pkgconfig -CONFIG_SCRIPT = @{var:botan-config} -PKGCONFIG = @{var:botan-pkgconfig} +CONFIG_SCRIPT = %{botan_config} +PKGCONFIG = %{botan_pkgconfig} ################################################## # Aliases for Common Programs # ################################################## -AR = @{var:ar_command} +AR = %{ar_command} CD = @cd ECHO = @echo -INSTALL_CMD_EXEC = @{var:install_cmd_exec} -INSTALL_CMD_DATA = @{var:install_cmd_data} +INSTALL_CMD_EXEC = %{install_cmd_exec} +INSTALL_CMD_DATA = %{install_cmd_data} LN = ln -fs MKDIR = @mkdir MKDIR_INSTALL = @umask 022; mkdir -p -m 755 -RANLIB = @{var:ranlib_command} +RANLIB = %{ranlib_command} RM = @rm -f RM_R = @rm -rf ################################################## # File Lists # ################################################## -CHECK = @{var:check_prefix}check +CHECK = %{check_prefix}check -DOCS = @{var:doc_files} +DOCS = %{doc_files} -HEADERS = @{var:include_files} +HEADERS = %{include_files} -LIBOBJS = @{var:lib_objs} +LIBOBJS = %{lib_objs} -CHECKOBJS = @{var:check_objs} +CHECKOBJS = %{check_objs} LIB_FLAGS = $(LIB_OPT) $(MACH_OPT) $(LANG_FLAGS) $(WARN_FLAGS) CHECK_FLAGS = $(CHECK_OPT) $(LANG_FLAGS) $(WARN_FLAGS) LIBRARIES = $(STATIC_LIB) -LIBNAME = @{var:lib_prefix}libbotan +LIBNAME = %{lib_prefix}libbotan STATIC_LIB = $(LIBNAME).a all: $(LIBRARIES) @@ -69,9 +69,9 @@ all: $(LIBRARIES) ################################################## # Build Commands # ################################################## -@{var:lib_build_cmds} +%{lib_build_cmds} -@{var:check_build_cmds} +%{check_build_cmds} ################################################## # Link Commands # @@ -92,15 +92,15 @@ $(STATIC_LIB): $(LIBOBJS) static: $(STATIC_LIB) doxygen: - doxygen @{var:doc-dir}/botan.doxy + doxygen %{doc_src_dir}/botan.doxy clean: - $(RM_R) @{var:build-dir}/lib/* @{var:build-dir}/checks/* + $(RM_R) %{build-dir}/lib/* %{build-dir}/checks/* $(RM) $(LIBRARIES) $(SYMLINK) $(CHECK) distclean: clean - $(RM_R) @{var:build-dir} - $(RM_R) @{var:doc-dir}/doxygen @{var:doc-dir}/botan.doxy + $(RM_R) %{build-dir} + $(RM_R) %{doc_src_dir}/doxygen %{doc_src_dir}/botan.doxy $(RM) Makefile $(CONFIG_SCRIPT) $(PKGCONFIG) install: $(LIBRARIES) diff --git a/src/build-data/makefile/unix_shr.in b/src/build-data/makefile/unix_shr.in index 5b1522f70..f718d1160 100644 --- a/src/build-data/makefile/unix_shr.in +++ b/src/build-data/makefile/unix_shr.in @@ -1,91 +1,91 @@ ################################################## # Compiler Options # ################################################## -CXX = @{var:cc} -LIB_OPT = @{var:lib_opt} -CHECK_OPT = @{var:check_opt} -MACH_OPT = @{var:mach_opt} -LANG_FLAGS = @{var:lang_flags} -WARN_FLAGS = @{var:warn_flags} -SO_OBJ_FLAGS = @{var:shared_flags} -SO_LINK_CMD = @{var:so_link} -LINK_TO = @{var:link_to} +CXX = %{cc} +LIB_OPT = %{lib_opt} +CHECK_OPT = %{check_opt} +MACH_OPT = %{mach_opt} +LANG_FLAGS = %{lang_flags} +WARN_FLAGS = %{warn_flags} +SO_OBJ_FLAGS = %{shared_flags} +SO_LINK_CMD = %{so_link} +LINK_TO = %{link_to} ################################################## # Version Numbers # ################################################## -VERSION = @{var:version} -SO_VERSION = @{var:so_version} +VERSION = %{version} +SO_VERSION = %{so_version} ################################################## # Installation Settings # ################################################## -DESTDIR = @{var:prefix} +DESTDIR = %{prefix} BINDIR = $(DESTDIR)/bin -LIBDIR = $(DESTDIR)/@{var:libdir} -HEADERDIR = $(DESTDIR)/@{var:includedir}/botan -DOCDIR = $(DESTDIR)/@{var:docdir}/Botan-$(VERSION) +LIBDIR = $(DESTDIR)/%{libdir} +HEADERDIR = $(DESTDIR)/%{includedir}/botan +DOCDIR = $(DESTDIR)/%{docdir}/Botan-$(VERSION) PKGCONF_DIR = $(LIBDIR)/pkgconfig -CONFIG_SCRIPT = @{var:botan-config} -PKGCONFIG = @{var:botan-pkgconfig} +CONFIG_SCRIPT = %{botan_config} +PKGCONFIG = %{botan_pkgconfig} ################################################## # Aliases for Common Programs # ################################################## -AR = @{var:ar_command} +AR = %{ar_command} CD = @cd ECHO = @echo -INSTALL_CMD_EXEC = @{var:install_cmd_exec} -INSTALL_CMD_DATA = @{var:install_cmd_data} +INSTALL_CMD_EXEC = %{install_cmd_exec} +INSTALL_CMD_DATA = %{install_cmd_data} LN = ln -fs MKDIR = @mkdir MKDIR_INSTALL = @umask 022; mkdir -p -m 755 -RANLIB = @{var:ranlib_command} +RANLIB = %{ranlib_command} RM = @rm -f RM_R = @rm -rf ################################################## # File Lists # ################################################## -CHECK = @{var:check_prefix}check +CHECK = %{check_prefix}check -DOCS = @{var:doc_files} +DOCS = %{doc_files} -HEADERS = @{var:include_files} +HEADERS = %{include_files} -LIBOBJS = @{var:lib_objs} +LIBOBJS = %{lib_objs} -CHECKOBJS = @{var:check_objs} +CHECKOBJS = %{check_objs} LIB_FLAGS = $(LIB_OPT) $(MACH_OPT) $(LANG_FLAGS) $(WARN_FLAGS) $(SO_OBJ_FLAGS) CHECK_FLAGS = $(CHECK_OPT) $(LANG_FLAGS) $(WARN_FLAGS) LIBRARIES = $(STATIC_LIB) $(SHARED_LIB) -LIBNAME = @{var:lib_prefix}libbotan +LIBNAME = %{lib_prefix}libbotan STATIC_LIB = $(LIBNAME).a -SHARED_LIB = $(LIBNAME)-$(SO_VERSION).@{var:so_suffix} -SONAME = $(LIBNAME)-$(SO_VERSION).@{var:so_suffix} +SHARED_LIB = $(LIBNAME)-$(SO_VERSION).%{so_suffix} +SONAME = $(LIBNAME)-$(SO_VERSION).%{so_suffix} -SYMLINK = libbotan.@{var:so_suffix} +SYMLINK = libbotan.%{so_suffix} all: $(LIBRARIES) ################################################## # Build Commands # ################################################## -@{var:lib_build_cmds} +%{lib_build_cmds} -@{var:check_build_cmds} +%{check_build_cmds} ################################################## # Link Commands # ################################################## $(CHECK): $(LIBRARIES) $(CHECKOBJS) - $(CXX) $(LDFLAGS) $(CHECKOBJS) -o $(CHECK) -L. -lbotan-@{var:so_version} $(LINK_TO) + $(CXX) $(LDFLAGS) $(CHECKOBJS) -o $(CHECK) -L. -lbotan-%{so_version} $(LINK_TO) $(STATIC_LIB): $(LIBOBJS) $(RM) $(STATIC_LIB) @@ -106,15 +106,15 @@ static: $(STATIC_LIB) shared: $(SHARED_LIB) doxygen: - doxygen @{var:doc-dir}/botan.doxy + doxygen %{doc_src_dir}/botan.doxy clean: - $(RM_R) @{var:build-dir}/lib/* @{var:build-dir}/checks/* + $(RM_R) %{build_dir}/lib/* %{build_dir}/checks/* $(RM) $(LIBRARIES) $(SYMLINK) $(CHECK) distclean: clean - $(RM_R) @{var:build-dir} - $(RM_R) @{var:doc-dir}/doxygen @{var:doc-dir}/botan.doxy + $(RM_R) %{build_dir} + $(RM_R) %{doc_src_dir}/doxygen %{doc_src_dir}/botan.doxy $(RM) Makefile $(CONFIG_SCRIPT) $(PKGCONFIG) install: $(LIBRARIES) -- cgit v1.2.3 From e3ca26266c2f5a684bbac6258603aaa10133c46a Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 1 Jul 2009 22:01:46 +0000 Subject: s/build-dir/build_dir/ in unix.in and nmake.in, missed them --- src/build-data/makefile/nmake.in | 12 ++++++------ src/build-data/makefile/unix.in | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/build-data/makefile/nmake.in b/src/build-data/makefile/nmake.in index b1e651551..fb9ab1542 100644 --- a/src/build-data/makefile/nmake.in +++ b/src/build-data/makefile/nmake.in @@ -93,15 +93,15 @@ static: $(STATIC_LIB) # Fake Targets # ################################################## clean: - $(RM) %{build-dir}\lib\* %{build-dir}\checks\* + $(RM) %{build_dir}\lib\* %{build_dir}\checks\* $(RM) $(LIBRARIES) $(CHECK) distclean: clean - $(RM) %{build-dir}\build.h - $(RM) %{build-dir}\include\botan\* - $(RMDIR) %{build-dir}\include\botan %{build-dir}\include - $(RMDIR) %{build-dir}\lib %{build-dir}\checks - $(RMDIR) %{build-dir} + $(RM) %{build_dir}\build.h + $(RM) %{build_dir}\include\botan\* + $(RMDIR) %{build_dir}\include\botan %{build_dir}\include + $(RMDIR) %{build_dir}\lib %{build_dir}\checks + $(RMDIR) %{build_dir} $(RM) Makefile ################################################## diff --git a/src/build-data/makefile/unix.in b/src/build-data/makefile/unix.in index 95859d16d..a48a5a17e 100644 --- a/src/build-data/makefile/unix.in +++ b/src/build-data/makefile/unix.in @@ -95,11 +95,11 @@ doxygen: doxygen %{doc_src_dir}/botan.doxy clean: - $(RM_R) %{build-dir}/lib/* %{build-dir}/checks/* + $(RM_R) %{build_dir}/lib/* %{build_dir}/checks/* $(RM) $(LIBRARIES) $(SYMLINK) $(CHECK) distclean: clean - $(RM_R) %{build-dir} + $(RM_R) %{build_dir} $(RM_R) %{doc_src_dir}/doxygen %{doc_src_dir}/botan.doxy $(RM) Makefile $(CONFIG_SCRIPT) $(PKGCONFIG) -- cgit v1.2.3 From 90dfb3ea86a76491bd7137d111e10a091ec00267 Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 2 Jul 2009 13:36:35 +0000 Subject: Use just %{version} instead of combining sub-parts needlessly in nmake.in --- src/build-data/makefile/nmake.in | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/src/build-data/makefile/nmake.in b/src/build-data/makefile/nmake.in index fb9ab1542..34c864e93 100644 --- a/src/build-data/makefile/nmake.in +++ b/src/build-data/makefile/nmake.in @@ -12,11 +12,7 @@ LINK_TO = %{link_to} ################################################## # Version Numbers # ################################################## -MAJOR = %{version_major} -MINOR = %{version_minor} -PATCH = %{version_patch} - -VERSION = $(MAJOR).$(MINOR).$(PATCH) +VERSION = %{version} ################################################## # Installation Settings # -- cgit v1.2.3 From d0d44b5d6862027688b3a529c7d6939fea6eafa4 Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 2 Jul 2009 19:00:36 +0000 Subject: Add dependencies for stream ciphers on stream --- src/stream/salsa20/info.txt | 4 ++++ src/stream/turing/info.txt | 4 ++++ src/stream/wid_wake/info.txt | 4 ++++ 3 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/stream/salsa20/info.txt b/src/stream/salsa20/info.txt index de1683643..db938307b 100644 --- a/src/stream/salsa20/info.txt +++ b/src/stream/salsa20/info.txt @@ -4,6 +4,10 @@ define SALSA20 load_on auto + +stream + + salsa20.cpp salsa20.h diff --git a/src/stream/turing/info.txt b/src/stream/turing/info.txt index 95ae2cf48..c251a0a30 100644 --- a/src/stream/turing/info.txt +++ b/src/stream/turing/info.txt @@ -4,6 +4,10 @@ define TURING load_on auto + +stream + + tur_tab.cpp turing.cpp diff --git a/src/stream/wid_wake/info.txt b/src/stream/wid_wake/info.txt index 299ebfdd7..94416417e 100644 --- a/src/stream/wid_wake/info.txt +++ b/src/stream/wid_wake/info.txt @@ -4,6 +4,10 @@ define WID_WAKE load_on auto + +stream + + wid_wake.cpp wid_wake.h -- cgit v1.2.3 From 591f112799b0aa6d6643666c4c67d4de24849c6e Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 2 Jul 2009 19:00:54 +0000 Subject: Only load mulop_amd64 on request (currently broken code) --- src/math/bigint/mulop_amd64/info.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/math/bigint/mulop_amd64/info.txt b/src/math/bigint/mulop_amd64/info.txt index 670780d9c..0960ac4d6 100644 --- a/src/math/bigint/mulop_amd64/info.txt +++ b/src/math/bigint/mulop_amd64/info.txt @@ -2,7 +2,7 @@ realname "BigInt Multiply-Add (x86-64)" mp_bits 64 -load_on dep +load_on request mp_mulop_amd64.S -- cgit v1.2.3 From df43e947c8dcae4c61948b84007a08369d5cdc37 Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 2 Jul 2009 19:44:41 +0000 Subject: Macro defines are split up in the build.h template now --- src/build-data/buildh.in | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in index 496826d91..e4ab0f44b 100644 --- a/src/build-data/buildh.in +++ b/src/build-data/buildh.in @@ -37,8 +37,16 @@ #endif /* Target identification and feature test macros */ +%{target_os_defines} -%{defines} +%{target_cpu_defines} + +%{target_compiler_defines} + +/* Module definitions */ +%{module_defines} + +/* Local configuration options */ %{local_config} /* -- cgit v1.2.3 From 1163077648f0ee5719aebf9b1d73c552ada2aab3 Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 2 Jul 2009 21:59:49 +0000 Subject: Minor hackery to deal with win32 library dependencies --- configure.pl | 5 ++--- configure.py | 4 ++-- src/entropy/cryptoapi_rng/info.txt | 2 +- src/entropy/win32_stats/info.txt | 2 +- src/timer/win32_query_perf_ctr/info.txt | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/configure.pl b/configure.pl index 73344b182..00c88913f 100755 --- a/configure.pl +++ b/configure.pl @@ -1673,7 +1673,7 @@ sub get_module_info { read_list($_, $reader, 'libs', sub { my $line = $_[0]; - $line =~ m/^([\w!,]*) -> ([\w,-]*)$/; + $line =~ m/^([\w!,]*) -> ([\w.,-]*)$/; $info{'libs'}{$1} = $2; }); @@ -2097,8 +2097,7 @@ sub generate_makefile { add_to($config, { 'shared' => 'no', - 'link_to' => libs('', '.'.$$config{'static_suffix'}, - @{$$config{'mod_libs'}}), + 'link_to' => libs('', '', '', @{$$config{'mod_libs'}}), }); } diff --git a/configure.py b/configure.py index c27950d75..4d77d8042 100755 --- a/configure.py +++ b/configure.py @@ -407,8 +407,8 @@ class CompilerInfo(object): return ['USE_STD_TR1'] elif self.compiler_has_tr1: return ['USE_STD_TR1'] - else: - return [] + + return [] class OsInfo(object): def __init__(self, infofile): diff --git a/src/entropy/cryptoapi_rng/info.txt b/src/entropy/cryptoapi_rng/info.txt index 40104664b..643c67d2e 100644 --- a/src/entropy/cryptoapi_rng/info.txt +++ b/src/entropy/cryptoapi_rng/info.txt @@ -17,5 +17,5 @@ cygwin -windows -> advapi32 +windows -> advapi32.lib diff --git a/src/entropy/win32_stats/info.txt b/src/entropy/win32_stats/info.txt index 825765539..ca7100923 100644 --- a/src/entropy/win32_stats/info.txt +++ b/src/entropy/win32_stats/info.txt @@ -20,5 +20,5 @@ mingw -windows -> user32 +windows -> user32.lib diff --git a/src/timer/win32_query_perf_ctr/info.txt b/src/timer/win32_query_perf_ctr/info.txt index e74259184..4bb1ddb34 100644 --- a/src/timer/win32_query_perf_ctr/info.txt +++ b/src/timer/win32_query_perf_ctr/info.txt @@ -17,7 +17,7 @@ mingw -windows -> user32 +windows -> user32.lib -- cgit v1.2.3 From c0ef6445300f404c75175a3d44247624b297948b Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 2 Jul 2009 22:38:18 +0000 Subject: Add some aliases for 586/686 to match against what platform produces on WinXP --- src/build-data/arch/ia32 | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/build-data/arch/ia32 b/src/build-data/arch/ia32 index 9ac41b74b..aafcf9a77 100644 --- a/src/build-data/arch/ia32 +++ b/src/build-data/arch/ia32 @@ -35,6 +35,9 @@ pentiumii -> pentium2 pentium3 -> pentium3 pentiumiii -> pentium3 +x86family5 -> i586 +x86family6 -> i686 + pentiumm -> pentium-m intelpentiumm -> pentium-m -- cgit v1.2.3 From 88cfd2b1f814272cde16930e687187ec9107427f Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 2 Jul 2009 23:46:35 +0000 Subject: Fix a subtle bug in the /dev/*random reader. The maximum ms wait time was set to 1000 ms (scaling based on amount of data requested). At 1000 ms exactly, we would form a timeval of 0 seconds and 1000000 usecs (ie, 1 second). Linux was fine with this, but FreeBSD 7.0's select was returning EINVAL. Fix things to properly create the timeval so that everyone is happy. --- src/entropy/dev_random/es_dev.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/entropy/dev_random/es_dev.cpp b/src/entropy/dev_random/es_dev.cpp index e6033753d..ef3074194 100644 --- a/src/entropy/dev_random/es_dev.cpp +++ b/src/entropy/dev_random/es_dev.cpp @@ -40,8 +40,9 @@ u32bit Device_EntropySource::Device_Reader::get(byte out[], u32bit length, FD_SET(fd, &read_set); struct ::timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = ms_wait_time * 1000; + + timeout.tv_sec = (ms_wait_time / 1000); + timeout.tv_usec = (ms_wait_time % 1000) * 1000; if(::select(fd + 1, &read_set, 0, 0, &timeout) < 0) return 0; -- cgit v1.2.3