Commit 53e97f85 authored by l.gombos@samsung.com's avatar l.gombos@samsung.com

Remove USE(OS_RANDOMNESS)

https://bugs.webkit.org/show_bug.cgi?id=108095

Reviewed by Darin Adler.

Remove the USE(OS_RANDOMNESS) guard as it is turned on for all
ports.

Source/JavaScriptCore:

* jit/JIT.cpp:
(JSC::JIT::JIT):

Source/WebCore:

No new tests as this is covered by existing tests.

* page/Crypto.cpp:
(WebCore::Crypto::getRandomValues):
* platform/UUID.cpp:
(WebCore::createCanonicalUUIDString):

Source/WebKit/blackberry:

* WebCoreSupport/AboutDataUseFeatures.in:

Source/WTF:

* wtf/CryptographicallyRandomNumber.cpp:
(WTF::cryptographicallyRandomValues):
* wtf/CryptographicallyRandomNumber.h:
* wtf/OSRandomSource.cpp:
(WTF::cryptographicallyRandomValuesFromOS):
* wtf/OSRandomSource.h:
* wtf/Platform.h:
* wtf/RandomNumber.cpp:
(WTF::randomNumber):
* wtf/RandomNumber.h:
* wtf/RandomNumberSeed.h:
(WTF::initializeRandomNumberGenerator):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149921 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8590d978
2013-05-10 Laszlo Gombos <l.gombos@samsung.com>
Remove USE(OS_RANDOMNESS)
https://bugs.webkit.org/show_bug.cgi?id=108095
Reviewed by Darin Adler.
Remove the USE(OS_RANDOMNESS) guard as it is turned on for all
ports.
* jit/JIT.cpp:
(JSC::JIT::JIT):
2013-05-10 Mark Hahnenberg <mhahnenberg@apple.com>
Rename StructureCheckHoistingPhase to TypeCheckHoistingPhase
......
......@@ -90,11 +90,7 @@ JIT::JIT(VM* vm, CodeBlock* codeBlock)
, m_lastResultBytecodeRegister(std::numeric_limits<int>::max())
, m_jumpTargetsPosition(0)
#endif
#if USE(OS_RANDOMNESS)
, m_randomGenerator(cryptographicallyRandomNumber())
#else
, m_randomGenerator(static_cast<unsigned>(randomNumber() * 0xFFFFFFF))
#endif
#if ENABLE(VALUE_PROFILER)
, m_canBeOptimized(false)
, m_shouldEmitProfiling(false)
......
2013-05-10 Laszlo Gombos <l.gombos@samsung.com>
Remove USE(OS_RANDOMNESS)
https://bugs.webkit.org/show_bug.cgi?id=108095
Reviewed by Darin Adler.
Remove the USE(OS_RANDOMNESS) guard as it is turned on for all
ports.
* wtf/CryptographicallyRandomNumber.cpp:
(WTF::cryptographicallyRandomValues):
* wtf/CryptographicallyRandomNumber.h:
* wtf/OSRandomSource.cpp:
(WTF::cryptographicallyRandomValuesFromOS):
* wtf/OSRandomSource.h:
* wtf/Platform.h:
* wtf/RandomNumber.cpp:
(WTF::randomNumber):
* wtf/RandomNumber.h:
* wtf/RandomNumberSeed.h:
(WTF::initializeRandomNumberGenerator):
2013-05-10 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Remove unnecessary GLIB_CHECK_VERSION #ifdefs
......
......@@ -36,8 +36,6 @@
namespace WTF {
#if USE(OS_RANDOMNESS)
namespace {
class ARC4Stream {
......@@ -176,6 +174,4 @@ void cryptographicallyRandomValues(void* buffer, size_t length)
sharedRandomNumberGenerator().randomValues(buffer, length);
}
#endif
}
......@@ -30,16 +30,12 @@
namespace WTF {
#if USE(OS_RANDOMNESS)
WTF_EXPORT_PRIVATE uint32_t cryptographicallyRandomNumber();
WTF_EXPORT_PRIVATE void cryptographicallyRandomValues(void* buffer, size_t length);
#endif
}
#if USE(OS_RANDOMNESS)
using WTF::cryptographicallyRandomNumber;
using WTF::cryptographicallyRandomValues;
#endif
#endif
......@@ -41,7 +41,6 @@
namespace WTF {
#if USE(OS_RANDOMNESS)
void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length)
{
#if OS(UNIX)
......@@ -66,6 +65,5 @@ void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length)
// be of cryptographic quality!
#endif
}
#endif
}
......@@ -28,14 +28,11 @@
namespace WTF {
#if USE(OS_RANDOMNESS)
// This function attempts to fill buffer with randomness from the operating
// system. If insufficient randomness is available, the buffer will be
// partially filled. Rather than calling this function directly, consider
// calling cryptographicallyRandomNumber or cryptographicallyRandomValues.
void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length);
#endif
}
#endif
......@@ -565,7 +565,6 @@
#define HAVE_STRINGS_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_TIME_H 1
#define WTF_USE_OS_RANDOMNESS 1
#define WTF_USE_PTHREADS 1
#endif /* OS(UNIX) */
......@@ -619,7 +618,6 @@
#if OS(WINDOWS)
#define HAVE_VIRTUALALLOC 1
#define WTF_USE_OS_RANDOMNESS 1
#endif
#if OS(QNX)
......
......@@ -38,39 +38,9 @@
namespace WTF {
#if !USE(OS_RANDOMNESS)
namespace Internal {
static uint64_t state;
void initializeRandomNumber(uint64_t seed)
{
state = seed;
}
// This random number generator comes from: Klimov, A. and Shamir, A.,
// "A New Class of Invertible Mappings", Cryptographic Hardware and Embedded
// Systems 2002, http://dl.acm.org/citation.cfm?id=752741
//
// Very fast, very simple, and passes Diehard and other good statistical
// tests as strongly as cryptographically-secure random number generators (but
// is not itself cryptographically-secure).
uint32_t randomNumber()
{
state += (state * state) | 5;
return static_cast<uint32_t>(state >> 32);
}
}
#endif
double randomNumber()
{
#if USE(OS_RANDOMNESS)
uint32_t bits = cryptographicallyRandomNumber();
#else
uint32_t bits = Internal::randomNumber();
#endif
return static_cast<double>(bits) / (static_cast<double>(std::numeric_limits<uint32_t>::max()) + 1.0);
}
......
......@@ -28,12 +28,6 @@
namespace WTF {
#if !USE(OS_RANDOMNESS)
namespace Internal {
void initializeRandomNumber(uint64_t);
}
#endif
// Returns a pseudo-random number in the range [0, 1), attempts to be
// cryptographically secure if possible on the target platform
WTF_EXPORT_PRIVATE double randomNumber();
......
......@@ -59,10 +59,6 @@ inline void initializeRandomNumberGenerator()
srand(static_cast<unsigned>(time(0)));
#endif
#if !USE(OS_RANDOMNESS)
uint64_t seed = static_cast<uint64_t>(rand()) << 32 | static_cast<uint64_t>(rand());
Internal::initializeRandomNumber(seed);
#endif
}
}
......
2013-05-10 Laszlo Gombos <l.gombos@samsung.com>
Remove USE(OS_RANDOMNESS)
https://bugs.webkit.org/show_bug.cgi?id=108095
Reviewed by Darin Adler.
Remove the USE(OS_RANDOMNESS) guard as it is turned on for all
ports.
No new tests as this is covered by existing tests.
* page/Crypto.cpp:
(WebCore::Crypto::getRandomValues):
* platform/UUID.cpp:
(WebCore::createCanonicalUUIDString):
2013-05-10 Christophe Dumez <ch.dumez@sisa.samsung.com>
Remove [NoInterfaceObject] from several WebAudio IDL interfaces
......
......@@ -59,7 +59,6 @@ Crypto::Crypto()
void Crypto::getRandomValues(ArrayBufferView* array, ExceptionCode& ec)
{
#if USE(OS_RANDOMNESS)
if (!array || !isIntegerArray(array)) {
ec = TYPE_MISMATCH_ERR;
return;
......@@ -69,10 +68,6 @@ void Crypto::getRandomValues(ArrayBufferView* array, ExceptionCode& ec)
return;
}
cryptographicallyRandomValues(array->baseAddress(), array->byteLength());
#else
ASSERT_UNUSED(array, array);
ec = NOT_SUPPORTED_ERR;
#endif
}
}
......@@ -31,7 +31,6 @@
#include "config.h"
#include "UUID.h"
#include "NotImplemented.h"
#include <wtf/CryptographicallyRandomNumber.h>
#include <wtf/HexNumber.h>
#include <wtf/text/StringBuilder.h>
......@@ -40,7 +39,6 @@ namespace WebCore {
String createCanonicalUUIDString()
{
#if USE(OS_RANDOMNESS)
unsigned randomData[4];
cryptographicallyRandomValues(reinterpret_cast<unsigned char*>(randomData), sizeof(randomData));
......@@ -59,10 +57,6 @@ String createCanonicalUUIDString()
appendUnsignedAsHexFixedSize(randomData[2] & 0x0000ffff, builder, 4, Lowercase);
appendUnsignedAsHexFixedSize(randomData[3], builder, 8, Lowercase);
return builder.toString();
#else
notImplemented();
return String();
#endif
}
}
2013-05-10 Laszlo Gombos <l.gombos@samsung.com>
Remove USE(OS_RANDOMNESS)
https://bugs.webkit.org/show_bug.cgi?id=108095
Reviewed by Darin Adler.
Remove the USE(OS_RANDOMNESS) guard as it is turned on for all
ports.
* WebCoreSupport/AboutDataUseFeatures.in:
2013-05-10 Jacky Jiang <zhajiang@blackberry.com>
Fix some compiler warnings (miscellaneous)
......
......@@ -69,7 +69,6 @@ OPENGL_ES_2
OPENTYPE_SANITIZER
OPENVG
OPENVG_BLUR
OS_RANDOMNESS
PLATFORM_STRATEGIES
PLATFORM_TEXT_TRACK_MENU
PLUGIN_HOST_PROCESS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment