Skip to content

Implement randomBytes for emscripten#99

Open
chirag-parmar wants to merge 2 commits intocheatfate:masterfrom
chirag-parmar:emscripten
Open

Implement randomBytes for emscripten#99
chirag-parmar wants to merge 2 commits intocheatfate:masterfrom
chirag-parmar:emscripten

Conversation

@chirag-parmar
Copy link
Copy Markdown

Description

Implements randomBytes for emscripten. According to the rust crate getrandom and the PR linked on the same page emscripten-core/emscripten#12240 emscripten wraps getRandomDevice (browser version of obtaining randomness) within the getentropy function.

Changes

  1. Implements randomBytes for emscripten
  2. Merges the logic for randomBytes of openbsd with emscripten. Before this PR, randomBytes within the openbsd segment did not care for the maximum chunk size allowed by getentropy (1, 2). This would resulted in using /dev/urandom for randomness above 256 bytes.
  3. Adds or clause for urandomRead to accomodate for emscripten since users might not define posix flag with emscripten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant