[Botan-devel] Botan 1.7.23 / 1.8.0 RC2: TR1 on by default, some hash and entropy polling optimizations

Jack Lloyd lloyd at randombit.net
Sun Nov 23 18:03:03 EST 2008

I decided to go ahead with 1.7.23 aka 1.8.0 RC2 a bit earlier than
originally planned, mostly because I ended up doing more than I
expected in the last week, and wanted to push things out for a bit of
eval. Nothing that should be really user visible or application
breaking, AFAIK, just some final cleanups, and one experiment in
optimization that turned out far better than I expected.

A rundown of the change notes, line by line:

 - By default use TR1 (thus enabling ECDSA) with GCC and ICC

As previously mentioned on botan-devel, TR1 is enabled by default when
compiling with GNU C++ and Intel C++. To disable, use --with-tr1=none

 - Optimize almost all hash functions, especially MD4 and Tiger

A simple change increased the throughput of most hash function
implementations (on Intel Core2/GCC) by 1-3%, and MD4 and Tiger gained
over 10%.

MDx_HashFunction::hash provided access to the hash compression
function, one block at a time. This function was changed to
compress_n, which can apply the compression function to more than one
block in sequence. This allows much better cache effects, etc when
processing long blocks. This is why MD4 and Tiger had the most
impressive speedups - their round functions are so simple (relatively
speaking) that the loop overhead was a much larger portion of the
overall runtime.

 - Cache socket descriptors in the EGD entropy source
 - Avoid bogging down startup in /proc walking entropy source
 - Remove Buffered_EntropySource helper class

These are changes to reduce startup latency, since commonly first
thing an app does is create an RNG and attempt to seed it. Cuts RNG
reseed time in about half on my machine.

 - Add configure.pl options --{with,without}-{bzip2,zlib,openssl,gnump}

Turned out to be pretty useful in the Gentoo ebuild, probably other things
that want to configure Botan builds but would prefer to talk to something
that looks (at least vaguely) like autoconf.

 - Add a Default_Benchmark_Timer typedef in benchmark.h
 - Add examples using benchmark.h and Algorithm_Factory
 - Make Timer pure virtual, and add ANSI_Clock_Timer

Instead of Timer::clock's default implementation using std::clock and
having it be overridden in subclasses, make Timer a pure virtual
interface and derive a new class from it for accessing std::clock.

Default_Benchmark_Timer is to help users of benchmark.h, you have to
pass a Timer& to the function but it would be a pain to have to pick
one out in each place you wished to check the speed of an algo.
Default_Benchmark_Timer will currently use either clock_gettime,
gettimeofday, or clock, in order of preference.

There is some text explaining the new examples at

 - Add (more) ECC tests from InSiTo

Once imported, all tests passed without changes.

 - Minor documentation updates

Emphasis on minor.

Download from http://botan.randombit.net/download.html

I'm still anticipating releasing 1.8.0 around early-mid
December. There may be a 1.7.24 / RC3, or there may not, depending on
what happens between now and then.


More information about the botan-devel mailing list