-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't build pqclean on wasm target (#81)
- Loading branch information
1 parent
2b7aa4c
commit 388d6d2
Showing
6 changed files
with
62 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
use libcrux::digest; | ||
use libcrux::drbg::Drbg; | ||
use libcrux::kem; | ||
|
||
#[cfg(not(target_arch = "wasm32"))] | ||
use libcrux::drbg; | ||
#[cfg(target_arch = "wasm32")] | ||
use rand_core::OsRng; | ||
|
||
fn main() { | ||
let mut drbg = Drbg::new(digest::Algorithm::Sha256).unwrap(); | ||
let (_secret_key, public_key) = kem::key_gen(kem::Algorithm::Kyber768, &mut drbg).unwrap(); | ||
#[cfg(not(target_arch = "wasm32"))] | ||
let mut rng = drbg::Drbg::new(libcrux::digest::Algorithm::Sha256).unwrap(); | ||
#[cfg(target_arch = "wasm32")] | ||
let mut rng = OsRng; | ||
|
||
let (_secret_key, public_key) = kem::key_gen(kem::Algorithm::Kyber768, &mut rng).unwrap(); | ||
|
||
for _i in 0..100000 { | ||
let (_shared_secret, _ciphertext) = | ||
kem::encapsulate(kem::Algorithm::Kyber768, &public_key, &mut drbg).unwrap(); | ||
kem::encapsulate(kem::Algorithm::Kyber768, &public_key, &mut rng).unwrap(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
use libcrux::digest; | ||
use libcrux::drbg::Drbg; | ||
use libcrux::kem; | ||
|
||
#[cfg(not(target_arch = "wasm32"))] | ||
use libcrux::drbg; | ||
#[cfg(target_arch = "wasm32")] | ||
use rand_core::OsRng; | ||
|
||
fn main() { | ||
let mut drbg = Drbg::new(digest::Algorithm::Sha256).unwrap(); | ||
#[cfg(not(target_arch = "wasm32"))] | ||
let mut rng = drbg::Drbg::new(libcrux::digest::Algorithm::Sha256).unwrap(); | ||
#[cfg(target_arch = "wasm32")] | ||
let mut rng = OsRng; | ||
|
||
for _i in 0..100000 { | ||
let (_secret_key, _public_key) = kem::key_gen(kem::Algorithm::Kyber768, &mut drbg).unwrap(); | ||
let (_secret_key, _public_key) = kem::key_gen(kem::Algorithm::Kyber768, &mut rng).unwrap(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters