From 492d4b1dd6a852fedbfece96ec02b86ba2c25bc8 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 18 Apr 2016 21:40:04 +0200 Subject: [PATCH] Repair NativeClient support --- src/libsodium/randombytes/randombytes.c | 5 ++++- test/default/randombytes.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libsodium/randombytes/randombytes.c b/src/libsodium/randombytes/randombytes.c index acccd199..781939a0 100644 --- a/src/libsodium/randombytes/randombytes.c +++ b/src/libsodium/randombytes/randombytes.c @@ -37,7 +37,7 @@ randombytes_init_if_needed(void) { if (implementation == NULL) { implementation = RANDOMBYTES_DEFAULT_IMPLEMENTATION; - implementation->stir(); + randombytes_stir(); } } @@ -78,6 +78,9 @@ randombytes_stir(void) { #ifndef __EMSCRIPTEN__ randombytes_init_if_needed(); + if (implementation->stir != NULL) { + implementation->stir(); + } #else EM_ASM({ if (Module.getRandomValue === undefined) { diff --git a/test/default/randombytes.c b/test/default/randombytes.c index b73773db..80c560de 100644 --- a/test/default/randombytes.c +++ b/test/default/randombytes.c @@ -33,6 +33,8 @@ static int randombytes_tests(void) #ifdef __EMSCRIPTEN__ assert(strcmp(randombytes_implementation_name(), "js") == 0); +#elif defined(__native_client__) + assert(strcmp(randombytes_implementation_name(), "nativeclient") == 0); #else assert(strcmp(randombytes_implementation_name(), "sysrandom") == 0); #endif