diff -Pru OpenCL-0.7.1/checks/bench.cpp OpenCL-Badlib/checks/bench.cpp --- OpenCL-0.7.1/checks/bench.cpp Wed May 16 10:18:30 2001 +++ OpenCL-Badlib/checks/bench.cpp Wed May 16 20:42:35 2001 @@ -1,8 +1,8 @@ /* This file is in the public domain */ -#include -#include -#include +#include +#include +#include #include #include @@ -109,9 +109,9 @@ std::string(int(2*ivlen), 'A')); if(!filter) { - std::cout << "Filter lookup doesn't know about " - << filtername << std::endl; - std::exit(1); + cout << "Filter lookup doesn't know about " + << filtername << endl; + exit(1); } OpenCL::Pipe pipe(filter, new BitBucket); @@ -119,7 +119,7 @@ byte buf[BUFFERSIZE]; rng.randomize(buf, BUFFERSIZE); u32bit iterations = 1, j = 0; - u32bit start = std::clock(), clocks_used = 0; + u32bit start = clock(), clocks_used = 0; /* 2/3 is a fudge factor; even with it the tests take longer than one might expect */ while(clocks_used < (2.0 / 3.0) * seconds * CLOCKS_PER_SEC) @@ -127,7 +127,7 @@ iterations *= 2; for(; j != iterations; j++) pipe.write(buf, BUFFERSIZE); - clocks_used = std::clock() - start; + clocks_used = clock() - start; } double bytes_per_sec = ((double)iterations * BUFFERSIZE) / @@ -136,14 +136,14 @@ if(html) { - std::cout << "" << name << std::string(25 - name.length(), ' '); - std::cout << "" << std::setw(6) << kbytes_per_sec << std::endl; + cout << "" << name << std::string(25 - name.length(), ' '); + cout << "" << setw(6) << kbytes_per_sec << endl; } else { - std::cout << name << ": " << std::string(25 - name.length(), ' '); - std::cout << std::setw(6) << kbytes_per_sec << " kbytes/sec" - << std::endl; + cout << name << ": " << std::string(25 - name.length(), ' '); + cout << setw(6) << kbytes_per_sec << " kbytes/sec" + << endl; } } @@ -152,7 +152,7 @@ try { if(html) { - std::cout << "\n" << "\n\n" << "OpenCL Benchmarks\n\n" @@ -170,23 +170,23 @@ algorithms[j].keylen, algorithms[j].ivlen); if(html) - std::cout << "\n\n\n"; + cout << "\n\n\n"; } catch(OpenCL::Exception& e) { - std::cout << "OpenCL exception caught: " << e.what() << std::endl; - std::exit(1); + cout << "OpenCL exception caught: " << e.what() << endl; + exit(1); } catch(std::exception& e) { - std::cout << "Standard library exception caught: " << e.what() - << std::endl; - std::exit(1); + cout << "Standard library exception caught: " << e.what() + << endl; + exit(1); } catch(...) { - std::cout << "Unknown exception caught." << std::endl; - std::exit(1); + cout << "Unknown exception caught." << endl; + exit(1); } } diff -Pru OpenCL-0.7.1/checks/block.cpp OpenCL-Badlib/checks/block.cpp --- OpenCL-0.7.1/checks/block.cpp Sun Apr 29 18:07:23 2001 +++ OpenCL-Badlib/checks/block.cpp Wed May 16 20:42:36 2001 @@ -1,6 +1,6 @@ /* This file is in the public domain */ -#include +#include #include #include @@ -111,13 +111,13 @@ for(int j = 0; j != 4; j++) if(hash_input[j] != hash_decrypt[j]) { - std::cout << "In " << typeid(cipher).name() - << " decryption CRC check failed." << std::endl; + cout << "In " << typeid(cipher).name() + << " decryption CRC check failed." << endl; } #endif if(position) { - std::cout << "In ECB_Filter::final, position != 0" << std::endl; + cout << "In ECB_Filter::final, position != 0" << endl; } } diff -Pru OpenCL-0.7.1/checks/check.cpp OpenCL-Badlib/checks/check.cpp --- OpenCL-0.7.1/checks/check.cpp Wed May 16 10:08:39 2001 +++ OpenCL-Badlib/checks/check.cpp Wed May 16 20:42:36 2001 @@ -6,9 +6,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -52,17 +52,17 @@ { if(j != args.size() - 1) /* another arg remains */ { - seconds = std::strtod(args[j+1].c_str(), 0); + seconds = strtod(args[j+1].c_str(), 0); /* sanity check; we allow zero for testing porpoises */ if((seconds < 0.1 || seconds > 30) && seconds != 0) { - std::cout << "Invalid argument to --seconds\n"; + cout << "Invalid argument to --seconds\n"; return 2; } } else { - std::cout << "Option --seconds needs an argument\n"; + cout << "Option --seconds needs an argument\n"; return 2; } } @@ -85,7 +85,7 @@ void print_help(double seconds) { - std::cout << "Usage:\n" + cout << "Usage:\n" << " --validate: Check test vectors\n" << " --bench-{all,block,mode,stream,hash,mac,rng}: Benchmark\n" << " --html: Produce HTML output for benchmarks\n" @@ -99,7 +99,7 @@ void test_types(); int do_validation_tests(const std::string&); - std::cout << "Beginning validation tests..." << std::endl; + cout << "Beginning validation tests..." << endl; test_types(); int errors = 0; try @@ -108,26 +108,26 @@ } catch(OpenCL::Exception& e) { - std::cout << "Exception caught: " << e.what() << std::endl; - std::exit(1); + cout << "Exception caught: " << e.what() << endl; + exit(1); } catch(std::exception& e) { - std::cout << "Standard library exception caught: " - << e.what() << std::endl; - std::exit(1); + cout << "Standard library exception caught: " + << e.what() << endl; + exit(1); } catch(...) { - std::cout << "Unknown exception caught." << std::endl; - std::exit(1); + cout << "Unknown exception caught." << endl; + exit(1); } if(errors == 0) - std::cout << "All tests passed!" << std::endl; + cout << "All tests passed!" << endl; else - std::cout << errors << " test" << ((errors == 1) ? "" : "s") - << " failed." << std::endl; - std::exit(errors ? 1 : 0); + cout << errors << " test" << ((errors == 1) ? "" : "s") + << " failed." << endl; + exit(errors ? 1 : 0); } #if defined(TEST_TYPES) @@ -137,27 +137,27 @@ bool passed = true; if(std::numeric_limits::is_specialized == false) { - std::cout << "WARNING: Could not check parameters of " << type - << " in std::numeric_limits" << std::endl; + cout << "WARNING: Could not check parameters of " << type + << " in std::numeric_limits" << endl; return true; } if(std::numeric_limits::digits != digits && digits != 0) { - std::cout << "ERROR: numeric_limits<" << type << ">::digits != " - << digits << std::endl; + cout << "ERROR: numeric_limits<" << type << ">::digits != " + << digits << endl; passed = false; } if(std::numeric_limits::is_signed != is_signed) { - std::cout << "ERROR: numeric_limits<" << type << ">::is_signed != " - << std::boolalpha << is_signed << std::endl; + cout << "ERROR: numeric_limits<" << type << ">::is_signed != " + << std::boolalpha << is_signed << endl; passed = false; } if(std::numeric_limits::is_integer == false) { - std::cout << "ERROR: numeric_limits<" << type - << ">::is_integer == false " << std::endl; + cout << "ERROR: numeric_limits<" << type + << ">::is_integer == false " << endl; passed = false; } return passed; @@ -178,14 +178,14 @@ passed = passed && test("dword", 0, false); if(std::numeric_limits::digits != 2*std::numeric_limits::digits) - std::cout << "ERROR: numeric_limits::digits != " - "2*numeric_limits::digits" << std::endl; + cout << "ERROR: numeric_limits::digits != " + "2*numeric_limits::digits" << endl; #endif if(!passed) { - std::cout << "Important settings in config.h are wrong. Please fix " - "and recompile." << std::endl; - std::exit(1); + cout << "Important settings in config.h are wrong. Please fix " + "and recompile." << endl; + exit(1); } } diff -Pru OpenCL-0.7.1/checks/validate.cpp OpenCL-Badlib/checks/validate.cpp --- OpenCL-0.7.1/checks/validate.cpp Sat Mar 31 10:03:02 2001 +++ OpenCL-Badlib/checks/validate.cpp Wed May 16 20:42:38 2001 @@ -3,8 +3,8 @@ This file is in the public domain */ -#include -#include +#include +#include #include #include @@ -22,12 +22,12 @@ u32bit do_validation_tests(const std::string& filename) { - std::ifstream test_data(filename.c_str()); + ifstream test_data(filename.c_str()); if(!test_data) { - std::cout << "Couldn't open test file " << filename << std::endl; - std::exit(1); + cout << "Couldn't open test file " << filename << endl; + exit(1); } u32bit errors = 0, alg_count = 0; @@ -36,8 +36,8 @@ { if(test_data.bad() || test_data.fail()) { - std::cout << "File I/O error." << std::endl; - std::exit(1); + cout << "File I/O error." << endl; + exit(1); } std::string line; @@ -72,8 +72,8 @@ alg_count++; if(failed_test(algorithm, substr[0], substr[1], substr[2], substr[3])) { - std::cout << "ERROR: \"" << algorithm << "\" failed test #" - << alg_count << std::endl; + cout << "ERROR: \"" << algorithm << "\" failed test #" + << alg_count << endl; errors++; } } @@ -105,9 +105,9 @@ OpenCL::Filter* test = lookup(algo, key, iv); if(test == 0) { - std::cout << "ERROR: \"" + algo + "\" is not a known algorithm name." - << std::endl; - std::exit(1); + cout << "ERROR: \"" + algo + "\" is not a known algorithm name." + << endl; + exit(1); } OpenCL::Pipe pipe(new OpenCL::HexDecoder, test, new OpenCL::HexEncoder); @@ -119,7 +119,7 @@ return true; for(u32bit j = 0; j != output.size(); j++) - if(output[j] != expected[j] && output[j] != std::toupper(expected[j])) + if(output[j] != expected[j] && output[j] != toupper(expected[j])) return true; return false; diff -Pru OpenCL-0.7.1/include/opencl/filtbase.h OpenCL-Badlib/include/opencl/filtbase.h --- OpenCL-0.7.1/include/opencl/filtbase.h Sat Mar 24 23:57:40 2001 +++ OpenCL-Badlib/include/opencl/filtbase.h Wed May 16 20:42:47 2001 @@ -6,7 +6,7 @@ #ifndef OPENCL_FILTER_BASE_H__ #define OPENCL_FILTER_BASE_H__ -#include +#include #include namespace OpenCL { @@ -86,8 +86,8 @@ /************************************************* * Input and Ouput Operators for Pipe * *************************************************/ -std::ostream& operator<<(std::ostream&, Pipe&); -std::istream& operator>>(std::istream&, Pipe&); +ostream& operator<<(ostream&, Pipe&); +istream& operator>>(istream&, Pipe&); /************************************************* * Fork * diff -Pru OpenCL-0.7.1/include/opencl/secalloc.h OpenCL-Badlib/include/opencl/secalloc.h --- OpenCL-0.7.1/include/opencl/secalloc.h Sat Mar 24 03:02:46 2001 +++ OpenCL-Badlib/include/opencl/secalloc.h Wed May 16 20:42:57 2001 @@ -6,7 +6,7 @@ #ifndef OPENCL_SECURE_ALLOCATION_H__ #define OPENCL_SECURE_ALLOCATION_H__ -#include +#include #include namespace OpenCL { @@ -32,7 +32,7 @@ unlock(ptr, n); delete[] ptr; } - static void clear(T* ptr, u32bit n) { std::memset(ptr, 0, sizeof(T)*n); } + static void clear(T* ptr, u32bit n) { memset(ptr, 0, sizeof(T)*n); } static void lock(T* ptr, u32bit n) { lock_mem(ptr, sizeof(T)*n); } static void unlock(T* ptr, u32bit n) { unlock_mem(ptr, sizeof(T)*n); } }; diff -Pru OpenCL-0.7.1/include/opencl/util.h OpenCL-Badlib/include/opencl/util.h --- OpenCL-0.7.1/include/opencl/util.h Fri Mar 30 18:19:12 2001 +++ OpenCL-Badlib/include/opencl/util.h Wed May 16 20:43:01 2001 @@ -7,7 +7,7 @@ #define OPENCL_UTIL_H__ #include -#include +#include #include namespace OpenCL { @@ -50,7 +50,7 @@ * Miscellaneous Functions * *************************************************/ template inline void copy_mem(T* out, const T* in, u32bit count) - { std::memcpy(out, in, sizeof(T)*count); } + { memcpy(out, in, sizeof(T)*count); } void xor_buf(byte[], const byte[], u32bit); void xor_buf(byte[], const byte[], const byte[], u32bit); diff -Pru OpenCL-0.7.1/old_libC.pl OpenCL-Badlib/old_libC.pl --- OpenCL-0.7.1/old_libC.pl Wed Dec 31 19:00:00 1969 +++ OpenCL-Badlib/old_libC.pl Wed May 16 20:42:21 2001 @@ -0,0 +1,48 @@ +#!/usr/bin/perl + +%new2old = ( + "" => "", + "" => "", + "" => "", + "" => "", + "" => "", + "" => "", + "" => "", + + "std::memcpy" => "memcpy", + "std::memset" => "memset", + "std::cout" => "cout", + "std::strlen" => "strlen", + "std::strcmp" => "strcmp", + "std::strtod" => "strtod", + "std::setw" => "setw", + "std::ostream" => "ostream", + "std::istream" => "istream", + "std::ifstream" => "ifstream", + "std::clock" => "clock", + "std::time" => "time", + "std::toupper" => "toupper", + "std::exit" => "exit", + "std::endl" => "endl", +); + +foreach $file (@ARGV) +{ + open INPUT, $file or die "open input ($!)"; + $data = ""; + while() + { + foreach $key (keys %new2old) + { + if(/$key/) + { + s/$key/$new2old{$key}/g; + } + } + $data .= $_; + } + close INPUT; + open OUTPUT, ">$file" or die "open output ($!)"; + print OUTPUT $data; + close OUTPUT; +} diff -Pru OpenCL-0.7.1/src/filtbase.cpp OpenCL-Badlib/src/filtbase.cpp --- OpenCL-0.7.1/src/filtbase.cpp Sat Mar 24 03:02:37 2001 +++ OpenCL-Badlib/src/filtbase.cpp Wed May 16 20:43:09 2001 @@ -159,7 +159,7 @@ /************************************************* * Write data from a pipe into a stream * *************************************************/ -std::ostream& operator<<(std::ostream& stream, Pipe& pipe) +ostream& operator<<(ostream& stream, Pipe& pipe) { static const u32bit BUFFERSIZE = DEFAULT_BUFFERSIZE; SecureBuffer buffer; @@ -176,7 +176,7 @@ /************************************************* * Read data from a stream into a pipe * *************************************************/ -std::istream& operator>>(std::istream& stream, Pipe& pipe) +istream& operator>>(istream& stream, Pipe& pipe) { static const u32bit BUFFERSIZE = DEFAULT_BUFFERSIZE; SecureBuffer buffer; diff -Pru OpenCL-0.7.1/src/timers.cpp OpenCL-Badlib/src/timers.cpp --- OpenCL-0.7.1/src/timers.cpp Fri Mar 30 18:17:16 2001 +++ OpenCL-Badlib/src/timers.cpp Wed May 16 20:43:37 2001 @@ -3,7 +3,7 @@ * (C) 1999-2001 The OpenCL Project * *************************************************/ -#include +#include #include namespace OpenCL { @@ -13,12 +13,12 @@ *************************************************/ u64bit system_time() { - return std::time(0); + return time(0); } u64bit system_clock() { - return std::clock(); + return clock(); } }