diff options
author | Bodo Möller <bodo@openssl.org> | 2000-02-19 15:22:53 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2000-02-19 15:22:53 +0000 |
commit | 853f757ecea74a271a7c5cdee3f3b5fe0d3ae863 (patch) | |
tree | 13a2eb9ba4e6b03334914e6e0b8cd465cadce870 /MacOS | |
parent | ae1bb4e572e02ce73d54c05ce18e872c36da2d35 (diff) | |
download | openssl-new-853f757ecea74a271a7c5cdee3f3b5fe0d3ae863.tar.gz |
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 <yoram@mail.idrive.com>.
Diffstat (limited to 'MacOS')
-rw-r--r-- | MacOS/GetHTTPS.src/GetHTTPS.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
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 <openssl/ssl.h> #include <openssl/err.h> +#include <openssl/rand.h> - +#include <timer.h> // 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); |