[Botan-devel] ...and a little help on the mac as well
Brought to you by:
randombit
|
From: Jeff B <je...@ho...> - 2003-06-05 23:49:00
|
If you read my previous message, you'll know that I'm trying to build Botan 1.2.4 on Windows using VS .NET 2003. Now, I'm trying to build Botan 1.2.4 on the Macintosh (for MacOS X) using Codewarrior 8. Here's the scoop: 1. I used perl configure.pl gcc-aix-ppc to set up my configuration. Does this seem right? I know that the mac & ppc aren't supported but http://botan.randombit.net/ states that Botan cam be built for MacOS X (albeit using gcc). 2. I created a console project using /Botan/Doc/Examples/rsa_kgen.cpp and added the Botan source. 3. The project compiles and links. When I run the project, I pass main() "512 ThisIsASamplePassphrase", but LibraryInitializer init; Fails. Looking into it, LibraryInitializer::LibraryInitializer() calls Init::initialize(arg_string); (arg_stringis is "") Inside Init::initialize() total_bits += Global_RNG::seed(true, min_entropy - total_bits); Inside Global_RNG::seed() bits += poll_es<File_EntropySource>(slow_poll); whuch calls poll_es() in rng_seed.cpp poll_es() is template<class ES> u32bit poll_es(bool slow_poll, u32bit buf_size = 256) { ES source; SecureVector<byte> buffer(buf_size); u32bit got = 0; if(slow_poll) got = source.slow_poll(buffer, buffer.size()); else got = source.fast_poll(buffer, buffer.size()); Global_RNG::add_entropy(buffer, got); return entropy_estimate(buffer, got); } } when ES object is constructed, File_EntropySource::File_EntropySource(const std::string& sources) { std::vector<std::string> source_list = split_on(sources, ':'); std::vector<std::string> defaults = Config::get_list("rng/es_files"); for(u32bit j = 0; j != source_list.size(); j++) add_source(source_list[j]); for(u32bit j = 0; j != defaults.size(); j++) add_source(defaults[j]); } the sources var that's passed in is "", so std::vector<std::string> source_list = split_on(sources, ':'); source_list is "" and std::vector<std::string> defaults = Config::get_list("rng/es_files"); is returning "/dev/urandom:/dev/random" stepping out and getting back to poll_es(), the call if(slow_poll) got = source.slow_poll(buffer, buffer.size()); is going to u32bit File_EntropySource::slow_poll(byte output[], u32bit length) { u32bit read = 0; for(u32bit j = 0; j != sources.size(); j++) { std::ifstream random_source(sources[j].c_str()); if(!random_source) continue; random_source.read((char*)output + read, length); read += random_source.gcount(); length -= random_source.gcount(); if(length == 0) break; } return read; } when j=0 and we try std::ifstream random_source(sources[j].c_str()); Sources[0] is "/dev/urandom" and std::ifstream() is failing Likewise, when j=1 Sources[0] is "/dev/random" and std::ifstream() is failing OK, I'm curious... Under Linix, if you std::ifstream("/directory/MyFile.txt"); Does this work? Any suggestions on what to do? Thanks, Jeff _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail |