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

PQ-PSK prototype #310

Merged
merged 50 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
d6f3448
Make ML-KEM-768 constants public
jschneider-bensch Jun 10, 2024
b4d9e76
Change `libcrux::ecdh` submodule and item visibility to public
jschneider-bensch Jun 10, 2024
7d3fe6b
Change visibility of `libcrux-ml-kem::MlKemKeyPair` fields to `pub`
jschneider-bensch Jun 10, 2024
d8d8e17
Extract `libcrux::kem` module to its own crate
jschneider-bensch Jun 10, 2024
7040c64
Update KEM crate documentation
jschneider-bensch Jun 10, 2024
550d6f6
Format
jschneider-bensch Jun 10, 2024
c639f7b
Provide `.len()` on ML-KEM structs and use that instead of constants
jschneider-bensch Jun 11, 2024
a82fc0e
Use `.into_parts()` on `MlKemKeyPair` instead of direct access
jschneider-bensch Jun 11, 2024
cb2ac3a
Add CI run for `libcrux-kem`
jschneider-bensch Jun 11, 2024
90dc277
Merge branch 'dev' into jonas/kem-crate
jschneider-bensch Jun 11, 2024
8fdf171
Fix ML-KEM tests
jschneider-bensch Jun 11, 2024
8000575
CI: Use Rust stable and exclude Win32 (linker issue)
jschneider-bensch Jun 11, 2024
35c5f6d
Revert CI change to now install Rust nightly again
jschneider-bensch Jun 11, 2024
2bc3b92
Pull out `ecdh` module into its own crate
jschneider-bensch Jun 11, 2024
7f68d12
Make `libcrux-kem` use `libcrux-ecdh` instead of `libcrux`
jschneider-bensch Jun 11, 2024
85ef2ad
Make `libcrux` use standalone `libcrux-ecdh` crate
jschneider-bensch Jun 11, 2024
ef18721
WIP: PQ-PSK prototype
jschneider-bensch Jun 12, 2024
319593f
Copied CI workflow for ECDH crate
jschneider-bensch Jun 12, 2024
20cb5b8
Merge imports
jschneider-bensch Jun 12, 2024
7e36ee7
Option to use Curve25519, ML-KEM768 or Classic McEliece
jschneider-bensch Jun 12, 2024
ba59708
Merge branch 'jonas/kem-crate' into jonas/psq
jschneider-bensch Jun 12, 2024
d0ad351
Move P256 ECDSA signature API back to libcrux
jschneider-bensch Jun 12, 2024
b119396
Move ECDH tests to the `libcrux-ecdh` crate
jschneider-bensch Jun 12, 2024
f86a100
Merge branch 'dev' into jonas/kem-crate
jschneider-bensch Jun 12, 2024
1bd7451
Make PSK lifetime a parameter of PSK generation
jschneider-bensch Jun 12, 2024
debd4e7
Update Cargo.lock
jschneider-bensch Jun 13, 2024
6186bcb
Reduce public API
jschneider-bensch Jun 13, 2024
3044792
Make `libcrux` depend on `libcrux-kem`
jschneider-bensch Jun 13, 2024
4e49371
Make spec libcrux interop tests use standalone crate
jschneider-bensch Jun 13, 2024
b47fd6e
Update benchmarks to use `libcrux-ml-kem` (resp. `libcrux-kem`)
jschneider-bensch Jun 13, 2024
8cde88c
Remove dead code
jschneider-bensch Jun 13, 2024
5d4b9a1
Simple benchmarks for PQ-PSK
jschneider-bensch Jun 13, 2024
af28377
Basic PSK message size measurement
jschneider-bensch Jun 13, 2024
0fec1b1
Merge branch 'dev' into jonas/kem-crate
jschneider-bensch Jun 13, 2024
0155caf
Merge branch 'jonas/kem-crate' into jonas/psq
jschneider-bensch Jun 13, 2024
e4d952c
Include raw KEM operations in benchmark
jschneider-bensch Jun 13, 2024
c9826d7
Include public key sizes in size comparison
jschneider-bensch Jun 13, 2024
da831ad
Include XWing in size comparison
jschneider-bensch Jun 13, 2024
d60924c
Include XWing in benchmarks
jschneider-bensch Jun 13, 2024
249f3f6
Merge branch 'dev' into jonas/psq
jschneider-bensch Jun 13, 2024
dc0c56e
wip; no chrono and encaps example
franziskuskiefer Jun 18, 2024
0ef5a89
std::time timestamp
jschneider-bensch Jun 18, 2024
e2017c3
Simple timestamp tests
jschneider-bensch Jun 18, 2024
c48ff2d
Minor rewrites for PV extraction
jschneider-bensch Jun 20, 2024
2e83b78
Format
jschneider-bensch Jun 21, 2024
065775c
Add documentation
jschneider-bensch Jun 26, 2024
bcf5b09
Add `README.md`
jschneider-bensch Jun 26, 2024
464826c
Merge branch 'dev' into jonas/psq
jschneider-bensch Jun 26, 2024
03f9269
Merge branch 'dev' into jonas/psq
jschneider-bensch Jun 26, 2024
d3bee52
Merge branch 'dev' into jonas/psq
jschneider-bensch Jun 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ members = [
"libcrux-kem",
"libcrux-hmac",
"libcrux-hkdf",
"libcrux-ecdh",
"libcrux-ecdh", "libcrux-psq",
]

