1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-24 12:36:01 -07: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:
Frank Denis 2014-11-22 11:24:32 -08:00
parent 4c8a35ca82
commit b0403efc80

View File

@ -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') ||