Skip to content

Conversation

@walkingeyerobot
Copy link
Collaborator

fixes #22782

I'm not sure how to get this tested. Any feedback would be appreciated.

@sbc100
Copy link
Collaborator

sbc100 commented Oct 31, 2024

From the CI failures it looks like you need to perhaps update/rebase on top of the main branch?

// There is no good source of entropy without an import. Make this weak so that
// it can be replaced with a pRNG or a proper import.
weak int getentropy(void* buffer, size_t length) {
abort();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you copy the code from https://github.com/WebAssembly/wasi-libc/blob/main/libc-bottom-half/sources/getentropy.c? (With a link/attribution I think).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. should I leave it weak?

}

// There is no good source of entropy without an import. Make this weak so that
// it can be replaced with a pRNG or a proper import.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment can now be removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@sbc100
Copy link
Collaborator

sbc100 commented Oct 31, 2024

I actually think we should probably just use this implementation everywhere (not just in standalone mode), then we can implement it in JS and get it tested that way. I'm happy to take over this work if you like?

@sbc100
Copy link
Collaborator

sbc100 commented Oct 31, 2024

Closing in favor of #22820

@sbc100 sbc100 closed this Oct 31, 2024
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.

Standalone: implement getentropy() via wasi_snapshot_preview1.random_get()

2 participants