[workspace.package]
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benches/sha2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ macro_rules! impl_comp {
($fun:ident, $libcrux:expr, $ring:expr, $rust_crypto:ty, $openssl:expr) => {
// Comparing libcrux performance for different payload sizes and other implementations.
fn $fun(c: &mut Criterion) {
const PAYLOAD_SIZES: [usize; 1] = [1024 * 1024 * 10];
const PAYLOAD_SIZES: [usize; 5] = [100, 1024, 2048, 4096, 8192];

let mut group = c.benchmark_group(stringify!($fun).replace("_", " "));

Expand Down
29 changes: 29 additions & 0 deletions libcrux-psq/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[package]
name = "libcrux-psq"
version.workspace = true
authors.workspace = true
license.workspace = true
homepage.workspace = true
edition.workspace = true
repository.workspace = true
readme.workspace = true

[lib]
path = "src/psq.rs"

[dependencies]
libcrux-kem = { version = "0.0.2-pre.2", path = "../libcrux-kem" }
libcrux-hkdf = { version = "=0.0.2-pre.2", path = "../libcrux-hkdf" }
libcrux-hmac = { version = "=0.0.2-pre.2", path = "../libcrux-hmac" }
classic-mceliece-rust = { version = "2.0.0", features = [
"mceliece460896f",
"zeroize",
] }
rand = { version = "0.8" }

[dev-dependencies]
criterion = "0.5"

[[bench]]
name = "psq"
harness = false
32 changes: 32 additions & 0 deletions libcrux-psq/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Post-Quantum Pre-Shared-Key Protocol (PSQ) #

This crate implements a protocol for agreeing on a pre-shared key such
that the protocol messages are secure against
harvest-now-decrypt-later (HNDL) passive quantum attackers.

The protocol between initator `A` and receiver `B` roughly works as follows:
```
A: (ik, enc) <- PQ-KEM(pk_B)
K_0 <- KDF(ik, pk_B || enc || sctxt)
K_m <- KDF(K_0, "Confirmation")
K <- KDF(K_0, "PSK")
mac_ttl <- MAC(K_m, psk_ttl)
A -> B: (enc, psk_ttl, mac_ttl)
```
Where
* `pk_B` is the receiver's KEM public key,
* `sctx` is context information for the given session of the protocol,
* `psk_ttl` specifies for how long the PSK should be considered valid, and
* `K` is the final PSK that is derived from the decapsulated shared
secret based on the internal KEM.

The crate implements the protocol based on several different internal
KEMs:
* `X25519`, an elliptic-curve Diffie-Hellman KEM (not post-quantum
secure; for performance comparison)
* `ML-KEM 768`, a lattice-based post-quantum KEM, in the process
of being standardized by NIST
* `Classic McEliece`, a code-based post-quantum KEM & Round 4
candidate in the NIST PQ competition,
* `XWingKemDraft02`, a hybrid post-quantum KEM, combining `X25519`
and `ML-KEM 768` based KEMs
Loading
Loading