[wasm][crypto] RandomNumberGenerator mapped to Web Crypto getRandomValues (#42728)
* [wasm][crypto] RandomNumberGenerator mapped to Web Crypto getRandomValues
- Uses Web Crypto API [`getRandomValues`](https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues) if available.
- Falls back to `/dev/urandom` as default if the crypto library is missing.
* Remove the emscripten interface code from the driver.c.
* remove extraneous code comment
* Move emscripten definition around.
* Address review comment
* Add javascript bridge implementation library to Native source tree.
- Javascript checks for crypto interface and uses `crypto.getRandomValues`
- Add api bridge call when building for emscripten browser.
- separate out into browser subdirectory
- If we couldn't find a proper implementation, as Math.random() is not suitable we will abort.
```
ABORT: no cryptographic support found getRandomValues. Consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };
```
* Change tests to set random values of the buffer instead of return a single value.
* Remove old test code
* Remove testing code
* Incorporate the PAL bridge layer into the `--js-library` build process
* Address review comments about directory structure and naming
* Update src/mono/wasm/runtime-test.js
Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Add note about insecure code for testing purposes
* Formatting
* Return -1 if crypto does not exist instead of aborting from js. This allows the managed code exception flow to continue as normal.
Co-authored-by: Ryan Lucia <ryan@luciaonline.net>