diff options
author | Anthony Neal <aneal@zeroc.com> | 2002-03-26 21:27:15 +0000 |
---|---|---|
committer | Anthony Neal <aneal@zeroc.com> | 2002-03-26 21:27:15 +0000 |
commit | 91c4282aba368df0ea155431f5f2be42ce3c09ea (patch) | |
tree | dcf3f1f9a595d00ac6b442bdd4c19014ef432043 /cpp/src/Ice/SystemOpenSSL.cpp | |
parent | Updated to allow for the removal of RequestQueue?.h. (diff) | |
download | ice-91c4282aba368df0ea155431f5f2be42ce3c09ea.tar.bz2 ice-91c4282aba368df0ea155431f5f2be42ce3c09ea.tar.xz ice-91c4282aba368df0ea155431f5f2be42ce3c09ea.zip |
Conformance to Code Style review. As well, cleaned out some old code that
wasn't needed any more.
Diffstat (limited to 'cpp/src/Ice/SystemOpenSSL.cpp')
-rw-r--r-- | cpp/src/Ice/SystemOpenSSL.cpp | 113 |
1 files changed, 57 insertions, 56 deletions
diff --git a/cpp/src/Ice/SystemOpenSSL.cpp b/cpp/src/Ice/SystemOpenSSL.cpp index aca6301513e..0b8822904e8 100644 --- a/cpp/src/Ice/SystemOpenSSL.cpp +++ b/cpp/src/Ice/SystemOpenSSL.cpp @@ -512,94 +512,95 @@ IceSSL::OpenSSL::System::~System() int IceSSL::OpenSSL::System::seedRand() { - int retCode = 1; - char buffer[1024]; - #ifdef WINDOWS RAND_screen(); #endif + char buffer[1024];
const char* file = RAND_file_name(buffer, sizeof(buffer)); - - if (file == 0 || !RAND_load_file(file, -1)) - { - retCode = 0; - } - else - { - _randSeeded = 1; - } - - return retCode; +
+ if (file == 0)
+ {
+ return 0;
+ }
+ + return RAND_load_file(file, -1); } long IceSSL::OpenSSL::System::loadRandFiles(const string& names) { - long tot = 0; - if (!names.empty()) - { - int egd; + {
+ return 0;
+ } +
+ long tot = 0;
+ int egd; - // Make a modifiable copy of the string. - char* namesString = new char[names.length() + 1]; - assert(namesString != 0); + // Make a modifiable copy of the string. + char* namesString = new char[names.length() + 1]; + assert(namesString != 0); - strcpy(namesString, names.c_str()); + strcpy(namesString, names.c_str()); - char seps[5]; + char seps[5]; - sprintf(seps, "%c", LIST_SEPARATOR_CHAR); + sprintf(seps, "%c", LIST_SEPARATOR_CHAR); - char* token = strtok(namesString, seps); + char* token = strtok(namesString, seps); - while (token != 0) - { - egd = RAND_egd(token); - - if (egd > 0) - { - tot += egd; - } - else - { - tot += RAND_load_file(token, -1); - } + while (token != 0) + { + egd = RAND_egd(token); - token = strtok(0, seps); + if (egd > 0) + { + tot += egd; } - - if (tot > 512) + else { - _randSeeded = 1; + tot += RAND_load_file(token, -1); } - delete []namesString; + token = strtok(0, seps); + } + + if (tot > 512) + { + _randSeeded = 1; } + delete []namesString; + return tot; } void IceSSL::OpenSSL::System::initRandSystem(const string& randBytesFiles) { - if (!_randSeeded) - { - long randBytesLoaded = 0; - - if (!seedRand() && randBytesFiles.empty() && !RAND_status() && - (_traceLevels->security >= IceSSL::SECURITY_WARNINGS)) - { - _logger->trace(_traceLevels->securityCat, - "WRN There is a lack of random data, consider specifying a random data file."); - } + if (_randSeeded) + {
+ return;
+ }
+
+ long randBytesLoaded = seedRand();
- if (!randBytesFiles.empty()) - { - randBytesLoaded = loadRandFiles(randBytesFiles); - } + if (!randBytesFiles.empty())
+ {
+ randBytesLoaded += loadRandFiles(randBytesFiles);
+ }
+
+ if (!randBytesLoaded && !RAND_status() && (_traceLevels->security >= IceSSL::SECURITY_WARNINGS)) + {
+ // In this case, there are two options open to us - specify a random data file using the
+ // RANDFILE environment variable, or specify additional random data files in the
+ // SSL configuration file. + _logger->trace(_traceLevels->securityCat, + "WRN There is a lack of random data, consider specifying additional random data files."); } +
+ _randSeeded = (randBytesLoaded > 0 ? 1 : 0);
} void |