Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a randomnumber generator function for WASI to support WebAssembly PQ crypto #405

Closed
wants to merge 2 commits into from

Conversation

john-sharratt
Copy link

@john-sharratt john-sharratt commented Jul 24, 2021

As a part of a project I am working on there is a heavy use of quantum resistant crypto.

Now that I am porting the library (https://github.com/john-sharratt/ate) over to WebAssembly so that it can run in a web browser I need the same crypto functions to work in wasm32 under wasi however there are no known libraries in rust that support such routines other than pqcrypto - hence I started porting it....

Thus, given that pqcrypto did not yet work on wasi I forked it to add support for compiling to target=wasm32-wasi (https://github.com/john-sharratt/pqcrypto-wasi) - most of it compiles except for the random generator which is runtime specific thus I have added a function within WASI.

The pull request over at pqcrypto is here:
rustpq/pqcrypto#22

The new function only impacts builds that target wasi hence it is fully forwards and backwards compatible.

To compile you need to use target wasm32-wasi and must have wasi-libc - take a look at this repo for an example on how to compile it:
https://github.com/john-sharratt/pqcrypto-wasi

@thomwiggers
Copy link
Member

The common files in PQClean aren't actually super recommended for redistribution as they (notably the symmetric crypto stuff) do contain some things, which have significant impact on performance, included only for testing reasons.

Additionally this file should probably first be updated upstream at https://GitHub.com/dsprenkels/randombytes/.

@john-sharratt
Copy link
Author

The common files in PQClean aren't actually super recommended for redistribution as they (notably the symmetric crypto stuff) do contain some things, which have significant impact on performance, included only for testing reasons.

Additionally this file should probably first be updated upstream at https://GitHub.com/dsprenkels/randombytes/.

Will take a look into this and get back to you ASAP

@john-sharratt
Copy link
Author

The common files in PQClean aren't actually super recommended for redistribution as they (notably the symmetric crypto stuff) do contain some things, which have significant impact on performance, included only for testing reasons.
Additionally this file should probably first be updated upstream at https://GitHub.com/dsprenkels/randombytes/.

Will take a look into this and get back to you ASAP

There done - added a pullrequest on the upstream as well
dsprenkels/randombytes#34

@thomwiggers
Copy link
Member

If merged at upstream we might update this file, but I think in general downstream consumers of implementations from PQClean should provide their own random number generator. PQClean is not intended as a library.

@john-sharratt
Copy link
Author

The randombytes.c file was merged upstream

thomwiggers added a commit that referenced this pull request Oct 4, 2021
@thomwiggers
Copy link
Member

Closed in favor of #425

@thomwiggers thomwiggers closed this Oct 4, 2021
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.

None yet

2 participants