From 55608e7dd1aa593944f967f2549564e4f42b654e Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 31 May 2007 03:25:19 +0000 Subject: Write functions to handle loading and saving words a block at a time, taking into account endian differences. The current code does not take advantage of the knowledge of which endianness we are running on; an optimization suggested by Yves Jerschow is to use (unsafe) casts to speed up the load/store operations. This turns out to provide large performance increases (30% or more) in some cases. Even without the unsafe casts, this version seems to average a few percent faster, probably because the longer loading loops have been partially or fully unrolled. This also makes the code implementing low-level algorithms like ciphers and hashes a bit more succint. --- src/randpool.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/randpool.cpp') diff --git a/src/randpool.cpp b/src/randpool.cpp index e041cf873..ed60b385a 100644 --- a/src/randpool.cpp +++ b/src/randpool.cpp @@ -9,6 +9,8 @@ #include #include +#include + namespace Botan { namespace { @@ -63,8 +65,7 @@ void Randpool::update_buffer() for(u32bit j = 0; j != counter.size(); ++j) if(++counter[j]) break; - for(u32bit j = 0; j != 8; ++j) - counter[j+4] = get_byte(j, timestamp); + store_be(timestamp, counter + 4); SecureVector mac_val = randpool_prf(mac, GEN_OUTPUT, counter, counter.size()); -- cgit v1.2.3