[Botan-devel] Issues with 1.2.4 and the workarounds
Brought to you by:
randombit
|
From: Jeff B <je...@ho...> - 2003-06-06 21:51:05
|
Hello, if you missed my posts yesterday, here's the scoop: I'm an
experienced programmer but I'm new to encryption and the Botan library, and
I'm currently evaluating Botan to use in a project I'm working on. I've got
the 1.2.4 sources and I'm trying to build using Visual Studio .NET 2003 on
Windows and CodeWarrior Pro 8.3 on MacOS X, but I'm having troubles building
on Windows and running on Mac...
Issue #1: Windows compile problem solved/workaround. The following in
get_ciph.cpp, line 87
Invalid_Combination(const std::string& mode, const std::string& pad) :
Exception("Invalid mode/padding pair: " + mode + "/" + pad) {}
Doesn't compile. If you comment out mode and pad and change it to
Invalid_Combination(const std::string& mode, const std::string& pad) :
Exception("Invalid mode/padding pair: " /*+ mode + "/" + pad*/) {}
It's able to compile and run (I've built a console app using the
rsa_kgen.cpp file.
Issue #2: In my test project (build on rsa_kgen.cpp),
Botan::Init::Initialize() was throwing because total_bits (generated from
Global_RNG::seed()) was zero. When I reported the problem yesterday, I had
indicated that it was a Mac problem... Turns out it's a Windows problem as
well.
I used "perl configure.pl msvc-windows-i486" to configure Botan on Windows.
When I ran the Windows version, Botan::Init::Initialize() was throwing, just
like it was on the mac.
Botan::Global_RNG::seed(), without any of the BOTAN_EXT_ENTROPY_SRC_EGD,
BOTAN_EXT_ENTROPY_SRC_CAPI, etc... defined, is the whittled down to the
following:
u32bit seed(bool slow_poll, u32bit bits_to_get)
{
u32bit bits = 0;
bits += poll_es<File_EntropySource>(slow_poll);
if(bits >= bits_to_get) return bits;
if(bits >= bits_to_get) return bits;
return bits;
}
}
Well, poll_es<File_EntropySource>(slow_poll) tries to read "/dev/urandom"
and "/dev/random" for random source bits, but neither of these files exist
on either of my machines (Mac or Windows), so
File_EntropySource::slow_poll() isn't placing anything into the buffer,
which causes poll_es() to return zero bits, which in turn causes
initialize() to throw.
When I added #define BOTAN_EXT_ENTROPY_SRC_WIN32 to the Windows project, the
same code got executed (and urandom and random weren't found), but the
addition of
bits += poll_es<Win32_EntropySource>(slow_poll);
called the Windows-specific code (Win32_EntropySource::do_fast_poll() and
Win32_EntropySource::do_slow_poll()) and added bits to the seed and
everything worked (YEA!)
OK, now, a question: Is this a known issue? From what I can tell, you need
to either have a "urandom" or "random" file present, or a platform-specific
#define (like BOTAN_EXT_ENTROPY_SRC_WIN32 ) in order for it to work. If
this is in the docs, I apologies... I missed it.
Jeff
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
|