Repair NativeClient support

This commit is contained in:
Frank Denis 2016-04-18 21:40:04 +02:00
parent bdf5c8246b
commit 492d4b1dd6
2 changed files with 6 additions and 1 deletions

View File

@ -37,7 +37,7 @@ randombytes_init_if_needed(void)
{ {
if (implementation == NULL) { if (implementation == NULL) {
implementation = RANDOMBYTES_DEFAULT_IMPLEMENTATION; implementation = RANDOMBYTES_DEFAULT_IMPLEMENTATION;
implementation->stir(); randombytes_stir();
} }
} }
@ -78,6 +78,9 @@ randombytes_stir(void)
{ {
#ifndef __EMSCRIPTEN__ #ifndef __EMSCRIPTEN__
randombytes_init_if_needed(); randombytes_init_if_needed();
if (implementation->stir != NULL) {
implementation->stir();
}
#else #else
EM_ASM({ EM_ASM({
if (Module.getRandomValue === undefined) { if (Module.getRandomValue === undefined) {

View File

@ -33,6 +33,8 @@ static int randombytes_tests(void)
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
assert(strcmp(randombytes_implementation_name(), "js") == 0); assert(strcmp(randombytes_implementation_name(), "js") == 0);
#elif defined(__native_client__)
assert(strcmp(randombytes_implementation_name(), "nativeclient") == 0);
#else #else
assert(strcmp(randombytes_implementation_name(), "sysrandom") == 0); assert(strcmp(randombytes_implementation_name(), "sysrandom") == 0);
#endif #endif