mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
Fail if JS crypto is not available.
Emscripten registers /dev/urandom and /dev/random by default, but falls back to Math.random()*256 when crypto.getRandomValues() is not available, which is not acceptable. So we need to re-register them no matter what.
This commit is contained in:
+3
-1
@@ -23,7 +23,9 @@ Module['preRun'].push(function(){
|
||||
}
|
||||
randombyte_node();
|
||||
randombyte = randombyte_node;
|
||||
} catch(e) { }
|
||||
} catch(e) {
|
||||
throw 'No secure random number generator found';
|
||||
}
|
||||
}
|
||||
FS.init();
|
||||
var devFolder = FS.findObject('/dev') ||
|
||||
|
||||
Reference in New Issue
Block a user