summaryrefslogtreecommitdiff
path: root/extra/yassl/taocrypt/src/random.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'extra/yassl/taocrypt/src/random.cpp')
-rw-r--r--extra/yassl/taocrypt/src/random.cpp75
1 files changed, 7 insertions, 68 deletions
diff --git a/extra/yassl/taocrypt/src/random.cpp b/extra/yassl/taocrypt/src/random.cpp
index 2a2ac83ca34..aa9be7f1985 100644
--- a/extra/yassl/taocrypt/src/random.cpp
+++ b/extra/yassl/taocrypt/src/random.cpp
@@ -1,6 +1,5 @@
/*
- Copyright (c) 2005-2007 MySQL AB, 2009 Sun Microsystems, Inc.
- Use is subject to license terms.
+ Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -12,8 +11,9 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ along with this program; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ MA 02110-1301 USA.
*/
@@ -92,78 +92,17 @@ void OS_Seed::GenerateSeed(byte* output, word32 sz)
}
-#elif defined(__NETWARE__)
-
-/* The OS_Seed implementation for Netware */
-
-#include <nks/thread.h>
-#include <nks/plat.h>
-
-// Loop on high resulution Read Time Stamp Counter
-static void NetwareSeed(byte* output, word32 sz)
-{
- word32 tscResult;
-
- for (word32 i = 0; i < sz; i += sizeof(tscResult)) {
- #if defined(__GNUC__)
- asm volatile("rdtsc" : "=A" (tscResult));
- #else
- #ifdef __MWERKS__
- asm {
- #else
- __asm {
- #endif
- rdtsc
- mov tscResult, eax
- }
- #endif
-
- memcpy(output, &tscResult, sizeof(tscResult));
- output += sizeof(tscResult);
-
- NXThreadYield(); // induce more variance
- }
-}
-
-
-OS_Seed::OS_Seed()
-{
-}
-
-
-OS_Seed::~OS_Seed()
-{
-}
-
-
-void OS_Seed::GenerateSeed(byte* output, word32 sz)
-{
- /*
- Try to use NXSeedRandom as it will generate a strong
- seed using the onboard 82802 chip
-
- As it's not always supported, fallback to default
- implementation if an error is returned
- */
-
- if (NXSeedRandom(sz, output) != 0)
- {
- NetwareSeed(output, sz);
- }
-}
-
-
#else
/* The default OS_Seed implementation */
-OS_Seed::OS_Seed()
+OS_Seed::OS_Seed()
{
fd_ = open("/dev/urandom",O_RDONLY);
if (fd_ == -1) {
fd_ = open("/dev/random",O_RDONLY);
- if (fd_ == -1)
- error_.SetError(OPEN_RAN_E);
+ if (fd_ == -1)
+ error_.SetError(OPEN_RAN_E);
}
}