From 853f757ecea74a271a7c5cdee3f3b5fe0d3ae863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bodo=20M=C3=B6ller?= Date: Sat, 19 Feb 2000 15:22:53 +0000 Subject: Allow for higher granularity of entropy estimates by using 'double' instead of 'unsigned' counters. Seed PRNG in MacOS/GetHTTPS.src/GetHTTPS.cpp. Partially submitted by Yoram Meroz . --- MacOS/GetHTTPS.src/GetHTTPS.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'MacOS') diff --git a/MacOS/GetHTTPS.src/GetHTTPS.cpp b/MacOS/GetHTTPS.src/GetHTTPS.cpp index 8e02333154..ed8e1cc962 100644 --- a/MacOS/GetHTTPS.src/GetHTTPS.cpp +++ b/MacOS/GetHTTPS.src/GetHTTPS.cpp @@ -18,6 +18,7 @@ * Also-- before attempting to compile this, make sure the aliases in "OpenSSL-0.9.4:include:openssl" * are installed! Use the AppleScript applet in the "openssl-0.9.4" folder to do this! */ +/* modified to seed the PRNG */ // Include some funky libs I've developed over time @@ -32,8 +33,9 @@ #include #include +#include - +#include // Let's try grabbing some data from here: @@ -77,8 +79,11 @@ SSL_CTX *ssl_ctx = nil; SSL *ssl = nil; char tempString[256]; - +UnsignedWide microTickCount; +#warning -- USE A TRUE RANDOM SEED, AND ADD ENTROPY WHENEVER POSSIBLE. -- +const char seed[] = "uyq9,7-b(VHGT^%$&^F/,876;,;./lkJHGFUY{PO*"; // Just gobbledygook + printf("OpenSSL Demo by Roy Wood, roy@centricsystems.ca\n\n"); BailIfError(errCode = MacSocket_Startup()); @@ -113,6 +118,10 @@ char tempString[256]; // ssl_ctx = SSL_CTX_new(SSLv3_client_method()); + RAND_seed (seed, sizeof (seed)); + Microseconds (µTickCount); + RAND_add (µTickCount, sizeof (microTickCount), 0); // Entropy is actually > 0, needs an estimate + // Create an SSL thingey and try to negotiate the connection ssl = SSL_new(ssl_ctx); -- cgit v1.2.3